home *** CD-ROM | disk | FTP | other *** search
-
- /*
- ** fsdb.h: 34.1 5/10/88
- **
- ** FSDB.H - Header file for DBLIB routines.
- ** The main data structure in DBLIB is the DBPROCESS structure.
- ** It keeps all the information about a particular host-dataserver
- ** connection.
- **
- ** Sybase DB-LIBRARY Version 2.0
- ** Confidential Property of Sybase, Inc.
- ** (c) Copyright Sybase, Inc. 1985, 1986
- ** All rights reserved
- */
-
- #ifndef _FSDB_H_
- #define _FSDB_H_ 1
-
-
- /* This section added for installable networks. */
- #define CONNECTIONOBJECTSIZE 0
- #define CONNECTIONREAD 1
- #define CONNECTIONWRITE 2
- #define CONNECTIONTRANSACT 3
- #define CONNECTIONWRITEOOB 4
- #define CONNECTIONMODE 5
- #define CONNECTIONSTATUS 6
- #define CONNECTIONOPEN 7
- #define CONNECTIONCLOSE 8
- #define CONNECTIONCHECKFORDATA 9
- #define DBNETCOUNT 10
- typedef long (far pascal *LGFARPROC)();
- #define PASCALENTRY pascal far
-
- /* temporarily undef ABS since there is one in sybdbtok.h */
- #ifdef ABS
- #undef ABS
- #endif /* ABS */
-
- #include <sybdbtok.h>
-
- #ifdef ABS
- #undef ABS
- #endif /* ABS */
- #if (MSDOS || OS2) /* Allows us to use intrinsic functions */
- #define ABS(a) abs(a)
- #else
- #define ABS(a) ((a) > 0 ? (a) : -(a))
- #endif /* MSDOS or OS2 */
-
- /* affects DBZEROSPACE */
-
- #if (MSDOS || OS2) /* Allows us to use intrinsic functions */
- #define BZERO(c, l) memset(c, 0, l)
- #else
- #define BZERO(c, l) bzero(c, l)
- #endif /* VMS or MSDOS or OS2 */
-
- /*
- ** Status code for dbnextrow() and dbgetrow().
- ** Return of > 0 indicates ALTROW.
- ** FAIL is another possible return.
- */
- #define MORE_ROWS (DBINT)(-1)
- #define NO_MORE_ROWS (DBINT)(-2)
- #define REG_ROW MORE_ROWS
- #define BUF_FULL (DBINT)(-3)
-
- /*
- ** Status code for dbresults(). Possible return values are
- ** SUCCEED, FAIL, and NO_MORE_RESULTS.
- */
- #define NO_MORE_RESULTS 2
-
- /*
- ** Return code for message-handlers. Indicates whether or not the handler
- ** wants DB-LIBRARY to buffer the current Server message for later use
- ** by the program.
- */
- #define DBSAVE 1
- #define DBNOSAVE 0
-
- #define DBNOERR -1
-
- /*
- ** Default size of row buffer. This is what people get if they do
- ** a dbsetopt(dbproc, DBBUFFER, 0).
- */
- #define DBBUFSIZE 1000
-
- /* The size of a SYBTEXT timestamp, in bytes. This timestamp is not to be
- * confused with a browse-mode timestamp.
- */
- #define DBTXTSLEN 8
-
- /*
- ** this is defined in the Dataserver server.h but it has alot of other
- ** stuff that we don't want.
- */
- #define MAXNAME 30
-
- #include <syblogin.h>
-
- #define DBMAXCOLNAME 30
- #define DBMAXBYLIST 16
-
- /* maximum printing lengths for fixed-length data */
- #define PRINT4 11
- #define PRINT2 6
- #define PRINT1 3
- #define PRFLT8 20
- #define PRMONEY 24
- #define PRBIT 1
- #define PRDATETIME 20
-
- #define TINYBIND 1
- #define SMALLBIND 2
- #define INTBIND 3
- #define CHARBIND 4
- #define TEXTBIND 5
- #define BINARYBIND 6
- #define ARRAYBIND 7
- #define BITBIND 8
- #define DATETIMEBIND 9
- #define MONEYBIND 10
- #define FLT8BIND 11
- #define STRINGBIND 12
- #define NTBSTRINGBIND 13
- #define VARYCHARBIND 14
- #define VARYBINBIND 15
- #define RESERVE1BIND 16
- #define RESERVE2BIND 17
- #define MAXBIND VARYBINBIND
-
-
-
- /*
- ** typedef DATE - date format
- */
- #ifndef SERVER
- typedef struct date
- {
- long dtdays; /* number of days since 1/1/1900 */
- long dttime; /* number 300th second since mid */
- } DATE;
- #endif
-
- #ifndef _DATEPARTS_
- # define _DATEPARTS_ 1
-
- typedef struct dateparts
- {
- short dateyear; /* 1900 to the future */
- short datemonth; /* 0 - 11 */
- short datedmonth; /* 1 - 31 */
- short datedyear; /* 1 - 366 */
- short datedweek; /* 0 - 6 */
- short datehour; /* 0 - 23 */
- short dateminute; /* 0 - 59 */
- short datesecond; /* 0 - 59 */
- short datemsecond; /* 0 - 997 */
- short datetzone; /* 0 - 127 */
- } DATEPARTS;
-
- #endif /* If not defined _DATEPARTS_ */
-
- #ifndef SERVER
- typedef struct mony
- {
- long mnyhigh;
- unsigned long mnylow;
- } MONY;
-
- # define mnyzero(m) {(m)->mnyhigh = 0; (m)->mnylow = 0;}
- #endif
-
-
- /*
- ** From pss.h DataServer structure.
- */
- /* Donepacket status bit defs go here */
- # define DONE_CONT (DBUSMALLINT) 0x1
- # define DONE_ERROR (DBUSMALLINT) 0x2
- # define DONE_INXACT (DBUSMALLINT) 0x4
- # define DONE_PROC (DBUSMALLINT) 0x8
- # define DONE_COUNT (DBUSMALLINT) 0x10
- # define DONE_ATTN (DBUSMALLINT) 0x20
-
- /*
- ** OFFSETS DEFINITIONS
- **
- ** These are a subset of the token values for offset information.
- ** These defines come from y.tab.h
- **
- */
- # define _ID 290
- # define _VARIABLE 291
- # define _STRING 292
- # define _BINARY 295
- # define _LABEL 296
- # define _INTEGER 293
- # define _REAL 294
- # define _MONEY 297
- # define _START 299
- # define _REQJOIN 280
- # define _LEQJOIN 281
- # define _MINKEYWORD 300
- # define _ADD 445
- # define _ALL 300
- # define _ALTER 444
- # define _AND 301
- # define _ANY 302
- # define _AS 305
- # define _ASC 306
- # define _AVG 307
- # define _BEGIN 385
- # define _BETWEEN 308
- # define _BREAK 408
- # define _BROWSE 309
- # define _BULK 430
- # define _BY 310
- # define _CHARINDEX 434
- # define _CHECKPOINT 400
- # define _CLUSTERED 311
- # define _COL_LENGTH 433
- # define _COL_NAME 332
- # define _COMMIT 458
- # define _COMPUTE 313
- # define _CONFIRM 314
- # define _CONTINUE 412
- # define _CONTROLROW 315
- # define _CONVERT 447
- # define _COUNT 316
- # define _CREATE 317
- # define _DATABASE 318
- # define _DATEADD 439
- # define _DATEDIFF 440
- # define _DATENAME 441
- # define _DATEPART 442
- # define _DBCC 399
- # define _DB_ID 428
- # define _DB_NAME 429
- # define _DEBUG 398
- # define _DECLARE 404
- # define _DEFAULT 402
- # define _DEFINE 319
- # define _DELETE 320
- # define _DESC 321
- # define _DISK 460
- # define _DISTINCT 322
- # define _DROP 323
- # define _DUMMY 324
- # define _DUMP 390
- # define _ELSE 406
- # define _END 386
- # define _ERRLVL 328
- # define _ERROREXIT 453
- # define _EXECUTE 330
- # define _EXISTS 331
- # define _EXIT 411
- # define _FILLFACTOR 333
- # define _FOR 419
- # define _FROM 335
- # define _GETDATE 443
- # define _GETDEFAULT 432
- # define _GOTO 409
- # define _GRANT 336
- # define _GROUP 337
- # define _HAVING 338
- # define _HOLDLOCK 413
- # define _HOST_ID 426
- # define _HOST_NAME 427
- # define _IF 405
- # define _IN 341
- # define _INDEX 342
- # define _INDEX_KEY 437
- # define _INSERT 343
- # define _INTO 344
- # define _IS 382
- # define _ISNULL 436
- # define _KILL 463
- # define _LIKE 438
- # define _LINENO 345
- # define _LOAD 391
- # define _LOG 393
- # define _MAX 346
- # define _MIN 347
- # define _NONCLUSTERED 349
- # define _NOT 350
- # define _NULL 351
- # define _OBJECT_ID 372
- # define _OBJECT_NAME 373
- # define _OFF 352
- # define _OFFSETS 353
- # define _ON 354
- # define _ONCE 355
- # define _OR 356
- # define _ORDER 357
- # define _OVER 359
- # define _PARAM 452
- # define _PERMANENT 361
- # define _PREPARE 455
- # define _PRINT 464
- # define _PROCEDURE 362
- # define _PROCESSEXIT 454
- # define _PUBLIC 421
- # define _RAISERROR 465
- # define _RECONFIGURE 461
- # define _RETURN 410
- # define _REVOKE 420
- # define _ROLLBACK 387
- # define _ROWCOUNT 466
- # define _RULE 401
- # define _SAVE 388
- # define _SELECT 365
- # define _SET 366
- # define _SETUSER 462
- # define _STATEMENT 459
- # define _STATISTICS 431
- # define _SUBSTRING 435
- # define _SUM 370
- # define _SUSER_ID 424
- # define _SUSER_NAME 425
- # define _TABLE 371
- # define _TAPE 395
- # define _TEMPORARY 374
- # define _TO 394
- # define _TRANSACTION 389
- # define _TRIGGER 418
- # define _TRUNCATE 392
- # define _UNIQUE 375
- # define _UPDATE 376
- # define _USE 377
- # define _USER_ID 422
- # define _USER_NAME 423
- # define _VALUES 378
- # define _VIEW 379
- # define _WAITFOR 450
- # define _WHERE 380
- # define _WHILE 407
- # define _WITH 381
- /* end y.tab.h */
-
- /*
- ** HOSTSERVER.h - structures and defines for communicating with server
- **
- */
-
- /*
- ** Data structure used to store all available networks.
- */
- typedef struct net_list
- {
- char *comm_type; /* Communication tyep specifier */
- RETCODE (*netopen)(); /* Network open routine */
- DBINT (*netread)(); /* Network read routine */
- DBINT (*netwrite)(); /* Network write routine */
- RETCODE (*netclose)(); /* Network close routine */
- RETCODE (*netattn)(); /* Network attention (OOB) */
-
- struct net_list *next; /* Pointer to the next struct int the
- ** linked list.
- */
- } NETACCESS;
- /*
- ** Data structure used by both send and recv
- */
- typedef struct servbuf
- {
- unsigned char *serv_snb; /* send: next place in buffer */
- unsigned char *serv_sbuf; /* send: start of send buffer */
- int serv_sleft; /* send: room left in send buffer */
- int serv_sbsize; /* send: buffer size */
- int serv_snum; /* send # for network */
- int serv_sstat; /* send: status bits */
- unsigned char *serv_rnb; /* recv: next place in buffer */
- unsigned char *serv_rbuf; /* recv: start of recv buffer */
- int serv_rleft; /* recv: room left in recv buffer */
- int serv_rpleft; /* recv: bytes left in current packet */
- int serv_rbsize; /* recv: buffer size */
- int serv_rnum; /* recv # for network */
- int serv_rstat; /* recv: status bits */
- int serv_commtype; /* communications type (tcp, etc.) */
- /* Changed removed network functions */
- #if OS2
- unsigned short hDbNet;
- LGFARPROC ConnectionFunctions[DBNETCOUNT];
- #endif
- char *netdata1; /* User data pointers to be */
- char *netdata2; /* associated with a dbproc */
- } SERVBUF;
-
-
-
- /*
- ** DBSTRING - This structure is just used for stringing text or parameters
- ** together.
- */
- struct dbstring
- {
- BYTE *strtext; /* actual byte string */
- DBINT strtotlen; /* allocated length of the byte string */
- struct dbstring *strnext;
- };
- typedef struct dbstring DBSTRING;
-
- /*
- ** DBROWDATA - This structure is used to hold the actual data that
- ** comes back for every column in every row. The DBPROCESS structure
- ** points to a linked-list of DBROW structures. Each DBROW strcture points
- ** to an array of DBROWDATA structures. Since every DBROWDATA structure
- ** contains pointers to separately allocated buffers, the members of
- ** each array are linked together in a singly-linked list, to facilitate
- ** the operation of simple row-freeing routines.
- */
- struct dbrowdata
- {
- BYTE *data; /* actual data for this column in this
- * row
- */
- DBINT datlen; /* length, in bytes, of this data */
- DBBINARY *dattxptr; /* This data's text-ptr, if it's of
- * type SYBTEXT.
- */
- DBTINYINT dattxplen; /* Length, in bytes, of the text-ptr. */
- DBBINARY dattxts[DBTXTSLEN];/* The text-timestamp of this text
- * value.
- */
- DBTINYINT dattxtslen; /* Length, in bytes, of the
- * text-timestamp.
- */
- struct dbrowdata *datnext;
- };
- typedef struct dbrowdata DBROWDATA;
-
- /*
- ** BINDREC - This is the structure used to store information about
- ** which columns should be bound to which programming variables
- */
- struct bindrec
- {
- BYTE *bindvar; /* ptr to program variable */
- DBINT bindlen; /* length of program variable */
- RETCODE (*bindproc)(); /* procedure to use for data copy. */
- DBINDICATOR *bindnullind; /* set TRUE if NULL data was bound,
- * FALSE otherwise.
- */
- };
- typedef struct bindrec BINDREC;
-
- /*
- ** NULLBIND - This structure is attached to the DBPROCESS and is used
- ** to determine what to bind when bind values are NULL.
- */
- struct nullbind
- {
- DBBIT nullbit;
- DBTINYINT nulltiny;
- DBSMALLINT nullsmall;
- DBINT nullint;
- DBCHAR *nullchar;
- DBINT nulllchar; /* length of char string */
- DBBINARY *nullbinary;
- DBINT nulllbinary; /* length of binary string */
- DBDATETIME nulldatetime;
- DBMONEY nullmoney;
- DBFLT8 nullflt8;
- DBCHAR *nullstring;
- DBCHAR *nullntbstring;
- DBVARYCHAR nullvarychar;
- DBVARYBIN nullvarybin;
- };
- typedef struct nullbind NULLBIND;
-
- /*
- ** DBCOLINFO - This structure contains the format information about a column.
- ** There is a linked list of DBCOLINFO structures in the DBPROCESS
- ** structure. There is one DBCOLINFO structure for each column in the
- ** target list of the current command. Format information for
- ** alternate rows, like compute, is kept in the DBALTHEAD and
- ** DBALTINFO structures.
- */
- struct dbcolinfo
- {
- char colname[DBMAXCOLNAME+1];/* column name */
- BYTE coltype; /* column type */
- DBINT coludtype; /* user-defined type */
- DBINT collen; /* max length of column */
- DBINT colprlen; /* max printing length of column */
- char *colcontrol; /* control format, if any */
- struct bindrec colbind; /* binding info, if any */
- int coltable; /* for browse mode: which table
- * did this column come from?
- */
- BYTE colstatus; /* for browse mode: what kind of column
- * is this?
- */
- char colorigname[DBMAXCOLNAME+1];/* for browse mode: what is the name
- * of the table column that provided
- * this select-list member?
- */
- char *coltxobjname; /* the DataServer always returns the
- * qualified object-name for TEXT
- * columns.
- */
- struct dbcolinfo *colnext; /* next column */
- };
- typedef struct dbcolinfo DBCOLINFO;
-
- /*
- ** DBTABNAME - This structure contains information about the tables which
- ** were used to produce the current set of results. The DataServer only
- ** provides this info for queries that are executed in "browse mode".
- **
- ** There is a linked list of DBTABNAME structures in the DBPROCESS
- ** structure. There is one DBTABNAME structure for each table used to
- ** produce the target list of the current command.
- **
- ** If this query was executed without "browse mode", then this list will
- ** have no members.
- */
- struct dbtabname
- {
- char tabname[MAXNAME+1]; /* column name */
- struct dbtabname *tabnext; /* next column */
- };
- typedef struct dbtabname DBTABNAME;
-
- /*
- ** DBRETVAL - This structure contains any data which was returned as a function
- ** value by the last command. Currently, "browse-mode" updates are the only
- ** commands which return function values.
- **
- ** There is a linked list of DBRETVAL structures in the DBPROCESS
- ** structure. There is one DBRETVAL structure for each function value
- ** returned by the current command.
- **
- ** If this command returned no function value, this list will
- ** have no members.
- */
- struct dbretval
- {
- char retname[MAXNAME+1]; /* value name */
- BYTE retvalstat; /* status byte */
- DBINT retusertype; /* user type */
- BYTE rettype; /* value type */
- DBINT retmaxlen; /* max value len (ignored) */
- DBINT retlen; /* value length */
- BYTE *retdata; /* the return-value itself. */
- struct dbretval *retnext; /* next return-value */
- };
- typedef struct dbretval DBRETVAL;
-
- /*
- ** DBALTHEAD - This structure contains information for ALT rows. ALT
- ** rows are COMPUTE results. There is one DBALTHEAD for each COMPUTE
- ** statement. All the COMPUTE operators in a particular COMPUTE statement
- ** must have the same bylist -- this is enforced by the DataServer.
- ** Off of each DBALTHEAD is a linked list of DBALTINFO structures that
- ** describe the format for each particular COMPUTE operation in the
- ** COMPUTE.
- */
- struct dbalthead
- {
- DBUSMALLINT althid; /* id for this COMPUTE statement */
- BYTE althalts; /* number of DBALTINFO structures in althlist */
- BYTE althsizeby; /* number of elements in the bylist */
- BYTE althbylist[DBMAXBYLIST]; /* colids of bylist elements */
- struct dbaltinfo *althlist; /* linked list of DBALTINFOs */
- struct dbprlist *althprlist; /* order print list for aops */
- struct dbalthead *althnext; /* next dbalthead */
- };
- typedef struct dbalthead DBALTHEAD;
-
- /*
- ** DBPRLIST - This structure is used to create an 'ordered' printing list
- ** for computes. For example a compute might be:
- ** compute sum(col1), avg(col2), sum(col2), avg(col3), avg(col1)
- ** For printing, it would be nice to have a list that pointed to the
- ** right DBALTINFO structures like this:
- ** sum(col1)-->sum(col2)
- ** |
- ** \|/
- ** avg(col1)-->avg(col2)-->avg(col3)
- ** It is used by the praltrow function that dbprrow uses but the
- ** information could be used by any DBLIB client.
- */
- struct dbprlist
- {
- DBROWDATA *prdata; /* actual data for the compute */
- struct dbaltinfo *prtarget; /* related ALTINFO struct */
- struct dbprlist *prright; /* next aop in compute */
- struct dbprlist *prdown; /* next compute in query */
- };
- typedef struct dbprlist DBPRLIST;
-
- /*
- ** DBALTINFO - This structure contains the format information about
- ** alternate rows. Compute clauses produce alternate rows of data,
- ** interspersed with the regular data rows returned by the dataserver.
- ** There is a linked list of DBALTHEAD structures in the DBPROCESS
- ** structure. There is one DBALTHEAD structure for each possible
- ** type of alternate row of the current command. Format information for
- ** regular data rows is kept in the DBCOLINFO structure.
- */
- struct dbaltinfo
- {
- char *altname; /* null terminated string to alt header */
- BYTE alttoken; /* type of alternate information */
- BYTE altcolid; /* which target list member referenced */
- BYTE alttype; /* column type */
- DBINT altudtype; /* user-defined type */
- DBINT altlen; /* max length of column */
- DBINT altprlen; /* printing length of data */
- char *altcontrol; /* control format, if any */
- struct dbprlist *altprlist; /* ptr to ordered printing list */
- struct bindrec altbind; /* binding info, if any */
- struct dbaltinfo *altnext; /* next column */
- };
- typedef struct dbaltinfo DBALTINFO;
-
- /*
- ** DBROW - This structure is used to store the actual row and alternate row
- ** data returned by the dataserver. The member of the DBPROCESS structure
- ** called dbfirstdata stores the doubly-linked list of rows. If buffering
- ** is off, only one row is stored. The rows are stored in the order that
- ** they are received from the server.
- */
- struct dbrow
- {
- DBINT rowid; /* this is the returned row number */
- DBUSMALLINT rowaltid; /* for ALT rows, this is
- * DBALTINFO.altid
- */
- DBROWDATA *rowdata; /* actual data */
- DBBOOL rowhasnull; /* are there any NULLS in this row of
- * data?
- */
- struct dbrow *rowprev; /* previous row if buffering on */
- struct dbrow *rownext; /* next row if buffering on */
- };
- typedef struct dbrow DBROW;
-
- /*
- ** DBINFO - This structure is used to store information and error messages
- ** returned by the dataserver.
- **
- ** NOTE - This structure is used by APT.
- ** Adding or deleting structure members should be done with
- ** care.
- */
- struct dbinfo
- {
- DBINT infonum; /* error or info number */
- DBTINYINT infostate; /* error state number */
- DBTINYINT infoclass; /* info class or error severity */
- char *infotext; /* null terminated message */
- struct dbinfo *infonext;
- };
- typedef struct dbinfo DBINFO;
-
- /*
- ** Options - both for the dataserver and DBLIB
- ** As additional options are added, they should be added here and in
- ** the Dboptdict array.
- */
-
- /*
- ** dataserver options are defined in pss.h
- ** dataserver options and their index into the Dboptdict array
- ** Dboptdict is defined in options.c
- */
- #define DBPARSEONLY 0
- #define DBESTIMATE 1
- #define DBSHOWPLAN 2
- #define DBNOEXEC 3
- #define DBARITHIGNORE 4
- #define DBNOCOUNT 5
- #define DBARITHABORT 6
- #define DBTEXTLIMIT 7
- #define DBBROWSE 8
- #define DBOFFSET 9
- #define DBSTAT 10
- #define DBERRLVL 11
- #define DBCONFIRM 12
- #define DBSTORPROCID 13
- #define DBBUFFER 14
- #define DBNOAUTOFREE 15
- #define DBROWCOUNT 16
- #define DBTEXTSIZE 17
-
- #define OFF 0
- #define ON 1
-
- /* RETCODES for option routines */
- #define NOSUCHOPTION 2
-
- /*
- ** DBOPTION - This structure is used to store the current dataserver and
- ** dblib options.
- */
- struct dboption
- {
- char *opttext;
- DBSTRING *optparam; /* param to the option */
- DBUSMALLINT optstatus; /* status of option */
- DBBOOL optactive; /* is this structure active (being used?) */
- struct dboption *optnext; /* for different versions of an option */
- };
- typedef struct dboption DBOPTION;
-
-
- /*
- ** These are the offset types recognized by the DataServer
- ** They are contained in the DataServer header pss.h. The _defines
- ** come from y.tab.h.
- */
- #define OFF_SELECT (DBUSMALLINT) _SELECT
- #define OFF_FROM (DBUSMALLINT) _FROM
- #define OFF_ORDER (DBUSMALLINT) _ORDER
- #define OFF_COMPUTE (DBUSMALLINT) _COMPUTE
- #define OFF_TABLE (DBUSMALLINT) _TABLE
- #define OFF_PROCEDURE (DBUSMALLINT) _PROCEDURE
- #define OFF_STATEMENT (DBUSMALLINT) _STATEMENT
- #define OFF_PARAM (DBUSMALLINT) _PARAM
- #define OFF_EXEC (DBUSMALLINT) _EXECUTE
-
- /*
- ** DBOFF - This structure is used to store text offset information.
- ** This information is used to send back to the dataserver new
- ** control formats.
- */
- struct dboff
- {
- DBUSMALLINT offtype; /* type of offset */
- DBUSMALLINT offset; /* actual offset */
- struct dboff *offnext;
- };
- typedef struct dboff DBOFF;
-
- /*
- ** DBDONE - This structure is just the dataserver done packet.
- ** It has information about the completion of a command.
- */
- struct dbdone
- {
- DBUSMALLINT donestatus; /* done status bits */
- DBUSMALLINT doneinfo; /* command specific info */
- DBINT donecount; /* done count -- rows for example */
- };
- typedef struct dbdone DBDONE;
-
- /* Status bits for DBPROCESS dbstatus */
- #define READROW (DBUSMALLINT) 0x2
- #define INSPROC (DBUSMALLINT) 0x4
- #define EXECDONE (DBUSMALLINT) 0x8
- #define NEWDB (DBUSMALLINT) 0x10
-
- /* Bulk-copy information -- */
-
- #define PERIOD '.' /* the separator... */
-
- #define STATNULL (BYTE) 0x08
- #define IN (BYTE) 1 /* TEMPORARY - for backward compatibility. */
- #define OUT (BYTE) 2 /* TEMPORARY - for backward compatibility. */
- #define DB_IN (BYTE) 1
- #define DB_OUT (BYTE) 2
- #define BCPNAMELEN 255
- #define DEFABORT 10 /* # of errors before we give up */
- #define ERRFILE "bcp.error" /* default error file name */
-
- /* BCP macros: */
- #define BCP_SETL(a,b) dbsetlbool((a), (b), DBSETBCP)
-
- /* The fields for calls to bcpcontrol. */
- #define BCPMAXERRS 1
- #define BCPFIRST 2
- #define BCPLAST 3
- #define BCPBATCH 4
- #define BCPERRFILE 5 /* TEMPORARY - for backward compatibility. */
-
- typedef struct bcpparsetable
- {
- char dbname[MAXNAME+1];
- char ownername[MAXNAME+1];
- char tabname[MAXNAME+1];
- } BCPPARSETABLE;
-
- /*
- ** BCPCOLDESC
- ** This is the basic unit of information used for bulkcopy.
- ** All the bulkcopy routines that talk with the DataServer
- ** routines pass an array of these.
- */
- typedef struct bcpcoldesc
- {
- BYTE *cd_dvalue; /* current value to be inserted */
- BYTE *cd_defvalue; /* default value to be inserted */
- DBINT cd_dlen; /* current length to be inserted */
- DBINT cd_deflen; /* length of default to be inserted */
- BYTE cd_colen; /* max length allowed in column */
- short cd_coloff; /* column offset in row */
- BYTE cd_colid; /* id of column */
- BYTE cd_type; /* storage type of column */
- BYTE cd_status; /* status bits */
- DBBOOL cd_nullok; /* is a NULL ok here? */
- char cd_name[MAXNAME+1]; /* column name */
- DBBOOL cd_moretext; /* Is this text to be sent via bcp__moretext? */
- long cd_textpos; /* file-position of a long TEXT or IMAGE */
- } BCPCOLDESC;
-
- /*
- ** BCPROWDESC
- ** This is the basic unit of information used for bulkcopy.
- ** All the bulkcopy routines that talk with the DataServer
- ** routines pass it.
- */
- typedef struct bcprowdesc
- {
- BCPCOLDESC *rd_coldesc; /* ptr to base address of COLDESC
- * array
- */
- short rd_colcount; /* number of columns in COLDESC */
- short rd_minlen; /* minimum length of a row */
- short rd_maxlen; /* maximum length of a row */
- } BCPROWDESC;
-
- /*
- ** BCPHOSTDESC
- ** This is the structure that has information about the type and
- ** format of the input or output data. An array of these is used
- ** to read/write data to or from the host.
- */
- typedef struct bcphostdesc
- {
- BCPCOLDESC *h_tabcol;/* which table column we are referring to */
- int h_tabcolnum; /* which table column we are referring to */
- int (*hconvert)(); /* conversion function, if applicable */
- BYTE htype; /* host data type for this column */
- DBINT hcollen; /* max length of hostfile column */
- BYTE *hdata; /* host-format data for this column */
- DBINT hdatlen; /* length of actual hostfile data */
- int hprefixlen; /* length of length-prefix for this column */
- BYTE *hterm; /* terminator for this column, if applicable */
- int htermlen; /* length of terminator for this column */
- DBBOOL hmoretext; /* Is this text to be sent via bcp__moretext? */
- long htextpos; /* file-position of a long TEXT or IMAGE */
- } BCPHOSTDESC;
-
- /* This structure contains information about any partially-sent TEXT or IMAGE
- * values, which are still to be sent by bcp_moretext().
- */
- typedef struct bcptextrec
- {
- DBINT len;
- BYTE *val;
- BYTE type;
- DBSMALLINT rowoffset;
- BYTE coloffset;
- } BCPTEXTREC;
-
- /*
- ** BCPDESC
- ** This structure is used to pass the information contained in the
- ** Bulk Copy property sheet around (if in the form version), or
- ** information typed in by the user (in dblib/stand alone version).
- ** In the form version, this information comes from the main form, while
- ** in the stand alone version this comes from the command line.
- */
- typedef struct bcpdesc
- {
- BCPROWDESC *bd_rowdesc; /* the associated rowdesc */
- BCPHOSTDESC *bd_hostdesc; /* ptr to base address of
- ** BCPHOSTDESC array */
- int bd_hcolcount; /* number of (cols) BCPHOSTDESC
- ** structs */
- BCPPARSETABLE *bd_ptable; /* ptr to tbl name components */
- char bd_table[(3 * MAXNAME) + 3]; /* full table name */
- char bd_filename[BCPNAMELEN+1];/* host filename */
- BYTE bd_direction; /* in/out */
- BYTE *bd_errfile; /* host err file */
- DBINT bd_abort; /* # of errors allowable */
- DBINT bd_firstrow; /* begin copy at this row */
- DBINT bd_lastrow; /* end copy at this row */
- DBINT bd_batch; /* # of rows per batch */
- int bd_textcount; /* # of text-columns in the
- * current row.
- */
- int bd_textcol; /* # of the text-column now
- * being sent by bcp_moretext().
- * Starts at zero.
- */
- DBINT bd_textbytes; /* # of bytes already sent of
- * the current bcp_moretext()
- * column.
- */
- BCPTEXTREC *bd_textarray;
- } BCPDESC;
-
-
- /*
- ** DBPROCESS - This is the basic DBLIB structure. It contains the command
- ** sent to the dataserver as well as the results of the command.
- ** It also includes any error or information messages, including the
- ** done packet, returned by the dataserver. If buffering is turned on,
- ** this structure also stores the data rows.
- */
- struct dbprocess
- {
- struct servbuf *dbfile; /* dataserver connection */
- BYTE *pipe; /* connection to server */
- DBUSMALLINT dbstatus; /* status field for dbprocess */
- BYTE dbtoken; /* current dataserver token */
- DBSTRING *dbcmdbuf; /* command buffer */
- int dbcurcmd; /* number of the current cmd results */
- DBINT dbprocid; /* procid, if any, of the current cmd */
- DBCOLINFO *dbcols; /* linked list of column information */
- DBALTHEAD *dbalts; /* linked list of alt column info */
- DBROW *dbfirstdata; /* doubly linked list of returned row
- * data
- */
- DBROW *dbcurdata; /* current row in dbfirstdata */
- DBROW *dblastdata; /* last row in dbfirstdata, usually
- * dbcurdata
- */
- DBOFF *dboffsets; /* list of offsets and controls in
- * dbcmdbuf
- */
- int dboffadjust; /* adjustment factor for offsets */
- DBSMALLINT dbcuroffset; /* active offset for results */
- DBOPTION *dbopts;
- DBSTRING *dboptcmd; /* option string to send to server */
- DBINFO *dbmsgs; /* linked list of info and error
- * messages
- */
- DBINFO *dbcurmsg; /* last message read by dbgetmsg() */
- DBDONE dbdone; /* done information */
- char dbcurdb[MAXNAME+1]; /* the name of the current
- * database
- */
- INTFUNCPTR (*dbbusy)(); /* function to call when waiting on
- * dataserver
- */
- int (*dbidle)(); /* function to call when waiting on
- * dataserver
- */
- int (*dbchkintr)(); /* user's function to call to check for
- * queued interrupts
- */
- int (*dbhndlintr)();/* user's interrupt handler */
- int dbbufsize; /* the size of the row buffer, if
- * enabled
- */
- NULLBIND dbnullbind; /* what to bind for nulls */
- int dbsticky; /* sticky flags like attn */
- int dbnumorders; /* number of columns in the query's
- * "order by" clause.
- */
- int *dbordercols; /* array of the column numbers found in
- * the query's "order by" clause.
- */
- DBBOOL dbavail; /* is this dbproc available for general
- * use?
- */
- int dbftosnum; /* this id is used when recording the
- * frontend-to-Server SQL traffic of
- * this DBPROCESS.
- */
- DBBOOL dbdead; /* TRUE if this DBPROCESS has become
- * useless, usually due to a fatal
- * Server error, or a communications
- * failure.
- */
- DBBOOL dbenabled; /* TRUE if this DBPROCESS is allowed to
- * be used in DB-LIBRARY functions. The
- * user may set this flag FALSE,
- * possibly within an error handler, if
- * execution of further commands would
- * just cause further errors.
- * DB-LIBRARY initially sets this flag
- * TRUE. The user may set and re-set
- * this flag at will.
- */
- DBBOOL dbloginfailed; /* TRUE if the Server has rejected
- * our username and password.
- */
- DBBOOL dbsqlsent; /* TRUE if the SQL in the command
- * buffer has already been sent to
- * the DataServer.
- */
- DBTABNAME *dbtabnames; /* linked-list of table-name information
- * used by "browse mode".
- */
- DBINT dbspid; /* The Server process-id of this
- * DBPROCESS. It's returned in the
- * row-count field of the done-packet
- * which signifies a successful login.
- */
- DBRETVAL *dbretvals; /* linked-list of function
- * return-values.
- */
- BCPDESC *db_bcpdesc; /* A structure containing bulk-copy
- * information.
- */
- DBBOOL dbtransbegun; /* Indicates that a text data transfer
- * is under way.
- */
- DBINT dbbytesleft; /* This is a countdown variable, used
- * to track the number of bytes which
- * are still to be sent as part of
- * a dbwritetext() command.
- */
- DBINT dbretstat; /* This is the return-status from
- * a stored procedure.
- */
- DBINT dbtextlimit; /* This is the longest text-column
- * that this dbproc will accept
- * from the Server. Any additional
- * bytes will be discarded.
- * If 0, then there's no limit.
- */
- #if VMS
- int db_event_mask; /* a mask used to determine what
- ** event has happened in the front-
- ** end i/o routines.
- */
- long db_event_flag; /* the number of the event flag used
- ** to check for timeout, interrupt
- ** (control_c) or i/o completion.
- */
- short db_io_channel; /* channel assigned to sys$command
- ** of the controlling process.
- */
- #endif /* VMS */
-
- struct dbprocess *dbnext;/* DBPROCESSes are kept track of
- * in a big linked-list.
- */
- };
- typedef struct dbprocess DBPROCESS;
-
- /*
- ** Various macros used to extract information from the DBPROCESS structure
- */
- #define DBCURCMD(a) (a == NULL ? FAIL : ((a)->dbcurcmd))
- #define DBCURROW(a) (a == NULL ? (DBINT)FAIL : ((a)->dbcurdata == (DBROW *) NULL ? ((DBINT)0): (a)->dbcurdata->rowid))
- #define DBFIRSTROW(a) (a == NULL ? (DBINT)FAIL : (((a)->dbfirstdata == (DBROW *) NULL ? ((DBINT)0): (a)->dbfirstdata->rowid)))
- #define DBLASTROW(a) (a == NULL ? (DBINT)FAIL : (((a)->dblastdata == (DBROW *) NULL ? ((DBINT)0): (a)->dblastdata->rowid)))
- #define DBROWTYPE(a) (a == NULL ? (DBINT)FAIL : (((a)->dbcurdata == (DBROW *) NULL ? NO_MORE_ROWS : ((a)->dbcurdata->rowaltid == 0 ? REG_ROW : (a)->dbcurdata->rowaltid))))
- #define DBMORECMDS(a) (a == NULL ? FAIL : (((a)->dbdone.donestatus & DONE_CONT ? SUCCEED: FAIL)))
- #define DONECONTINUE(a) (a == NULL ? FAIL : (((a)->dbdone.donestatus & DONE_CONT ? SUCCEED: FAIL)))
- #define DBCOUNT(a) (a == NULL ? (DBINT)-1 : (((a)->dbdone.donecount)))
- #define DBCMDROW(x) (x == NULL ? FAIL : (((x)->dbcols == NULL ? FAIL: SUCCEED)))
- #define DBROWS(x) (x == NULL ? FAIL : ((((x)->dbstatus & READROW) ? SUCCEED: FAIL)))
- #define DBNUMORDERS(a) (a == NULL ? (-1) : (((a)->dbnumorders)))
- #define DBZEROSPACE(p,i) (BZERO(((char *) (p)), (i)))
- #define DBBUFFULL(a) (a == NULL ? TRUE : ((DBLASTROW(a) - DBFIRSTROW(a) + 1 >= (a)->dbbufsize ? TRUE : FALSE)))
- #define DBMOREROWS(a) (a == NULL ? FALSE : ((((a)->dbtoken == SYBROW) || ((a)->dbtoken == SYBALTROW) ? TRUE : FALSE)))
- #define DBISAVAIL(a) (a == NULL ? FALSE : ((((a)->dbavail) ? TRUE : FALSE)))
- #define DBGETTIMEOUT(a) (DbTimeout)
- #define DBGETTIME() (DbTimeout)
- #define DBDEAD(a) (a == NULL ? TRUE : (((a)->dbdead)))
-
- /*
- ** Defined for use with Sybase Installable Networks version 2.0
- */
- #define DBIORDESC(a) ((a)->dbfile->serv_rnum)
- #define DBIOWDESC(a) ((a)->dbfile->serv_snum)
- #define DBNETTIME() (DbTimeout) /* Read/Write */
- #define DBNETCOMP(a) ((a)->dbfile->serv_comp)
-
- #define DBRBUF(a) ((a)->dbfile->serv_rleft)
-
- /* These constants are used for RPC options. The first group are flags
- * in a 2-byte bitmask, so they'll be different on Suns and Vaxes. The
- * second group are flags in a 1-byte bitmask, so they should be
- * machine-independent.
- */
- #define DBRPCRECOMPILE ((DBSMALLINT)1)
-
- #define DBRPCRETURN ((BYTE)1)
-
- #if VMS
- /* These constants are used for VMS network manipulation. */
- #define DB_IO_EVENT 1
- #define DB_INTERRUPT_EVENT 2
- #define DB_TIMER_EVENT 4
- #endif /* VMS */
-
- /*
- ** Macros to set values in the LOGINREC structure.
- */
- #define DBSETHOST 1
- #define DBSETUSER 2
- #define DBSETPWD 3
- #define DBSETHID 4
- #define DBSETAPP 5
- #define DBSETBCP 6
- #define DBSETLHOST(a,b) dbsetlname((a), (b), DBSETHOST)
- #define DBSETLUSER(a,b) dbsetlname((a), (b), DBSETUSER)
- #define DBSETLPWD(a,b) dbsetlname((a), (b), DBSETPWD)
- #define DBSETLHID(a,b) dbsetlname((a), (b), DBSETHID)
- #define DBSETLAPP(a,b) dbsetlname((a), (b), DBSETAPP)
-
- extern DBBOOL DbDebug;
- extern int DbTime;
- extern DBBOOL DbIntrFlag; /* True if an interrupt was typed. */
- extern char DbSeparator;
- extern int DbHeader;
- extern int DbTimeout; /* default timeout value for DBPROCESSes. */
-
- /* bcp functions */
- extern BCPDESC *bcpinit();
- extern RETCODE bcpcontrol();
- extern RETCODE bcpcolumn();
- extern RETCODE bcpformat();
- extern RETCODE bcpexec();
- extern RETCODE bcpbind();
- extern RETCODE bcpsendrow();
- extern RETCODE bcpabort();
- extern RETCODE bcpcollen();
- extern DBINT bcpdone();
-
- /* DB-LIBRARY minor error numbers */
- #define SYBESYNC 10001 /* Read attempted while out of synchronization
- * with DataServer.
- */
- #define SYBEFCON 10002 /* DataServer connection failed. */
- #define SYBETIME 10003 /* DataServer connection timed out. */
- #define SYBEREAD 10004 /* Read from DataServer failed. */
- #define SYBEBUFL 10005 /* DB-LIBRARY internal error - send buffer
- * length corrupted.
- */
- #define SYBEWRIT 10006 /* Write to DataServer failed. */
- #define SYBEVMS 10007 /* Sendflush: VMS I/O error. */
- #define SYBESOCK 10008 /* Unable to open socket */
- #define SYBECONN 10009 /* Unable to connect socket -- DataServer is
- * unavailable or does not exist.
- */
- #define SYBEMEM 10010 /* Unable to allocate sufficient memory */
- #define SYBEDBPS 10011 /* Maximum number of DBPROCESSes
- * already allocated.
- */
- #define SYBEINTF 10012 /* Server name not found in interface file */
- #define SYBEUHST 10013 /* Unknown host machine name */
- #define SYBEPWD 10014 /* Incorrect password. */
- #define SYBEOPIN 10015 /* Could not open interface file. */
- #define SYBEINLN 10016 /* Interface file: unexpected end-of-line. */
- #define SYBESEOF 10017 /* Unexpected EOF from DataServer. */
- #define SYBESMSG 10018 /* General DataServer error: Check messages
- * from the DataServer.
- */
- #define SYBERPND 10019 /* Attempt to initiate a new DataServer
- * operation with results pending.
- */
- #define SYBEBTOK 10020 /* Bad token from DataServer: Data-stream
- * processing out of sync.
- */
- #define SYBEITIM 10021 /* Illegal timeout value specified. */
- #define SYBEOOB 10022 /* Error in sending out-of-band data to
- * DataServer.
- */
- #define SYBEBTYP 10023 /* Unknown bind type passed to DB-LIBRARY
- * function.
- */
- #define SYBEBNCR 10024 /* Attempt to bind user variable to a
- * non-existent compute row.
- */
- #define SYBEIICL 10025 /* Illegal integer column length returned by
- * DataServer. Legal integer lengths are 1, 2,
- * and 4 bytes.
- */
- #define SYBECNOR 10026 /* Column number out of range. */
- #define SYBENPRM 10027 /* NULL parameter not allowed for this
- * dboption.
- */
- #define SYBEUVDT 10028 /* Unknown variable-length datatype encountered.
- */
- #define SYBEUFDT 10029 /* Unknown fixed-length datatype encountered. */
- #define SYBEWAID 10030 /* DB-LIBRARY internal error: ALTFMT following
- * ALTNAME has wrong id.
- */
- #define SYBECDNS 10031 /* Datastream indicates that a compute column is
- * derived from a non-existent select-list
- * member.
- */
- #define SYBEABNC 10032 /* Attempt to bind to a non-existent column. */
- #define SYBEABMT 10033 /* User attempted a dbbind() with mismatched
- * column and variable types.
- */
- #define SYBEABNP 10034 /* Attempt to bind using NULL pointers. */
- #define SYBEAAMT 10035 /* User attempted a dbaltbind() with mismatched
- * column and variable types.
- */
- #define SYBENXID 10036 /* The Server did not grant us a
- * distributed-transaction ID.
- */
- #define SYBERXID 10037 /* The Server did not recognize our
- * distributed-transaction ID.
- */
- #define SYBEICN 10038 /* Invalid computeid or compute column number.
- */
- #define SYBENMOB 10039 /* No such member of 'order by' clause. */
- #define SYBEAPUT 10040 /* Attempt to print unknown token. */
- #define SYBEASNL 10041 /* Attempt to set fields in a null loginrec. */
- #define SYBENTLL 10042 /* Name too long for loginrec field. */
- #define SYBEASUL 10043 /* Attempt to set unknown loginrec field. */
- #define SYBERDNR 10044 /* Attempt to retrieve data from a non-existent
- * row.
- */
- #define SYBENSIP 10045 /* Negative starting index passed to dbstrcpy().
- */
- #define SYBEABNV 10046 /* Attempt to bind to a NULL program variable.
- */
- #define SYBEDDNE 10047 /* DBPROCESS is dead or not enabled. */
- #define SYBECUFL 10048 /* Data-conversion resulted in underflow. */
- #define SYBECOFL 10049 /* Data-conversion resulted in overflow. */
- #define SYBECSYN 10050 /* Attempt to convert data stopped by syntax
- * error in source field.
- */
- #define SYBECLPR 10051 /* Data-conversion resulted in loss of
- * precision.
- */
- #define SYBECNOV 10052 /* Attempt to set variable to NULL resulted
- * in overflow.
- */
- #define SYBERDCN 10053 /* Requested data-conversion does not exist. */
- #define SYBESFOV 10054 /* dbsafestr() overflowed its destination
- * buffer.
- */
- #define SYBEUNT 10055 /* Unknown network type found in
- * interface file.
- */
- #define SYBECLOS 10056 /* Error in closing network connection. */
- #define SYBEUAVE 10057 /* Unable to allocate VMS event flag. */
- #define SYBEUSCT 10058 /* Unable to set communications timer. */
- #define SYBEEQVA 10059 /* Error in queueing VMS AST routine. */
- #define SYBEUDTY 10060 /* Unknown datatype encountered. */
- #define SYBETSIT 10061 /* Attempt to call dbtsput() with an
- * invalid timestamp.
- */
- #define SYBEAUTN 10062 /* Attempt to update the timestamp of a table
- * which has no timestamp column.
- */
- #define SYBEBDIO 10063 /* Bad bulk-copy direction. Must be either
- * IN or OUT.
- */
- #define SYBEBCNT 10064 /* Attempt to use Bulk Copy with a non-existent
- * Server table.
- */
- #define SYBEIFNB 10065 /* Illegal field number passed to bcp_control().
- */
- #define SYBETTS 10066 /* The table which bulk-copy is attempting to
- * copy to a host-file is shorter than the
- * number of rows which bulk-copy was instructed
- * to skip.
- */
- #define SYBEKBCO 10067 /* 1000 rows successfully bulk-copied to
- * host-file.
- */
- #define SYBEBBCI 10068 /* Batch successfully bulk-copied to DataServer.
- */
- #define SYBEKBCI 10069 /* Bcp: 1000 rows sent to DataServer. */
- #define SYBEBCRE 10070 /* I/O error while reading bcp data-file. */
- #define SYBETPTN 10071 /* Syntax error: only two periods are permitted
- * in table names.
- */
- #define SYBEBCWE 10072 /* I/O error while writing bcp data-file. */
- #define SYBEBCNN 10073 /* Attempt to bulk-copy a NULL value into
- * a Server column which does not accept
- * NULL values.
- */
- #define SYBEBCOR 10074 /* Attempt to bulk-copy an oversized row to the
- * DataServer.
- */
- #define SYBEBCIS 10075 /* Attempt to bulk-copy an illegally-sized
- * column value to the DataServer.
- */
- #define SYBEBCPI 10076 /* bcp_init() must be called before any other
- * bcp routines.
- */
- #define SYBEBCPN 10077 /* bcp_bind(), bcp_collen() and bcp_colptr()
- * may be used only after bcp_init() has been
- * called with the copy direction set to DB_IN.
- */
- #define SYBEBCPB 10078 /* bcp_bind() may NOT be used after bcp_init()
- * has been passed a non-NULL input file name.
- */
- #define SYBEVDPT 10079 /* For bulk copy, all variable-length data
- * must have either a length-prefix or a
- * terminator specified.
- */
- #define SYBEBIVI 10080 /* bcp_columns() and bcp_colfmt() may be used
- * only after bcp_init() has been passed a
- * valid input file.
- */
- #define SYBEBCBC 10081 /* bcp_columns() must be called before
- * bcp_colfmt().
- */
- #define SYBEBCFO 10082 /* Bcp host-files must contain at least one
- * column.
- */
- #define SYBEBCVH 10083 /* bcp_exec() may be called only after
- * bcp_init() has been passed a valid host file.
- */
- #define SYBEBCUO 10084 /* Bcp: Unable to open host data-file. */
- #define SYBEBCUC 10085 /* Bcp: Unable to close host data-file. */
- #define SYBEBUOE 10086 /* Bcp: Unable to open error-file. */
- #define SYBEBUCE 10087 /* Bcp: Unable to close error-file. */
- #define SYBEBWEF 10088 /* I/O error while writing bcp error-file. */
- #define SYBEASTF 10089 /* VMS: Unable to setmode for control_c ast. */
- #define SYBEUACS 10090 /* VMS: Unable to assign channel to sys$command.
- */
- #define SYBEASEC 10091 /* Attempt to send an empty command buffer to
- * the DataServer.
- */
- #define SYBETMTD 10092 /* Attempt to send too much TEXT data via the
- * dbmoretext() call.
- */
- #define SYBENTTN 10093 /* Attempt to use dbtxtsput() to put a new
- * text-timestamp into a non-existent data row.
- */
- #define SYBEDNTI 10094 /* Attempt to use dbtxtsput() to put a new
- * text-timestamp into a column whose datatype
- * is neither SYBTEXT nor SYBIMAGE.
- */
- #define SYBEBTMT 10095 /* Attempt to send too much TEXT data via the
- * bcp_moretext() call.
- */
- #define SYBEDUPNT 10096 /* Attempt to install duplicate network.
- ** (well really we just found a dup comm_type.
- */
- #define SYBEUVBF 10097 /* Attempt to read an unknown version of
- ** BCP format-file
- */
- #define SYBEBUOF 10098 /* Bcp: Unable to open format-file. */
- #define SYBEBUCF 10099 /* Bcp: Unable to close format-file. */
- #define SYBEBRFF 10100 /* I/O error while reading bcp format-file. */
- #define SYBEBWFF 10101 /* I/O error while writing bcp format-file. */
- #define SYBEBUDF 10102 /* Bcp: Unrecognized datatype found in
- * format-file.
- */
- #define SYBEBIHC 10103 /* Incorrect host-column number found in bcp
- * format-file.
- */
- #define SYBEBEOF 10104 /* Unexpected EOF encountered in BCP data-file.
- */
- #define SYBEBCNL 10105 /* Negative length-prefix found in BCP
- * data-file.
- */
- #define SYBEBCSI 10106 /* Host-file columns may be skipped only when
- * copying INto the Server.
- */
- #define SYBEBCIT 10107 /* It's illegal to use BCP terminators with
- * program variables other than SYBCHAR,
- * SYBBINARY, SYBTEXT, or SYBIMAGE.
- */
- #define SYBEBCSA 10108 /* The BCP hostfile '%s' contains only %ld
- * rows. Skipping all of these rows is
- * not allowed.
- */
- #define SYBEBCRO 10109 /* The BCP hostfile '%s' contains only %ld
- * rows. It was impossible to read the
- * requested %ld rows.
- */
- #define SYBENULL 10110 /* NULL DBPROCESS pointer encountered */
-
- /* Forward declarations of DB-LIBRARY routines */
-
-
- extern unsigned char *dbadata(struct dbprocess *dbproc,int computeid,int colnumber);
- extern long dbadlen(struct dbprocess *dbproc,int computeid,int colnumber);
- extern int dbaltbind(struct dbprocess *dbproc,int computeid,int column,int vartype,long varlen,unsigned char *destvar);
- extern int dbaltcolid(struct dbprocess *dbproc,int computeid,int colnumber);
- extern long dbaltlen(struct dbprocess *dbproc,int computeid,int colnumber);
- extern int dbaltop(struct dbprocess *dbproc,int computeid,int colnumber);
- extern int dbalttype(struct dbprocess *dbproc,int computeid,int colnumber);
- extern int dbbind(struct dbprocess *dbproc,int column,int vartype,long varlen,unsigned char *destvar);
- extern unsigned char *dbbylist(struct dbprocess *dbproc,int id,int *size);
- extern int dbcancel(struct dbprocess *dbproc);
- extern int dbcanquery(struct dbprocess *dbproc);
- extern char *dbchange(struct dbprocess *dbproc);
- static void dbdbchange(struct dbprocess *dbproc,struct dbinfo *info);
- extern void dbclose(struct dbprocess *dbproc);
- extern void dbclrbuf(struct dbprocess *dbproc,long n);
- extern int dbclropt(struct dbprocess *dbproc,int option,char *param);
- extern int dbcmd(struct dbprocess *dbproc,char *cmdstring);
- extern unsigned char dbcolbrowse(struct dbprocess *dbproc,int colnum);
- extern long dbcollen(struct dbprocess *dbproc,int colnumber);
- extern char *dbcolname(struct dbprocess *dbproc,int colnumber);
- extern char *dbcolsource(struct dbprocess *dbproc,int colnumber);
- extern int dbcoltype(struct dbprocess *dbproc,int colnumber);
- extern int dbconvert(struct dbprocess *dbproc,int srctype,unsigned char *src,long srclen,int desttype,unsigned char *dest,long destlen);
- extern unsigned char *dbdata(struct dbprocess *dbproc,int colnumber);
- extern long dbdatlen(struct dbprocess *dbproc,int colnumber);
- extern int (*dberrhandle(int (*handler)()))();
- extern char *dberrstr(int errorno);
- extern void dbexit(void );
- extern int dbfcmd(struct dbprocess *dbproc,char *cmdstring,...);
- extern void dbfreebuf(struct dbprocess *dbproc);
- extern void dbfreequal(char far *);
- extern char *dbgetchar(struct dbprocess *dbproc,int n);
- extern int dbgetmaxprocs(void );
- extern int dbgetoff(struct dbprocess *dbproc,unsigned short type,int start);
- extern int dbgetrow(struct dbprocess *dbproc,long row);
- extern unsigned char dbisopt(struct dbprocess *dbproc,int option,char *param);
- extern struct loginrec *dblogin(void );
- extern int dbmoretext(struct dbprocess *dbproc,long size,unsigned char *text);
- extern int (*dbmsghandle(int (*handler)()))();
- extern long dbreadpage(struct dbprocess *dbproc,char *dbname,long pageno,unsigned char *buf);
- extern int dbwritepage(struct dbprocess *dbproc,char *dbname,int pageno,long size,unsigned char *buf);
- extern char *dbname(struct dbprocess *dbproc);
- extern int dbuse(struct dbprocess *dbproc,char *dbname);
- extern int dbnextrow(struct dbprocess *dbproc);
- extern int dbnumalts(struct dbprocess *dbproc,int id);
- extern int dbnumcols(struct dbprocess *dbproc);
- extern int dbnumcompute(struct dbprocess *dbproc);
- extern struct dbprocess *dbopen(struct loginrec *password,char *servername);
- extern int dbordercol(struct dbprocess *dbproc,int order);
- extern void dbprhead(struct dbprocess *dbproc);
- extern int dbprrow(struct dbprocess *dbproc);
- extern char *dbprtype(int type);
- extern char *dbqual(struct dbprocess *dbproc,int tabnum,char *tabname);
- extern long dbreadpage(struct dbprocess *dbproc,char *dbname,long pageno,unsigned char *buf);
- extern int dbresults(struct dbprocess *dbproc);
- extern void dbsetavail(struct dbprocess *dbproc);
- extern void dbsetbusy(struct dbprocess *dbproc,int (*(*busyfunc)())());
- extern int dbsetconnect(char *service_type,char *net_type,char *net_name,char *machine_name,char *port);
- extern void dbsetidle(struct dbprocess *dbproc,int (*idlefunc)());
- extern void dbsetifile(char *filename);
- extern void dbsetinterrupt(struct dbprocess *dbproc,int (*chkintr)(),int (*hndlintr)());
- extern int dbsetlogintime(int seconds);
- extern int dbsetlname(struct loginrec *lptr, char *name, int type);
- extern int dbsetmaxprocs(int maxprocs);
- extern int dbsetnull(struct dbprocess *dbproc,int bindtype,int bindlen,unsigned char *bindval);
- extern int dbsetopt(struct dbprocess *dbproc,int option,char *param);
- extern int dbsettime(int seconds);
- extern int dbsettimeout(struct dbprocess *dbproc,int seconds);
- extern int dbsqlexec(struct dbprocess *dbproc);
- extern int dbsqlok(struct dbprocess *dbproc);
- extern int dbsqlsend(struct dbprocess *dbproc);
- extern int dbstrcpy(struct dbprocess *dbproc,int start,int numbytes,char *dest);
- extern int dbstrlen(struct dbprocess *dbproc);
- extern unsigned char dbtabbrowse(struct dbprocess *dbproc,int tabnum);
- extern int dbtabcount(struct dbprocess *dbproc);
- extern char *dbtabname(struct dbprocess *dbproc,int tabnum);
- extern char *dbtabsource(struct dbprocess *dbproc,int colnum,int *tabnum);
- extern int dbtsnewlen(struct dbprocess *dbproc);
- extern unsigned char *dbtsnewval(struct dbprocess *dbproc);
- extern int dbtsput(struct dbprocess *dbproc,unsigned char *newts,int newtslen,int tabnum,char *tabname);
- extern int dbtxplen(struct dbprocess *dbproc,int colnumber,unsigned char *txplen);
- extern unsigned char *dbtxptr(struct dbprocess *dbproc,int colnumber);
- extern unsigned char *dbtxtimestamp(struct dbprocess *dbproc,int colnumber);
- extern unsigned char *dbtxtsnewval(struct dbprocess *dbproc);
- extern int dbtxtsput(struct dbprocess *dbproc,unsigned char *newtxts,int colnum);
- extern int dbuse(struct dbprocess *dbproc,char *dbname);
- extern unsigned char dbwillconvert(int srctype,int desttype);
- extern int dbwritepage(struct dbprocess *dbproc,char *dbname,int pageno,long size,unsigned char *buf);
- extern int dbwritetext(struct dbprocess *dbproc,char *objname,unsigned char *textptr,unsigned char textptrlen,unsigned char *timestamp,unsigned char log,long size,unsigned char *text);
- extern long bcp_batch(struct dbprocess *dbproc);
- extern int bcp_bind(struct dbprocess *dbproc,unsigned char *varaddr,int prefixlen,long varlen,unsigned char *terminator,int termlen,int type,int table_column);
- extern int bcp_colfmt(struct dbprocess *dbproc,int host_colnum,int host_type,int host_prefixlen,long host_collen,unsigned char *host_term,int host_termlen,int table_colnum);
- extern int bcp_collen(struct dbprocess *dbproc,long varlen,int table_column);
- extern int bcp_colptr(struct dbprocess *dbproc,unsigned char *colptr,int table_column);
- extern int bcp_columns(struct dbprocess *dbproc,int host_colcount);
- extern int bcp_control(struct dbprocess *dbproc,int field,long value);
- extern long bcp_done(struct dbprocess *dbproc);
- extern int bcp_exec(struct dbprocess *dbproc,long *rows_copied);
- extern int bcp_init(struct dbprocess *dbproc,char *tblname,char *hfile,char *errfile,int direction);
- extern int bcp_moretext(struct dbprocess *dbproc,long size,unsigned char *text);
- extern int bcp_sendrow(struct dbprocess *dbproc);
- extern int abort_xact(struct dbprocess *connect,long commid);
- extern void build_xact_string(char *xact_name,char *service_name,long commid,char *result);
- extern void close_commit(struct dbprocess *connect);
- extern int commit_xact(struct dbprocess *connect,long commid);
- extern struct dbprocess *open_commit(struct loginrec *login,char *service);
- extern int remove_xact(struct dbprocess *connect,long commid,int n);
- extern int scan_xact(struct dbprocess *connect,long commid);
- extern long start_xact(struct dbprocess *connect,char *application_name,char *xact_name,int count);
- extern int stat_xact(struct dbprocess *connect,long commid);
- extern int dbnetinstall(char *type,int (*netopen)(),long (*netread)(),long (*netwrite)(),int (*netclose)(),int (*netattn)());
- extern int dbneterr(struct dbprocess *dbproc,int minor,int oserr,char *oserrorstr);
-
-
-
- #if VMS
-
- /* VMS programs can use the AST facility to write asynchronous DB-LIBRARY
- * programs.
- */
- extern RETCODE dbcanquery_a();
- extern RETCODE dbnextrow_a();
- extern RETCODE dbresults_a();
- extern RETCODE dbsqlexec_a();
- extern RETCODE dbsqlok_a();
-
- #endif /* VMS */
-
- #if (MSDOS || OS2)
- /*
- ** These are the NON-PROTOTYPED decalaration for all the Sybase supported
- ** networks.
- */
- /*
- ** Support for SUN's PC-NFS
- */
- extern RETCODE tcp_nfs_open();
- extern DBINT tcp_nfs_read();
- extern DBINT tcp_nfs_write();
- extern RETCODE tcp_nfs_close();
- extern RETCODE tcp_nfs_sendattn();
-
- /*
- ** Support for Lan Managers Named Pipes
- */
- extern RETCODE nmp_open();
- extern DBINT nmp_read();
- extern DBINT nmp_write();
- extern RETCODE nmp_close();
- extern RETCODE nmp_sendattn();
-
- /*
- ** Support for Excelan's Exos 205T Ethernet Controller
- */
- extern RETCODE tcp_exos_open();
- extern DBINT tcp_exos_read();
- extern DBINT tcp_exos_write();
- extern RETCODE tcp_exos_close();
- extern RETCODE tcp_exos_sendattn();
-
-
- #endif /* MSDOS or OS2 */
-
- #endif /* ifndef _FSDB_H_ */
-