home *** CD-ROM | disk | FTP | other *** search
- /*****************************************************************************
- Name: asi.h
-
- Description: Header file for AutoCAD SQL Interface
-
- Author: Nikolayev Alexander
- Autodesk, Inc.
- Moscow, USSR.
-
- (C) Copyright 1991-1992 by Autodesk, Inc.
- ***************************************************************************
- This program is copyrighted by Autodesk, Inc. and is licensed
- to you under the following conditions. You may not distribute
- or publish the source code of this program in any form. You
- may incorporate this code in object form in derivative works
- provided such derivative works are (i.) are designed and
- intended to work solely with Autodesk, Inc. products, and
- (ii.) contain Autodesk's copyright notice "(C) Copyright
- 1988-1992 by Autodesk, Inc."
- ***************************************************************************
-
- THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED
- WARRANTY. ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR
- PURPOSE AND OF MERCHANTABILITY ARE HEREBY DISCLAIMED.
-
- ***************************************************************************
- RESTRICTED RIGHTS LEGEND
-
- Use, duplication, or disclosure by the U.S. Government is subject
- to restrictions set forth in FAR 52.227-19 (Commerical Computer
- Software - Restricted Rights) and DFAR 252.227-7013 (c) (1) (ii)
- (Rights in Technical Data and Computer Software), as applicable.
- ***************************************************************************
-
-
- Entry Points:
-
- Modification History:
- 27 Jun 1991 - ann - original written
- 16 Jan 1992 - ann - aii_ to asi_
- 28 Mar 1992 - grisha - switch on prototypes for WATCOM C
- 14 Apr 1992 - ann - ESCAPE support
- 16 Apr 1992 - ann - change coldisc to coldesc in ASIHANDLE
- 20 Apr 1992 - smw - Misc. spelling corrections, new copyrights
-
- Bugs and restriction on use:
-
- Notes:
-
- *****************************************************************************/
- #ifndef __ASIH__
- #define __ASIH__ asih
-
- #if defined(MSC) || defined(BCC) || defined(WC386)
- #ifndef PROTOTYPES
- #define PROTOTYPES 1
- #endif /* PROTOTYPES */
- #endif /* MSC || BCC */
-
- #if defined(HIGHC)
- #ifdef PROTOTYPES
- #undef PROTOTYPES
- #ifdef _
- #undef _
- #define _(x) ()
- #endif /* _ */
- #endif /* PROTOTYPES */
- #endif /* HIGHC */
-
- #ifdef PROTOTYPES
- #define A0(x) x /* First function argument */
- #define AI(x) ,x /* Subsequent function argument */
- #ifndef _
- #define _(x) x /* Macro from ads */
- #endif /* _ */
- #define _static static /* static in function declaration */
- #else /* PROTOTYPES */
- #define A0(x) /* First function argument */
- #define AI(x) /* Subsequent function argument */
- #ifndef _
- #define _(x) () /* Macro from adslib.h */
- #endif /* _ */
- #define _static /* static in function declaration */
- #endif /* PROTOTYPES */
-
- /****************************************************************/
- /* DEFINES */
- /****************************************************************/
- /* Sizes of different objects. According to ANSI standard identifier
- the name shall not consist of more than 18 characters. */
- #define BASENAMESIZE 20 /* Database name size */
- #define USERNAMESIZE 20 /* User name size */
- #define PASSWORDSIZE 20 /* Password size */
- #define TBLNAMESIZE 20 /* Table name size */
- #define NDXNAMESIZE 20 /* Index name size */
- #define VIEWNAMESIZE 20 /* View name size */
- #define COLNAMESIZE 20 /* Column name size */
- #define ALIASNAMESIZE 20 /* Alias name size */
- #define EMBNAMESIZE 32 /* Embeded variable name size */
- #define CURNAMESIZE 20 /* Cursor name size */
- #define ATHNAMESIZE 20 /* Authorization identifier name size */
-
-
- #define STRINGLEN 256 /* Maximal length of character string */
-
- /* types of SQL statements */
- #define ASI_DELETE 1 /* DELETE */
- #define ASI_CREATE 2 /* CREATE */
- #define ASI_CURSOR 3 /* CURSOR operations */
- #define ASI_GRANT 4 /* GRANT */
- #define ASI_REVOKE 5 /* REVOKE */
- #define ASI_INSERT 7 /* INSERT */
- #define ASI_DROP 8 /* DROP */
- #define ASI_UPDATE 9 /* UPDATE */
- #define ASI_ALTER 10 /* ALTER */
-
- /* Types of statements that are not SQL statements. They are not
- associated with operation and are used for connecting to and
- disconnecting from the database, and to link database handle (OA)
- with a particular connection */
-
-
- #define ASI_LOGON 13 /* Connect to database */
- #define ASI_LOGOFF 14 /* Disconnect from database */
- #define ASI_OLINK 15 /* Associate database handle with connection.
- It is very similar to ORACLE open cursor */
- #define ASI_CLINK 16 /* Break link between database handle and
- connection */
-
- /* Types of operations which can be associated with SQL statements
- are: positioned delete, update, fetch, commit and rollback. In
- standard SQL are all separate statements. Here we have treated them
- as a phase of SQL statement processing. ASI_DEL, ASI_FET, ASI_FBK,
- ASI_UPD, ASI_FFR, ASI_FLR can be used only after execution of the
- declare cursor statement (opening the cursor). */
-
- #define ASI_COM 1 /* Compiled sql statement is passed for testing */
- #define ASI_EXE 2 /* Compiled sql statement is ready for execution */
- #define ASI_DEL 3 /* Delete current positioned row: cursor operation */
- #define ASI_FET 4 /* Fetch forward: cursor operation */
- #define ASI_FBK 5 /* Fetch backward: cursor operation */
- #define ASI_UPD 6 /* Update current positioned row: cursor operation */
- #define ASI_CMT 7 /* Commit transaction assocciated with handle */
- #define ASI_RBK 8 /* Rollback transaction assocciated with handle */
- #define ASI_FFR 9 /* Fetch first row: cursor operation */
- #define ASI_FLR 10 /* Fetch last row: cursor operation */
-
-
- /* Distinct attribute. SELECT clause */
- #define ASI_NODSTALL 0 /* DISTINCT or ALL are absent */
- #define ASI_DISTINCT 1 /* DISTINCT */
- #define ASI_ALL 2 /* ALL */
-
- /* Ordering attributes. ORDER BY clause */
- #define ASI_NOORDER 0 /* No order */
- #define ASI_DESC 1 /* Descending order */
- #define ASI_ASC 2 /* Ascending order */
-
-
- /* Type of object for DROP and CREATE statements */
- #define ASI_TABLE 1
- #define ASI_INDEX 2
- #define ASI_VIEW 3
-
- /* SQL data types */
- #define ASI_CHAR 1
- #define ASI_NUMERIC 2
- #define ASI_DECIMAL 3
- #define ASI_INTEGER 4
- #define ASI_SMALLINT 5
- #define ASI_FLOAT 6
- #define ASI_REAL 7
- #define ASI_DOUBLE 8
-
-
- /*Types that are used internally (syntax tree, buffers, and so on) */
- #define ASI_OPCODE 0 /* Operation code */
- #define ASI_SQUERY 1 /* Subquery */
- #define ASI_SCOL 2 /* Column specification */
- #define ASI_SREAL 3 /* Real */
- #define ASI_SINT 4 /* Integer */
- #define ASI_SCHAR 5 /* Character string */
- #define ASI_SBIND 6 /* Bind data */
- #define ASI_SNULL 7 /* Null value */
- #define ASI_SCONST 8 /* Constant values */
- #define ASI_SUSER 9 /* User value */
- #define ASI_SOVRF 10 /* Overflow */
-
-
- /* Types of host variables than can be bound or used in positioned update */
- #define ASI_HINT 1 /* Integer */
- #define ASI_HREAL 2 /* Real double */
- #define ASI_HCHAR 3 /* Character string */
- #define ASI_HSHORT 4 /* Short integer */
- #define ASI_HLONG 5 /* Long integer */
- #define ASI_HFLOAT 6 /* Float */
-
-
- /* Types of constraint */
- #define ASI_CHK 1 /* Check constraint */
- #define ASI_RFR 2 /* Reference constraint */
- #define ASI_UNI 3 /* Unique constraint (NOT NULL [UNIQUE] ) */
-
- /* Unique specifications */
- #define ASI_NOS 0 /* Is not specified */
- #define ASI_UNQ 1 /* Unique */
- #define ASI_PRM 2 /* Primary key */
-
- /* Actions of GRANT and REVOKE statements */
- #define ASI_GSELECT 1 /* SELECT */
- #define ASI_GINSERT 2 /* INSERT */
- #define ASI_GDELETE 3 /* DELETE */
- #define ASI_GUPDATE 4 /* UPDATE */
- #define ASI_GREF 5 /* REFERENCES */
-
- /* Operation Codes in syntax tree (type of node is ASI_OPCODE) */
- #define ASI_NOT 1 /* Boolean NOT */
- #define ASI_AND 2 /* Boolean AND */
- #define ASI_OR 3 /* Boolean OR */
- #define ASI_MUL 4 /* * */
- #define ASI_DIV 5 /* / */
- #define ASI_ADD 6 /* + */
- #define ASI_SUB 7 /* - */
- #define ASI_MINUS 8 /* Unary - */
- #define ASI_EQL 9 /* = */
- #define ASI_NEQ 10 /* != */
- #define ASI_LTT 11 /* < */
- #define ASI_LEQ 12 /* <= */
- #define ASI_GTR 13 /* > */
- #define ASI_GEQ 14 /* >= */
- #define ASI_EXISTS 15 /* EXISTS */
- #define ASI_IN 16 /* IN */
- #define ASI_LIKE 17 /* LIKE */
- #define ASI_ISNULL 18 /* IS NULL */
- #define ASI_EQLALL 19 /* = ALL */
- #define ASI_NEQALL 20 /* <> ALL */
- #define ASI_LTTALL 21 /* < ALL */
- #define ASI_LEQALL 22 /* <= ALL */
- #define ASI_GTRALL 23 /* > ALL */
- #define ASI_GEQALL 24 /* >= ALL */
- #define ASI_EQLANY 25 /* = ANY */
- #define ASI_NEQANY 26 /* <> ANY */
- #define ASI_LTTANY 27 /* < ANY */
- #define ASI_LEQANY 28 /* <= ANY */
- #define ASI_GTRANY 29 /* > ANY */
- #define ASI_GEQANY 30 /* >= ANY */
- #define ASI_AVG 31 /* Aggregate function AVG */
- #define ASI_COUNT 32 /* Aggregate function COUNT */
- #define ASI_MAX 33 /* Aggregate function MAX */
- #define ASI_MIN 34 /* Aggregate function MIN */
- #define ASI_SUM 35 /* Aggregate function SUM */
- #define ASI_DIST 36 /* DISTINCT is used with function argument */
- #define ASI_UNION 37 /* UNION operator in query expression */
- #define ASI_UNNALL 38 /* UNION ALL operator in query expression */
-
- /* Top of set and end of set */
- #define ASI_TOS (-1) /* Top of Selection Set */
- #define ASI_EOS (-2) /* End of Selection Set */
-
- /* Operation not supported by driver */
- #define ASI_SDELETE 0x00000001 /* Support delete */
- #define ASI_SCREATE 0x00000002 /* Support create table */
- #define ASI_SCURSOR 0x00000004 /* Support cursor operation */
- #define ASI_SGRANT 0x00000008 /* Support grant operation */
- #define ASI_SREVOKE 0x00000010 /* Support revoke operation */
- #define ASI_SINSERT 0x00000020 /* Support insert operation */
- #define ASI_SDROP 0x00000040 /* Support drop table operation */
- #define ASI_SUPDATE 0x00000080 /* Support update operation */
- #define ASI_SALTER 0x00000100 /* Support alter operation */
- #define ASI_SOCOM 0x00000200 /* Support compile operation */
- #define ASI_SOEXE 0x00000400 /* Support execute operation */
- #define ASI_SODEL 0x00000800 /* Support cursor delete operation */
- #define ASI_SOFET 0x00001000 /* Support fetch operation */
- #define ASI_SOFBK 0x00002000 /* Support fetch back operation */
- #define ASI_SOFFR 0x00004000 /* Support fetch first row operation */
- #define ASI_SOFLR 0x00008000 /* Support fetch last row operation */
- #define ASI_SOUPD 0x00010000 /* Support cursor update operation */
- #define ASI_SOCMT 0x00020000 /* Support cursor commit operation */
- #define ASI_SORBK 0x00040000 /* Support roll back operation */
- #define ASI_SCINDEX 0x00080000 /* Support create index */
- #define ASI_SCVIEW 0x00100000 /* Support create view */
-
- #ifndef TRUE
- #define TRUE 1
- #endif
-
- #ifndef FALSE
- #define FALSE 0
- #endif
-
-
- /* ASI external functions return codes */
- #define ASI_GOOD 1 /* Good return status */
- #define ASI_BAD 0 /* Bad return status */
-
-
- #include "asierr.h" /* SQL Error codes */
-
-
- #define asi_colsdsc(Handle) (Handle)->coldesc
- #define asi_rowqty(Handle) (Handle)->row_qty
- #define asi_currow(Handle) (Handle)->cur_row
- #define asi_valrow(Handle) (Handle)->valuelist
- #define asi_err(Handle) (Handle)->ret_code
- #define asi_xerr(Handle) (Handle)->xret_code
- #define asi_synerrpos(Handle) (Handle)->err_pos
- #define asi_stm(Handle) (Handle)->type_of_statement
- #define asi_opr(Handle) (Handle)->type_of_operation
- #define asi_drvid(Handle) (Handle)->drv_id
- #define asi_drvmsg(Handle) (Handle)->drvmsg
-
- /****************************************************************/
- /* TYPEDEFS */
- /****************************************************************/
- typedef double real;
- typedef double decimal;
- typedef long integer;
-
-
- typedef struct bd { /* Bind data structure */
- char varname[EMBNAMESIZE]; /* Host variable name */
- short type; /* Type of variable */
- short len; /* Length of buffer */
- union bp { /* Value of host variable in intrisic format */
- integer Integer; /* Internal integer ASI_SINT */
- real Real; /* Internal real ASI_SREAL */
- char *String; /* Internal character ASI_SCHAR */
- } value;
- } BINDDATA, *BINDDATAPTR;
-
-
- typedef union _val { /* Value buffer */
- integer intval; /* Integer value */
- real realval; /* Real value */
- char *string; /* String value */
- BINDDATA binddata; /* Bind data */
- } VAL, *VALPTR;
-
-
- typedef struct bl { /* List of bind data */
- struct bl *nextbind; /* Next struct in list */
- BINDDATAPTR binddata; /* Pointer to bind data */
- } BINDLST, *BINDLSTPTR;
-
-
- typedef struct colspec { /* Column specification */
- char authorid[USERNAMESIZE]; /* Authorization identifier */
- char tabname[TBLNAMESIZE]; /* Name of the table */
- char colname[COLNAMESIZE]; /* Name of the column */
- } COLSPEC, *COLSPECPTR;
-
-
- typedef struct coldata { /* Column data specification */
- COLSPEC colspec; /* Column specification */
- short data_type; /* Column data type */
- short data_offset; /* Column data offset */
- short precision; /* Precision of data */
- short scale; /* Scale of data */
- } COLDATA, * COLDATAPTR;
-
-
- typedef struct node { /* Node of the Syntax tree */
- struct node *leftnode; /* Left subtree */
- struct node *rightnode; /* Right subtree */
- short type_of_node; /* Type of node */
- short echar; /* Escape character (for LIKE mask) */
- union value { /* Value of node */
- short operation; /* Operation */
- integer intval; /* Integer constant */
- real realval; /* Real constant */
- char *string; /* String constant */
- COLDATA coldata; /* Column data specification */
- struct select *subquery; /* Subquery */
- struct valuelst *constval; /* Constant values list */
- BINDDATA binddata; /* Data that should be to binded */
- } node_value;
- } NODE, *NODEPTR;
-
-
- /* The following structures are used for table definition */
-
- typedef struct rs { /* Reference specification */
- char tabname[TBLNAMESIZE]; /* Table name */
- struct clnm *collist; /* Column list */
- } REFSPEC, *REFSPECPTR;
-
-
- typedef struct coldesc { /* Column descriptor */
- char colname[COLNAMESIZE]; /* Column name */
- short type; /* Column type */
- short precision; /* Length of CHAR or precision of DECIMAL */
- short scale; /* Scale of DECIMAL */
- } COLDSC, *COLDSCPTR;
-
-
- typedef struct coldfl { /* Element of a column default list */
- short type; /* Type of value */
- VAL literal; /* Literal value */
- } COLDFL, *COLDFLPTR;
-
-
- typedef struct colcns { /* Element of a column constraint list */
- struct colcns *nextcns; /* Pointer to next column constraint */
- short type; /* Type of constraint (NULL, REF, or CHECK) */
- union cnst { /* Constraint spec */
- short unique_spec; /* Unique specification */
- REFSPEC ref_spec; /* Reference specification */
- NODEPTR check_cond; /* Check condition */
- } cns_spec;
- } COLCNS, *COLCNSPTR;
-
-
- /* Definition of a table column is given by the the following structure.
- If column does not have a default value or constraint then the
- 'coldflt' or 'colcnstr' shall be initialized to NULL. */
-
- typedef struct coldef { /* Column definition structure */
- struct coldef *nextcol; /* Pointer to next column definition */
- COLDSC coldsc; /* Column describtor */
- COLDFL coldfl; /* Column default */
- COLCNSPTR colcns; /* Column constraint */
- } COLDEF, *COLDEFPTR;
-
- typedef struct tcns { /* Table constraint */
- short type; /* Constraint type (unique, ref, or check) */
- union cns { /* Constraint specification */
- struct unq { /* Unique constraint definition */
- short unique_spec; /* Unique specification */
- struct clnm *collist; /* Unique column list */
- } unique;
- struct rcd { /* Referential constraint definition */
- REFSPEC ref_spec; /* References specification */
- struct clnm *collist; /* Referencing columns */
- } refcns;
- NODEPTR checkcns; /* Check constraint definition */
- } cns_spec;
- } TABCNS, *TABCNSPTR;
-
-
- typedef struct tabcns { /* Table constraints list */
- struct tabcns *nextcns; /* Next table constraint */
- TABCNS cns_spec; /* Constraint specification */
- } TABCNSLST, *TABCNSLSTPTR;
-
-
- typedef struct tblcrt { /* TABLE CREATE structure */
- char tabname[TBLNAMESIZE]; /* Table name */
- COLDEFPTR coldef; /* Column definition list */
- TABCNSLSTPTR tabcns; /* Table constraints list */
- } TABLECRT, *TABLECRTPTR;
- /* ------ End of table create section ------- */
-
-
- typedef struct colsel { /* Element of SELECT list */
- struct colsel *nextcol; /* Pointer to next column in list */
- NODEPTR expression; /* Pointer to column expression */
- } SELLST, *SELLSTPTR;
-
-
- typedef struct tblname { /* Element of table list */
- struct tblname *nexttab; /* Pointer to the next table name in list */
- char authorid[USERNAMESIZE]; /* Authorization identifier */
- char tabname[TBLNAMESIZE]; /* Name of the table */
- char aliasname[ALIASNAMESIZE]; /* Alias name of the table */
- } TBLLST, *TBLLSTPTR;
-
-
- typedef struct clnm { /* Element of columns list */
- struct clnm *nextcol; /* Pointer to next column in list */
- COLSPEC colspec; /* Column specification */
- short order; /* May be ascending or descending.
- Relevant only while using attribute
- in ORDER BY clause */
- } COLLST, *COLLSTPTR;
-
-
- typedef struct valuelst { /* Entry of value list */
- struct valuelst *nextvalue; /* Pointer to the next column in row */
- short type; /* Type of value */
- VAL value; /* Value itself */
- } VALLST, *VALLSTPTR;
-
-
- typedef struct outbuff { /* Output buffer list */
- struct outbuff *nextbuff; /* Next buffer */
- short type; /* Type of data */
- short colnum; /* Column number associated with this buffer */
- short len; /* Length of the buffer */
- short *indp; /* Pointer to result indicator */
- union vls { /* Pointers to program buffers */
- short *shortval;
- int *intval;
- long *longval;
- float *floatval;
- real *realval;
- char *stringval;
- } value;
- } OUTBUFFER, *OUTBUFFPTR;
-
-
- typedef struct setdsc { /* Description of a resulting set */
- struct setdsc *nextcol; /* Next column descriptor */
- COLDSC coldsc; /* Column descriptor */
- } COLDSCLST, *COLDSCLSTPTR;
-
-
- typedef struct logon { /* LOGON structure */
- char basename [BASENAMESIZE]; /* Database name */
- char username [USERNAMESIZE]; /* user name */
- char password [PASSWORDSIZE]; /* Password */
- } LOGON, *LOGONPTR;
-
-
- typedef struct select { /* SELECT structure */
- short distall; /* DISTINCT or ALL attr in columns list */
- SELLSTPTR collist; /* Pointer to list of columns expressions 'SELECT' */
- TBLLSTPTR tablist; /* Pointer to list of tables names 'FROM' */
- NODEPTR condition; /* Pointer to the root node of syntax tree 'WHERE' */
- COLLSTPTR group; /* Pointer to grouping attributes. 'GROUP' */
- NODEPTR having; /* Pointer to group condition. 'HAVING' */
- } SELECT, *SELECTPTR;
-
-
- typedef struct curspc { /* Cursor specification */
- NODEPTR queryexpr; /* Pointer to the root node of the query expression */
- COLLSTPTR order; /* pointer to the order by attributes. 'ORDER BY' */
- } CURSPC, *CURSPCPTR;
-
-
- typedef struct setcol { /* Update column structure */
- struct setcol *nextcol; /* Next column */
- char colname[COLNAMESIZE]; /* Column name */
- short type; /* Type of value */
- VAL value; /* Column value */
- } SETCOL, *SETCOLPTR ;
-
-
- typedef struct cursor { /* Cursor operations structure */
- CURSPCPTR curspec; /* pointer to the cursor specification */
- SETCOLPTR update; /* Set <column name> = <value> */
- } CURSOR, *CURSORPTR;
-
-
- /* Grant column list has meaning only if action is UPDATE or REFERENCE */
- typedef struct priv { /* Privilege list */
- struct priv *nextprv; /* Next privilege */
- short action; /* Action */
- COLLSTPTR collist; /* Grant column list */
- } PRV, *PRVPTR;
-
-
- typedef struct grnt { /* Grantee list */
- struct grnt *nextgrt; /* Next grantee */
- char author[ATHNAMESIZE]; /* Authorization identifier */
- } GRT, *GRTPTR;
-
-
- /* If prvlist is NULL than ALL PRIVILEGES are granted. */
- typedef struct grant { /* GRANT privilege */
- PRVPTR prvlist; /* Privileges */
- char tabname[TBLNAMESIZE]; /* Table name */
- GRTPTR granteelist; /* Grantee */
- short grant_option; /* TRUE if WITH GRANT_OPTION */
- } GRANT, *GRANTPTR;
-
-
- typedef struct revoke { /* REVOKE privileges */
- PRVPTR prvlist; /* Privileges */
- char tabname[TBLNAMESIZE]; /* Table name */
- GRTPTR granteelist; /* Grantee */
- } REVOKE, *REVOKEPTR;
-
-
- typedef struct alter { /* ALTER structure */
- char tabname[TBLNAMESIZE]; /* Table name */
- COLDSC coldsc; /* Column descriptor */
- } ALTER, *ALTERPTR;
-
-
- typedef struct ndxcrt { /* CREATE INDEX structure */
- short unique; /* Unique or not unique */
- char tabname[TBLNAMESIZE]; /* Table name */
- char ndxname[NDXNAMESIZE]; /* Index name */
- COLLSTPTR collist; /* Column list */
- } INDEXCRT, *INDEXCRTPTR;
-
-
- typedef struct viewcrt { /* CREATE VIEW structure */
- char viewname[VIEWNAMESIZE]; /* View name */
- COLLSTPTR collist; /* Column list */
- SELECTPTR query; /* Query specification */
- int chkopt; /* Check option */
- } VIEWCRT, *VIEWCRTPTR;
-
-
- typedef struct create { /* CREATE structure */
- short type; /* object to create */
- union obj {
- TABLECRTPTR tabcrt; /* Data needed for table creation */
- INDEXCRTPTR ndxcrt; /* Data needed for index creation */
- VIEWCRTPTR viewcrt; /* Data needed for view creation */
- } object;
- } CREATE, *CREATEPTR;
-
-
- typedef struct delete { /* DELETE structure */
- char authorid[USERNAMESIZE]; /* Authorization identifier */
- char tabname[TBLNAMESIZE]; /* Table name */
- NODEPTR condition; /* Search condition */
- } DELETE, *DELETEPTR;
-
-
- typedef struct insert { /* INSERT structure */
- char authorid[USERNAMESIZE]; /* Authorization identifier */
- char tabname[TBLNAMESIZE]; /* Table name */
- COLLSTPTR collist; /* Insert column list */
- short type; /* Values are specified as ASI_SQUERY or
- ASI_SCONST */
- union valsp { /* Insert values specification */
- SELECTPTR query; /* Query specification */
- VALLSTPTR valuelist; /* Immediate values */
- } values;
- } INSERT, *INSERTPTR;
-
-
- typedef struct drop { /* DROP structure */
- short type; /* Type of the object */
- char name[TBLNAMESIZE]; /* Name of the object */
- } DROP, *DROPPTR;
-
-
- typedef struct update { /* Structure for the searched UPDATE */
- char authorid[USERNAMESIZE];/* Authorization identifier */
- char tabname[TBLNAMESIZE]; /* Table name */
- COLLSTPTR collist; /* Pointer to the columns list */
- SELLSTPTR valexprlist; /* Pointer to value expressions list */
- NODEPTR condition; /* Condition on rows to update */
- } UPDATE, *UPDATEPTR;
-
-
- typedef struct rowlst { /* List of rows */
- struct rowlst *nextrow; /* Pointer to next row */
- VALLSTPTR valuelist; /* List of column values */
- } ROWLST, *ROWLSTPTR;
-
-
- typedef struct tabdata { /* Table data */
- COLDSCLSTPTR colsdsc; /* Resulting table description */
- ROWLSTPTR rowslist; /* List of table rows */
- } TABDATA, *TABDATAPTR;
-
-
- /* -----------------------------------------------------------------------
- It is prohibited for a driver to modify the following members
- of ASIHANDLE structure :
- type_of_statement, type_of_operation, statement, bindlist, outbuff,
- drv_id;
-
- In different cases the driver shall return the result via the
- following members of ASIHANDLE structure :
-
- coldesc, valuelist, cur_row, row_qty, ret_code;
-
- sqlbasehdl can be used by the driver internally.
- ----------------------------------------------------------------------- */
- typedef struct asi_handle { /* Database handle in appl program & driver*/
- short type_of_statement; /* Type of the SQL statement */
- short type_of_operation; /* What to do with the SQL statement */
- union op { /* Translated SQL statement */
- LOGONPTR logon;
- CREATEPTR create; /* Create */
- ALTERPTR alter; /* Alter */
- DELETEPTR delete; /* Searched delete */
- UPDATEPTR update; /* Searched update */
- INSERTPTR insert; /* Insert */
- CURSORPTR cursor; /* Cursor operations */
- GRANTPTR grant;
- REVOKEPTR revoke;
- DROPPTR drop;
- } statement;
- BINDLSTPTR bindlist; /* List of pointers to host variables */
- OUTBUFFPTR outbuff; /* Output buffer list */
- short drv_id; /* Driver identifier */
- short cnc_id; /* Connection identifier */
- COLDSCLSTPTR coldesc; /* Pointer to resulting table structure */
- VALLSTPTR valuelist; /* Values of the current row in a selection set */
- long cur_row; /* Current row in the selection set */
- long row_qty; /* Number of rows in the selection set */
- short err_pos; /* Syntax error position */
- short ret_code; /* Return code */
- short xret_code; /* Extra return code (for DBMS server use) */
- unsigned long status; /* Driver status */
- char drvmsg[128]; /* Driver message (Any char string from driver) */
- void *sqlbasehdl; /* Pointer to internal database handle */
- } ASIHANDLE, *ASIHANDLEPTR;
-
-
- /****************************************************************/
- /* EXTERNAL FUNCTION */
- /****************************************************************/
- int asi_initdrv _((ASIHANDLEPTR, char *));
- int asi_termdrv _((ASIHANDLEPTR));
- void asi_termalldrv _((void));
- int asi_initsql _((void));
- int asi_termsql _((void));
- int asi_cfgdrv _((ASIHANDLEPTR, int));
-
- int asi_lon _((ASIHANDLEPTR,ASIHANDLEPTR, char *, char *, char *));
- int asi_lof _((ASIHANDLEPTR));
-
- int asi_ohdl _((ASIHANDLEPTR, ASIHANDLEPTR));
- int asi_chdl _((ASIHANDLEPTR));
-
- int asi_com _((ASIHANDLEPTR, char *));
- int asi_bnd _((ASIHANDLEPTR, char *, void *, int, int));
- int asi_exe _((ASIHANDLEPTR));
- int asi_cex _((ASIHANDLEPTR, char *));
- int asi_sob _((ASIHANDLEPTR, int, void *, short *, int, int));
- int asi_fet _((ASIHANDLEPTR));
- int asi_fbk _((ASIHANDLEPTR));
- int asi_ftr _((ASIHANDLEPTR));
- int asi_fbr _((ASIHANDLEPTR));
- int asi_del _((ASIHANDLEPTR));
- int asi_upd _((ASIHANDLEPTR, ...));
- int asi_upd2 _((ASIHANDLEPTR, COLDSCLSTPTR, VALLSTPTR));
- int asi_cmt _((ASIHANDLEPTR));
- int asi_rbk _((ASIHANDLEPTR));
- int asi_cvl _((ASIHANDLEPTR, int, void *, int, int *));
- int asi_cds _((ASIHANDLEPTR, int, COLDSCPTR));
-
- TABDATAPTR asi_gettable _((ASIHANDLEPTR));
- void asi_rlstable _((TABDATAPTR));
-
-
- char *asi_errmsg _((ASIHANDLEPTR)); /* Get error message */
-
- /* These function are useful in the driver */
- int asi_add_col_dsc _((COLDSCLSTPTR *, COLDSCPTR));
- int asi_add_value _((VALLSTPTR *, void *, int));
- void asi_rls_value_lst _((VALLSTPTR));
- void asi_rls_col_dsc _((COLDSCLSTPTR));
-
- COLDSCLSTPTR asi_dupl_colsdsc _((COLDSCLSTPTR)); /* Duplicate descriptors
- list */
- VALLSTPTR asi_dupl_valuelist _((VALLSTPTR)); /* Duplicate value list */
-
- #endif /* __ASIH__ */
- /* EOF*/
-