/* SQLFLEX
    Brian -- Initial Development..
    Cris - Sep 11, 96 - changed the 'typedef' structure so that the
        MS C++ compiler can generate declarations..
*/

#ifndef _SQLHDR
#define _SQLHDR

#include "sqlda.h"
 
struct _squlist
    {
    char **_SQUulist;			/* columns to be updated */
    struct _squlist *_SQUnext;		/* next update list */
    int _SQUid;				/* update list id */
    };
typedef struct _squlist _SQULIST;

struct _S_SQCURSOR
    {
    short _SQCstmttype;			/* SQ_SELECT, SQ_INSERT, etc. */
    short _SQCsqlid;			/* SQL's id for this cursor */
    short _SQCflags;			/* CROPEN, CREOF, CRSINGLE ,CRPREPARE*/
    short _SQCnfields;			/* number of result fields
					 * (number supplied by SQL)
					 */
    short _SQCnibind;			/* number of input args */
    short _SQCnobind;			/* number of output args */
    short _SQCtcount;			/* tuples remaining in buffer */
    short _SQCtsize;			/* length of data expected from
					 * SQL
					 */
    short _SQCtbsize;			/* tuple buffer size */
    struct sqlvar_struct *_SQCibind;	/* pointer to first in array of 
					 * binding structures for arguments
					 * to be taken from the user
					 * program and sent to SQL;
					 */
    struct sqlvar_struct *_SQCobind;	/* pointer to first in array of
					 * binding structures for values
					 * to be received from SQL and
					 * supplied to the user program;
					 */
    char **_SQCcommand;			/* pointer to ptrs to pieces of
					 * the command 
					 */
    struct sqlvar_struct *_SQCfields;	/* pointer to first in array of
					 * structures describing the data
					 * to be received from SQL;
					 * (fields described by SQL)
					 */
    char *_SQCstrtab;			/* pointer to table of strings - the
					 * names of the attributes to be
					 * received from SQL
					 * (table supplied by SQL)
					 */
    char *_SQCtbuf;			/* tuple buffer */
    char *_SQCtuple;			/* pointer to current tuple within
					 * buffer
					 */
    char *_SQCname;			/* cursor name */
    struct sqlda  *_SQCsqlda;		/* pointer to sqlda */

		/* used for scroll cursors */
    long _SQCfirst;			/* rowid of 1st tuple in buffer */
    long _SQClast;			/* rowid of last tuple in buffer */

    /* used by POWER CURSORS */
    char *_SQCtable;			/* table name */
    char **_SQCselect_list;		/* selection/insert list */
    char **_SQCorderby_list;		/* order by list */
    _SQULIST _SQCulist;			/* the first power update list */
    /* end of used by POWER CURSORS */
    };
typedef struct _S_SQCURSOR _SQCURSOR;

struct _S_SQSTMT
    {
    short _SQSstmttype;			/* SQ_SELECT, SQ_INSERT, etc. */
    short _SQSsqlid;			/* SQL's id for this cursor */
    };
typedef struct _S_SQSTMT  _SQSTMT;

#endif	/* _SQLHDR */
