FreeTDS API

Classes | Macros | Typedefs | Enumerations | Functions
sybdb.h File Reference

Primary include file for db-lib applications. More...

`#include "tds_sysdep_public.h"`
Include dependency graph for sybdb.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Classes
struct | DBCOL
struct | DBCOL2
struct | DBDATETIME
struct | DBDATETIME4
struct | DBDATETIMEALL
struct | DBMONEY
struct | DBMONEY4
struct | DBNUMERIC
struct | dbstring
struct | dbtypeinfo
struct | DBVARYBIN
struct | DBVARYCHAR
struct | tds_microsoft_dbdaterec
struct | tds_microsoft_dbdaterec2
struct | tds_sybase_dbdaterec
struct | tds_sybase_dbdaterec2

## Macros
#define | BCP_SETL(x, y) dbsetlbool((x), (y), DBSETBCP)
| Enable (or prevent) bcp operations for connections made with a login. More...
#define | BCP_SETLABELED(x, y) dbsetlbool((x), (y), DBSETLABELED)
#define | BCPBATCH 4
#define | BCPFIRST 2
#define | BCPHINTS 6
#define | BCPKEEPIDENTITY 8
#define | BCPLABELED 5
#define | BCPLAST 3
#define | BCPMAXERRS 1
#define | BIGDATETIMEBIND 23
#define | BIGINTBIND 30
#define | BIGTIMEBIND 24
#define | BINARYBIND 15
#define | BITBIND 16
#define | BUF_FULL -3
#define | CHARBIND 0
#define | DATEBIND 21
#define | DATETIME2BIND 31
#define | DATETIMEBIND 11
#define | DB_IN 1
#define | DB_OUT 2
#define | DB_QUERYOUT 3
#define | DBARITHABORT 6
#define | DBARITHIGNORE 4
#define | DBAUTH 29
#define | DBBOTH 2
#define | DBBROWSE 8
#define | DBBUFFER 14
#define | DBCHAINXACTS 26
#define | DBCLIENTCURSORS 33
#define | DBCMDNONE 0
#define | DBCMDPEND 1
#define | DBCMDROW(x) dbcmdrow((x))
| Sybase macro mapping to the Microsoft (lower-case) function. More...
#define | DBCMDSENT 2
#define | DBCONFIRM 12
#define | DBCOUNT(x) dbcount((x))
| Sybase macro mapping to the Microsoft (lower-case) function. More...
#define | DBCURCMD(x) dbcurcmd((x))
| Sybase macro mapping to the Microsoft (lower-case) function. More...
#define | DBCURROW(x) dbcurrow((x))
| Sybase macro mapping to the Microsoft (lower-case) function. More...
#define | DBDATEFIRST 25
#define | DBDATEFORMAT 19
#define | DBDATESHORT 32
#define | DBDEAD(x) dbdead((x))
| Sybase macro mapping to the Microsoft (lower-case) function. More...
#define | DBDOUBLE 1
#define | DBERRLVL 11
#define | DBESTIMATE 1
#define | DBFIPSFLAG 27
#define | DBFIRSTROW(x) dbfirstrow((x))
| Sybase macro mapping to the Microsoft (lower-case) function. More...
#define | DBGETTIME dbgettime
#define | DBIDENTITY 30
#define | DBINTERRUPT 4
#define | DBIORDESC(x) dbiordesc((x))
| Sybase macro, maps to the internal (lower-case) function. More...
#define | DBIOWDESC(x) dbiowdesc((x))
| Sybase macro, maps to the internal (lower-case) function. More...
#define | DBISAVAIL(x) dbisavail((x))
| Sybase macro mapping to the Microsoft (lower-case) function. More...
#define | DBISOLATION 28
#define | DBLASTROW(x) dblastrow((x))
| Sybase macro mapping to the Microsoft (lower-case) function. More...
#define | DBLFCONVERT 24
#define | DBMAXNAME 128
#define | DBMAXNUMLEN 33
#define | DBMORECMDS(x) dbmorecmds((x))
| Sybase macro mapping to the Microsoft (lower-case) function. More...
#define | DBNATLANG 18
#define | DBNOAUTOFREE 15
#define | DBNOCOUNT 5
#define | DBNOERR -1
#define | DBNOEXEC 3
#define | DBNOIDCOL 31
#define | DBNOSAVE 0
#define | DBNOTIFICATION 2
#define | DBNUMOPTIONS 36
#define | DBOFFSET 9
#define | dbopen(x, y) tdsdbopen((x),(y), 0)
#define | DBPADOFF 0
#define | DBPADON 1
#define | DBPARSEONLY 0
#define | DBPRCOLSEP 21
#define | DBPRLINELEN 22
#define | DBPRLINESEP 23
#define | DBPRPAD 20
#define | DBQUOTEDIDENT 35
#define | DBRESULT 1
#define | DBROWCOUNT 16
#define | DBROWS(x) dbrows((x))
| Sybase macro mapping to the Microsoft (lower-case) function. More...
#define | DBROWTYPE(x) dbrowtype((x))
| Sybase macro mapping to the Microsoft (lower-case) function. More...
#define | DBRPCCURSOR TDS_STATIC_CAST(DBSMALLINT, 0x0008)
#define | DBRPCDEFAULT 2
#define | DBRPCRECOMPILE TDS_STATIC_CAST(DBSMALLINT, 0x0001)
#define | DBRPCRESET TDS_STATIC_CAST(DBSMALLINT, 0x0002)
#define | DBRPCRETURN 1
#define | DBSAVE 1
#define | DBSETAPP 5
#define | DBSETBCP 6
#define | DBSETCHARSET 10
#define | DBSETDBNAME 14
#define | DBSETENCRYPT 12
#define | DBSETHOST 1
#define | DBSETLABELED 13
#define | DBSETLAPP(x, y) dbsetlname((x), (y), DBSETAPP)
| Set the (client) application name in the login packet. More...
#define | dbsetlapp(x, y) dbsetlname((x), (y), DBSETAPP)
#define | DBSETLCHARSET(x, y) dbsetlname((x), (y), DBSETCHARSET)
| Set the client character set in the login packet. More...
#define | DBSETLDBNAME(x, y) dbsetlname((x), (y), DBSETDBNAME)
#define | DBSETLENCRYPT(x, y) dbsetlbool((x), (y), DBSETENCRYPT)
| Enable (or not) network password encryption for Sybase servers version 10.0 or above. More...
#define | DBSETLHOST(x, y) dbsetlname((x), (y), DBSETHOST)
| Set the (client) host name in the login packet. More...
#define | dbsetlhost(x, y) dbsetlname((x), (y), DBSETHOST)
#define | DBSETLLABELED(x, y) dbsetlbool((x), (y), DBSETLABELED)
| Alternative way to set login packet fields. More...
#define | DBSETLNATLANG(x, y) dbsetlname((x), (y), DBSETNATLANG)
| Set the language the server should use for messages. More...
#define | dbsetlnatlang(x, y) dbsetlname((x), (y), DBSETNATLANG)
| Set the language the server should use for messages. More...
#define | DBSETLNTLMV2(x, y) dbsetlbool((x), (y), DBSETNTLMV2)
#define | DBSETLPACKET(x, y) dbsetllong((x), (y), DBSETPACKET)
| Set the packet size in the login packet for new connections. More...
#define | dbsetlpacket(x, y) dbsetllong((x), (y), DBSETPACKET)
| Set the packet size in the login packet for new connections. More...
#define | DBSETLPWD(x, y) dbsetlname((x), (y), DBSETPWD)
| Set the password in the login packet. More...
#define | dbsetlpwd(x, y) dbsetlname((x), (y), DBSETPWD)
#define | DBSETLREADONLY(x, y) dbsetlbool((x), (y), DBSETREADONLY)
#define | DBSETLSECURE(x) dbsetlbool((x), (1), DBSETBCP)
#define | DBSETLUSER(x, y) dbsetlname((x), (y), DBSETUSER)
| Set the username in the login packet. More...
#define | dbsetluser(x, y) dbsetlname((x), (y), DBSETUSER)
#define | DBSETLUTF16(x, y) dbsetlbool((x), (y), DBSETUTF16)
#define | DBSETLVERSION(login, version) dbsetlversion((login), (version))
| maps to the Microsoft (lower-case) function. More...
#define | DBSETNATLANG 7
#define | DBSETNTLMV2 1002
#define | DBSETPACKET 11
#define | DBSETPWD 3
#define | DBSETREADONLY 1003
#define | DBSETTIME 34
#define | DBSETUSER 2
#define | DBSETUTF16 1001
#define | DBSHOWPLAN 2
#define | DBSINGLE 0
#define | DBSTAT 10
#define | DBSTORPROCID 13
#define | DBTDS(a) dbtds(a)
| Sybase macro, maps to the internal (lower-case) function. More...
#define | DBTDS_2_0 1 /* pre 4.0 SQL Server */
#define | DBTDS_3_4 2 /* Microsoft SQL Server (3.0) */
#define | DBTDS_4_0 3 /* 4.0 SQL Server */
#define | DBTDS_4_2 4 /* 4.2 SQL Server */
#define | DBTDS_4_6 5 /* 2.0 OpenServer and 4.6 SQL Server. */
#define | DBTDS_4_9_5 6 /* 4.9.5 (NCR) SQL Server */
#define | DBTDS_5_0 7 /* 5.0 SQL Server */
#define | DBTDS_7_0 8 /* Microsoft SQL Server 7.0 */
#define | DBTDS_7_1 9 /* Microsoft SQL Server 2000 */
#define | DBTDS_7_2 10 /* Microsoft SQL Server 2005 */
#define | DBTDS_7_3 11 /* Microsoft SQL Server 2008 */
#define | DBTDS_7_4 12 /* Microsoft SQL Server 2012/2014 */
#define | DBTDS_8_0 9 /* Microsoft SQL Server 2000 */
#define | DBTDS_9_0 10 /* Microsoft SQL Server 2005 */
#define | DBTDS_UNKNOWN 0
| DBTDS_xxx are returned by DBTDS() The integer values of the constants are poorly chosen.
#define | DBTEXTLIMIT 7
#define | DBTEXTSIZE 17
#define | DBTIMEOUT 3
#define | DBTXPLEN 16
#define | DBTXTSLEN 8
#define | DBVER42 DBVERSION_42
#define | DBVER60 DBVERSION_70 /* our best approximation */
#define | DBVERSION_100 2
#define | DBVERSION_42 3
#define | DBVERSION_46 1
#define | DBVERSION_70 4
#define | DBVERSION_71 5
#define | DBVERSION_72 6
#define | DBVERSION_73 7
#define | DBVERSION_74 8
#define | DBVERSION_UNKNOWN 0
| DBVERSION_xxx are used with dbsetversion()
#define | DECIMALBIND 18
#define | FAIL 0
#define | FALSE 0
#define | FLT8BIND 9
#define | INT_CANCEL 2
#define | INT_CONTINUE 1
#define | INT_EXIT 0
#define | INT_TIMEOUT 3
#define | INTBIND 8
#define | MAXBINDTYPES 32 /* keep last */
#define | MAXOPTTEXT 32
#define | MONEYBIND 13
#define | MORE_ROWS -1
#define | NO_MORE_RESULTS 2
#define | NO_MORE_ROWS -2
#define | NOSUCHOPTION 2
#define | NTBSTRINGBIND 2
#define | NUMERICBIND 17
#define | OFF 0
#define | ON 1
#define | REALBIND 10
#define | REG_ROW -1
#define | SMALLBIND 7
#define | SMALLDATETIMEBIND 12
#define | SMALLMONEYBIND 14
#define | SRCDECIMALBIND 20
#define | SRCNUMERICBIND 19
#define | STRINGBIND 1
#define | SUCCEED 1
#define | SYBAOPAVG 0x4f
#define | SYBAOPAVGU 0x50
#define | SYBAOPCHECKSUM_AGG 0x72
#define | SYBAOPCNT 0x4b
#define | SYBAOPCNT_BIG 0x09
#define | SYBAOPCNTU 0x4c
#define | SYBAOPMAX 0x52
#define | SYBAOPMIN 0x51
#define | SYBAOPSTDEV 0x30
#define | SYBAOPSTDEVP 0x31
#define | SYBAOPSUM 0x4d
#define | SYBAOPSUMU 0x4e
#define | SYBAOPVAR 0x32
#define | SYBAOPVARP 0x33
#define | SYBBIGDATETIME SYBBIGDATETIME
#define | SYBBIGTIME SYBBIGTIME
#define | SYBBINARY SYBBINARY
#define | SYBBIT SYBBIT
#define | SYBBITN SYBBITN
#define | SYBCHAR SYBCHAR
#define | SYBDATE SYBDATE
#define | SYBDATETIME SYBDATETIME
#define | SYBDATETIME4 SYBDATETIME4
#define | SYBDATETIMN SYBDATETIMN
#define | SYBDECIMAL SYBDECIMAL
#define | SYBEAAMT 20035 /* User attempted a dbaltbind() with mismatched column and variable types. */
#define | SYBEABMT 20033 /* User attempted a dbbind() with mismatched column and variable types. */
#define | SYBEABNC 20032 /* Attempt to bind to a non-existent column. */
#define | SYBEABNP 20034 /* Attempt to bind using NULL pointers. */
#define | SYBEABNV 20046 /* Attempt to bind to a NULL program variable. */
#define | SYBEACNV 20148 /* Attemp to do conversion with NULL destination variable. */
#define | SYBEADST 20128 /* Error in attempting to determine the size of a pair of translation tables. */
#define | SYBEAICF 20127 /* Error in attempting to install custom format. */
#define | SYBEALTT 20129 /* Error in attempting to load a pair of translation tables. */
#define | SYBEAOLF 20133 /* Error in attempting to open a localization file. */
#define | SYBEAPCT 20130 /* Error in attempting to perform a character-set translation. */
#define | SYBEAPUT 20040 /* Attempt to print unknown token. */
#define | SYBEARDI 20134 /* Error in attempting to read datetime information from a localization file. */
#define | SYBEARDL 20136 /* Error in attempting to read the dblib.loc localization file. */
#define | SYBEASEC 20091 /* Attempt to send an empty command buffer to the SQL Server. */
#define | SYBEASNL 20041 /* Attempt to set fields in a null loginrec. */
#define | SYBEASTF 20089 /* VMS: Unable to setmode for control_c ast. */
#define | SYBEASTL 20197 /* Synchronous I/O attempted at AST level. */
#define | SYBEASUL 20043 /* Attempt to set unknown loginrec field. */
#define | SYBEATTNACK 20296 /* Timed out waiting for server to acknowledge attention." */
#define | SYBEAUTN 20062 /* Attempt to update the timestamp of a table which has no timestamp column. */
#define | SYBEBADPK 20201 /* Packet size of %1! not supported. -- size of %2! used instead. */
#define | SYBEBADTYPE 20254 /* Illegal value for type parameter given to %1!. */
#define | SYBEBBCI 20068 /* Batch successfully bulk-copied to SQL Server. */
#define | SYBEBBFL 20297 /* -001- Batch failed in bulk-copy to SQL Server */
#define | SYBEBBL 20215 /* Bad bindlen parameter passed to dbsetnull() */
#define | SYBEBCBC 20081 /* bcp_columns() must be called before bcp_colfmt() and bcp_colfmt_ps(). */
#define | SYBEBCBNPR 20230 /* bcp_bind(): if varaddr is NULL, prefixlen must be 0 and no terminator should be specified. */
#define | SYBEBCBNTYP 20231 /* bcp_bind(): if varaddr is NULL and varlen greater than 0, the table column type must be SYBTEXT or SYBIMAGE and the program variable type must be SYBTEXT, SYBCHAR, SYBIMAGE or SYBBINARY. */
#define | SYBEBCBPREF 20236 /* Illegal prefix length. Legal values are 0, 1, 2 or 4. */
#define | SYBEBCFO 20082 /* Bcp host-files must contain at least one column. */
#define | SYBEBCHLEN 20235 /* host_collen should be greater than or equal to -1. */
#define | SYBEBCIS 20075 /* Attempt to bulk-copy an illegally-sized column value to the SQL Server. */
#define | SYBEBCIT 20107 /* It's illegal to use BCP terminators with program variables other than SYBCHAR, SYBBINARY, SYBTEXT, or SYBIMAGE. */
#define | SYBEBCITBLEN 20239 /* bcp_init(): tblname parameter is too long. */
#define | SYBEBCITBNM 20238 /* bcp_init(): tblname parameter cannot be NULL. */
#define | SYBEBCMTXT 20228 /* bcp_moretext() may be used only when there is at least one text or image column in the server table. */
#define | SYBEBCNL 20105 /* Negative length-prefix found in BCP data-file. */
#define | SYBEBCNN 20073 /* Attempt to bulk-copy a NULL value into Server column %d, which does not accept NULL values. */
#define | SYBEBCNT 20064 /* Attempt to use Bulk Copy with a non-existent Server table. */
#define | SYBEBCOR 20074 /* Attempt to bulk-copy an oversized row to the SQL Server. */
#define | SYBEBCPB 20078 /* bcp_bind(), bcp_moretext() and bcp_sendrow() may NOT be used after bcp_init() has been passed a non-NULL input file name. */
#define | SYBEBCPCTYP 20233 /* bcp_colfmt(): If table_colnum is 0, host_type cannot be 0. */
#define | SYBEBCPI 20076 /* bcp_init() must be called before any other bcp routines. */
#define | SYBEBCPN 20077 /* bcp_bind(), bcp_collen(), bcp_colptr(), bcp_moretext() and bcp_sendrow() may be used only after bcp_init() has been called with the copy direction set to DB_IN. */
#define | SYBEBCPOPT 20294 /* The option cannot be called while a bulk copy operation is progress. */
#define | SYBEBCPREC 20229 /* Column %1!: Illegal precision value encountered. */
#define | SYBEBCPREF 20237 /* Illegal prefix length. Legal values are -1, 0, 1, 2 or 4. */
#define | SYBEBCRE 20070 /* I/O error while reading bcp data-file. */
#define | SYBEBCRO 20111 /* The BCP hostfile '%s' contains only %ld rows. It was impossible to read the requested %ld rows. */
#define | SYBEBCSA 20108 /* The BCP hostfile '%s' contains only %ld rows. Skipping all of these rows is not allowed. */
#define | SYBEBCSET 20221 /* Unknown character-set encountered." */
#define | SYBEBCSI 20106 /* Host-file columns may be skipped only when copying INto the Server. */
#define | SYBEBCSNDROW 20240 /* bcp_sendrow() may NOT be called unless all text data for the previous row has been sent using bcp_moretext(). */
#define | SYBEBCSNTYP 20232 /* column number %1!: if varaddr is NULL and varlen greater than 0, the table column type must be SYBTEXT or SYBIMAGE and the program variable type must be SYBTEXT, SYBCHAR, SYBIMAGE or SYBBINARY. */
#define | SYBEBCUC 20085 /* Bcp: Unable to close host data-file. */
#define | SYBEBCUO 20084 /* Bcp: Unable to open host data-file. */
#define | SYBEBCVH 20083 /* bcp_exec() may be called only after bcp_init() has been passed a valid host file. */
#define | SYBEBCVLEN 20234 /* varlen should be greater than or equal to -1. */
#define | SYBEBCWE 20072 /* I/O error while writing bcp data-file. */
#define | SYBEBDIO 20063 /* Bad bulk-copy direction. Must be either IN or OUT. */
#define | SYBEBEOF 20104 /* Unexpected EOF encountered in BCP data-file. */
#define | SYBEBIHC 20103 /* Incorrect host-column number found in bcp format-file. */
#define | SYBEBIVI 20080 /* bcp_columns(), bcp_colfmt() and bcp_colfmt_ps() may be used only after bcp_init() has been passed a valid input file. */
#define | SYBEBNCR 20024 /* Attempt to bind user variable to a non-existent compute row. */
#define | SYBEBNUM 20214 /* Bad numbytes parameter passed to dbstrcpy() */
#define | SYBEBOOL 20293 /* Boolean parameters must be TRUE or FALSE. */
#define | SYBEBPKS 20193 /* In DBSETLPACKET(), the packet size parameter must be between 0 and 999999. */
#define | SYBEBPREC 20216 /* Illegal precision specified */
#define | SYBEBPROBADDEF 20249 /* bcp protocol error: illegal default column id received. */
#define | SYBEBPROBADLEN 20251 /* bcp protocol error: illegal datatype length received. */
#define | SYBEBPROBADPREC 20252 /* bcp protocol error: illegal precision value received. */
#define | SYBEBPROBADSCL 20253 /* bcp protocol error: illegal scale value received. */
#define | SYBEBPROBADTYP 20250 /* bcp protocol error: unknown column datatype. */
#define | SYBEBPROCOL 20241 /* bcp protocol error: returned column count differs from the actual number of columns received. */
#define | SYBEBPRODEF 20242 /* bcp protocol error: expected default information and got none. */
#define | SYBEBPRODEFID 20244 /* bcp protocol error: default column id and actual column id are not same */
#define | SYBEBPRODEFTYP 20246 /* bcp protocol error: default value datatype differs from column datatype. */
#define | SYBEBPROEXTDEF 20247 /* bcp protocol error: more than one row of default information received. */
#define | SYBEBPROEXTRES 20248 /* bcp protocol error: unexpected set of results received. */
#define | SYBEBPRONODEF 20245 /* bcp protocol error: default value received for column that does not have default. */
#define | SYBEBPRONUMDEF 20243 /* bcp protocol error: expected number of defaults differs from the actual number of defaults received. */
#define | SYBEBRFF 20100 /* I/O error while reading bcp format-file. */
#define | SYBEBSCALE 20217 /* Illegal scale specified */
#define | SYBEBTMT 20095 /* Attempt to send too much TEXT data via the bcp_moretext() call. */
#define | SYBEBTOK 20020 /* Bad token from SQL Server: Data-stream processing out of sync. */
#define | SYBEBTYP 20023 /* Unknown bind type passed to DB-LIBRARY function. */
#define | SYBEBTYPSRV 20220 /* Datatype is not supported by the server. */
#define | SYBEBUCE 20087 /* Bcp: Unable to close error-file. */
#define | SYBEBUCF 20099 /* Bcp: Unable to close format-file. */
#define | SYBEBUDF 20102 /* Bcp: Unrecognized datatype found in format-file. */
#define | SYBEBUFF 20147 /* Bcp: Unable to create format-file. */
#define | SYBEBUFL 20005 /* DB-LIBRARY internal error - send buffer length corrupted. */
#define | SYBEBULKINSERT 20599 /* cannot build bulk insert statement */
#define | SYBEBUOE 20086 /* Bcp: Unable to open error-file. */
#define | SYBEBUOF 20098 /* Bcp: Unable to open format-file. */
#define | SYBEBWEF 20088 /* I/O error while writing bcp error-file. */
#define | SYBEBWFF 20101 /* I/O error while writing bcp format-file. */
#define | SYBECAP 20203 /* DB-Library capabilities not accepted by the Server. */
#define | SYBECAPTYP 20213 /* Unexpected capability type in CAPABILITY datastream. */
#define | SYBECDNS 20031 /* Datastream indicates that a compute column is derived from a non-existent select-list member. */
#define | SYBECDOMAIN 20218 /* Source field value is not within the domain of legal values. */
#define | SYBECINTERNAL 20219 /* Internal Conversion error. */
#define | SYBECLOS 20056 /* Error in closing network connection. */
#define | SYBECLOSEIN 20292 /* Unable to close interface file. */
#define | SYBECLPR 20051 /* Data-conversion resulted in loss of precision. */
#define | SYBECNOR 20026 /* Column number out of range. */
#define | SYBECNOV 20052 /* Attempt to set variable to NULL resulted in overflow. */
#define | SYBECOFL 20049 /* Data-conversion resulted in overflow. */
#define | SYBECOLSIZE 22000 /* Invalid column information structure size */
#define | SYBECONN 20009 /* Unable to connect socket -- SQL Server is unavailable or does not exist. */
#define | SYBECRNC 20116 /* The current row is not a result of compute clause %d, so it is illegal to attempt to extract that data from this row. */
#define | SYBECRSAGR 20263 /* Aggregate functions are not allowed in a cursor statement. */
#define | SYBECRSBROL 20266 /* Backward scrolling cannot be used in a forward scrolling cursor. */
#define | SYBECRSBSKEY 20268 /* Keyset cannot be scrolled backward in mixed cursors with a previous fetch type. */
#define | SYBECRSBUFR 20260 /* Row buffering should not be turned on when using cursor APIs. */
#define | SYBECRSDIS 20262 /* Cursor statement contains one of the disallowed phrases 'compute', 'union', 'for browse', or 'select into'. */
#define | SYBECRSFLAST 20265 /* Fetch type LAST requires fully keyset driven cursors. */
#define | SYBECRSFRAND 20264 /* Fetch types RANDOM and RELATIVE can only be used within the keyset of keyset driven cursors. */
#define | SYBECRSFROWN 20267 /* Row number to be fetched is outside valid range. */
#define | SYBECRSFTYPE 20280 /* Unknown fetch type. */
#define | SYBECRSINV 20277 /* Invalid cursor statement. */
#define | SYBECRSINVALID 20281 /* The cursor handle is invalid. */
#define | SYBECRSMROWS 20282 /* Multiple rows are returned, only one is expected. */
#define | SYBECRSNOBIND 20279 /* Cursor bind must be called prior to updating cursor */
#define | SYBECRSNOCOUNT 20270 /* The DBNOCOUNT option should not be turned on when doing updates or deletes with dbcursor(). */
#define | SYBECRSNOFREE 20261 /* The DBNOAUTOFREE option should not be turned on when using cursor APIs. */
#define | SYBECRSNOIND 20256 /* One of the tables involved in the cursor statement does not have a unique index. */
#define | SYBECRSNOKEYS 20278 /* The entire keyset must be defined for KEYSET cursors. */
#define | SYBECRSNOLEN 20284 /* No unique index found. */
#define | SYBECRSNOPTCC 20285 /* No OPTCC was found. */
#define | SYBECRSNORDER 20286 /* The order of clauses must be from, where, and order by. */
#define | SYBECRSNORES 20255 /* Cursor statement generated no results. */
#define | SYBECRSNOTABLE 20287 /* Table name is NULL. */
#define | SYBECRSNOUPD 20276 /* Update or delete operation did not affect any rows. */
#define | SYBECRSNOWHERE 20273 /* A WHERE clause is not allowed in a cursor update or insert. */
#define | SYBECRSNROWS 20283 /* No rows returned, at least one is expected. */
#define | SYBECRSNUNIQUE 20288 /* No unique keys associated with this view. */
#define | SYBECRSORD 20259 /* Only fully keyset driven cursors can have 'order by', ' group by', or 'having' phrases. */
#define | SYBECRSRO 20269 /* Data locking or modifications cannot be made in a READONLY cursor. */
#define | SYBECRSSET 20274 /* A SET clause is required for a cursor update or insert. */
#define | SYBECRSTAB 20271 /* Table name must be determined in operations involving data locking or modifications. */
#define | SYBECRSUPDNB 20272 /* Update or insert operations cannot use bind variables when binding type is NOBIND. */
#define | SYBECRSUPDTAB 20275 /* Update or insert operations using bind variables require single table cursors. */
#define | SYBECRSVAR 20289 /* There is no valid address associated with this bind. */
#define | SYBECRSVIEW 20257 /* A view cannot be joined with another table or a view in a cursor statement. */
#define | SYBECRSVIIND 20258 /* The view used in the cursor statement does not include all the unique index columns of the underlying tables. */
#define | SYBECS 20299 /* -004- cs context Error */
#define | SYBECSYN 20050 /* Attempt to convert data stopped by syntax error in source field. */
#define | SYBECUFL 20048 /* Data-conversion resulted in underflow. */
#define | SYBECWLL 20123 /* Attempt to set column width less than 1. */
#define | SYBEDBPS 20011 /* Maximum number of DBPROCESSes already allocated. */
#define | SYBEDCL 20298 /* -004- DCL Error */
#define | SYBEDDNE 20047 /* DBPROCESS is dead or not enabled. */
#define | SYBEDIVZ 20196 /* Attempt to divide by $0.00 in function %1!. */
#define | SYBEDNTI 20094 /* Attempt to use dbtxtsput() to put a new text-timestamp into a column whose datatype is neither SYBTEXT nor SYBIMAGE. */
#define | SYBEDPOR 20149 /* Out-of-range datepart constant. */
#define | SYBEDVOR 20152 /* Day values must be between 1 and 7. */
#define | SYBEECAN 20184 /* Attempted to cancel unrequested event notification. */
#define | SYBEECRT 20183 /* Must call dbregdefine() before dbregcreate(). */
#define | SYBEEINI 20182 /* Must call dbreginit() before dbregraise(). */
#define | SYBEEQVA 20059 /* Error in queueing VMS AST routine. */
#define | SYBEERRLABEL 20295 /* An illegal value was returned from the security label handler. */
#define | SYBEESSL 20172 /* Login security level entered does not agree with operating system level */
#define | SYBEETD 20164 /* Failure to send the expected amount of TEXT or IMAGE data via dbmoretext(). */
#define | SYBEEUNR 20185 /* Unsolicited event notification received. */
#define | SYBEEVOP 20178 /* Called dbregwatch() with a bad options parameter. */
#define | SYBEEVST 20181 /* Must initiate a transaction before calling dbregparam(). */
#define | SYBEFCON 20002 /* SQL Server connection failed. */
#define | SYBEFENC 20222 /* Password Encryption failed." */
#define | SYBEFGTL 20122 /* Bcp: Row number of the first row to be copied cannot be greater than the row number for the last row to be copied. */
#define | SYBEFMODE 20167 /* Read/Write/Append mode denied on file. */
#define | SYBEFRES 20223 /* Challenge-Response function failed.", */
#define | SYBEFSHD 20132 /* Error in attempting to find the Sybase home directory. */
#define | SYBEFUNC 20204 /* Functionality not supported at the specified version level. */
#define | SYBEGENOS 20161 /* General Operating System Error. */
#define | SYBEICN 20038 /* Invalid computeid or compute column number. */
#define | SYBEICONV2BIG 2404 /* Buffer overflow converting characters from client into server's character set.*/
#define | SYBEICONVAVAIL 2401 /* Character set conversion is not available between client character set '%.*s' and server character set '%.*s'.*/
#define | SYBEICONVI 2403 /* Some character(s) could not be converted into client's character set. Unconverted bytes were changed to question marks ('?').*/
#define | SYBEICONVIU 2400 /* Some character(s) could not be converted into client's character set. */
#define | SYBEICONVO 2402 /* Error converting characters into server's character set. Some character(s) could not be converted.*/
#define | SYBEIDCL 20143 /* Illegal datetime column length returned by DataServer. Legal datetime lengths are 4 and 8 bytes. */
#define | SYBEIDECCL 20227 /* Invalid decimal column length returned by the server. */
#define | SYBEIFCL 20145 /* Illegal floating-point column length returned by DataServer. Legal floating-point lengths are 4 and 8 bytes. */
#define | SYBEIFNB 20065 /* Illegal field number passed to bcp_control(). */
#define | SYBEIICL 20025 /* Illegal integer column length returned by SQL Server. Legal integer lengths are 1, 2, and 4 bytes. */
#define | SYBEIMCL 20144 /* Illegal money column length returned by DataServer. Legal money lengths are 4 and 8 bytes. */
#define | SYBEINLN 20016 /* Interface file: unexpected end-of-line. */
#define | SYBEINTF 20012 /* Server name not found in interface file */
#define | SYBEINUMCL 20226 /* Invalid numeric column length returned by the server. */
#define | SYBEIPV 20194 /* %1! is an illegal value for the %2! parameter of %3!. */
#define | SYBEISOI 20142 /* Invalid sort-order information found. */
#define | SYBEISRVPREC 20224 /* Illegal precision value returned by the server. */
#define | SYBEISRVSCL 20225 /* Illegal scale value returned by the server. */
#define | SYBEITIM 20021 /* Illegal timeout value specified. */
#define | SYBEIVERS 20206 /* Illegal version level specified. */
#define | SYBEKBCI 20069 /* Bcp: 1000 rows sent to SQL Server. */
#define | SYBEKBCO 20067 /* 1000 rows successfully bulk-copied to host-file. */
#define | SYBELBLEN 20211 /* Security labels should be less than 256 characters long. */
#define | SYBEMEM 20010 /* Unable to allocate sufficient memory */
#define | SYBEMOV 20195 /* Money arithmetic resulted in overflow in function %1!. */
#define | SYBEMPLL 20112 /* Attempt to set maximum number of DBPROCESSes lower than 1. */
#define | SYBEMVOR 20151 /* Month values must be between 1 and 12. */
#define | SYBENBUF 20175 /* called dbsendpassthru() with a NULL buf pointer. */
#define | SYBENBVP 20153 /* Cannot pass dbsetnull() a NULL bindval pointer. */
#define | SYBENDC 20150 /* Cannot have negative component in date in numeric form. */
#define | SYBENDTP 20155 /* Called dbdatecrack() with a NULL datetime parameter. */
#define | SYBENEG 20210 /* Negotiated login attempt failed. */
#define | SYBENEHA 20179 /* Called dbreghandle() with a NULL handler parameter. */
#define | SYBENHAN 20174 /* called dbrecvpassthru() with a NULL handler parameter. */
#define | SYBENLNL 20173 /* Program not linked with specified network library. */
#define | SYBENMOB 20039 /* No such member of 'order by' clause. */
#define | SYBENOEV 20200 /* dbpoll() cannot be called if registered procedure notifications have been disabled. */
#define | SYBENOTI 20177 /* No event handler installed. */
#define | SYBENOVALUE 20290 /* Security labels require both a name and a value */
#define | SYBENPRM 20027 /* NULL parameter not allowed for this dboption. */
#define | SYBENSIP 20045 /* Negative starting index passed to dbstrcpy(). */
#define | SYBENTLL 20042 /* Name too long for loginrec field. */
#define | SYBENTST 20170 /* The file being opened must be a stream_lf. */
#define | SYBENTTN 20093 /* Attempt to use dbtxtsput() to put a new text-timestamp into a non-existent data row. */
#define | SYBENULL 20109 /* NULL DBPROCESS pointer passed to DB-Library. */
#define | SYBENULP 20176 /* Called %s with a NULL %s parameter. */
#define | SYBENUM 20159 /* Incorrect number of arguments given to DB-Library. */
#define | SYBENXID 20036 /* The Server did not grant us a distributed-transaction ID. */
#define | SYBEONCE 20207 /* Function can be called only once. */
#define | SYBEOOB 20022 /* Error in sending out-of-band data to SQL Server. */
#define | SYBEOPIN 20015 /* Could not open interface file. */
#define | SYBEOPNA 20121 /* The text/image facility is available only when using a SQL Server whose version number is 4.0 or greater. */
#define | SYBEOPTNO 20163 /* Option is not allowed or is unreconized */
#define | SYBEOREN 20141 /* Warning: an out-of-range error-number was encountered in dblib.loc. The maximum permissible error-number is defined as DBERRCOUNT in sybdb.h. */
#define | SYBEORPF 20096 /* Attempt to set remote password would overflow the login-record's remote-password field. */
#define | SYBEOSSL 20171 /* Operating system login level not in range of Secure SQL Server */
#define | SYBEPAGE 20162 /* wrong resource type or length given for dbpage() operation. */
#define | SYBEPOLL 20199 /* Only one dbpoll() can be active at a time. */
#define | SYBEPORT 2500 /* Both port and instance specified */
#define | SYBEPRTF 20191 /* dbtracestring() may only be called from a printfunc(). */
#define | SYBEPWD 20014 /* Incorrect password. */
#define | SYBERDCN 20053 /* Requested data-conversion does not exist. */
#define | SYBERDNR 20044 /* Attempt to retrieve data from a non-existent row. */
#define | SYBEREAD 20004 /* Read from SQL Server failed. */
#define | SYBERESP 20205 /* Response function address passed to dbresponse() must be non-NULL. */
#define | SYBERFILE 20166 /* "Can not open resource file." */
#define | SYBERPCS 20186 /* Must call dbrpcinit() before dbrpcparam(). */
#define | SYBERPIL 20113 /* It is illegal to pass -1 to dbrpcparam() for the datalen of parameters which are of type SYBCHAR, SYBVARCHAR, SYBBINARY, or SYBVARBINARY. */
#define | SYBERPNA 20120 /* The RPC facility is available only when using a SQL Server whose version number is 4.0 or greater. */
#define | SYBERPND 20019 /* Attempt to initiate a new SQL Server operation with results pending. */
#define | SYBERPNULL 20208 /* value parameter for dbprcparam() can be NULL, only if the datalen parameter is 0 */
#define | SYBERPTXTIM 20209 /* RPC parameters cannot be of type Text/Image. */
#define | SYBERPUL 20114 /* When passing a SYBINTN, SYBDATETIMN, SYBMONEYN, or SYBFLTN parameter via dbrpcparam(), it's necessary to specify the parameter's maximum or actual length, so that DB-Library can recognize it as a SYBINT1, SYBINT2, SYBINT4, SYBMONEY, or SYBMONEY4, etc. */
#define | SYBERTCC 20117 /* dbreadtext() may not be used to receive the results of a query which contains a COMPUTE clause. */
#define | SYBERTSC 20118 /* dbreadtext() may only be used to receive the results of a query which contains a single result column. */
#define | SYBERTYPE 20165 /* Invalid resource type given to DB-Library. */
#define | SYBERXID 20037 /* The Server did not recognize our distributed-transaction ID. */
#define | SYBESECURE 20202 /* Secure Server function not supported in this version. */
#define | SYBESEFA 20198 /* DBSETNOTIFS cannot be called if connections are present. */
#define | SYBESEOF 20017 /* Unexpected EOF from SQL Server. */
#define | SYBESFOV 20054 /* dbsafestr() overflowed its destination buffer. */
#define | SYBESLCT 20168 /* Could not select or copy field specified */
#define | SYBESMSG 20018 /* General SQL Server error: Check messages from the SQL Server. */
#define | SYBESOCK 20008 /* Unable to open socket */
#define | SYBESPID 20154 /* Called dbspid() with a NULL dbproc. */
#define | SYBESYNC 20001 /* Read attempted while out of synchronization with SQL Server. */
#define | SYBETDSVER 2410 /* Cannot bcp with TDSVER < 5.0 */
#define | SYBETEXS 20188 /* Called dbmoretext() with a bad size parameter. */
#define | SYBETIME 20003 /* SQL Server connection timed out. */
#define | SYBETMCF 20126 /* Attempt to install too many custom formats via dbfmtinstall(). */
#define | SYBETMTD 20092 /* Attempt to send too much TEXT data via the dbmoretext() call. */
#define | SYBETPAR 20187 /* No SYBTEXT or SYBIMAGE parameters were defined. */
#define | SYBETPTN 20071 /* Syntax error: only two periods are permitted in table names. */
#define | SYBETRAC 20189 /* Attempted to turn off a trace flag that was not on. */
#define | SYBETRAN 20180 /* DBPROCESS is being used for another transaction. */
#define | SYBETRAS 20190 /* DB-Library internal error - trace structure not found. */
#define | SYBETRSN 20192 /* Bad numbytes parameter passed to dbtracestring(). */
#define | SYBETSIT 20061 /* Attempt to call dbtsput() with an invalid timestamp. */
#define | SYBETTS 20066 /* 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 | SYBETYPE 20160 /* Invalid argument type given to DB-Library. */
#define | SYBEUACS 20090 /* VMS: Unable to assign channel to sys$command. */
#define | SYBEUAVE 20057 /* Unable to allocate VMS event flag. */
#define | SYBEUCPT 20125 /* Unrecognized custom-format parameter-type encountered in dbstrbuild(). */
#define | SYBEUCRR 20119 /* Internal software error: Unknown connection result reported by * dbpasswd(). */
#define | SYBEUDTY 20060 /* Unknown datatype encountered. */
#define | SYBEUFDS 20124 /* Unrecognized format encountered in dbstrbuild(). */
#define | SYBEUFDT 20029 /* Unknown fixed-length datatype encountered. */
#define | SYBEUHST 20013 /* Unknown host machine name */
#define | SYBEUMSG 20212 /* Unknown message-id in MSG datastream. */
#define | SYBEUNAM 20110 /* Unable to get current username from operating system. */
#define | SYBEUNOP 20115 /* Unknown option passed to dbsetopt(). */
#define | SYBEUNT 20055 /* Unknown network type found in interface file. */
#define | SYBEURCI 20135 /* Unable to read copyright information from the dblib localization file. */
#define | SYBEUREI 20140 /* Unable to read error information from the dblib localization file. */
#define | SYBEUREM 20138 /* Unable to read error mnemonic from the dblib localization file. */
#define | SYBEURES 20139 /* Unable to read error string from the dblib localization file. */
#define | SYBEURMI 20137 /* Unable to read money-format information from the dblib localization file. */
#define | SYBEUSCT 20058 /* Unable to set communications timer. */
#define | SYBEUTDS 20146 /* Unrecognized TDS version received from SQL Server. */
#define | SYBEUVBF 20097 /* Attempt to read an unknown version of BCP format-file. */
#define | SYBEUVDT 20028 /* Unknown variable-length datatype encountered. */
#define | SYBEVDPT 20079 /* For bulk copy, all variable-length data must have either a length-prefix or a terminator specified. */
#define | SYBEVERDOWN 100 /* TDS version downgraded . */
#define | SYBEVMS 20007 /* Sendflush: VMS I/O error. */
#define | SYBEVOIDRET 20291 /* Parameter of type SYBVOID cannot be a return parameter. */
#define | SYBEWAID 20030 /* DB-LIBRARY internal error: ALTFMT following ALTNAME has wrong id. */
#define | SYBEWRIT 20006 /* Write to SQL Server failed. */
#define | SYBEXOCI 20131 /* A character-set translation overflowed its destination buffer while using bcp to copy data from a host-file to the SQL Server. */
#define | SYBEXTDN 20157 /* Warning: the xlt_todisp parameter to dbfree_xlate() was NULL. The space associated with the xlt_tosrv parameter has been freed. */
#define | SYBEXTN 20156 /* The xlt_todisp and xlt_tosrv parameters to dbfree_xlate() were NULL. */
#define | SYBEXTSN 20158 /* Warning: the xlt_tosrv parameter to dbfree_xlate() was NULL. The space associated with the xlt_todisp parameter has been freed. */
#define | SYBEZTXT 20169 /* Attempt to send zero length TEXT or IMAGE to dataserver via dbwritetext(). */
#define | SYBFLT8 SYBFLT8
#define | SYBFLTN SYBFLTN
#define | SYBIMAGE SYBIMAGE
#define | SYBINT1 SYBINT1
#define | SYBINT2 SYBINT2
#define | SYBINT4 SYBINT4
#define | SYBINT8 SYBINT8
#define | SYBINTN SYBINTN
#define | SYBMONEY SYBMONEY
#define | SYBMONEY4 SYBMONEY4
#define | SYBMONEYN SYBMONEYN
#define | SYBMSDATE SYBMSDATE
#define | SYBMSDATETIME2 SYBMSDATETIME2
#define | SYBMSDATETIMEOFFSET SYBMSDATETIMEOFFSET
#define | SYBMSTIME SYBMSTIME
#define | SYBNTEXT SYBNTEXT
#define | SYBNUMERIC SYBNUMERIC
#define | SYBNVARCHAR SYBNVARCHAR
#define | SYBREAL SYBREAL
#define | SYBTEXT SYBTEXT
#define | SYBTIME SYBTIME
#define | SYBVARBINARY SYBVARBINARY
#define | SYBVARCHAR SYBVARCHAR
#define | SYBVOID SYBVOID
#define | TDS_STATIC_CAST(type, a) ((type)(a))
#define | TIMEBIND 22
#define | TINYBIND 6
#define | TRUE 1
#define | VARYBINBIND 4
#define | VARYCHARBIND 3

## Typedefs
typedef int | BOOL
typedef unsigned char | BYTE
typedef DBWAITFUNC(* | DB_DBBUSY_FUNC) (void *dbproc)
typedef int(* | DB_DBCHKINTR_FUNC) (void *dbproc)
typedef int(* | DB_DBHNDLINTR_FUNC) (void *dbproc)
typedef void(* | DB_DBIDLE_FUNC) (DBWAITFUNC dfunc, void *dbproc)
typedef tds_sysdep_int64_type | DBBIGINT
typedef unsigned char | DBBINARY
typedef unsigned char | DBBIT
typedef unsigned char | DBBOOL
typedef char | DBCHAR
typedef void | DBCURSOR
typedef struct tds_sybase_dbdaterec | DBDATEREC
typedef struct tds_sybase_dbdaterec2 | DBDATEREC2
typedef DBNUMERIC | DBDECIMAL
typedef tds_sysdep_real64_type | DBFLT8
typedef tds_sysdep_int32_type | DBINT
typedef void | DBLOGINFO
typedef void(* | DBPIVOT_FUNC) (struct col_t *output, const struct col_t *input)
typedef struct tds_dblib_dbprocess | DBPROCESS
typedef tds_sysdep_real32_type | DBREAL
typedef tds_sysdep_int16_type | DBSMALLINT
typedef void | DBSORTORDER
typedef struct dbstring | DBSTRING
typedef unsigned char | DBTINYINT
typedef struct dbtypeinfo | DBTYPEINFO
typedef unsigned tds_sysdep_int64_type | DBUBIGINT
typedef unsigned tds_sysdep_int32_type | DBUINT
typedef unsigned tds_sysdep_int16_type | DBUSMALLINT
typedef void * | DBVOIDPTR
typedef int(* | DBWAITFUNC) (void)
typedef void | DBXLATE
typedef int(* | EHANDLEFUNC) (DBPROCESS *dbproc, int severity, int dberr, int oserr, char *dberrstr, char *oserrstr)
typedef int(* | INTFUNCPTR) (void *,...)
typedef struct tds_dblib_loginrec | LOGINREC
typedef int(* | MHANDLEFUNC) (DBPROCESS *dbproc, DBINT msgno, int msgstate, int severity, char *msgtext, char *srvname, char *proc, int line)
typedef int | RETCODE
typedef short | SHORT
typedef int | STATUS
typedef unsigned short | USHORT

## Enumerations
enum | { SYBCHAR = 47, SYBCHAR = 47, SYBVARCHAR = 39, SYBVARCHAR = 39, SYBINTN = 38, SYBINTN = 38, SYBINT1 = 48, SYBINT1 = 48, SYBINT2 = 52, SYBINT2 = 52, SYBINT4 = 56, SYBINT4 = 56, SYBINT8 = 127, SYBINT8 = 127, SYBFLT8 = 62, SYBFLT8 = 62, SYBDATETIME = 61, SYBDATETIME = 61, SYBBIT = 50, SYBBIT = 50, SYBBITN = 104, SYBBITN = 104, SYBTEXT = 35, SYBTEXT = 35, SYBNTEXT = 99, SYBNTEXT = 99, SYBIMAGE = 34, SYBIMAGE = 34, SYBMONEY4 = 122, SYBMONEY4 = 122, SYBMONEY = 60, SYBMONEY = 60, SYBDATETIME4 = 58, SYBDATETIME4 = 58, SYBREAL = 59, SYBREAL = 59, SYBBINARY = 45, SYBBINARY = 45, SYBVOID = 31, SYBVOID = 31, SYBVARBINARY = 37, SYBVARBINARY = 37, SYBNUMERIC = 108, SYBNUMERIC = 108, SYBDECIMAL = 106, SYBDECIMAL = 106, SYBFLTN = 109, SYBFLTN = 109, SYBMONEYN = 110, SYBMONEYN = 110, SYBDATETIMN = 111, SYBDATETIMN = 111, SYBNVARCHAR = 103, SYBNVARCHAR = 103, SYBDATE = 49, SYBDATE = 49, SYBTIME = 51, SYBTIME = 51, SYBBIGDATETIME = 187, SYBBIGDATETIME = 187, SYBBIGTIME = 188, SYBBIGTIME = 188, SYBMSDATE = 40, SYBMSDATE = 40, SYBMSTIME = 41, SYBMSTIME = 41, SYBMSDATETIME2 = 42, SYBMSDATETIME2 = 42, SYBMSDATETIMEOFFSET = 43, SYBMSDATETIMEOFFSET = 43 }
enum | { MAXCOLNAMELEN = 512 }
enum | CI_TYPE { CI_REGULAR =1, CI_ALTERNATE =2, CI_CURSOR =3 }

## Functions
DBINT | bcp_batch (DBPROCESS *dbproc)
| Commit a set of rows to the table. More...
RETCODE | bcp_bind (DBPROCESS *dbproc, BYTE *varaddr, int prefixlen, DBINT varlen, BYTE *terminator, int termlen, int type, int table_column)
| Bind a program host variable to a database column. More...
RETCODE | bcp_colfmt (DBPROCESS *dbproc, int host_column, int host_type, int host_prefixlen, DBINT host_collen, const BYTE *host_term, int host_termlen, int colnum)
| Specify the format of a datafile prior to writing to a table. More...
RETCODE | bcp_colfmt_ps (DBPROCESS *dbproc, int host_column, int host_type, int host_prefixlen, DBINT host_collen, BYTE *host_term, int host_termlen, int colnum, DBTYPEINFO *typeinfo)
| Specify the format of a host file for bulk copy purposes, with precision and scale support for numeric and decimal columns. More...
RETCODE | bcp_collen (DBPROCESS *dbproc, DBINT varlen, int table_column)
| Set the length of a host variable to be written to a table. More...
RETCODE | bcp_colptr (DBPROCESS *dbproc, BYTE *colptr, int table_column)
| Override bcp_bind() by pointing to a different host variable. More...
RETCODE | bcp_columns (DBPROCESS *dbproc, int host_colcount)
| Indicate how many columns are to be found in the datafile. More...
RETCODE | bcp_control (DBPROCESS *dbproc, int field, DBINT value)
| Set BCP options for uploading a datafile. More...
DBINT | bcp_done (DBPROCESS *dbproc)
| Conclude the transfer of data from program variables. More...
RETCODE | bcp_exec (DBPROCESS *dbproc, DBINT *rows_copied)
| Write a datafile to a table. More...
int | bcp_getbatchsize (DBPROCESS *dbproc)
DBBOOL | bcp_getl (LOGINREC *login)
| See if BCP_SETL() was used to set the LOGINREC for BCP work. More...
RETCODE | bcp_init (DBPROCESS *dbproc, const char *tblname, const char *hfile, const char *errfile, int direction)
| Prepare for bulk copy operation on a table. More...
RETCODE | bcp_options (DBPROCESS *dbproc, int option, BYTE *value, int valuelen)
| Set "hints" for uploading a file. More...
RETCODE | bcp_readfmt (DBPROCESS *dbproc, const char filename[])
| Read a format definition file. More...
RETCODE | bcp_sendrow (DBPROCESS *dbproc)
| Write data in host variables to the table. More...
BYTE * | dbadata (DBPROCESS *dbproc, int computeid, int column)
| Get address of compute column data. More...
DBINT | dbadlen (DBPROCESS *dbproc, int computeid, int column)
| Get size of data in a compute column. More...
RETCODE | dbaltbind (DBPROCESS *dbprocess, int computeid, int column, int vartype, DBINT varlen, BYTE *varaddr)
| Bind a compute column to a program variable. More...
RETCODE | dbaltbind_ps (DBPROCESS *dbprocess, int computeid, int column, int vartype, DBINT varlen, BYTE *varaddr, DBTYPEINFO *typeinfo)
int | dbaltcolid (DBPROCESS *dbproc, int computeid, int column)
| Get column ID of a compute column. More...
DBINT | dbaltlen (DBPROCESS *dbproc, int computeid, int column)
| Get size of data in compute column. More...
int | dbaltop (DBPROCESS *dbproc, int computeid, int column)
| Get aggregation operator for a compute column. More...
int | dbalttype (DBPROCESS *dbproc, int computeid, int column)
| Get datatype for a compute column. More...
DBINT | dbaltutype (DBPROCESS *dbproc, int computeid, int column)
| Get user-defined datatype of a compute column. More...
RETCODE | dbanullbind (DBPROCESS *dbprocess, int computeid, int column, DBINT *indicator)
| Tie a null-indicator to a compute result column. More...
RETCODE | dbanydatecrack (DBPROCESS *dbproc, DBDATEREC2 *di, int type, const void *data)
| Break any kind of date or time value into useful pieces. More...
RETCODE | dbbind (DBPROCESS *dbproc, int column, int vartype, DBINT varlen, BYTE *varaddr)
| Tie a host variable to a resultset column. More...
RETCODE | dbbind_ps (DBPROCESS *dbprocess, int column, int vartype, DBINT varlen, BYTE *varaddr, DBTYPEINFO *typeinfo)
int | dbbufsize (DBPROCESS *dbprocess)
BYTE * | dbbylist (DBPROCESS *dbproc, int computeid, int *size)
| Get `bylist` for a compute row. More...
RETCODE | dbcancel (DBPROCESS *dbproc)
| Cancel the current command batch. More...
RETCODE | dbcanquery (DBPROCESS *dbproc)
| Cancel the query currently being retrieved, discarding all pending rows. More...
char * | dbchange (DBPROCESS *dbprocess)
| See if a command caused the current database to change. More...
DBBOOL | dbcharsetconv (DBPROCESS *dbprocess)
void | dbclose (DBPROCESS *dbproc)
| Close a connection to the server and free associated resources. More...
void | dbclrbuf (DBPROCESS *dbproc, DBINT n)
| Clear n rows from the row buffer. More...
RETCODE | dbclropt (DBPROCESS *dbproc, int option, const char param[])
| Reset an option. More...
RETCODE | dbcmd (DBPROCESS *dbproc, const char cmdstring[])
| `Append` SQL to the command buffer. More...
RETCODE | dbcmdrow (DBPROCESS *dbproc)
| See if the current command can return rows. More...
RETCODE | dbcolinfo (DBPROCESS *dbproc, CI_TYPE type, DBINT column, DBINT computeid, DBCOL *pdbcol)
| Get a bunch of column attributes with a single call (Microsoft-compatibility feature). More...
DBINT | dbcollen (DBPROCESS *dbproc, int column)
| Get size of a regular result column. More...
char * | dbcolname (DBPROCESS *dbproc, int column)
| Return name of a regular result column. More...
char * | dbcolsource (DBPROCESS *dbproc, int colnum)
| Get base database column name for a result set column. More...
int | dbcoltype (DBPROCESS *dbproc, int column)
| Get the datatype of a regular result set column. More...
DBTYPEINFO * | dbcoltypeinfo (DBPROCESS *dbproc, int column)
| Get precision and scale information for a regular result column. More...
DBINT | dbcolutype (DBPROCESS *dbprocess, int column)
| Get user-defined datatype of a regular result column. More...
DBINT | dbconvert (DBPROCESS *dbproc, int srctype, const BYTE *src, DBINT srclen, int desttype, BYTE *dest, DBINT destlen)
| cf. More...
DBINT | dbconvert_ps (DBPROCESS *dbprocess, int srctype, const BYTE *src, DBINT srclen, int desttype, BYTE *dest, DBINT destlen, DBTYPEINFO *typeinfo)
| Convert one datatype to another. More...
DBINT | dbcount (DBPROCESS *dbproc)
| Get count of rows processed. More...
int | dbcurcmd (DBPROCESS *dbproc)
| Get number of the row just returned. More...
DBINT | dbcurrow (DBPROCESS *dbproc)
| Get number of the row currently being read. More...
BYTE * | dbdata (DBPROCESS *dbproc, int column)
| Get address of data in a regular result column. More...
int | dbdatecmp (DBPROCESS *dbproc, DBDATETIME *d1, DBDATETIME *d2)
| Compare DBDATETIME values, similar to strcmp(3). More...
RETCODE | dbdatecrack (DBPROCESS *dbproc, DBDATEREC *di, DBDATETIME *dt)
| Break a DBDATETIME value into useful pieces. More...
DBINT | dbdatlen (DBPROCESS *dbproc, int column)
| Get size of current row's data in a regular result column. More...
DBBOOL | dbdead (DBPROCESS *dbproc)
| Check if dbproc is an ex-parrot. More...
EHANDLEFUNC | dberrhandle (EHANDLEFUNC handler)
| Set an error handler, for messages from db-lib. More...
void | dbexit (void)
| Close server connections and free all related structures. More...
RETCODE | dbfcmd (DBPROCESS *dbproc, const char *fmt,...)
| `printf-like` way to form SQL to send to the server. More...
DBINT | dbfirstrow (DBPROCESS *dbproc)
| See if a server response has arrived. More...
void | dbfreebuf (DBPROCESS *dbproc)
| Erase the command buffer, in case `DBNOAUTOFREE` was set with dbsetopt(). More...
char * | dbgetchar (DBPROCESS *dbprocess, int n)
| Get address of a position in the command buffer. More...
char * | dbgetcharset (DBPROCESS *dbprocess)
int | dbgetlusername (LOGINREC *login, BYTE *name_buffer, int buffer_len)
int | dbgetmaxprocs (void)
| get maximum simultaneous connections db-lib will open to the server. More...
char * | dbgetnatlanf (DBPROCESS *dbprocess)
int | dbgetpacket (DBPROCESS *dbproc)
| Get TDS packet size for the connection. More...
RETCODE | dbgetrow (DBPROCESS *dbproc, DBINT row)
| Read a row from the row buffer. More...
int | dbgettime (void)
| Get maximum seconds db-lib waits for a server response to query. More...
BYTE * | dbgetuserdata (DBPROCESS *dbproc)
| Get address of user-allocated data from a `DBPROCESS`. More...
DBBOOL | dbhasretstat (DBPROCESS *dbproc)
| Determine if query generated a return status number. More...
RETCODE | dbinit (void)
| Initialize db-lib. More...
int | dbiordesc (DBPROCESS *dbproc)
| Get file descriptor of the socket used by a `DBPROCESS` to read data coming from the server. (!) More...
int | dbiowdesc (DBPROCESS *dbproc)
| Get file descriptor of the socket used by a `DBPROCESS` to write data coming to the server. (!) More...
DBBOOL | dbisavail (DBPROCESS *dbprocess)
BOOL | dbiscount (DBPROCESS *dbproc)
| Indicates whether or not the count returned by dbcount is real (Microsoft-compatibility feature). More...
DBBOOL | dbisopt (DBPROCESS *dbproc, int option, const char param[])
| Get value of an option. More...
DBINT | dblastrow (DBPROCESS *dbproc)
| Get number of the last row in the row buffer. More...
LOGINREC * | dblogin (void)
| Allocate a `LOGINREC` structure. More...
void | dbloginfree (LOGINREC *login)
| free the `LOGINREC` More...
RETCODE | dbmny4add (DBPROCESS *dbproc, DBMONEY4 *m1, DBMONEY4 *m2, DBMONEY4 *sum)
| Add two DBMONEY4 values. More...
int | dbmny4cmp (DBPROCESS *dbproc, DBMONEY4 *m1, DBMONEY4 *m2)
| Compare two DBMONEY4 values. More...
RETCODE | dbmny4copy (DBPROCESS *dbprocess, DBMONEY4 *m1, DBMONEY4 *m2)
| Copy a DBMONEY4 value. More...
RETCODE | dbmny4minus (DBPROCESS *dbproc, DBMONEY4 *src, DBMONEY4 *dest)
| Negate a DBMONEY4 value. More...
RETCODE | dbmny4sub (DBPROCESS *dbproc, DBMONEY4 *m1, DBMONEY4 *m2, DBMONEY4 *diff)
| Subtract two DBMONEY4 values. More...
RETCODE | dbmny4zero (DBPROCESS *dbproc, DBMONEY4 *dest)
| Zero a DBMONEY4 value. More...
int | dbmnycmp (DBPROCESS *dbproc, DBMONEY *m1, DBMONEY *m2)
| Compare two DBMONEY values. More...
RETCODE | dbmnycopy (DBPROCESS *dbproc, DBMONEY *src, DBMONEY *dest)
| Copy a DBMONEY value. More...
RETCODE | dbmnydec (DBPROCESS *dbproc, DBMONEY *mnyptr)
| Subtract $0.0001 from a DBMONEY value. More...
RETCODE | dbmnyinc (DBPROCESS *dbproc, DBMONEY *mnyptr)
| Add $0.0001 to a DBMONEY value. More...
RETCODE | dbmnymaxneg (DBPROCESS *dbproc, DBMONEY *dest)
| Get maximum negative DBMONEY value supported. More...
RETCODE | dbmnymaxpos (DBPROCESS *dbproc, DBMONEY *dest)
| Get maximum positive DBMONEY value supported. More...
RETCODE | dbmnyminus (DBPROCESS *dbproc, DBMONEY *src, DBMONEY *dest)
| Negate a DBMONEY value. More...
RETCODE | dbmnysub (DBPROCESS *dbproc, DBMONEY *m1, DBMONEY *m2, DBMONEY *diff)
RETCODE | dbmnyzero (DBPROCESS *dbproc, DBMONEY *dest)
| Set a DBMONEY value to zero. More...
const char * | dbmonthname (DBPROCESS *dbproc, char *language, int monthnum, DBBOOL shortform)
| Get name of a month, in some human language. More...
RETCODE | dbmorecmds (DBPROCESS *dbproc)
| See if more commands are to be processed. More...
RETCODE | dbmoretext (DBPROCESS *dbproc, DBINT size, const BYTE text[])
| Send chunk of a text/image value to the server. More...
MHANDLEFUNC | dbmsghandle (MHANDLEFUNC handler)
| Set a message handler, for messages from the server. More...
char * | dbname (DBPROCESS *dbproc)
| Get name of current database. More...
STATUS | dbnextrow (DBPROCESS *dbproc)
STATUS | dbnextrow_pivoted (DBPROCESS *dbproc, struct pivot_t *pp)
RETCODE | dbnullbind (DBPROCESS *dbproc, int column, DBINT *indicator)
| Tie a null-indicator to a regular result column. More...
int | dbnumalts (DBPROCESS *dbproc, int computeid)
| Get count of columns in a compute row. More...
int | dbnumcols (DBPROCESS *dbproc)
| Return number of regular columns in a result set. More...
int | dbnumcompute (DBPROCESS *dbprocess)
| Get count of `COMPUTE` clauses for a result set. More...
int | dbnumrets (DBPROCESS *dbproc)
| Get count of output parameters filled by a stored procedure. More...
DBPROCESS * | dbopen (LOGINREC *login, const char *server)
| Normally not used. More...
RETCODE | dbpivot (DBPROCESS *dbproc, int nkeys, int *keys, int ncols, int *cols, DBPIVOT_FUNC func, int val)
| Pivot the rows, creating a new resultset. More...
void | dbpivot_count (struct col_t *output, const struct col_t *input)
DBPIVOT_FUNC | dbpivot_lookup_name (const char name[])
void | dbpivot_max (struct col_t *output, const struct col_t *input)
void | dbpivot_min (struct col_t *output, const struct col_t *input)
void | dbpivot_sum (struct col_t *output, const struct col_t *input)
DBINT | dbprcollen (DBPROCESS *dbproc, int column)
| Get size of a result column needed to print column. More...
void | dbprhead (DBPROCESS *dbproc)
| Print result set headings to stdout. More...
RETCODE | dbprrow (DBPROCESS *dbproc)
| Print a result set to stdout. More...
const char * | dbprtype (int token)
| Print a token value's name to a buffer. More...
STATUS | dbreadtext (DBPROCESS *dbproc, void *buf, DBINT bufsize)
| Fetch part of a text or image value from the server. More...
void | dbrecftos (const char filename[])
| Record to a file all SQL commands sent to the server. More...
RETCODE | dbresults (DBPROCESS *dbproc)
| Set up query results. More...
RETCODE | dbresults_r (DBPROCESS *dbproc, int recursive)
BYTE * | dbretdata (DBPROCESS *dbproc, int retnum)
| Get value of an output parameter filled by a stored procedure. More...
int | dbretlen (DBPROCESS *dbproc, int retnum)
| Get size of an output parameter filled by a stored procedure. More...
char * | dbretname (DBPROCESS *dbproc, int retnum)
| Get name of an output parameter filled by a stored procedure. More...
DBINT | dbretstatus (DBPROCESS *dbproc)
| Fetch status value returned by query or remote procedure call. More...
int | dbrettype (DBPROCESS *dbproc, int retnum)
| Get datatype of a stored procedure's return parameter. More...
RETCODE | dbrows (DBPROCESS *dbproc)
| Indicate whether a query returned rows. More...
struct pivot_t * | dbrows_pivoted (DBPROCESS *dbproc)
STATUS | dbrowtype (DBPROCESS *dbprocess)
| Get returned row's type. More...
RETCODE | dbrpcinit (DBPROCESS *dbproc, const char rpcname[], DBSMALLINT options)
| Initialize a remote procedure call. More...
RETCODE | dbrpcparam (DBPROCESS *dbproc, const char paramname[], BYTE status, int type, DBINT maxlen, DBINT datalen, BYTE *value)
| Add a parameter to a remote procedure call. More...
RETCODE | dbrpcsend (DBPROCESS *dbproc)
| Execute the procedure and free associated memory. More...
RETCODE | dbsafestr (DBPROCESS *dbproc, const char *src, DBINT srclen, char *dest, DBINT destlen, int quotetype)
| safely quotes character values in SQL text. More...
RETCODE * | dbsechandle (DBINT type, INTFUNCPTR handler)
char * | dbservcharset (DBPROCESS *dbprocess)
| Get `syscharset` name of the server character set. More...
void | dbsetavail (DBPROCESS *dbprocess)
| Mark a `DBPROCESS` as "available". More...
void | dbsetbusy (DBPROCESS *dbprocess, DB_DBBUSY_FUNC busyfunc)
RETCODE | dbsetdefcharset (char *charset)
void | dbsetidle (DBPROCESS *dbprocess, DB_DBIDLE_FUNC idlefunc)
void | dbsetifile (char *filename)
| set name and location of the `interfaces` file FreeTDS should use to look up a servername. More...
void | dbsetinterrupt (DBPROCESS *dbproc, DB_DBCHKINTR_FUNC chkintr, DB_DBHNDLINTR_FUNC hndlintr)
| Set interrupt handler for db-lib to use while blocked against a read from the server. More...
RETCODE | dbsetlbool (LOGINREC *login, int value, int which)
| Set a boolean value in a `LOGINREC` structure. More...
RETCODE | dbsetllong (LOGINREC *login, long value, int which)
| Set an integer value in a `LOGINREC` structure. More...
RETCODE | dbsetlname (LOGINREC *login, const char *value, int which)
| Set the value of a string in a `LOGINREC` structure. More...
RETCODE | dbsetlogintime (int seconds)
| Set maximum seconds db-lib waits for a server response to a login attempt. More...
RETCODE | dbsetlshort (LOGINREC *login, int value, int which)
RETCODE | dbsetlversion (LOGINREC *login, BYTE version)
| Set TDS version for future connections. More...
RETCODE | dbsetmaxprocs (int maxprocs)
| Set maximum simultaneous connections db-lib will open to the server. More...
RETCODE | dbsetnull (DBPROCESS *dbprocess, int bindtype, int bindlen, BYTE *bindval)
| Define substitution values to be used when binding null values. More...
RETCODE | dbsetopt (DBPROCESS *dbproc, int option, const char *char_param, int int_param)
| Set db-lib or server option. More...
STATUS | dbsetrow (DBPROCESS *dbprocess, DBINT row)
| Make a buffered row "current" without fetching it into bound variables. More...
RETCODE | dbsettime (int seconds)
| Set maximum seconds db-lib waits for a server response to query. More...
void | dbsetuserdata (DBPROCESS *dbproc, BYTE *ptr)
| Associate client-allocated (and defined) data with a `DBPROCESS`. More...
RETCODE | dbsetversion (DBINT version)
| Specify a db-lib version level. More...
int | dbspid (DBPROCESS *dbproc)
| Get server process ID for a `DBPROCESS`. More...
RETCODE | dbspr1row (DBPROCESS *dbproc, char *buffer, DBINT buf_len)
| Print a regular result row to a buffer. More...
DBINT | dbspr1rowlen (DBPROCESS *dbproc)
| Determine size buffer required to hold the results returned by dbsprhead(), dbsprline(), and dbspr1row(). More...
RETCODE | dbsprhead (DBPROCESS *dbproc, char *buffer, DBINT buf_len)
| Print result set headings to a buffer. More...
RETCODE | dbsprline (DBPROCESS *dbproc, char *buffer, DBINT buf_len, DBCHAR line_char)
| Get formatted string for underlining dbsprhead() column names. More...
RETCODE | dbsqlexec (DBPROCESS *dbproc)
| send the SQL command to the server and wait for an answer. More...
RETCODE | dbsqlok (DBPROCESS *dbproc)
| Wait for results of a query from the server. More...
RETCODE | dbsqlsend (DBPROCESS *dbproc)
| Transmit the command buffer to the server. More...
int | dbstrbuild (DBPROCESS *dbproc, char *charbuf, int bufsize, char *text, char *formats,...)
| Build a printable string from text containing placeholders for variables. More...
RETCODE | dbstrcpy (DBPROCESS *dbproc, int start, int numbytes, char *dest)
| Get a copy of a chunk of the command buffer. More...
int | dbstrlen (DBPROCESS *dbproc)
| Get size of the command buffer, in bytes. More...
RETCODE | dbtablecolinfo (DBPROCESS *dbproc, DBINT column, DBCOL *pdbcol)
| describe table column attributes with a single call (Freetds-only API function modelled on dbcolinfo) More...
int | dbtds (DBPROCESS *dbprocess)
| Get the TDS version in use for dbproc. More...
DBINT | dbtextsize (DBPROCESS *dbprocess)
DBBINARY * | dbtxptr (DBPROCESS *dbproc, int column)
| Get text pointer for a column in the current row. More...
DBBINARY * | dbtxtimestamp (DBPROCESS *dbproc, int column)
| Get text timestamp for a column in the current row. More...
DBBINARY * | dbtxtsnewval (DBPROCESS *dbprocess)
RETCODE | dbtxtsput (DBPROCESS *dbprocess, DBBINARY newtxts, int colnum)
RETCODE | dbuse (DBPROCESS *dbproc, const char *name)
| Change current database. More...
DBINT | dbvarylen (DBPROCESS *dbproc, int column)
| Determine whether a column can vary in size. More...
const char * | dbversion (void)
| See which version of db-lib is in use. More...
DBBOOL | dbwillconvert (int srctype, int desttype)
| Test whether or not a datatype can be converted to another datatype. More...
RETCODE | dbwritetext (DBPROCESS *dbproc, char *objname, DBBINARY *textptr, DBTINYINT textptrlen, DBBINARY *timestamp, DBBOOL log, DBINT size, BYTE *text)
| Send text or image data to the server. More...
DBBOOL | DRBUF (DBPROCESS *dbprocess)
DBPROCESS * | tdsdbopen (LOGINREC *login, const char *server, int msdblib)
| Form a connection with the server. More...

## Detailed Description

Primary include file for db-lib applications.

Declares macros, functions, enumerated types, and defined tokens used by the db-lib API.

## Function Documentation

## § dbcolinfo()

RETCODE dbcolinfo | ( | DBPROCESS * | dbproc,
|  | CI_TYPE | type,
|  | DBINT | column,
|  | DBINT | computeid,
|  | DBCOL * | pdbcol
| ) |  |

Get a bunch of column attributes with a single call (Microsoft-compatibility feature).

Parameters

  dbproc | contains all information needed by db-lib to manage communications with the server.
  type | must be CI_REGULAR or CI_ALTERNATE (CI_CURSOR is defined by the vendor, but is not yet implemented).
  column | Nth in the result set, starting from 1.
  computeid | (ignored)
  pdbcol | address of structure to be populated by this function.

Returns
  SUCCEED or FAIL.

See also
  dbcolbrowse(), dbqual(), dbtabbrowse(), dbtabcount(), dbtabname(), dbtabsource(), dbtsnewlen(), dbtsnewval(), dbtsput().

Todo:
  Support cursor rows.

Here is the call graph for this function:

## § dbopen()

DBPROCESS* dbopen | ( | LOGINREC * | login,
|  | const char * | server
| ) |  |

Normally not used.

The function is linked in only if the –enable-sybase-compat configure option is used. Cf. sybdb.h dbopen() macros, and dbdatecrack().

Here is the call graph for this function:

## § dbpivot()

RETCODE dbpivot | ( | DBPROCESS * | dbproc,
|  | int | nkeys,
|  | int * | keys,
|  | int | ncols,
|  | int * | cols,
|  | DBPIVOT_FUNC | func,
|  | int | val
| ) |  |

Pivot the rows, creating a new resultset.

Call dbpivot() immediately after dbresults(). It calls dbnextrow() as long as it returns REG_ROW, transforming the results into a cross-tab report. dbpivot() modifies the metadata such that DB-Library can be used tranparently: retrieve the rows as usual with dbnumcols(), dbnextrow(), etc.

, our old friend the number of left-edge columns to group by an array of left-edge columns to group by the number of top-edge columns to group by an array of top-edge columns to group by the aggregation function to use the number of the column to which is applied

Returns
  the return code from the final call to dbnextrow(). Success is normally indicated by NO_MORE_ROWS.