31#include "tds_sysdep_public.h"
35#define TDS_STATIC_CAST(type, a) static_cast<type>(a)
42#define TDS_STATIC_CAST(type, a) ((type)(a))
70#define DBVERSION_UNKNOWN 0
72#define DBVERSION_100 2
81#define DBVER42 DBVERSION_42
82#define DBVER60 DBVERSION_70
88#define DBTDS_UNKNOWN 0
110#define BCPKEEPIDENTITY 8
121typedef void DBCURSOR;
123typedef void DBSORTORDER;
124typedef void DBLOGINFO;
125typedef void *DBVOIDPTR;
127typedef unsigned short USHORT;
128typedef int (*INTFUNCPTR) (
void *, ...);
129typedef int (*DBWAITFUNC) (void);
130typedef DBWAITFUNC(*DB_DBBUSY_FUNC) (
void *dbproc);
131typedef void (*DB_DBIDLE_FUNC) (DBWAITFUNC dfunc,
void *dbproc);
132typedef int (*DB_DBCHKINTR_FUNC) (
void *dbproc);
133typedef int (*DB_DBHNDLINTR_FUNC) (
void *dbproc);
147#if !defined(_WINDEF_) && !defined(_WINDEF_H) && !defined(DOS32X)
158#define SYBCHAR SYBCHAR
160#define SYBVARCHAR SYBVARCHAR
162#define SYBINTN SYBINTN
164#define SYBINT1 SYBINT1
166#define SYBINT2 SYBINT2
168#define SYBINT4 SYBINT4
170#define SYBINT8 SYBINT8
172#define SYBFLT8 SYBFLT8
174#define SYBDATETIME SYBDATETIME
178#define SYBBITN SYBBITN
180#define SYBTEXT SYBTEXT
182#define SYBNTEXT SYBNTEXT
184#define SYBIMAGE SYBIMAGE
186#define SYBMONEY4 SYBMONEY4
188#define SYBMONEY SYBMONEY
190#define SYBDATETIME4 SYBDATETIME4
192#define SYBREAL SYBREAL
194#define SYBBINARY SYBBINARY
196#define SYBVOID SYBVOID
198#define SYBVARBINARY SYBVARBINARY
200#define SYBNUMERIC SYBNUMERIC
202#define SYBDECIMAL SYBDECIMAL
204#define SYBFLTN SYBFLTN
206#define SYBMONEYN SYBMONEYN
208#define SYBDATETIMN SYBDATETIMN
210#define SYBNVARCHAR SYBNVARCHAR
212#define SYBDATE SYBDATE
214#define SYBTIME SYBTIME
215 SYBBIGDATETIME = 187,
216#define SYBBIGDATETIME SYBBIGDATETIME
218#define SYBBIGTIME SYBBIGTIME
220#define SYBMSDATE SYBMSDATE
222#define SYBMSTIME SYBMSTIME
224#define SYBMSDATETIME2 SYBMSDATETIME2
225 SYBMSDATETIMEOFFSET = 43,
226#define SYBMSDATETIMEOFFSET SYBMSDATETIMEOFFSET
229#define SYBAOPCNT 0x4b
230#define SYBAOPCNTU 0x4c
231#define SYBAOPSUM 0x4d
232#define SYBAOPSUMU 0x4e
233#define SYBAOPAVG 0x4f
234#define SYBAOPAVGU 0x50
235#define SYBAOPMIN 0x51
236#define SYBAOPMAX 0x52
239#define SYBAOPCNT_BIG 0x09
240#define SYBAOPSTDEV 0x30
241#define SYBAOPSTDEVP 0x31
242#define SYBAOPVAR 0x32
243#define SYBAOPVARP 0x33
244#define SYBAOPCHECKSUM_AGG 0x72
248typedef unsigned char DBBOOL;
250typedef unsigned char DBBIT;
251typedef unsigned char DBTINYINT;
252typedef int16_t DBSMALLINT;
253typedef int32_t DBINT;
254typedef int64_t DBBIGINT;
255typedef unsigned char DBBINARY;
256typedef tds_sysdep_real32_type DBREAL;
257typedef tds_sysdep_real64_type DBFLT8;
258typedef uint16_t DBUSMALLINT;
259typedef uint32_t DBUINT;
260typedef uint64_t DBUBIGINT;
271 unsigned char array[256];
276 unsigned char precision;
278 unsigned char array[33];
311 DBUSMALLINT time_prec:3;
315 DBUSMALLINT has_time:1;
316 DBUSMALLINT has_date:1;
317 DBUSMALLINT has_offset:1;
321# define SQLCHAR SYBCHAR
332typedef unsigned char BYTE;
351{ MAXCOLNAMELEN = 512 };
352typedef enum { CI_REGULAR=1, CI_ALTERNATE=2, CI_CURSOR=3 } CI_TYPE;
357 DBCHAR Name[MAXCOLNAMELEN+2];
358 DBCHAR ActualName[MAXCOLNAMELEN+2];
359 DBCHAR TableName[MAXCOLNAMELEN+2];
376 DBCHAR Name[MAXCOLNAMELEN+2];
377 DBCHAR ActualName[MAXCOLNAMELEN+2];
378 DBCHAR TableName[MAXCOLNAMELEN+2];
390 DBINT ServerMaxLength;
391 DBCHAR ServerTypeDeclaration[256];
402#define DBARITHIGNORE 4
404#define DBARITHABORT 6
411#define DBSTORPROCID 13
413#define DBNOAUTOFREE 15
417#define DBDATEFORMAT 19
420#define DBPRLINELEN 22
421#define DBPRLINESEP 23
422#define DBLFCONVERT 24
423#define DBDATEFIRST 25
424#define DBCHAINXACTS 26
426#define DBISOLATION 28
430#define DBDATESHORT 32
431#define DBCLIENTCURSORS 33
433#define DBQUOTEDIDENT 35
435#define DBNUMOPTIONS 36
443#define NOSUCHOPTION 2
530typedef int (*EHANDLEFUNC) (DBPROCESS * dbproc,
int severity,
int dberr,
int oserr,
char *dberrstr,
char *oserrstr);
532typedef int (*MHANDLEFUNC) (DBPROCESS * dbproc, DBINT msgno,
int msgstate,
int severity,
char *msgtext,
char *srvname,
533 char *proc,
int line);
537#define DBNOTIFICATION 2
547#define NTBSTRINGBIND 2
548#define VARYCHARBIND 3
555#define DATETIMEBIND 11
556#define SMALLDATETIMEBIND 12
558#define SMALLMONEYBIND 14
561#define NUMERICBIND 17
562#define DECIMALBIND 18
563#define SRCNUMERICBIND 19
564#define SRCDECIMALBIND 20
567#define BIGDATETIMEBIND 23
568#define BIGTIMEBIND 24
570#define DATETIME2BIND 31
571#define MAXBINDTYPES 32
574#define DBPRLINELEN 22
576#define DBRPCDEFAULT 2
580#define NO_MORE_ROWS -2
582#define NO_MORE_RESULTS 2
595#define DBRPCRECOMPILE TDS_STATIC_CAST(DBSMALLINT, 0x0001)
596#define DBRPCRESET TDS_STATIC_CAST(DBSMALLINT, 0x0002)
597#define DBRPCCURSOR TDS_STATIC_CAST(DBSMALLINT, 0x0008)
599#if defined(DBLIB_UNIMPLEMENTED)
600DBBOOL db12hour(DBPROCESS * dbprocess,
const char language[]);
602DBBOOL dbcolbrowse(DBPROCESS * dbprocess,
int colnum);
604RETCODE dbcursor(DBCURSOR * hc, DBINT optype, DBINT bufno, BYTE * table, BYTE * values);
605RETCODE dbcursorbind(DBCURSOR * hc,
int col,
int vartype, DBINT varlen, DBINT * poutlen, BYTE * pvaraddr, DBTYPEINFO * typeinfo);
606void dbcursorclose(DBCURSOR * hc);
607RETCODE dbcursorcolinfo(DBCURSOR * hc, DBINT column, DBCHAR * colname, DBINT * coltype, DBINT * collen, DBINT * usertype);
608RETCODE dbcursorfetch(DBCURSOR * hc, DBINT fetchtype, DBINT rownum);
609RETCODE dbcursorinfo(DBCURSOR * hc, DBINT * ncols, DBINT * nrows);
610DBCURSOR *dbcursoropen(DBPROCESS * dbprocess, BYTE * stmt, SHORT scollopt, SHORT concuropt, USHORT nrows, DBINT * pstatus);
613RETCODE dbdate4zero(DBPROCESS * dbprocess,
DBDATETIME4 * d1);
614RETCODE dbdatechar(DBPROCESS * dbprocess,
char *buf,
int datepart,
int value);
615int dbdatename(DBPROCESS * dbprocess,
char *buf,
int date,
DBDATETIME * datetime);
616char *dateorder(DBPROCESS * dbprocess,
char *language);
617DBINT dbdatepart(DBPROCESS * dbprocess,
int datepart,
DBDATETIME * datetime);
618RETCODE dbdatezero(DBPROCESS * dbprocess,
DBDATETIME * d1);
619char *dbdayname(DBPROCESS * dbprocess,
char *language,
int daynum);
621int dbgetoff(DBPROCESS * dbprocess, DBUSMALLINT offtype,
int startfrom);
623char *dbqual(DBPROCESS * dbprocess,
int tabnum,
char *tabname);
624void dbfreequal(
char *qualptr);
626DBSORTORDER *dbloadsort(DBPROCESS * dbprocess);
627RETCODE dbfreesort(DBPROCESS * dbprocess, DBSORTORDER * sortorder);
629RETCODE dbload_xlate(DBPROCESS * dbprocess,
char *srv_charset,
char *clt_name, DBXLATE ** xlt_tosrv, DBXLATE ** xlt_todisp);
635RETCODE dbmnydown(DBPROCESS * dbproc,
DBMONEY * mnyptr,
int divisor,
int *remainder);
636RETCODE dbmnyinit(DBPROCESS * dbproc,
DBMONEY * mnyptr,
int trim, DBBOOL * negative);
637RETCODE dbmnyndigit(DBPROCESS * dbproc,
DBMONEY * mnyptr, DBCHAR * value, DBBOOL * zero);
639RETCODE dbmnydigit(DBPROCESS * dbprocess,
DBMONEY * m1, DBCHAR * value, DBBOOL * zero);
640RETCODE dbmnyscale(DBPROCESS * dbproc,
DBMONEY * dest,
int multiplier,
int addend);
643RETCODE dbnpcreate(DBPROCESS * dbprocess);
644RETCODE dbnpdefine(DBPROCESS * dbprocess, DBCHAR * procedure_name, DBSMALLINT namelen);
646int DBNUMORDERS(DBPROCESS * dbprocess);
648RETCODE dbpoll(DBPROCESS * dbproc,
long milliseconds, DBPROCESS ** ready_dbproc,
int *return_reason);
649int dbordercol(DBPROCESS * dbprocess,
int order);
651RETCODE dbregdrop(DBPROCESS * dbprocess, DBCHAR * procnm, DBSMALLINT namelen);
652RETCODE dbregexec(DBPROCESS * dbproc, DBUSMALLINT options);
653RETCODE dbreghandle(DBPROCESS * dbprocess, DBCHAR * procnm, DBSMALLINT namelen, INTFUNCPTR handler);
654RETCODE dbreginit(DBPROCESS * dbproc, DBCHAR * procedure_name, DBSMALLINT namelen);
655RETCODE dbreglist(DBPROCESS * dbproc);
656RETCODE dbregnowatch(DBPROCESS * dbprocess, DBCHAR * procnm, DBSMALLINT namelen);
657RETCODE dbregparam(DBPROCESS * dbproc,
char *param_name,
int type, DBINT datalen, BYTE * data);
658RETCODE dbregwatch(DBPROCESS * dbprocess, DBCHAR * procnm, DBSMALLINT namelen, DBUSMALLINT options);
659RETCODE dbregwatchlist(DBPROCESS * dbprocess);
662RETCODE dbrpwset(
LOGINREC * login,
char *srvname,
char *password,
int pwlen);
664DBINT dbreadpage(DBPROCESS * dbprocess,
char *p_dbname, DBINT pageno, BYTE * buf);
665RETCODE dbwritepage(DBPROCESS * dbprocess,
char *p_dbname, DBINT pageno, DBINT size, BYTE * buf);
667RETCODE dbsetdeflang(
char *language);
669int dbstrcmp(DBPROCESS * dbprocess,
char *s1,
int l1,
char *s2,
int l2, DBSORTORDER * sort);
670int dbstrsort(DBPROCESS * dbprocess,
char *s1,
int l1,
char *s2,
int l2, DBSORTORDER * sort);
672DBBOOL dbtabbrowse(DBPROCESS * dbprocess,
int tabnum);
673int dbtabcount(DBPROCESS * dbprocess);
674char *dbtabname(DBPROCESS * dbprocess,
int tabnum);
675char *dbtabsource(DBPROCESS * dbprocess,
int colnum,
int *tabnum);
677RETCODE dbsendpassthru(DBPROCESS * dbprocess, DBVOIDPTR bufp);
678RETCODE dbrecvpassthru(DBPROCESS * dbprocess, DBVOIDPTR * bufp);
680RETCODE dbgetloginfo(DBPROCESS * dbprocess, DBLOGINFO ** loginfo);
681RETCODE dbsetloginfo(
LOGINREC * loginrec, DBLOGINFO * loginfo);
683int dbtsnewlen(DBPROCESS * dbprocess);
684DBBINARY *dbtsnewval(DBPROCESS * dbprocess);
685RETCODE dbtsput(DBPROCESS * dbprocess, DBBINARY * newts,
int newtslen,
int tabnum,
char *tabname);
687RETCODE dbfree_xlate(DBPROCESS * dbprocess, DBXLATE * xlt_tosrv, DBXLATE * clt_todisp);
688int dbxlate(DBPROCESS * dbprocess,
char *src,
int srclen,
char *dest,
int destlen, DBXLATE * xlt,
int *srcbytes_used,
689 DBBOOL srcend,
int status);
691RETCODE bcp_moretext(DBPROCESS * dbproc, DBINT size, BYTE * text);
692RETCODE bcp_writefmt(DBPROCESS * dbproc,
const char filename[]);
694void build_xact_string(
char *xact_name,
char *service_name, DBINT commid,
char *result);
695RETCODE remove_xact(DBPROCESS * connect, DBINT commid,
int n);
696RETCODE abort_xact(DBPROCESS * connect, DBINT commid);
697void close_commit(DBPROCESS * connect);
698RETCODE commit_xact(DBPROCESS * connect, DBINT commid);
699DBPROCESS *open_commit(
LOGINREC * login,
char *servername);
700RETCODE scan_xact(DBPROCESS * connect, DBINT commid);
701DBINT start_xact(DBPROCESS * connect,
char *application_name,
char *xact_name,
int site_count);
702DBINT stat_xact(DBPROCESS * connect, DBINT commid);
706BYTE *
dbadata(DBPROCESS * dbproc,
int computeid,
int column);
707DBINT
dbadlen(DBPROCESS * dbproc,
int computeid,
int column);
708RETCODE
dbaltbind(DBPROCESS * dbprocess,
int computeid,
int column,
int vartype, DBINT varlen, BYTE * varaddr);
709RETCODE dbaltbind_ps(DBPROCESS * dbprocess,
int computeid,
int column,
int vartype, DBINT varlen, BYTE * varaddr,
710 DBTYPEINFO * typeinfo);
711int dbaltcolid(DBPROCESS * dbproc,
int computeid,
int column);
712DBINT
dbaltlen(DBPROCESS * dbproc,
int computeid,
int column);
713int dbaltop(DBPROCESS * dbproc,
int computeid,
int column);
714int dbalttype(DBPROCESS * dbproc,
int computeid,
int column);
715DBINT
dbaltutype(DBPROCESS * dbproc,
int computeid,
int column);
716RETCODE
dbanullbind(DBPROCESS * dbprocess,
int computeid,
int column, DBINT * indicator);
717RETCODE
dbbind(DBPROCESS * dbproc,
int column,
int vartype, DBINT varlen, BYTE * varaddr);
718RETCODE dbbind_ps(DBPROCESS * dbprocess,
int column,
int vartype, DBINT varlen, BYTE * varaddr, DBTYPEINFO * typeinfo);
719int dbbufsize(DBPROCESS * dbprocess);
720BYTE *
dbbylist(DBPROCESS * dbproc,
int computeid,
int *size);
721RETCODE
dbcancel(DBPROCESS * dbproc);
723char *
dbchange(DBPROCESS * dbprocess);
724DBBOOL dbcharsetconv(DBPROCESS * dbprocess);
725void dbclose(DBPROCESS * dbproc);
726void dbclrbuf(DBPROCESS * dbproc, DBINT n);
727RETCODE
dbclropt(DBPROCESS * dbproc,
int option,
const char param[]);
728RETCODE
dbcmd(DBPROCESS * dbproc,
const char cmdstring[]);
729RETCODE
dbcmdrow(DBPROCESS * dbproc);
731#define DBCMDROW(x) dbcmdrow((x))
733RETCODE
dbcolinfo (DBPROCESS *dbproc, CI_TYPE type, DBINT column, DBINT computeid,
DBCOL *pdbcol);
734DBINT
dbcollen(DBPROCESS * dbproc,
int column);
735char *
dbcolname(DBPROCESS * dbproc,
int column);
736const char *
dbacolname(DBPROCESS * dbproc,
int computeid,
int column);
738int dbcoltype(DBPROCESS * dbproc,
int column);
740DBINT
dbcolutype(DBPROCESS * dbprocess,
int column);
741DBINT
dbconvert(DBPROCESS * dbproc,
int srctype,
const BYTE * src, DBINT srclen,
int desttype, BYTE * dest, DBINT destlen);
742DBINT
dbconvert_ps(DBPROCESS * dbprocess,
int srctype,
const BYTE * src, DBINT srclen,
int desttype, BYTE * dest, DBINT destlen,
743 DBTYPEINFO * typeinfo);
745DBINT
dbcount(DBPROCESS * dbproc);
747#define DBCOUNT(x) dbcount((x))
750#define DBCURCMD(x) dbcurcmd((x))
753#define DBCURROW(x) dbcurrow((x))
754BYTE *
dbdata(DBPROCESS * dbproc,
int column);
757RETCODE
dbanydatecrack(DBPROCESS * dbproc, DBDATEREC2 * di,
int type,
const void *data);
758DBINT
dbdatlen(DBPROCESS * dbproc,
int column);
759DBBOOL
dbdead(DBPROCESS * dbproc);
761#define DBDEAD(x) dbdead((x))
764RETCODE
dbfcmd(DBPROCESS * dbproc,
const char *fmt, ...);
767#define DBFIRSTROW(x) dbfirstrow((x))
769char *
dbgetchar(DBPROCESS * dbprocess,
int n);
770char *dbgetcharset(DBPROCESS * dbprocess);
771int dbgetlusername(
LOGINREC * login, BYTE * name_buffer,
int buffer_len);
773char *dbgetnatlanf(DBPROCESS * dbprocess);
775RETCODE
dbgetrow(DBPROCESS * dbproc, DBINT row);
777#define DBGETTIME dbgettime
783#define DBIORDESC(x) dbiordesc((x))
786#define DBIOWDESC(x) dbiowdesc((x))
787DBBOOL dbisavail(DBPROCESS * dbprocess);
789#define DBISAVAIL(x) dbisavail((x))
790DBBOOL
dbisopt(DBPROCESS * dbproc,
int option,
const char param[]);
793#define DBLASTROW(x) dblastrow((x))
816const char *
dbmonthname(DBPROCESS * dbproc,
char *language,
int monthnum, DBBOOL shortform);
819#define DBMORECMDS(x) dbmorecmds((x))
820RETCODE
dbmoretext(DBPROCESS * dbproc, DBINT size,
const BYTE text[]);
822char *
dbname(DBPROCESS * dbproc);
823STATUS dbnextrow(DBPROCESS * dbproc);
824RETCODE
dbnullbind(DBPROCESS * dbproc,
int column, DBINT * indicator);
825int dbnumalts(DBPROCESS * dbproc,
int computeid);
830DBPROCESS *dbopen(
LOGINREC * login,
const char *server);
834void dbpivot_count (
struct col_t *output,
const struct col_t *input);
835void dbpivot_sum (
struct col_t *output,
const struct col_t *input);
836void dbpivot_min (
struct col_t *output,
const struct col_t *input);
837void dbpivot_max (
struct col_t *output,
const struct col_t *input);
840typedef void (*DBPIVOT_FUNC)(
struct col_t *output,
const struct col_t *input);
841struct pivot_t * dbrows_pivoted(DBPROCESS *dbproc);
842STATUS dbnextrow_pivoted(DBPROCESS *dbproc,
struct pivot_t *pp);
843RETCODE
dbpivot(DBPROCESS *dbproc,
int nkeys,
int *keys,
int ncols,
int *cols, DBPIVOT_FUNC func,
int val);
845DBPIVOT_FUNC dbpivot_lookup_name(
const char name[] );
848#define dbopen(x,y) tdsdbopen((x),(y), 1)
850#define dbopen(x,y) tdsdbopen((x),(y), 0)
854#ifdef PHP_SYBASE_DBOPEN
855#undef PHP_SYBASE_DBOPEN
856#define PHP_SYBASE_DBOPEN dbopen
860DBINT
dbprcollen(DBPROCESS * dbproc,
int column);
861RETCODE
dbprrow(DBPROCESS * dbproc);
863DBBOOL DRBUF(DBPROCESS * dbprocess);
864STATUS
dbreadtext(DBPROCESS * dbproc,
void *buf, DBINT bufsize);
867RETCODE dbresults_r(DBPROCESS * dbproc,
int recursive);
868BYTE *
dbretdata(DBPROCESS * dbproc,
int retnum);
869int dbretlen(DBPROCESS * dbproc,
int retnum);
870char *
dbretname(DBPROCESS * dbproc,
int retnum);
872int dbrettype(DBPROCESS * dbproc,
int retnum);
873RETCODE
dbrows(DBPROCESS * dbproc);
875#define DBROWS(x) dbrows((x))
878#define DBROWTYPE(x) dbrowtype((x))
879RETCODE
dbrpcinit(DBPROCESS * dbproc,
const char rpcname[], DBSMALLINT options);
880RETCODE
dbrpcparam(DBPROCESS * dbproc,
const char paramname[], BYTE status,
int type, DBINT maxlen, DBINT datalen, BYTE * value);
882RETCODE
dbsafestr(DBPROCESS * dbproc,
const char *src, DBINT srclen,
char *dest, DBINT destlen,
int quotetype);
883RETCODE *dbsechandle(DBINT type, INTFUNCPTR handler);
886void dbsetbusy(DBPROCESS * dbprocess, DB_DBBUSY_FUNC busyfunc);
887RETCODE dbsetdefcharset(
char *charset);
888void dbsetidle(DBPROCESS * dbprocess, DB_DBIDLE_FUNC idlefunc);
890void dbsetinterrupt(DBPROCESS * dbproc, DB_DBCHKINTR_FUNC chkintr, DB_DBHNDLINTR_FUNC hndlintr);
893RETCODE
dbsetnull(DBPROCESS * dbprocess,
int bindtype,
int bindlen, BYTE * bindval);
894RETCODE
dbsetopt(DBPROCESS * dbproc,
int option,
const char *char_param,
int int_param);
895STATUS
dbsetrow(DBPROCESS * dbprocess, DBINT row);
900int dbspid(DBPROCESS * dbproc);
901RETCODE
dbspr1row(DBPROCESS * dbproc,
char *buffer, DBINT buf_len);
903RETCODE
dbsprhead(DBPROCESS * dbproc,
char *buffer, DBINT buf_len);
904RETCODE
dbsprline(DBPROCESS * dbproc,
char *buffer, DBINT buf_len, DBCHAR line_char);
906RETCODE
dbsqlok(DBPROCESS * dbproc);
908int dbstrbuild(DBPROCESS * dbproc,
char *charbuf,
int bufsize,
char *text,
char *formats, ...);
909RETCODE
dbstrcpy(DBPROCESS * dbproc,
int start,
int numbytes,
char *dest);
911DBINT
dbvarylen(DBPROCESS * dbproc,
int column);
913#define SYBEVERDOWN 100
914#define SYBEICONVIU 2400
915#define SYBEICONVAVAIL 2401
916#define SYBEICONVO 2402
917#define SYBEICONVI 2403
918#define SYBEICONV2BIG 2404
921#define SYBETDSVER 2410
923#define SYBESYNC 20001
924#define SYBEFCON 20002
925#define SYBETIME 20003
926#define SYBEREAD 20004
927#define SYBEBUFL 20005
928#define SYBEWRIT 20006
930#define SYBESOCK 20008
931#define SYBECONN 20009
933#define SYBEDBPS 20011
934#define SYBEINTF 20012
935#define SYBEUHST 20013
937#define SYBEOPIN 20015
938#define SYBEINLN 20016
939#define SYBESEOF 20017
940#define SYBESMSG 20018
941#define SYBERPND 20019
942#define SYBEBTOK 20020
943#define SYBEITIM 20021
945#define SYBEBTYP 20023
946#define SYBEBNCR 20024
947#define SYBEIICL 20025
948#define SYBECNOR 20026
949#define SYBENPRM 20027
950#define SYBEUVDT 20028
951#define SYBEUFDT 20029
952#define SYBEWAID 20030
953#define SYBECDNS 20031
954#define SYBEABNC 20032
955#define SYBEABMT 20033
956#define SYBEABNP 20034
957#define SYBEAAMT 20035
958#define SYBENXID 20036
959#define SYBERXID 20037
961#define SYBENMOB 20039
962#define SYBEAPUT 20040
963#define SYBEASNL 20041
964#define SYBENTLL 20042
965#define SYBEASUL 20043
966#define SYBERDNR 20044
967#define SYBENSIP 20045
968#define SYBEABNV 20046
969#define SYBEDDNE 20047
970#define SYBECUFL 20048
971#define SYBECOFL 20049
972#define SYBECSYN 20050
973#define SYBECLPR 20051
974#define SYBECNOV 20052
975#define SYBERDCN 20053
976#define SYBESFOV 20054
978#define SYBECLOS 20056
979#define SYBEUAVE 20057
980#define SYBEUSCT 20058
981#define SYBEEQVA 20059
982#define SYBEUDTY 20060
983#define SYBETSIT 20061
984#define SYBEAUTN 20062
985#define SYBEBDIO 20063
986#define SYBEBCNT 20064
987#define SYBEIFNB 20065
989#define SYBEKBCO 20067
990#define SYBEBBCI 20068
991#define SYBEKBCI 20069
992#define SYBEBCRE 20070
993#define SYBETPTN 20071
994#define SYBEBCWE 20072
995#define SYBEBCNN 20073
996#define SYBEBCOR 20074
997#define SYBEBCIS 20075
998#define SYBEBCPI 20076
999#define SYBEBCPN 20077
1000#define SYBEBCPB 20078
1001#define SYBEVDPT 20079
1002#define SYBEBIVI 20080
1003#define SYBEBCBC 20081
1004#define SYBEBCFO 20082
1005#define SYBEBCVH 20083
1006#define SYBEBCUO 20084
1007#define SYBEBCUC 20085
1008#define SYBEBUOE 20086
1009#define SYBEBUCE 20087
1010#define SYBEBWEF 20088
1011#define SYBEASTF 20089
1012#define SYBEUACS 20090
1013#define SYBEASEC 20091
1014#define SYBETMTD 20092
1015#define SYBENTTN 20093
1016#define SYBEDNTI 20094
1017#define SYBEBTMT 20095
1018#define SYBEORPF 20096
1019#define SYBEUVBF 20097
1020#define SYBEBUOF 20098
1021#define SYBEBUCF 20099
1022#define SYBEBRFF 20100
1023#define SYBEBWFF 20101
1024#define SYBEBUDF 20102
1025#define SYBEBIHC 20103
1026#define SYBEBEOF 20104
1027#define SYBEBCNL 20105
1028#define SYBEBCSI 20106
1029#define SYBEBCIT 20107
1030#define SYBEBCSA 20108
1031#define SYBENULL 20109
1032#define SYBEUNAM 20110
1033#define SYBEBCRO 20111
1034#define SYBEMPLL 20112
1035#define SYBERPIL 20113
1036#define SYBERPUL 20114
1037#define SYBEUNOP 20115
1038#define SYBECRNC 20116
1039#define SYBERTCC 20117
1040#define SYBERTSC 20118
1041#define SYBEUCRR 20119
1042#define SYBERPNA 20120
1043#define SYBEOPNA 20121
1044#define SYBEFGTL 20122
1045#define SYBECWLL 20123
1046#define SYBEUFDS 20124
1047#define SYBEUCPT 20125
1048#define SYBETMCF 20126
1049#define SYBEAICF 20127
1050#define SYBEADST 20128
1051#define SYBEALTT 20129
1052#define SYBEAPCT 20130
1053#define SYBEXOCI 20131
1054#define SYBEFSHD 20132
1055#define SYBEAOLF 20133
1056#define SYBEARDI 20134
1057#define SYBEURCI 20135
1058#define SYBEARDL 20136
1059#define SYBEURMI 20137
1060#define SYBEUREM 20138
1061#define SYBEURES 20139
1062#define SYBEUREI 20140
1063#define SYBEOREN 20141
1064#define SYBEISOI 20142
1065#define SYBEIDCL 20143
1066#define SYBEIMCL 20144
1067#define SYBEIFCL 20145
1068#define SYBEUTDS 20146
1069#define SYBEBUFF 20147
1070#define SYBEACNV 20148
1071#define SYBEDPOR 20149
1072#define SYBENDC 20150
1073#define SYBEMVOR 20151
1074#define SYBEDVOR 20152
1075#define SYBENBVP 20153
1076#define SYBESPID 20154
1077#define SYBENDTP 20155
1078#define SYBEXTN 20156
1079#define SYBEXTDN 20157
1080#define SYBEXTSN 20158
1081#define SYBENUM 20159
1082#define SYBETYPE 20160
1083#define SYBEGENOS 20161
1084#define SYBEPAGE 20162
1085#define SYBEOPTNO 20163
1086#define SYBEETD 20164
1087#define SYBERTYPE 20165
1088#define SYBERFILE 20166
1089#define SYBEFMODE 20167
1090#define SYBESLCT 20168
1091#define SYBEZTXT 20169
1092#define SYBENTST 20170
1093#define SYBEOSSL 20171
1094#define SYBEESSL 20172
1095#define SYBENLNL 20173
1096#define SYBENHAN 20174
1097#define SYBENBUF 20175
1098#define SYBENULP 20176
1099#define SYBENOTI 20177
1100#define SYBEEVOP 20178
1101#define SYBENEHA 20179
1102#define SYBETRAN 20180
1103#define SYBEEVST 20181
1104#define SYBEEINI 20182
1105#define SYBEECRT 20183
1106#define SYBEECAN 20184
1107#define SYBEEUNR 20185
1108#define SYBERPCS 20186
1109#define SYBETPAR 20187
1110#define SYBETEXS 20188
1111#define SYBETRAC 20189
1112#define SYBETRAS 20190
1113#define SYBEPRTF 20191
1114#define SYBETRSN 20192
1115#define SYBEBPKS 20193
1116#define SYBEIPV 20194
1117#define SYBEMOV 20195
1118#define SYBEDIVZ 20196
1119#define SYBEASTL 20197
1120#define SYBESEFA 20198
1121#define SYBEPOLL 20199
1122#define SYBENOEV 20200
1123#define SYBEBADPK 20201
1124#define SYBESECURE 20202
1125#define SYBECAP 20203
1126#define SYBEFUNC 20204
1127#define SYBERESP 20205
1128#define SYBEIVERS 20206
1129#define SYBEONCE 20207
1130#define SYBERPNULL 20208
1131#define SYBERPTXTIM 20209
1132#define SYBENEG 20210
1133#define SYBELBLEN 20211
1134#define SYBEUMSG 20212
1135#define SYBECAPTYP 20213
1136#define SYBEBNUM 20214
1137#define SYBEBBL 20215
1138#define SYBEBPREC 20216
1139#define SYBEBSCALE 20217
1140#define SYBECDOMAIN 20218
1141#define SYBECINTERNAL 20219
1142#define SYBEBTYPSRV 20220
1143#define SYBEBCSET 20221
1144#define SYBEFENC 20222
1145#define SYBEFRES 20223
1146#define SYBEISRVPREC 20224
1147#define SYBEISRVSCL 20225
1148#define SYBEINUMCL 20226
1149#define SYBEIDECCL 20227
1150#define SYBEBCMTXT 20228
1151#define SYBEBCPREC 20229
1152#define SYBEBCBNPR 20230
1153#define SYBEBCBNTYP 20231
1154#define SYBEBCSNTYP 20232
1155#define SYBEBCPCTYP 20233
1156#define SYBEBCVLEN 20234
1157#define SYBEBCHLEN 20235
1158#define SYBEBCBPREF 20236
1159#define SYBEBCPREF 20237
1160#define SYBEBCITBNM 20238
1161#define SYBEBCITBLEN 20239
1162#define SYBEBCSNDROW 20240
1163#define SYBEBPROCOL 20241
1164#define SYBEBPRODEF 20242
1165#define SYBEBPRONUMDEF 20243
1166#define SYBEBPRODEFID 20244
1167#define SYBEBPRONODEF 20245
1168#define SYBEBPRODEFTYP 20246
1169#define SYBEBPROEXTDEF 20247
1170#define SYBEBPROEXTRES 20248
1171#define SYBEBPROBADDEF 20249
1172#define SYBEBPROBADTYP 20250
1173#define SYBEBPROBADLEN 20251
1174#define SYBEBPROBADPREC 20252
1175#define SYBEBPROBADSCL 20253
1176#define SYBEBADTYPE 20254
1177#define SYBECRSNORES 20255
1178#define SYBECRSNOIND 20256
1179#define SYBECRSVIEW 20257
1180#define SYBECRSVIIND 20258
1181#define SYBECRSORD 20259
1182#define SYBECRSBUFR 20260
1183#define SYBECRSNOFREE 20261
1184#define SYBECRSDIS 20262
1185#define SYBECRSAGR 20263
1186#define SYBECRSFRAND 20264
1187#define SYBECRSFLAST 20265
1188#define SYBECRSBROL 20266
1189#define SYBECRSFROWN 20267
1190#define SYBECRSBSKEY 20268
1191#define SYBECRSRO 20269
1192#define SYBECRSNOCOUNT 20270
1193#define SYBECRSTAB 20271
1194#define SYBECRSUPDNB 20272
1195#define SYBECRSNOWHERE 20273
1196#define SYBECRSSET 20274
1197#define SYBECRSUPDTAB 20275
1198#define SYBECRSNOUPD 20276
1199#define SYBECRSINV 20277
1200#define SYBECRSNOKEYS 20278
1201#define SYBECRSNOBIND 20279
1202#define SYBECRSFTYPE 20280
1203#define SYBECRSINVALID 20281
1204#define SYBECRSMROWS 20282
1205#define SYBECRSNROWS 20283
1206#define SYBECRSNOLEN 20284
1207#define SYBECRSNOPTCC 20285
1208#define SYBECRSNORDER 20286
1209#define SYBECRSNOTABLE 20287
1210#define SYBECRSNUNIQUE 20288
1211#define SYBECRSVAR 20289
1212#define SYBENOVALUE 20290
1213#define SYBEVOIDRET 20291
1214#define SYBECLOSEIN 20292
1215#define SYBEBOOL 20293
1216#define SYBEBCPOPT 20294
1217#define SYBEERRLABEL 20295
1218#define SYBEATTNACK 20296
1219#define SYBEBBFL 20297
1220#define SYBEDCL 20298
1222#define SYBEBULKINSERT 20599
1223#define SYBECOLSIZE 22000
1225int dbtds(DBPROCESS * dbprocess);
1227#define DBTDS(a) dbtds(a)
1228DBINT dbtextsize(DBPROCESS * dbprocess);
1229DBBINARY *
dbtxptr(DBPROCESS * dbproc,
int column);
1231DBBINARY *dbtxtsnewval(DBPROCESS * dbprocess);
1232RETCODE dbtxtsput(DBPROCESS * dbprocess, DBBINARY newtxts,
int colnum);
1233RETCODE
dbuse(DBPROCESS * dbproc,
const char *name);
1236RETCODE
dbwritetext(DBPROCESS * dbproc,
char *objname, DBBINARY * textptr, DBTINYINT textptrlen, DBBINARY * timestamp,
1237 DBBOOL log, DBINT size, BYTE * text);
1242RETCODE dbsetlshort(
LOGINREC * login,
int value,
int which);
1247#define DBSETLHOST(x,y) dbsetlname((x), (y), DBSETHOST)
1248#define dbsetlhost(x,y) dbsetlname((x), (y), DBSETHOST)
1250#define DBSETLUSER(x,y) dbsetlname((x), (y), DBSETUSER)
1251#define dbsetluser(x,y) dbsetlname((x), (y), DBSETUSER)
1253#define DBSETLPWD(x,y) dbsetlname((x), (y), DBSETPWD)
1254#define dbsetlpwd(x,y) dbsetlname((x), (y), DBSETPWD)
1255#if defined(DBLIB_UNIMPLEMENTED)
1257# define DBSETLHID(x,y) dbsetlname((x), (y), DBSETHID)
1260#define DBSETLAPP(x,y) dbsetlname((x), (y), DBSETAPP)
1261#define dbsetlapp(x,y) dbsetlname((x), (y), DBSETAPP)
1263#define BCP_SETL(x,y) dbsetlbool((x), (y), DBSETBCP)
1264#define DBSETLSECURE(x) dbsetlbool((x), (1), DBSETBCP)
1265#define DBSETNATLANG 7
1266#define DBSETLNATLANG(x,y) dbsetlname((x), (y), DBSETNATLANG)
1267#define dbsetlnatlang(x,y) dbsetlname((x), (y), DBSETNATLANG)
1268#if defined(DBLIB_UNIMPLEMENTED)
1269# define DBSETNOSHORT 8
1270# define DBSETLNOSHORT(x,y) dbsetlbool((x), (y), DBSETNOSHORT)
1272# define DBSETLHIER(x,y) dbsetlshort((x), (y), DBSETHIER)
1274#define DBSETCHARSET 10
1275#define DBSETLCHARSET(x,y) dbsetlname((x), (y), DBSETCHARSET)
1276#define DBSETPACKET 11
1277#define DBSETLPACKET(x,y) dbsetllong((x), (y), DBSETPACKET)
1278#define dbsetlpacket(x,y) dbsetllong((x), (y), DBSETPACKET)
1279#define DBSETENCRYPT 12
1280#define DBSETLENCRYPT(x,y) dbsetlbool((x), (y), DBSETENCRYPT)
1281#define DBSETLABELED 13
1282#define DBSETLLABELED(x,y) dbsetlbool((x), (y), DBSETLABELED)
1283#define BCP_SETLABELED(x,y) dbsetlbool((x), (y), DBSETLABELED)
1284#define DBSETDBNAME 14
1285#define DBSETLDBNAME(x,y) dbsetlname((x), (y), DBSETDBNAME)
1286#define DBSETLVERSION(login, version) dbsetlversion((login), (version))
1288#define DBSETUTF16 1001
1289#define DBSETLUTF16(x,y) dbsetlbool((x), (y), DBSETUTF16)
1290#define DBSETNTLMV2 1002
1291#define DBSETLNTLMV2(x,y) dbsetlbool((x), (y), DBSETNTLMV2)
1292#define DBSETREADONLY 1003
1293#define DBSETLREADONLY(x,y) dbsetlbool((x), (y), DBSETREADONLY)
1295RETCODE
bcp_init(DBPROCESS * dbproc,
const char *tblname,
const char *hfile,
const char *errfile,
int direction);
1299RETCODE
bcp_bind(DBPROCESS * dbproc, BYTE * varaddr,
int prefixlen, DBINT varlen, BYTE * terminator,
int termlen,
int type,
1301RETCODE
bcp_collen(DBPROCESS * dbproc, DBINT varlen,
int table_column);
1302RETCODE
bcp_columns(DBPROCESS * dbproc,
int host_colcount);
1303RETCODE
bcp_colfmt(DBPROCESS * dbproc,
int host_column,
int host_type,
int host_prefixlen, DBINT host_collen,
1304 const BYTE * host_term,
int host_termlen,
int colnum);
1305RETCODE
bcp_colfmt_ps(DBPROCESS * dbproc,
int host_column,
int host_type,
int host_prefixlen, DBINT host_collen,
1306 BYTE * host_term,
int host_termlen,
int colnum, DBTYPEINFO * typeinfo);
1307RETCODE
bcp_colptr(DBPROCESS * dbproc, BYTE * colptr,
int table_column);
1308RETCODE
bcp_control(DBPROCESS * dbproc,
int field, DBINT value);
1309int bcp_getbatchsize(DBPROCESS * dbproc);
1310RETCODE
bcp_exec(DBPROCESS * dbproc, DBINT * rows_copied);
1312RETCODE
bcp_options(DBPROCESS * dbproc,
int option, BYTE * value,
int valuelen);
1313RETCODE
bcp_readfmt(DBPROCESS * dbproc,
const char filename[]);
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).
Definition dblib.c:3026
RETCODE dbpivot(DBPROCESS *dbproc, int nkeys, int *keys, int ncols, int *cols, DBPIVOT_FUNC func, int val)
Pivot the rows, creating a new resultset.
Definition dbpivot.c:908
void dbclrbuf(DBPROCESS *dbproc, DBINT n)
Clear n rows from the row buffer.
Definition dblib.c:2825
DBTYPEINFO * dbcoltypeinfo(DBPROCESS *dbproc, int column)
Get precision and scale information for a regular result column.
Definition dblib.c:2997
LOGINREC * dblogin(void)
Allocate a LOGINREC structure.
Definition dblib.c:710
void dbfreebuf(DBPROCESS *dbproc)
Erase the command buffer, in case DBNOAUTOFREE was set with dbsetopt().
Definition dblib.c:6041
BYTE * dbdata(DBPROCESS *dbproc, int column)
Get address of data in a regular result column.
Definition dblib.c:3333
int dbstrlen(DBPROCESS *dbproc)
Get size of the command buffer, in bytes.
Definition dblib.c:6272
BYTE * dbadata(DBPROCESS *dbproc, int computeid, int column)
Get address of compute column data.
Definition dblib.c:4396
int dbspid(DBPROCESS *dbproc)
Get server process ID for a DBPROCESS.
Definition dblib.c:5901
DBBINARY * dbtxtimestamp(DBPROCESS *dbproc, int column)
Get text timestamp for a column in the current row.
Definition dblib.c:6509
BYTE * dbbylist(DBPROCESS *dbproc, int computeid, int *size)
Get bylist for a compute row.
Definition dblib.c:4980
char * dbservcharset(DBPROCESS *dbprocess)
Get syscharset name of the server character set.
Definition dblib.c:7005
DBINT dbspr1rowlen(DBPROCESS *dbproc)
Determine size buffer required to hold the results returned by dbsprhead(), dbsprline(),...
Definition dblib.c:3400
DBINT dbconvert(DBPROCESS *dbproc, int srctype, const BYTE *src, DBINT srclen, int desttype, BYTE *dest, DBINT destlen)
cf.
Definition dblib.c:2574
DBINT dbadlen(DBPROCESS *dbproc, int computeid, int column)
Get size of data in a compute column.
Definition dblib.c:4291
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.
Definition dblib.c:4612
RETCODE dbsetnull(DBPROCESS *dbprocess, int bindtype, int bindlen, BYTE *bindval)
Define substitution values to be used when binding null values.
Definition dblib.c:1943
char * dbcolname(DBPROCESS *dbproc, int column)
Return name of a regular result column.
Definition dblib.c:1853
RETCODE dbfcmd(DBPROCESS *dbproc, const char *fmt,...)
printf-like way to form SQL to send to the server.
Definition dblib.c:1316
RETCODE dbdatecrack(DBPROCESS *dbproc, DBDATEREC *di, DBDATETIME *dt)
Break a DBDATETIME value into useful pieces.
Definition dblib.c:5828
RETCODE dbresults(DBPROCESS *dbproc)
Set up query results.
Definition dblib.c:1675
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.
Definition dblib.c:6576
RETCODE dbcanquery(DBPROCESS *dbproc)
Cancel the query currently being retrieved, discarding all pending rows.
Definition dblib.c:6012
RETCODE dbinit(void)
Initialize db-lib.
Definition dblib.c:665
DBINT dbvarylen(DBPROCESS *dbproc, int column)
Determine whether a column can vary in size.
Definition dblib.c:3199
RETCODE dbcancel(DBPROCESS *dbproc)
Cancel the current command batch.
Definition dblib.c:3375
RETCODE dbsetlogintime(int seconds)
Set maximum seconds db-lib waits for a server response to a login attempt.
Definition dblib.c:4220
RETCODE dbgetrow(DBPROCESS *dbproc, DBINT row)
Read a row from the row buffer.
Definition dblib.c:1911
int dbcoltype(DBPROCESS *dbproc, int column)
Get the datatype of a regular result set column.
Definition dblib.c:2951
void dbsetifile(char *filename)
set name and location of the interfaces file FreeTDS should use to look up a servername.
Definition dblib.c:2692
RETCODE dbuse(DBPROCESS *dbproc, const char *name)
Change current database.
Definition dblib.c:1427
int dbnumalts(DBPROCESS *dbproc, int computeid)
Get count of columns in a compute row.
Definition dblib.c:4921
BOOL dbiscount(DBPROCESS *dbproc)
Indicates whether or not the count returned by dbcount is real (Microsoft-compatibility feature).
Definition dblib.c:2785
int dbgettime(void)
Get maximum seconds db-lib waits for a server response to query.
Definition dblib.c:4204
RETCODE dbmoretext(DBPROCESS *dbproc, DBINT size, const BYTE text[])
Send chunk of a text/image value to the server.
Definition dblib.c:6714
const char * dbprtype(int token)
Print a token value's name to a buffer.
Definition dblib.c:6429
char * dbcolsource(DBPROCESS *dbproc, int colnum)
Get base database column name for a result set column.
Definition dblib.c:3125
char * dbchange(DBPROCESS *dbprocess)
See if a command caused the current database to change.
Definition dblib.c:6969
const char * dbacolname(DBPROCESS *dbproc, int computeid, int column)
Return name of a computed result column.
Definition dblib.c:1879
RETCODE dbnullbind(DBPROCESS *dbproc, int column, DBINT *indicator)
Tie a null-indicator to a regular result column.
Definition dblib.c:2721
RETCODE dbbind(DBPROCESS *dbproc, int column, int vartype, DBINT varlen, BYTE *varaddr)
Tie a host variable to a resultset column.
Definition dblib.c:2615
const char * dbversion(void)
See which version of db-lib is in use.
Definition dblib.c:6822
RETCODE dbcmd(DBPROCESS *dbproc, const char cmdstring[])
Append SQL to the command buffer.
Definition dblib.c:1355
DBINT dbcollen(DBPROCESS *dbproc, int column)
Get size of a regular result column.
Definition dblib.c:3150
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.
Definition dblib.c:2281
char * dbgetchar(DBPROCESS *dbprocess, int n)
Get address of a position in the command buffer.
Definition dblib.c:6291
RETCODE dbanullbind(DBPROCESS *dbprocess, int computeid, int column, DBINT *indicator)
Tie a null-indicator to a compute result column.
Definition dblib.c:2757
RETCODE dbclropt(DBPROCESS *dbproc, int option, const char param[])
Reset an option.
Definition dblib.c:6076
DBINT dbcount(DBPROCESS *dbproc)
Get count of rows processed.
Definition dblib.c:2805
int dbaltop(DBPROCESS *dbproc, int computeid, int column)
Get aggregation operator for a compute column.
Definition dblib.c:4425
RETCODE dbtablecolinfo(DBPROCESS *dbproc, DBINT column, DBCOL *pdbcol)
describe table column attributes with a single call (Freetds-only API function modelled on dbcolinfo)
Definition dblib.c:6446
DBINT dbaltlen(DBPROCESS *dbproc, int computeid, int column)
Get size of data in compute column.
Definition dblib.c:7119
RETCODE dbsetopt(DBPROCESS *dbproc, int option, const char *char_param, int int_param)
Set db-lib or server option.
Definition dblib.c:4452
void dbprhead(DBPROCESS *dbproc)
Print result set headings to stdout.
Definition dblib.c:3940
RETCODE dbsetlversion(LOGINREC *login, BYTE version)
Set TDS version for future connections.
Definition dblib.c:937
RETCODE dbprrow(DBPROCESS *dbproc)
Print a result set to stdout.
Definition dblib.c:3521
char * dbname(DBPROCESS *dbproc)
Get name of current database.
Definition dblib.c:6989
int dbalttype(DBPROCESS *dbproc, int computeid, int column)
Get datatype for a compute column.
Definition dblib.c:4321
RETCODE dbsprhead(DBPROCESS *dbproc, char *buffer, DBINT buf_len)
Print result set headings to a buffer.
Definition dblib.c:3876
RETCODE dbsqlexec(DBPROCESS *dbproc)
send the SQL command to the server and wait for an answer.
Definition dblib.c:1401
DBBOOL dbwillconvert(int srctype, int desttype)
Test whether or not a datatype can be converted to another datatype.
Definition dblib.c:2855
DBINT dbcolutype(DBPROCESS *dbprocess, int column)
Get user-defined datatype of a regular result column.
Definition dblib.c:2974
int dbstrbuild(DBPROCESS *dbproc, char *charbuf, int bufsize, char *text, char *formats,...)
Build a printable string from text containing placeholders for variables.
Definition dblib.c:7282
EHANDLEFUNC dberrhandle(EHANDLEFUNC handler)
Set an error handler, for messages from db-lib.
Definition dblib.c:5102
RETCODE dbsetversion(DBINT version)
Specify a db-lib version level.
Definition dblib.c:5957
int dbgetpacket(DBPROCESS *dbproc)
Get TDS packet size for the connection.
Definition dblib.c:4056
void dbrecftos(const char filename[])
Record to a file all SQL commands sent to the server.
Definition dblib.c:6749
BYTE * dbgetuserdata(DBPROCESS *dbproc)
Get address of user-allocated data from a DBPROCESS.
Definition dblib.c:5939
void dbsetuserdata(DBPROCESS *dbproc, BYTE *ptr)
Associate client-allocated (and defined) data with a DBPROCESS.
Definition dblib.c:5921
DBINT dbprcollen(DBPROCESS *dbproc, int column)
Get size of a result column needed to print column.
Definition dblib.c:3173
void dbloginfree(LOGINREC *login)
free the LOGINREC
Definition dblib.c:742
RETCODE dbmorecmds(DBPROCESS *dbproc)
See if more commands are to be processed.
Definition dblib.c:6218
DBBOOL dbisopt(DBPROCESS *dbproc, int option, const char param[])
Get value of an option.
Definition dblib.c:6144
int dbnumcompute(DBPROCESS *dbprocess)
Get count of COMPUTE clauses for a result set.
Definition dblib.c:4954
RETCODE dbsqlsend(DBPROCESS *dbproc)
Transmit the command buffer to the server.
Definition dblib.c:7025
RETCODE dbsprline(DBPROCESS *dbproc, char *buffer, DBINT buf_len, DBCHAR line_char)
Get formatted string for underlining dbsprhead() column names.
Definition dblib.c:3818
void dbexit(void)
Close server connections and free all related structures.
Definition dblib.c:1534
RETCODE dbsafestr(DBPROCESS *dbproc, const char *src, DBINT srclen, char *dest, DBINT destlen, int quotetype)
safely quotes character values in SQL text.
Definition dblib.c:6368
int dbaltcolid(DBPROCESS *dbproc, int computeid, int column)
Get column ID of a compute column.
Definition dblib.c:4265
RETCODE dbanydatecrack(DBPROCESS *dbproc, DBDATEREC2 *di, int type, const void *data)
Break any kind of date or time value into useful pieces.
Definition dblib.c:5849
RETCODE dbsettime(int seconds)
Set maximum seconds db-lib waits for a server response to query.
Definition dblib.c:4173
int dbnumcols(DBPROCESS *dbproc)
Return number of regular columns in a result set.
Definition dblib.c:1829
int dbgetmaxprocs(void)
get maximum simultaneous connections db-lib will open to the server.
Definition dblib.c:4152
DBBINARY * dbtxptr(DBPROCESS *dbproc, int column)
Get text pointer for a column in the current row.
Definition dblib.c:6539
MHANDLEFUNC dbmsghandle(MHANDLEFUNC handler)
Set a message handler, for messages from the server.
Definition dblib.c:5121
STATUS dbreadtext(DBPROCESS *dbproc, void *buf, DBINT bufsize)
Fetch part of a text or image value from the server.
Definition dblib.c:6645
RETCODE dbsqlok(DBPROCESS *dbproc)
Wait for results of a query from the server.
Definition dblib.c:4795
DBINT dbdatlen(DBPROCESS *dbproc, int column)
Get size of current row's data in a regular result column.
Definition dblib.c:3305
STATUS dbsetrow(DBPROCESS *dbprocess, DBINT row)
Make a buffered row "current" without fetching it into bound variables.
Definition dblib.c:2026
void dbclose(DBPROCESS *dbproc)
Close a connection to the server and free associated resources.
Definition dblib.c:1467
RETCODE dbstrcpy(DBPROCESS *dbproc, int start, int numbytes, char *dest)
Get a copy of a chunk of the command buffer.
Definition dblib.c:6324
DBINT dbaltutype(DBPROCESS *dbproc, int computeid, int column)
Get user-defined datatype of a compute column.
Definition dblib.c:7096
RETCODE dbsetmaxprocs(int maxprocs)
Set maximum simultaneous connections db-lib will open to the server.
Definition dblib.c:4080
RETCODE dbspr1row(DBPROCESS *dbproc, char *buffer, DBINT buf_len)
Print a regular result row to a buffer.
Definition dblib.c:3438
RETCODE dbaltbind(DBPROCESS *dbprocess, int computeid, int column, int vartype, DBINT varlen, BYTE *varaddr)
Bind a compute column to a program variable.
Definition dblib.c:4350
DBINT dbretstatus(DBPROCESS *dbproc)
Fetch status value returned by query or remote procedure call.
Definition dblib.c:4655
RETCODE dbrpcinit(DBPROCESS *dbproc, const char rpcname[], DBSMALLINT options)
Initialize a remote procedure call.
Definition rpc.c:72
BYTE * dbretdata(DBPROCESS *dbproc, int retnum)
Get value of an output parameter filled by a stored procedure.
Definition dblib.c:4734
char * dbretname(DBPROCESS *dbproc, int retnum)
Get name of an output parameter filled by a stored procedure.
Definition dblib.c:4705
DBBOOL dbhasretstat(DBPROCESS *dbproc)
Determine if query generated a return status number.
Definition dblib.c:4631
int dbrettype(DBPROCESS *dbproc, int retnum)
Get datatype of a stored procedure's return parameter.
Definition dblib.c:6247
int dbretlen(DBPROCESS *dbproc, int retnum)
Get size of an output parameter filled by a stored procedure.
Definition dblib.c:4760
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.
Definition rpc.c:155
RETCODE dbrpcsend(DBPROCESS *dbproc)
Execute the procedure and free associated memory.
Definition rpc.c:281
int dbnumrets(DBPROCESS *dbproc)
Get count of output parameters filled by a stored procedure.
Definition dblib.c:4673
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.
Definition bcp.c:374
DBBOOL bcp_getl(LOGINREC *login)
See if BCP_SETL() was used to set the LOGINREC for BCP work.
Definition bcp.c:703
RETCODE bcp_control(DBPROCESS *dbproc, int field, DBINT value)
Set BCP options for uploading a datafile.
Definition bcp.c:541
RETCODE bcp_columns(DBPROCESS *dbproc, int host_colcount)
Indicate how many columns are to be found in the datafile.
Definition bcp.c:298
RETCODE bcp_colptr(DBPROCESS *dbproc, BYTE *colptr, int table_column)
Override bcp_bind() by pointing to a different host variable.
Definition bcp.c:667
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.
Definition bcp.c:2039
RETCODE bcp_exec(DBPROCESS *dbproc, DBINT *rows_copied)
Write a datafile to a table.
Definition bcp.c:1577
DBINT bcp_done(DBPROCESS *dbproc)
Conclude the transfer of data from program variables.
Definition bcp.c:1997
RETCODE bcp_readfmt(DBPROCESS *dbproc, const char filename[])
Read a format definition file.
Definition bcp.c:1638
DBINT bcp_batch(DBPROCESS *dbproc)
Commit a set of rows to the table.
Definition bcp.c:1970
RETCODE bcp_init(DBPROCESS *dbproc, const char *tblname, const char *hfile, const char *errfile, int direction)
Prepare for bulk copy operation on a table.
Definition bcp.c:164
RETCODE bcp_collen(DBPROCESS *dbproc, DBINT varlen, int table_column)
Set the length of a host variable to be written to a table.
Definition bcp.c:263
RETCODE bcp_sendrow(DBPROCESS *dbproc)
Write data in host variables to the table.
Definition bcp.c:1343
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 numeri...
Definition bcp.c:506
RETCODE bcp_options(DBPROCESS *dbproc, int option, BYTE *value, int valuelen)
Set "hints" for uploading a file.
Definition bcp.c:619
RETCODE dbmny4zero(DBPROCESS *dbproc, DBMONEY4 *dest)
Zero a DBMONEY4 value.
Definition dblib.c:5551
RETCODE dbmny4add(DBPROCESS *dbproc, DBMONEY4 *m1, DBMONEY4 *m2, DBMONEY4 *sum)
Add two DBMONEY4 values.
Definition dblib.c:5574
int dbmny4cmp(DBPROCESS *dbproc, DBMONEY4 *m1, DBMONEY4 *m2)
Compare two DBMONEY4 values.
Definition dblib.c:5693
RETCODE dbmnymaxpos(DBPROCESS *dbproc, DBMONEY *dest)
Get maximum positive DBMONEY value supported.
Definition dblib.c:5326
RETCODE dbmny4minus(DBPROCESS *dbproc, DBMONEY4 *src, DBMONEY4 *dest)
Negate a DBMONEY4 value.
Definition dblib.c:5527
RETCODE dbmnyminus(DBPROCESS *dbproc, DBMONEY *src, DBMONEY *dest)
Negate a DBMONEY value.
Definition dblib.c:5500
RETCODE dbmny4sub(DBPROCESS *dbproc, DBMONEY4 *m1, DBMONEY4 *m2, DBMONEY4 *diff)
Subtract two DBMONEY4 values.
Definition dblib.c:5605
RETCODE dbmnyzero(DBPROCESS *dbproc, DBMONEY *dest)
Set a DBMONEY value to zero.
Definition dblib.c:5305
RETCODE dbmnycopy(DBPROCESS *dbproc, DBMONEY *src, DBMONEY *dest)
Copy a DBMONEY value.
Definition dblib.c:5991
RETCODE dbmny4copy(DBPROCESS *dbprocess, DBMONEY4 *m1, DBMONEY4 *m2)
Copy a DBMONEY4 value.
Definition dblib.c:5721
RETCODE dbmnymaxneg(DBPROCESS *dbproc, DBMONEY *dest)
Get maximum negative DBMONEY value supported.
Definition dblib.c:5347
RETCODE dbmnydec(DBPROCESS *dbproc, DBMONEY *mnyptr)
Subtract $0.0001 from a DBMONEY value.
Definition dblib.c:5472
RETCODE dbmnyinc(DBPROCESS *dbproc, DBMONEY *mnyptr)
Add $0.0001 to a DBMONEY value.
Definition dblib.c:5444
int dbmnycmp(DBPROCESS *dbproc, DBMONEY *m1, DBMONEY *m2)
Compare two DBMONEY values.
Definition dblib.c:5247
int dbdatecmp(DBPROCESS *dbproc, DBDATETIME *d1, DBDATETIME *d2)
Compare DBDATETIME values, similar to strcmp(3).
Definition dblib.c:5746
const char * dbmonthname(DBPROCESS *dbproc, char *language, int monthnum, DBBOOL shortform)
Get name of a month, in some human language.
Definition dblib.c:6940
int dbcurcmd(DBPROCESS *dbproc)
Get number of the row just returned.
Definition dblib.c:6201
RETCODE dbsetlbool(LOGINREC *login, int value, int which)
Set a boolean value in a LOGINREC structure.
Definition dblib.c:898
DBINT dblastrow(DBPROCESS *dbproc)
Get number of the last row in the row buffer.
Definition dblib.c:7189
RETCODE dbcmdrow(DBPROCESS *dbproc)
See if the current command can return rows.
Definition dblib.c:4241
RETCODE dbrows(DBPROCESS *dbproc)
Indicate whether a query returned rows.
Definition dblib.c:4015
void dbsetavail(DBPROCESS *dbprocess)
Mark a DBPROCESS as "available".
Definition dblib.c:7257
int dbiowdesc(DBPROCESS *dbproc)
Get file descriptor of the socket used by a DBPROCESS to write data coming to the server....
Definition dblib.c:7229
int dbtds(DBPROCESS *dbprocess)
Get the TDS version in use for dbproc.
Definition dblib.c:6783
DBINT dbcurrow(DBPROCESS *dbproc)
Get number of the row currently being read.
Definition dblib.c:6167
STATUS dbrowtype(DBPROCESS *dbprocess)
Get returned row's type.
Definition dblib.c:6184
int dbiordesc(DBPROCESS *dbproc)
Get file descriptor of the socket used by a DBPROCESS to read data coming from the server....
Definition dblib.c:7213
RETCODE dbsetllong(LOGINREC *login, long value, int which)
Set an integer value in a LOGINREC structure.
Definition dblib.c:827
RETCODE dbsetlname(LOGINREC *login, const char *value, int which)
Set the value of a string in a LOGINREC structure.
Definition dblib.c:764
DBPROCESS * tdsdbopen(LOGINREC *login, const char *server, int msdblib)
Form a connection with the server.
Definition dblib.c:1166
DBBOOL dbdead(DBPROCESS *dbproc)
Check if dbproc is an ex-parrot.
Definition dblib.c:5039
DBINT dbfirstrow(DBPROCESS *dbproc)
See if a server response has arrived.
Definition dblib.c:7174
Definition bsqlodbc.c:100
DBSMALLINT offset
time offset
Definition sybdb.h:310
DBUBIGINT time
time, 7 digit precision
Definition sybdb.h:308
DBINT date
date, 0 = 1900-01-01
Definition sybdb.h:309