/*
 ******************************************************************************
 *  Copyright 1984-1993 United States Data Corporation. All Rights Reserved.
 ******************************************************************************
 *                                - NOTICE -
 *
 *  The information contained herein is confidential information of United
 *  States Data Corporation, a Delaware corporation, and is protected by
 *  United States copyright and trade secret law and international treaties.
 *  This information is not to be disclosed, used or copied by or transferred
 *  to any individual, corporation, company or other person without the
 *  express written permission of United States Data Corporation.
 ******************************************************************************
 *
 * Module:	SPC_DSQL.H
 *
 *	Header file for the dynamic SQL.
 *
 * History:
 *		bjc 07/05/93	Created. 
 */


#ifndef _HDT_DSQL_INCLUDED
#define _HDT_DSQL_INCLUDED

#include <hdt_base.h>		/* Base Definitions for the API */
#include <hdt_dbc.h>	
#include <hdt_dbs.h>	

/*
 ************************************************************************
 *                            Constants                                 *       
 ************************************************************************
 */

/*
 *  OR-wise flags constants
 */

#define DSQL_COMMIT	0x0001
#define DSQL_PERSIST	0x0002


/*
 ************************************************************************
 *                                Types                                 *
 ************************************************************************
 */

/*
 *  Prototype for DSQL Set Parameters callback routines
 */

typedef int (*DSQL_SP) (HS_DA*, short, void*);

/*
 *  Prototype for DSQL Fetch Handler callback routines
 */

typedef int (*DSQL_FH) (void*, HS_DA*, short);


/*
 ************************************************************************
 *                              Macros                                  * 
 ************************************************************************
 */


/*
 ************************************************************************
 *                         Function Prototypes                          * 
 ************************************************************************
 */

/*
 *  High-level Dynamic SQL Routines
 */

extern int	dsql_fetch(DBS *dbs, char *query, void *qinstance,
		           DSQL_SP dsql_fp, DSQL_FH dsql_fh, void *udata,
		           u16 flags, short cache, short max_rows);

extern int	dsql_write(DBS *dbs, char *query, void *qinstance,
		           DSQL_SP dsql_sp, void *udata, u16 flags);

/*
 *  Low-level Dynamic SQL Routines - most users will not need to
 *  use these functions.
 */

extern DBC*	dsql_create_cursor(char *query, void *qinstance,
		                   HS_DA *select, HS_DA *where,
		                   u32 flags, int rw_mode);

extern DBC*	dsql_find_cursor(DBS *dbs, char *query, void *qinstance);

extern int	dsql_fetch_cursor(DBC *dbc, DSQL_FH dsql_fh, 
		                  void *udata, u16 flags, short max_rows);

extern int	dsql_write_cursor(DBC *dbc, u16 flags);

#endif

