FreeTDS API: include/sybdb.h Source File

FreeTDS API

- Main Page
- Related Pages
- Modules
- Classes
- Files

- File List
- File Members

All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
sybdb.h
Go to the documentation of this file.
1 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases
2 * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 Brian Bruns
3 * Copyright (C) 2010, 2011 Frediano Ziglio
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
14 *
15 * You should have received a copy of the GNU Library General Public
16 * License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 * Boston, MA 02111-1307, USA.
19 */
20
28 #ifndef _sybdb_h_
29 #define _sybdb_h_
30
31 #include "tds_sysdep_public.h"
32
33 #undef TDS_STATIC_CAST
34 #ifdef __cplusplus
35 #define TDS_STATIC_CAST(type, a) static_cast<type>(a)
36 extern "C"
37 {
38 #if 0
39 }
40 #endif
41 #else
42 #define TDS_STATIC_CAST(type, a) ((type)(a))
43 #endif
44
45 static const char rcsid_sybdb_h[] = "$Id: sybdb.h,v 1.106 2011-12-05 02:26:31 jklowden Exp $";
46 static const void *const no_unused_sybdb_h_warn[] = { rcsid_sybdb_h, no_unused_sybdb_h_warn };
47
48 #ifdef FALSE
49 #undef FALSE
50 #endif
51 #ifdef TRUE
52 #undef TRUE
53 #endif
54 #define FALSE 0
55 #define TRUE 1
56
57 #define DBSAVE 1
58 #define DBNOSAVE 0
59 #define DBNOERR -1
60
61 #define INT_EXIT 0
62 #define INT_CONTINUE 1
63 #define INT_CANCEL 2
64 #define INT_TIMEOUT 3
65
66 #define DBMAXNUMLEN 33
67 #define DBMAXNAME 30
68
72 #define DBVERSION_UNKNOWN 0
73 #define DBVERSION_46 1
74 #define DBVERSION_100 2
75 #define DBVERSION_42 3
76 #define DBVERSION_70 4
77 #define DBVERSION_71 5
78 #define DBVERSION_80 DBVERSION_71
79 #define DBVERSION_72 6
80 #define DBVERSION_73 7
81
82 /* these two are defined by Microsoft for dbsetlversion() */
83 #define DBVER42 DBVERSION_42
84 #define DBVER60 DBVERSION_70 /* our best approximation */
85
90 #define DBTDS_UNKNOWN 0
91 #define DBTDS_2_0 1 /* pre 4.0 SQL Server */
92 #define DBTDS_3_4 2 /* Microsoft SQL Server (3.0) */
93 #define DBTDS_4_0 3 /* 4.0 SQL Server */
94 #define DBTDS_4_2 4 /* 4.2 SQL Server */
95 #define DBTDS_4_6 5 /* 2.0 OpenServer and 4.6 SQL Server. */
96 #define DBTDS_4_9_5 6 /* 4.9.5 (NCR) SQL Server */
97 #define DBTDS_5_0 7 /* 5.0 SQL Server */
98 #define DBTDS_7_0 8 /* Microsoft SQL Server 7.0 */
99 #define DBTDS_8_0 9 /* Microsoft SQL Server 2000 */
100 #define DBTDS_9_0 10 /* Microsoft SQL Server 2005 */
101 #define DBTDS_7_1 9 /* Microsoft SQL Server 2000 */
102 #define DBTDS_7_2 10 /* Microsoft SQL Server 2005 */
103 #define DBTDS_7_3 11 /* Microsoft SQL Server 2008 */
104
105 #define DBTXPLEN 16
106
107 #define BCPMAXERRS 1
108 #define BCPFIRST 2
109 #define BCPLAST 3
110 #define BCPBATCH 4
111 #define BCPKEEPIDENTITY 8
112
113 #define BCPLABELED 5
114 #define BCPHINTS 6
115
116 #define DBCMDNONE 0
117 #define DBCMDPEND 1
118 #define DBCMDSENT 2
119
120 typedef int RETCODE;
121
122 typedef void DBCURSOR;
123 typedef void DBXLATE;
124 typedef void DBSORTORDER;
125 typedef void DBLOGINFO;
126 typedef void *DBVOIDPTR;
127 typedef short SHORT;
128 typedef unsigned short USHORT;
129 typedef int (*INTFUNCPTR) (void *, ...);
130 typedef int (*DBWAITFUNC) (void);
131 typedef DBWAITFUNC(*DB_DBBUSY_FUNC) (void *dbproc);
132 typedef void (*DB_DBIDLE_FUNC) (DBWAITFUNC dfunc, void *dbproc);
133 typedef int (*DB_DBCHKINTR_FUNC) (void *dbproc);
134 typedef int (*DB_DBHNDLINTR_FUNC) (void *dbproc);
135
136 #ifndef __INCvxWorksh
137 /* VxWorks already defines STATUS and BOOL. Compiler gets mad if you
138 ** redefine them. */
139 /* __INCvxWorksh will get #defined by std. include files included from tds.h
140 */
141 #ifdef STATUS
142 /* On DU4.0d we get a conflicting STATUS definition from arpa/nameser.h
143 when _REENTRANT is defined.
144 */
145 #undef STATUS
146 #endif
147 typedef int STATUS;
148 #if !defined(_WINDEF_) && !defined(_WINDEF_H) && !defined(DOS32X)
149 typedef int BOOL;
150 #endif
151 #endif
152
153 #ifndef _tds_h_
154 /* copied from tds.h */
155 /* TODO find a best way... */
156 enum
157 {
158 SYBCHAR = 47, /* 0x2F */
159 #define SYBCHAR SYBCHAR
160 SYBVARCHAR = 39, /* 0x27 */
161 #define SYBVARCHAR SYBVARCHAR
162 SYBINTN = 38, /* 0x26 */
163 #define SYBINTN SYBINTN
164 SYBINT1 = 48, /* 0x30 */
165 #define SYBINT1 SYBINT1
166 SYBINT2 = 52, /* 0x34 */
167 #define SYBINT2 SYBINT2
168 SYBINT4 = 56, /* 0x38 */
169 #define SYBINT4 SYBINT4
170 SYBINT8 = 127, /* 0x7F */
171 #define SYBINT8 SYBINT8
172 SYBFLT8 = 62, /* 0x3E */
173 #define SYBFLT8 SYBFLT8
174 SYBDATETIME = 61, /* 0x3D */
175 #define SYBDATETIME SYBDATETIME
176 SYBBIT = 50, /* 0x32 */
177 #define SYBBIT SYBBIT
178 SYBBITN = 104, /* 0x68 */
179 #define SYBBITN SYBBITN
180 SYBTEXT = 35, /* 0x23 */
181 #define SYBTEXT SYBTEXT
182 SYBNTEXT = 99, /* 0x63 */
183 #define SYBNTEXT SYBNTEXT
184 SYBIMAGE = 34, /* 0x22 */
185 #define SYBIMAGE SYBIMAGE
186 SYBMONEY4 = 122, /* 0x7A */
187 #define SYBMONEY4 SYBMONEY4
188 SYBMONEY = 60, /* 0x3C */
189 #define SYBMONEY SYBMONEY
190 SYBDATETIME4 = 58, /* 0x3A */
191 #define SYBDATETIME4 SYBDATETIME4
192 SYBREAL = 59, /* 0x3B */
193 #define SYBREAL SYBREAL
194 SYBBINARY = 45, /* 0x2D */
195 #define SYBBINARY SYBBINARY
196 SYBVOID = 31, /* 0x1F */
197 #define SYBVOID SYBVOID
198 SYBVARBINARY = 37, /* 0x25 */
199 #define SYBVARBINARY SYBVARBINARY
200 SYBNUMERIC = 108, /* 0x6C */
201 #define SYBNUMERIC SYBNUMERIC
202 SYBDECIMAL = 106, /* 0x6A */
203 #define SYBDECIMAL SYBDECIMAL
204 SYBFLTN = 109, /* 0x6D */
205 #define SYBFLTN SYBFLTN
206 SYBMONEYN = 110, /* 0x6E */
207 #define SYBMONEYN SYBMONEYN
208 SYBDATETIMN = 111, /* 0x6F */
209 #define SYBDATETIMN SYBDATETIMN
210 SYBNVARCHAR = 103 /* 0x67 */
211 #define SYBNVARCHAR SYBNVARCHAR
212 };
213
214 #define SYBAOPCNT 0x4b
215 #define SYBAOPCNTU 0x4c
216 #define SYBAOPSUM 0x4d
217 #define SYBAOPSUMU 0x4e
218 #define SYBAOPAVG 0x4f
219 #define SYBAOPAVGU 0x50
220 #define SYBAOPMIN 0x51
221 #define SYBAOPMAX 0x52
222
223 /* mssql2k compute operator */
224 #define SYBAOPCNT_BIG 0x09
225 #define SYBAOPSTDEV 0x30
226 #define SYBAOPSTDEVP 0x31
227 #define SYBAOPVAR 0x32
228 #define SYBAOPVARP 0x33
229 #define SYBAOPCHECKSUM_AGG 0x72
230
231 #endif
232
233 typedef unsigned char DBBOOL;
234 typedef char DBCHAR;
235 typedef unsigned char DBBIT;
236 typedef unsigned char DBTINYINT;
237 typedef tds_sysdep_int16_type DBSMALLINT;
238 typedef tds_sysdep_int32_type DBINT;
239 typedef tds_sysdep_int64_type DBBIGINT;
240 typedef unsigned char DBBINARY;
241 typedef tds_sysdep_real32_type DBREAL;
242 typedef tds_sysdep_real64_type DBFLT8;
243 typedef unsigned tds_sysdep_int16_type DBUSMALLINT;
244
245 typedef struct
246 {
247 DBSMALLINT len;
248 char str[256];
249 } DBVARYCHAR;
250
251 typedef struct
252 {
253 DBSMALLINT len;
254 unsigned char array[256];
255 } DBVARYBIN;
256
257 typedef struct
258 {
259 unsigned char precision;
260 unsigned char scale;
261 unsigned char array[33];
262 } DBNUMERIC;
263
264 typedef DBNUMERIC DBDECIMAL;
265
266 typedef struct
267 {
268 DBINT mnyhigh;
269 unsigned tds_sysdep_int32_type mnylow;
270 } DBMONEY;
271
272 typedef struct
273 {
274 DBINT mny4;
275 } DBMONEY4;
276
277 typedef struct
278 {
279 DBINT dtdays;
280 DBINT dttime;
281 } DBDATETIME;
282
283 typedef struct
284 {
285 DBUSMALLINT days; /* days since Jan-1-1900 */
286 DBUSMALLINT minutes; /* minutes since midnight */
287 } DBDATETIME4;
288
289 #ifdef MSDBLIB
290 # define SQLCHAR SYBCHAR
291 typedef struct
292 {
293 DBUSMALLINT numdays;
294 DBUSMALLINT nummins;
295 } DBDATETIM4;
296 #endif
297
298 typedef struct tds_dblib_loginrec LOGINREC;
299
300 #ifndef DOS32X
301 typedef unsigned char BYTE;
302 #endif
303
304 typedef struct dbtypeinfo
305 {
306 DBINT precision;
307 DBINT scale;
308 } DBTYPEINFO;
309
310 struct dbstring
311 {
312 BYTE *strtext;
313 DBINT strtotlen;
314 struct dbstring *strnext;
315 };
316 typedef struct dbstring DBSTRING;
317
318 /* Used by dbcolinfo */
319 enum
320 { MAXCOLNAMELEN = 512 }; /* duplicates TDS_SYSNAME_SIZE */
321 typedef enum { CI_REGULAR=1, CI_ALTERNATE=2, CI_CURSOR=3 } CI_TYPE;
322
323 typedef struct
324 {
325 DBINT SizeOfStruct;
326 DBCHAR Name[MAXCOLNAMELEN+2];
327 DBCHAR ActualName[MAXCOLNAMELEN+2];
328 DBCHAR TableName[MAXCOLNAMELEN+2];
329 SHORT Type;
330 DBINT UserType;
331 DBINT MaxLength;
332 BYTE Precision;
333 BYTE Scale;
334 BOOL VarLength;
335 BYTE Null;
336 BYTE CaseSensitive;
337 BYTE Updatable;
338 BOOL Identity;
339
340 } DBCOL;
341
342 typedef struct
343 {
344 DBINT SizeOfStruct;
345 DBCHAR Name[MAXCOLNAMELEN+2];
346 DBCHAR ActualName[MAXCOLNAMELEN+2];
347 DBCHAR TableName[MAXCOLNAMELEN+2];
348 SHORT Type;
349 DBINT UserType;
350 DBINT MaxLength;
351 BYTE Precision;
352 BYTE Scale;
353 BOOL VarLength;
354 BYTE Null;
355 BYTE CaseSensitive;
356 BYTE Updatable;
357 BOOL Identity;
358 SHORT ServerType;
359 DBINT ServerMaxLength;
360 DBCHAR ServerTypeDeclaration[256];
361 } DBCOL2;
362 /* end dbcolinfo stuff */
363
364
365
366 /* a large list of options, DBTEXTSIZE is needed by sybtcl */
367 #define DBPARSEONLY 0
368 #define DBESTIMATE 1
369 #define DBSHOWPLAN 2
370 #define DBNOEXEC 3
371 #define DBARITHIGNORE 4
372 #define DBNOCOUNT 5
373 #define DBARITHABORT 6
374 #define DBTEXTLIMIT 7
375 #define DBBROWSE 8
376 #define DBOFFSET 9
377 #define DBSTAT 10
378 #define DBERRLVL 11
379 #define DBCONFIRM 12
380 #define DBSTORPROCID 13
381 #define DBBUFFER 14
382 #define DBNOAUTOFREE 15
383 #define DBROWCOUNT 16
384 #define DBTEXTSIZE 17
385 #define DBNATLANG 18
386 #define DBDATEFORMAT 19
387 #define DBPRPAD 20
388 #define DBPRCOLSEP 21
389 #define DBPRLINELEN 22
390 #define DBPRLINESEP 23
391 #define DBLFCONVERT 24
392 #define DBDATEFIRST 25
393 #define DBCHAINXACTS 26
394 #define DBFIPSFLAG 27
395 #define DBISOLATION 28
396 #define DBAUTH 29
397 #define DBIDENTITY 30
398 #define DBNOIDCOL 31
399 #define DBDATESHORT 32
400 #define DBCLIENTCURSORS 33
401 #define DBSETTIME 34
402 #define DBQUOTEDIDENT 35
403
404 #define DBNUMOPTIONS 36
405
406 #define DBPADOFF 0
407 #define DBPADON 1
408
409 #define OFF 0
410 #define ON 1
411
412 #define NOSUCHOPTION 2
413
414 #define MAXOPTTEXT 32
415
416 typedef struct tds_dblib_dbprocess DBPROCESS;
417
418 /*
419 * Sybase & Microsoft use different names for the dbdaterec members.
420 * Keep these two structures physically identical in memory.
421 * dbdatecrack() casts one to the other for ease of implementation.
422 *
423 * Giving credit where credit is due, we can acknowledge that
424 * Microsoft chose the better names here, hands down. ("datedmonth"?!)
425 */
426 struct tds_microsoft_dbdaterec
427 {
428 DBINT year; /* 1753 - 9999 */
429 DBINT quarter; /* 1 - 4 */
430 DBINT month; /* 1 - 12 */
431 DBINT day; /* 1 - 31 */
432 DBINT dayofyear; /* 1 - 366 */
433 DBINT week; /* 1 - 54 (for leap years) */
434 DBINT weekday; /* 1 - 7 (Mon. - Sun.) */
435 DBINT hour; /* 0 - 23 */
436 DBINT minute; /* 0 - 59 */
437 DBINT second; /* 0 - 59 */
438 DBINT millisecond; /* 0 - 999 */
439 DBINT tzone; /* 0 - 127 (Sybase only) */
440 };
441
442 struct tds_sybase_dbdaterec
443 {
444 DBINT dateyear; /* 1900 and counting */
445 DBINT quarter; /* 0 - 3 (Microsoft only) */
446 DBINT datemonth; /* 0 - 11 */
447 DBINT datedmonth; /* 1 - 31 */
448 DBINT datedyear; /* 1 - 366 */
449 DBINT week; /* 1 - 54 (Microsoft only) */
450 DBINT datedweek; /* 0 - 6 */
451 DBINT datehour; /* 0 - 23 */
452 DBINT dateminute; /* 0 - 59 */
453 DBINT datesecond; /* 0 - 59 */
454 DBINT datemsecond; /* 0 - 997 */
455 DBINT datetzone; /* 0 - 127 */
456 };
457
458 #ifdef MSDBLIB
459 typedef struct tds_microsoft_dbdaterec DBDATEREC;
460 #else
461 typedef struct tds_sybase_dbdaterec DBDATEREC;
462 #endif
463
464 typedef int (*EHANDLEFUNC) (DBPROCESS * dbproc, int severity, int dberr, int oserr, char *dberrstr, char *oserrstr);
465
466 typedef int (*MHANDLEFUNC) (DBPROCESS * dbproc, DBINT msgno, int msgstate, int severity, char *msgtext, char *srvname,
467 char *proc, int line);
468
469 /* dbpoll() result codes, sybtcl needs DBRESULT */
470 #define DBRESULT 1
471 #define DBNOTIFICATION 2
472 #define DBTIMEOUT 3
473 #define DBINTERRUPT 4
474
475 /* more sybtcl needs: */
476 #define DBTXTSLEN 8
477
478 /* bind types */
479 #define CHARBIND 0
480 #define STRINGBIND 1
481 #define NTBSTRINGBIND 2
482 #define VARYCHARBIND 3
483 #define VARYBINBIND 4
484 #define TINYBIND 6
485 #define SMALLBIND 7
486 #define INTBIND 8
487 #define FLT8BIND 9
488 #define REALBIND 10
489 #define DATETIMEBIND 11
490 #define SMALLDATETIMEBIND 12
491 #define MONEYBIND 13
492 #define SMALLMONEYBIND 14
493 #define BINARYBIND 15
494 #define BITBIND 16
495 #define NUMERICBIND 17
496 #define DECIMALBIND 18
497 #define SRCNUMERICBIND 19
498 #define SRCDECIMALBIND 20
499 #define BIGINTBIND 30
500 #define DATETIME2BIND 31
501 #define MAXBINDTYPES 32 /* keep last */
502
503 #define DBPRCOLSEP 21
504 #define DBPRLINELEN 22
505 #define DBRPCRETURN 1
506 #define DBRPCDEFAULT 2
507
508 #define REG_ROW -1
509 #define MORE_ROWS -1
510 #define NO_MORE_ROWS -2
511 #define BUF_FULL -3
512 #define NO_MORE_RESULTS 2
513 #define SUCCEED 1
514 #define FAIL 0
515
516 #define DB_IN 1
517 #define DB_OUT 2
518 #define DB_QUERYOUT 3
519
520 #define DBSINGLE 0
521 #define DBDOUBLE 1
522 #define DBBOTH 2
523
524 /* remote procedure call (rpc) options */
525 #define DBRPCRECOMPILE TDS_STATIC_CAST(DBSMALLINT, 0x0001)
526 #define DBRPCRESET TDS_STATIC_CAST(DBSMALLINT, 0x0002)
527 #define DBRPCCURSOR TDS_STATIC_CAST(DBSMALLINT, 0x0008)
528
529 #if defined(DBLIB_UNIMPLEMENTED)
530 DBBOOL db12hour(DBPROCESS * dbprocess, const char language[]);
531
532 DBBOOL dbcolbrowse(DBPROCESS * dbprocess, int colnum);
533
534 RETCODE dbcursor(DBCURSOR * hc, DBINT optype, DBINT bufno, BYTE * table, BYTE * values);
535 RETCODE dbcursorbind(DBCURSOR * hc, int col, int vartype, DBINT varlen, DBINT * poutlen, BYTE * pvaraddr, DBTYPEINFO * typeinfo);
536 void dbcursorclose(DBCURSOR * hc);
537 RETCODE dbcursorcolinfo(DBCURSOR * hc, DBINT column, DBCHAR * colname, DBINT * coltype, DBINT * collen, DBINT * usertype);
538 RETCODE dbcursorfetch(DBCURSOR * hc, DBINT fetchtype, DBINT rownum);
539 RETCODE dbcursorinfo(DBCURSOR * hc, DBINT * ncols, DBINT * nrows);
540 DBCURSOR *dbcursoropen(DBPROCESS * dbprocess, BYTE * stmt, SHORT scollopt, SHORT concuropt, USHORT nrows, DBINT * pstatus);
541
542 int dbdate4cmp(DBPROCESS * dbprocess, DBDATETIME4 * d1, DBDATETIME4 * d2);
543 RETCODE dbdate4zero(DBPROCESS * dbprocess, DBDATETIME4 * d1);
544 RETCODE dbdatechar(DBPROCESS * dbprocess, char *buf, int datepart, int value);
545 int dbdatename(DBPROCESS * dbprocess, char *buf, int date, DBDATETIME * datetime);
546 char *dateorder(DBPROCESS * dbprocess, char *language);
547 DBINT dbdatepart(DBPROCESS * dbprocess, int datepart, DBDATETIME * datetime);
548 RETCODE dbdatezero(DBPROCESS * dbprocess, DBDATETIME * d1);
549 char *dbdayname(DBPROCESS * dbprocess, char *language, int daynum);
550
551 int dbgetoff(DBPROCESS * dbprocess, DBUSMALLINT offtype, int startfrom);
552
553 char *dbqual(DBPROCESS * dbprocess, int tabnum, char *tabname);
554 void dbfreequal(char *qualptr);
555
556 DBSORTORDER *dbloadsort(DBPROCESS * dbprocess);
557 RETCODE dbfreesort(DBPROCESS * dbprocess, DBSORTORDER * sortorder);
558
559 RETCODE dbload_xlate(DBPROCESS * dbprocess, char *srv_charset, char *clt_name, DBXLATE ** xlt_tosrv, DBXLATE ** xlt_todisp);
560
561 RETCODE dbmny4divide(DBPROCESS * dbproc, DBMONEY4 * m1, DBMONEY4 * m2, DBMONEY4 * quotient);
562 RETCODE dbmny4mul(DBPROCESS * dbproc, DBMONEY4 * m1, DBMONEY4 * m2, DBMONEY4 * prod);
563 RETCODE dbmnyadd(DBPROCESS * dbproc, DBMONEY * m1, DBMONEY * m2, DBMONEY * sum);
564 RETCODE dbmnydivide(DBPROCESS * dbproc, DBMONEY * m1, DBMONEY * m2, DBMONEY * quotient);
565 RETCODE dbmnydown(DBPROCESS * dbproc, DBMONEY * mnyptr, int divisor, int *remainder);
566 RETCODE dbmnyinit(DBPROCESS * dbproc, DBMONEY * mnyptr, int trim, DBBOOL * negative);
567 RETCODE dbmnyndigit(DBPROCESS * dbproc, DBMONEY * mnyptr, DBCHAR * value, DBBOOL * zero);
568 RETCODE dbmnymul(DBPROCESS * dbproc, DBMONEY * m1, DBMONEY * m2, DBMONEY * prod);
569 RETCODE dbmnydigit(DBPROCESS * dbprocess, DBMONEY * m1, DBCHAR * value, DBBOOL * zero);
570 RETCODE dbmnyscale(DBPROCESS * dbproc, DBMONEY * dest, int multiplier, int addend);
571
572
573 RETCODE dbnpcreate(DBPROCESS * dbprocess);
574 RETCODE dbnpdefine(DBPROCESS * dbprocess, DBCHAR * procedure_name, DBSMALLINT namelen);
575
576 int DBNUMORDERS(DBPROCESS * dbprocess);
577
578 RETCODE dbpoll(DBPROCESS * dbproc, long milliseconds, DBPROCESS ** ready_dbproc, int *return_reason);
579 int dbordercol(DBPROCESS * dbprocess, int order);
580
581 RETCODE dbregdrop(DBPROCESS * dbprocess, DBCHAR * procnm, DBSMALLINT namelen);
582 RETCODE dbregexec(DBPROCESS * dbproc, DBUSMALLINT options);
583 RETCODE dbreghandle(DBPROCESS * dbprocess, DBCHAR * procnm, DBSMALLINT namelen, INTFUNCPTR handler);
584 RETCODE dbreginit(DBPROCESS * dbproc, DBCHAR * procedure_name, DBSMALLINT namelen);
585 RETCODE dbreglist(DBPROCESS * dbproc);
586 RETCODE dbregnowatch(DBPROCESS * dbprocess, DBCHAR * procnm, DBSMALLINT namelen);
587 RETCODE dbregparam(DBPROCESS * dbproc, char *param_name, int type, DBINT datalen, BYTE * data);
588 RETCODE dbregwatch(DBPROCESS * dbprocess, DBCHAR * procnm, DBSMALLINT namelen, DBUSMALLINT options);
589 RETCODE dbregwatchlist(DBPROCESS * dbprocess);
590
591 void dbrpwclr(LOGINREC * login);
592 RETCODE dbrpwset(LOGINREC * login, char *srvname, char *password, int pwlen);
593
594 DBINT dbreadpage(DBPROCESS * dbprocess, char *p_dbname, DBINT pageno, BYTE * buf);
595 RETCODE dbwritepage(DBPROCESS * dbprocess, char *p_dbname, DBINT pageno, DBINT size, BYTE * buf);
596
597 RETCODE dbsetdeflang(char *language);
598
599 int dbstrcmp(DBPROCESS * dbprocess, char *s1, int l1, char *s2, int l2, DBSORTORDER * sort);
600 int dbstrsort(DBPROCESS * dbprocess, char *s1, int l1, char *s2, int l2, DBSORTORDER * sort);
601
602 DBBOOL dbtabbrowse(DBPROCESS * dbprocess, int tabnum);
603 int dbtabcount(DBPROCESS * dbprocess);
604 char *dbtabname(DBPROCESS * dbprocess, int tabnum);
605 char *dbtabsource(DBPROCESS * dbprocess, int colnum, int *tabnum);
606
607 RETCODE dbsetlshort(LOGINREC * login, int value, int which);
608
609 RETCODE dbsendpassthru(DBPROCESS * dbprocess, DBVOIDPTR bufp);
610 RETCODE dbrecvpassthru(DBPROCESS * dbprocess, DBVOIDPTR * bufp);
611
612 RETCODE dbgetloginfo(DBPROCESS * dbprocess, DBLOGINFO ** loginfo);
613 RETCODE dbsetloginfo(LOGINREC * loginrec, DBLOGINFO * loginfo);
614
615 int dbtsnewlen(DBPROCESS * dbprocess);
616 DBBINARY *dbtsnewval(DBPROCESS * dbprocess);
617 RETCODE dbtsput(DBPROCESS * dbprocess, DBBINARY * newts, int newtslen, int tabnum, char *tabname);
618
619 RETCODE dbfree_xlate(DBPROCESS * dbprocess, DBXLATE * xlt_tosrv, DBXLATE * clt_todisp);
620 int dbxlate(DBPROCESS * dbprocess, char *src, int srclen, char *dest, int destlen, DBXLATE * xlt, int *srcbytes_used,
621 DBBOOL srcend, int status);
622
623 RETCODE bcp_moretext(DBPROCESS * dbproc, DBINT size, BYTE * text);
624 RETCODE bcp_writefmt(DBPROCESS * dbproc, const char filename[]);
625
626 void build_xact_string(char *xact_name, char *service_name, DBINT commid, char *result);
627 RETCODE remove_xact(DBPROCESS * connect, DBINT commid, int n);
628 RETCODE abort_xact(DBPROCESS * connect, DBINT commid);
629 void close_commit(DBPROCESS * connect);
630 RETCODE commit_xact(DBPROCESS * connect, DBINT commid);
631 DBPROCESS *open_commit(LOGINREC * login, char *servername);
632 RETCODE scan_xact(DBPROCESS * connect, DBINT commid);
633 DBINT start_xact(DBPROCESS * connect, char *application_name, char *xact_name, int site_count);
634 DBINT stat_xact(DBPROCESS * connect, DBINT commid);
635
636 #endif /* define unimplemented */
637
638 BYTE *dbadata(DBPROCESS * dbproc, int computeid, int column);
639 DBINT dbadlen(DBPROCESS * dbproc, int computeid, int column);
640 RETCODE dbaltbind(DBPROCESS * dbprocess, int computeid, int column, int vartype, DBINT varlen, BYTE * varaddr);
641 RETCODE dbaltbind_ps(DBPROCESS * dbprocess, int computeid, int column, int vartype, DBINT varlen, BYTE * varaddr,
642 DBTYPEINFO * typeinfo);
643 int dbaltcolid(DBPROCESS * dbproc, int computeid, int column);
644 DBINT dbaltlen(DBPROCESS * dbproc, int computeid, int column);
645 int dbaltop(DBPROCESS * dbproc, int computeid, int column);
646 int dbalttype(DBPROCESS * dbproc, int computeid, int column);
647 DBINT dbaltutype(DBPROCESS * dbproc, int computeid, int column);
648 RETCODE dbanullbind(DBPROCESS * dbprocess, int computeid, int column, DBINT * indicator);
649 RETCODE dbbind(DBPROCESS * dbproc, int column, int vartype, DBINT varlen, BYTE * varaddr);
650 RETCODE dbbind_ps(DBPROCESS * dbprocess, int column, int vartype, DBINT varlen, BYTE * varaddr, DBTYPEINFO * typeinfo);
651 int dbbufsize(DBPROCESS * dbprocess);
652 BYTE *dbbylist(DBPROCESS * dbproc, int computeid, int *size);
653 RETCODE dbcancel(DBPROCESS * dbproc);
654 RETCODE dbcanquery(DBPROCESS * dbproc);
655 char *dbchange(DBPROCESS * dbprocess);
656 DBBOOL dbcharsetconv(DBPROCESS * dbprocess);
657 void dbclose(DBPROCESS * dbproc);
658 void dbclrbuf(DBPROCESS * dbproc, DBINT n);
659 RETCODE dbclropt(DBPROCESS * dbproc, int option, const char param[]);
660 RETCODE dbcmd(DBPROCESS * dbproc, const char cmdstring[]);
661 RETCODE dbcmdrow(DBPROCESS * dbproc);
662
663 #define DBCMDROW(x) dbcmdrow((x))
664 RETCODE dbtablecolinfo (DBPROCESS *dbproc, DBINT column, DBCOL *pdbcol );
665 RETCODE dbcolinfo (DBPROCESS *dbproc, CI_TYPE type, DBINT column, DBINT computeid, DBCOL *pdbcol);
666 DBINT dbcollen(DBPROCESS * dbproc, int column);
667 char *dbcolname(DBPROCESS * dbproc, int column);
668 char *dbcolsource(DBPROCESS * dbproc, int colnum);
669 int dbcoltype(DBPROCESS * dbproc, int column);
670 DBTYPEINFO *dbcoltypeinfo(DBPROCESS * dbproc, int column);
671 DBINT dbcolutype(DBPROCESS * dbprocess, int column);
672 DBINT dbconvert(DBPROCESS * dbproc, int srctype, const BYTE * src, DBINT srclen, int desttype, BYTE * dest, DBINT destlen);
673 DBINT dbconvert_ps(DBPROCESS * dbprocess, int srctype, const BYTE * src, DBINT srclen, int desttype, BYTE * dest, DBINT destlen,
674 DBTYPEINFO * typeinfo);
675 BOOL dbiscount(DBPROCESS * dbproc);
676 DBINT dbcount(DBPROCESS * dbproc);
677
678 #define DBCOUNT(x) dbcount((x))
679 int dbcurcmd(DBPROCESS * dbproc);
680
681 #define DBCURCMD(x) dbcurcmd((x))
682 DBINT dbcurrow(DBPROCESS * dbproc);
683
684 #define DBCURROW(x) dbcurrow((x))
685 BYTE *dbdata(DBPROCESS * dbproc, int column);
686 int dbdatecmp(DBPROCESS * dbproc, DBDATETIME * d1, DBDATETIME * d2);
687 RETCODE dbdatecrack(DBPROCESS * dbproc, DBDATEREC * di, DBDATETIME * dt);
688 DBINT dbdatlen(DBPROCESS * dbproc, int column);
689 DBBOOL dbdead(DBPROCESS * dbproc);
690
691 #define DBDEAD(x) dbdead((x))
692 EHANDLEFUNC dberrhandle(EHANDLEFUNC handler);
693 void dbexit(void);
694 RETCODE dbfcmd(DBPROCESS * dbproc, const char *fmt, ...);
695 DBINT dbfirstrow(DBPROCESS * dbproc);
696
697 #define DBFIRSTROW(x) dbfirstrow((x))
698 void dbfreebuf(DBPROCESS * dbproc);
699 char *dbgetchar(DBPROCESS * dbprocess, int n);
700 char *dbgetcharset(DBPROCESS * dbprocess);
701 int dbgetlusername(LOGINREC * login, BYTE * name_buffer, int buffer_len);
702 int dbgetmaxprocs(void);
703 char *dbgetnatlanf(DBPROCESS * dbprocess);
704 int dbgetpacket(DBPROCESS * dbproc);
705 RETCODE dbgetrow(DBPROCESS * dbproc, DBINT row);
706 int dbgettime(void);
707 #define DBGETTIME dbgettime
708 BYTE *dbgetuserdata(DBPROCESS * dbproc);
709 DBBOOL dbhasretstat(DBPROCESS * dbproc);
710 RETCODE dbinit(void);
711 int dbiordesc(DBPROCESS * dbproc);
712
713 #define DBIORDESC(x) dbiordesc((x))
714 int dbiowdesc(DBPROCESS * dbproc);
715
716 #define DBIOWDESC(x) dbiowdesc((x))
717 DBBOOL dbisavail(DBPROCESS * dbprocess);
718
719 #define DBISAVAIL(x) dbisavail((x))
720 DBBOOL dbisopt(DBPROCESS * dbproc, int option, const char param[]);
721 DBINT dblastrow(DBPROCESS * dbproc);
722
723 #define DBLASTROW(x) dblastrow((x))
724 LOGINREC *dblogin(void);
725 void dbloginfree(LOGINREC * login);
726
727 int dbmny4cmp(DBPROCESS * dbproc, DBMONEY4 * m1, DBMONEY4 * m2);
728 int dbmnycmp(DBPROCESS * dbproc, DBMONEY * m1, DBMONEY * m2);
729
730 RETCODE dbmny4add(DBPROCESS * dbproc, DBMONEY4 * m1, DBMONEY4 * m2, DBMONEY4 * sum);
731 RETCODE dbmnydec(DBPROCESS * dbproc, DBMONEY * mnyptr);
732 RETCODE dbmnyinc(DBPROCESS * dbproc, DBMONEY * mnyptr);
733 RETCODE dbmnymaxpos(DBPROCESS * dbproc, DBMONEY * dest);
734 RETCODE dbmnymaxneg(DBPROCESS * dbproc, DBMONEY * dest);
735 RETCODE dbmny4minus(DBPROCESS * dbproc, DBMONEY4 * src, DBMONEY4 * dest);
736 RETCODE dbmnyminus(DBPROCESS * dbproc, DBMONEY * src, DBMONEY * dest);
737 RETCODE dbmny4sub(DBPROCESS * dbproc, DBMONEY4 * m1, DBMONEY4 * m2, DBMONEY4 * diff);
738 RETCODE dbmnysub(DBPROCESS * dbproc, DBMONEY * m1, DBMONEY * m2, DBMONEY * diff);
739
740 RETCODE dbmny4copy(DBPROCESS * dbprocess, DBMONEY4 * m1, DBMONEY4 * m2);
741 RETCODE dbmnycopy(DBPROCESS * dbproc, DBMONEY * src, DBMONEY * dest);
742
743 RETCODE dbmny4zero(DBPROCESS * dbproc, DBMONEY4 * dest);
744 RETCODE dbmnyzero(DBPROCESS * dbproc, DBMONEY * dest);
745
746 const char *dbmonthname(DBPROCESS * dbproc, char *language, int monthnum, DBBOOL shortform);
747 RETCODE dbmorecmds(DBPROCESS * dbproc);
748
749 #define DBMORECMDS(x) dbmorecmds((x))
750 RETCODE dbmoretext(DBPROCESS * dbproc, DBINT size, const BYTE text[]);
751 MHANDLEFUNC dbmsghandle(MHANDLEFUNC handler);
752 char *dbname(DBPROCESS * dbproc);
753 STATUS dbnextrow(DBPROCESS * dbproc);
754 RETCODE dbnullbind(DBPROCESS * dbproc, int column, DBINT * indicator);
755 int dbnumalts(DBPROCESS * dbproc, int computeid);
756 int dbnumcols(DBPROCESS * dbproc);
757 int dbnumcompute(DBPROCESS * dbprocess);
758 int dbnumrets(DBPROCESS * dbproc);
759 DBPROCESS *tdsdbopen(LOGINREC * login, const char *server, int msdblib);
760 DBPROCESS *dbopen(LOGINREC * login, const char *server);
761
762 /* pivot functions */
763 struct col_t;
764 void dbpivot_count (struct col_t *output, const struct col_t *input);
765 void dbpivot_sum (struct col_t *output, const struct col_t *input);
766 void dbpivot_min (struct col_t *output, const struct col_t *input);
767 void dbpivot_max (struct col_t *output, const struct col_t *input);
768
769 struct pivot_t;
770 typedef void (*DBPIVOT_FUNC)(struct col_t *output, const struct col_t *input);
771 struct pivot_t * dbrows_pivoted(DBPROCESS *dbproc);
772 STATUS dbnextrow_pivoted(DBPROCESS *dbproc, struct pivot_t *pp);
773 RETCODE dbpivot(DBPROCESS *dbproc, int nkeys, int *keys, int ncols, int *cols, DBPIVOT_FUNC func, int val);
774
775 DBPIVOT_FUNC dbpivot_lookup_name( const char name[] );
776
777 #ifdef MSDBLIB
778 #define dbopen(x,y) tdsdbopen((x),(y), 1)
779 #else
780 #define dbopen(x,y) tdsdbopen((x),(y), 0)
781 #endif
782
783 /* fix PHP problem */
784 #ifdef PHP_SYBASE_DBOPEN
785 #undef PHP_SYBASE_DBOPEN
786 #define PHP_SYBASE_DBOPEN dbopen
787 #endif
788
789 void dbprhead(DBPROCESS * dbproc);
790 DBINT dbprcollen(DBPROCESS * dbproc, int column);
791 RETCODE dbprrow(DBPROCESS * dbproc);
792 const char *dbprtype(int token);
793 DBBOOL DRBUF(DBPROCESS * dbprocess);
794 STATUS dbreadtext(DBPROCESS * dbproc, void *buf, DBINT bufsize);
795 void dbrecftos(const char filename[]);
796 RETCODE dbresults(DBPROCESS * dbproc);
797 RETCODE dbresults_r(DBPROCESS * dbproc, int recursive);
798 BYTE *dbretdata(DBPROCESS * dbproc, int retnum);
799 int dbretlen(DBPROCESS * dbproc, int retnum);
800 char *dbretname(DBPROCESS * dbproc, int retnum);
801 DBINT dbretstatus(DBPROCESS * dbproc);
802 int dbrettype(DBPROCESS * dbproc, int retnum);
803 RETCODE dbrows(DBPROCESS * dbproc);
804
805 #define DBROWS(x) dbrows((x))
806 STATUS dbrowtype(DBPROCESS * dbprocess);
807
808 #define DBROWTYPE(x) dbrowtype((x))
809 RETCODE dbrpcinit(DBPROCESS * dbproc, const char rpcname[], DBSMALLINT options);
810 RETCODE dbrpcparam(DBPROCESS * dbproc, const char paramname[], BYTE status, int type, DBINT maxlen, DBINT datalen, BYTE * value);
811 RETCODE dbrpcsend(DBPROCESS * dbproc);
812 RETCODE dbsafestr(DBPROCESS * dbproc, const char *src, DBINT srclen, char *dest, DBINT destlen, int quotetype);
813 RETCODE *dbsechandle(DBINT type, INTFUNCPTR handler);
814 char *dbservcharset(DBPROCESS * dbprocess);
815 void dbsetavail(DBPROCESS * dbprocess);
816 void dbsetbusy(DBPROCESS * dbprocess, DB_DBBUSY_FUNC busyfunc);
817 RETCODE dbsetdefcharset(char *charset);
818 void dbsetidle(DBPROCESS * dbprocess, DB_DBIDLE_FUNC idlefunc);
819 void dbsetifile(char *filename);
820 void dbsetinterrupt(DBPROCESS * dbproc, DB_DBCHKINTR_FUNC chkintr, DB_DBHNDLINTR_FUNC hndlintr);
821 RETCODE dbsetlogintime(int seconds);
822 RETCODE dbsetmaxprocs(int maxprocs);
823 RETCODE dbsetnull(DBPROCESS * dbprocess, int bindtype, int bindlen, BYTE * bindval);
824 RETCODE dbsetopt(DBPROCESS * dbproc, int option, const char *char_param, int int_param);
825 STATUS dbsetrow(DBPROCESS * dbprocess, DBINT row);
826 RETCODE dbsettime(int seconds);
827 void dbsetuserdata(DBPROCESS * dbproc, BYTE * ptr);
828 RETCODE dbsetversion(DBINT version);
829
830 int dbspid(DBPROCESS * dbproc);
831 RETCODE dbspr1row(DBPROCESS * dbproc, char *buffer, DBINT buf_len);
832 DBINT dbspr1rowlen(DBPROCESS * dbproc);
833 RETCODE dbsprhead(DBPROCESS * dbproc, char *buffer, DBINT buf_len);
834 RETCODE dbsprline(DBPROCESS * dbproc, char *buffer, DBINT buf_len, DBCHAR line_char);
835 RETCODE dbsqlexec(DBPROCESS * dbproc);
836 RETCODE dbsqlok(DBPROCESS * dbproc);
837 RETCODE dbsqlsend(DBPROCESS * dbproc);
838 int dbstrbuild(DBPROCESS * dbproc, char *charbuf, int bufsize, char *text, char *formats, ...);
839 RETCODE dbstrcpy(DBPROCESS * dbproc, int start, int numbytes, char *dest);
840 int dbstrlen(DBPROCESS * dbproc);
841 DBINT dbvarylen(DBPROCESS * dbproc, int column);
842
843 #define SYBEVERDOWN 100 /* TDS version downgraded . */
844 #define SYBEICONVIU 2400 /* Some character(s) could not be converted into client's character set. */
845 #define SYBEICONVAVAIL 2401 /* Character set conversion is not available between client character set '%.*s' and server character set '%.*s'.*/
846 #define SYBEICONVO 2402 /* Error converting characters into server's character set. Some character(s) could not be converted.*/
847 #define SYBEICONVI 2403 /* Some character(s) could not be converted into client's character set. Unconverted bytes were changed to question marks ('?').*/
848 #define SYBEICONV2BIG 2404 /* Buffer overflow converting characters from client into server's character set.*/
849 /* cf. doc/dblib_errors.txt for more iconv error values. */
850 /* Reserve a few slots for other iconv-related issues. */
851 #define SYBETDSVER 2410 /* Cannot bcp with TDSVER < 5.0 */
852 #define SYBEPORT 2500 /* Both port and instance specified */
853 #define SYBESYNC 20001 /* Read attempted while out of synchronization with SQL Server. */
854 #define SYBEFCON 20002 /* SQL Server connection failed. */
855 #define SYBETIME 20003 /* SQL Server connection timed out. */
856 #define SYBEREAD 20004 /* Read from SQL Server failed. */
857 #define SYBEBUFL 20005 /* DB-LIBRARY internal error - send buffer length corrupted. */
858 #define SYBEWRIT 20006 /* Write to SQL Server failed. */
859 #define SYBEVMS 20007 /* Sendflush: VMS I/O error. */
860 #define SYBESOCK 20008 /* Unable to open socket */
861 #define SYBECONN 20009 /* Unable to connect socket -- SQL Server is unavailable or does not exist. */
862 #define SYBEMEM 20010 /* Unable to allocate sufficient memory */
863 #define SYBEDBPS 20011 /* Maximum number of DBPROCESSes already allocated. */
864 #define SYBEINTF 20012 /* Server name not found in interface file */
865 #define SYBEUHST 20013 /* Unknown host machine name */
866 #define SYBEPWD 20014 /* Incorrect password. */
867 #define SYBEOPIN 20015 /* Could not open interface file. */
868 #define SYBEINLN 20016 /* Interface file: unexpected end-of-line. */
869 #define SYBESEOF 20017 /* Unexpected EOF from SQL Server. */
870 #define SYBESMSG 20018 /* General SQL Server error: Check messages from the SQL Server. */
871 #define SYBERPND 20019 /* Attempt to initiate a new SQL Server operation with results pending. */
872 #define SYBEBTOK 20020 /* Bad token from SQL Server: Data-stream processing out of sync. */
873 #define SYBEITIM 20021 /* Illegal timeout value specified. */
874 #define SYBEOOB 20022 /* Error in sending out-of-band data to SQL Server. */
875 #define SYBEBTYP 20023 /* Unknown bind type passed to DB-LIBRARY function. */
876 #define SYBEBNCR 20024 /* Attempt to bind user variable to a non-existent compute row. */
877 #define SYBEIICL 20025 /* Illegal integer column length returned by SQL Server. Legal integer lengths are 1, 2, and 4 bytes. */
878 #define SYBECNOR 20026 /* Column number out of range. */
879 #define SYBENPRM 20027 /* NULL parameter not allowed for this dboption. */
880 #define SYBEUVDT 20028 /* Unknown variable-length datatype encountered. */
881 #define SYBEUFDT 20029 /* Unknown fixed-length datatype encountered. */
882 #define SYBEWAID 20030 /* DB-LIBRARY internal error: ALTFMT following ALTNAME has wrong id. */
883 #define SYBECDNS 20031 /* Datastream indicates that a compute column is derived from a non-existent select-list member. */
884 #define SYBEABNC 20032 /* Attempt to bind to a non-existent column. */
885 #define SYBEABMT 20033 /* User attempted a dbbind() with mismatched column and variable types. */
886 #define SYBEABNP 20034 /* Attempt to bind using NULL pointers. */
887 #define SYBEAAMT 20035 /* User attempted a dbaltbind() with mismatched column and variable types. */
888 #define SYBENXID 20036 /* The Server did not grant us a distributed-transaction ID. */
889 #define SYBERXID 20037 /* The Server did not recognize our distributed-transaction ID. */
890 #define SYBEICN 20038 /* Invalid computeid or compute column number. */
891 #define SYBENMOB 20039 /* No such member of 'order by' clause. */
892 #define SYBEAPUT 20040 /* Attempt to print unknown token. */
893 #define SYBEASNL 20041 /* Attempt to set fields in a null loginrec. */
894 #define SYBENTLL 20042 /* Name too long for loginrec field. */
895 #define SYBEASUL 20043 /* Attempt to set unknown loginrec field. */
896 #define SYBERDNR 20044 /* Attempt to retrieve data from a non-existent row. */
897 #define SYBENSIP 20045 /* Negative starting index passed to dbstrcpy(). */
898 #define SYBEABNV 20046 /* Attempt to bind to a NULL program variable. */
899 #define SYBEDDNE 20047 /* DBPROCESS is dead or not enabled. */
900 #define SYBECUFL 20048 /* Data-conversion resulted in underflow. */
901 #define SYBECOFL 20049 /* Data-conversion resulted in overflow. */
902 #define SYBECSYN 20050 /* Attempt to convert data stopped by syntax error in source field. */
903 #define SYBECLPR 20051 /* Data-conversion resulted in loss of precision. */
904 #define SYBECNOV 20052 /* Attempt to set variable to NULL resulted in overflow. */
905 #define SYBERDCN 20053 /* Requested data-conversion does not exist. */
906 #define SYBESFOV 20054 /* dbsafestr() overflowed its destination buffer. */
907 #define SYBEUNT 20055 /* Unknown network type found in interface file. */
908 #define SYBECLOS 20056 /* Error in closing network connection. */
909 #define SYBEUAVE 20057 /* Unable to allocate VMS event flag. */
910 #define SYBEUSCT 20058 /* Unable to set communications timer. */
911 #define SYBEEQVA 20059 /* Error in queueing VMS AST routine. */
912 #define SYBEUDTY 20060 /* Unknown datatype encountered. */
913 #define SYBETSIT 20061 /* Attempt to call dbtsput() with an invalid timestamp. */
914 #define SYBEAUTN 20062 /* Attempt to update the timestamp of a table which has no timestamp column. */
915 #define SYBEBDIO 20063 /* Bad bulk-copy direction. Must be either IN or OUT. */
916 #define SYBEBCNT 20064 /* Attempt to use Bulk Copy with a non-existent Server table. */
917 #define SYBEIFNB 20065 /* Illegal field number passed to bcp_control(). */
918 #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. */
919 #define SYBEKBCO 20067 /* 1000 rows successfully bulk-copied to host-file. */
920 #define SYBEBBCI 20068 /* Batch successfully bulk-copied to SQL Server. */
921 #define SYBEKBCI 20069 /* Bcp: 1000 rows sent to SQL Server. */
922 #define SYBEBCRE 20070 /* I/O error while reading bcp data-file. */
923 #define SYBETPTN 20071 /* Syntax error: only two periods are permitted in table names. */
924 #define SYBEBCWE 20072 /* I/O error while writing bcp data-file. */
925 #define SYBEBCNN 20073 /* Attempt to bulk-copy a NULL value into Server column %d, which does not accept NULL values. */
926 #define SYBEBCOR 20074 /* Attempt to bulk-copy an oversized row to the SQL Server. */
927 #define SYBEBCIS 20075 /* Attempt to bulk-copy an illegally-sized column value to the SQL Server. */
928 #define SYBEBCPI 20076 /* bcp_init() must be called before any other bcp routines. */
929 #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. */
930 #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. */
931 #define SYBEVDPT 20079 /* For bulk copy, all variable-length data must have either a length-prefix or a terminator specified. */
932 #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. */
933 #define SYBEBCBC 20081 /* bcp_columns() must be called before bcp_colfmt() and bcp_colfmt_ps(). */
934 #define SYBEBCFO 20082 /* Bcp host-files must contain at least one column. */
935 #define SYBEBCVH 20083 /* bcp_exec() may be called only after bcp_init() has been passed a valid host file. */
936 #define SYBEBCUO 20084 /* Bcp: Unable to open host data-file. */
937 #define SYBEBCUC 20085 /* Bcp: Unable to close host data-file. */
938 #define SYBEBUOE 20086 /* Bcp: Unable to open error-file. */
939 #define SYBEBUCE 20087 /* Bcp: Unable to close error-file. */
940 #define SYBEBWEF 20088 /* I/O error while writing bcp error-file. */
941 #define SYBEASTF 20089 /* VMS: Unable to setmode for control_c ast. */
942 #define SYBEUACS 20090 /* VMS: Unable to assign channel to sys$command. */
943 #define SYBEASEC 20091 /* Attempt to send an empty command buffer to the SQL Server. */
944 #define SYBETMTD 20092 /* Attempt to send too much TEXT data via the dbmoretext() call. */
945 #define SYBENTTN 20093 /* Attempt to use dbtxtsput() to put a new text-timestamp into a non-existent data row. */
946 #define SYBEDNTI 20094 /* Attempt to use dbtxtsput() to put a new text-timestamp into a column whose datatype is neither SYBTEXT nor SYBIMAGE. */
947 #define SYBEBTMT 20095 /* Attempt to send too much TEXT data via the bcp_moretext() call. */
948 #define SYBEORPF 20096 /* Attempt to set remote password would overflow the login-record's remote-password field. */
949 #define SYBEUVBF 20097 /* Attempt to read an unknown version of BCP format-file. */
950 #define SYBEBUOF 20098 /* Bcp: Unable to open format-file. */
951 #define SYBEBUCF 20099 /* Bcp: Unable to close format-file. */
952 #define SYBEBRFF 20100 /* I/O error while reading bcp format-file. */
953 #define SYBEBWFF 20101 /* I/O error while writing bcp format-file. */
954 #define SYBEBUDF 20102 /* Bcp: Unrecognized datatype found in format-file. */
955 #define SYBEBIHC 20103 /* Incorrect host-column number found in bcp format-file. */
956 #define SYBEBEOF 20104 /* Unexpected EOF encountered in BCP data-file. */
957 #define SYBEBCNL 20105 /* Negative length-prefix found in BCP data-file. */
958 #define SYBEBCSI 20106 /* Host-file columns may be skipped only when copying INto the Server. */
959 #define SYBEBCIT 20107 /* It's illegal to use BCP terminators with program variables other than SYBCHAR, SYBBINARY, SYBTEXT, or SYBIMAGE. */
960 #define SYBEBCSA 20108 /* The BCP hostfile '%s' contains only %ld rows. Skipping all of these rows is not allowed. */
961 #define SYBENULL 20109 /* NULL DBPROCESS pointer passed to DB-Library. */
962 #define SYBEUNAM 20110 /* Unable to get current username from operating system. */
963 #define SYBEBCRO 20111 /* The BCP hostfile '%s' contains only %ld rows. It was impossible to read the requested %ld rows. */
964 #define SYBEMPLL 20112 /* Attempt to set maximum number of DBPROCESSes lower than 1. */
965 #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. */
966 #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. */
967 #define SYBEUNOP 20115 /* Unknown option passed to dbsetopt(). */
968 #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. */
969 #define SYBERTCC 20117 /* dbreadtext() may not be used to receive the results of a query which contains a COMPUTE clause. */
970 #define SYBERTSC 20118 /* dbreadtext() may only be used to receive the results of a query which contains a single result column. */
971 #define SYBEUCRR 20119 /* Internal software error: Unknown connection result reported by * dbpasswd(). */
972 #define SYBERPNA 20120 /* The RPC facility is available only when using a SQL Server whose version number is 4.0 or greater. */
973 #define SYBEOPNA 20121 /* The text/image facility is available only when using a SQL Server whose version number is 4.0 or greater. */
974 #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. */
975 #define SYBECWLL 20123 /* Attempt to set column width less than 1. */
976 #define SYBEUFDS 20124 /* Unrecognized format encountered in dbstrbuild(). */
977 #define SYBEUCPT 20125 /* Unrecognized custom-format parameter-type encountered in dbstrbuild(). */
978 #define SYBETMCF 20126 /* Attempt to install too many custom formats via dbfmtinstall(). */
979 #define SYBEAICF 20127 /* Error in attempting to install custom format. */
980 #define SYBEADST 20128 /* Error in attempting to determine the size of a pair of translation tables. */
981 #define SYBEALTT 20129 /* Error in attempting to load a pair of translation tables. */
982 #define SYBEAPCT 20130 /* Error in attempting to perform a character-set translation. */
983 #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. */
984 #define SYBEFSHD 20132 /* Error in attempting to find the Sybase home directory. */
985 #define SYBEAOLF 20133 /* Error in attempting to open a localization file. */
986 #define SYBEARDI 20134 /* Error in attempting to read datetime information from a localization file. */
987 #define SYBEURCI 20135 /* Unable to read copyright information from the dblib localization file. */
988 #define SYBEARDL 20136 /* Error in attempting to read the dblib.loc localization file. */
989 #define SYBEURMI 20137 /* Unable to read money-format information from the dblib localization file. */
990 #define SYBEUREM 20138 /* Unable to read error mnemonic from the dblib localization file. */
991 #define SYBEURES 20139 /* Unable to read error string from the dblib localization file. */
992 #define SYBEUREI 20140 /* Unable to read error information from the dblib localization file. */
993 #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. */
994 #define SYBEISOI 20142 /* Invalid sort-order information found. */
995 #define SYBEIDCL 20143 /* Illegal datetime column length returned by DataServer. Legal datetime lengths are 4 and 8 bytes. */
996 #define SYBEIMCL 20144 /* Illegal money column length returned by DataServer. Legal money lengths are 4 and 8 bytes. */
997 #define SYBEIFCL 20145 /* Illegal floating-point column length returned by DataServer. Legal floating-point lengths are 4 and 8 bytes. */
998 #define SYBEUTDS 20146 /* Unrecognized TDS version received from SQL Server. */
999 #define SYBEBUFF 20147 /* Bcp: Unable to create format-file. */
1000 #define SYBEACNV 20148 /* Attemp to do conversion with NULL destination variable. */
1001 #define SYBEDPOR 20149 /* Out-of-range datepart constant. */
1002 #define SYBENDC 20150 /* Cannot have negative component in date in numeric form. */
1003 #define SYBEMVOR 20151 /* Month values must be between 1 and 12. */
1004 #define SYBEDVOR 20152 /* Day values must be between 1 and 7. */
1005 #define SYBENBVP 20153 /* Cannot pass dbsetnull() a NULL bindval pointer. */
1006 #define SYBESPID 20154 /* Called dbspid() with a NULL dbproc. */
1007 #define SYBENDTP 20155 /* Called dbdatecrack() with a NULL datetime parameter. */
1008 #define SYBEXTN 20156 /* The xlt_todisp and xlt_tosrv parameters to dbfree_xlate() were NULL. */
1009 #define SYBEXTDN 20157 /* Warning: the xlt_todisp parameter to dbfree_xlate() was NULL. The space associated with the xlt_tosrv parameter has been freed. */
1010 #define SYBEXTSN 20158 /* Warning: the xlt_tosrv parameter to dbfree_xlate() was NULL. The space associated with the xlt_todisp parameter has been freed. */
1011 #define SYBENUM 20159 /* Incorrect number of arguments given to DB-Library. */
1012 #define SYBETYPE 20160 /* Invalid argument type given to DB-Library. */
1013 #define SYBEGENOS 20161 /* General Operating System Error. */
1014 #define SYBEPAGE 20162 /* wrong resource type or length given for dbpage() operation. */
1015 #define SYBEOPTNO 20163 /* Option is not allowed or is unreconized */
1016 #define SYBEETD 20164 /* Failure to send the expected amount of TEXT or IMAGE data via dbmoretext(). */
1017 #define SYBERTYPE 20165 /* Invalid resource type given to DB-Library. */
1018 #define SYBERFILE 20166 /* "Can not open resource file." */
1019 #define SYBEFMODE 20167 /* Read/Write/Append mode denied on file. */
1020 #define SYBESLCT 20168 /* Could not select or copy field specified */
1021 #define SYBEZTXT 20169 /* Attempt to send zero length TEXT or IMAGE to dataserver via dbwritetext(). */
1022 #define SYBENTST 20170 /* The file being opened must be a stream_lf. */
1023 #define SYBEOSSL 20171 /* Operating system login level not in range of Secure SQL Server */
1024 #define SYBEESSL 20172 /* Login security level entered does not agree with operating system level */
1025 #define SYBENLNL 20173 /* Program not linked with specified network library. */
1026 #define SYBENHAN 20174 /* called dbrecvpassthru() with a NULL handler parameter. */
1027 #define SYBENBUF 20175 /* called dbsendpassthru() with a NULL buf pointer. */
1028 #define SYBENULP 20176 /* Called %s with a NULL %s parameter. */
1029 #define SYBENOTI 20177 /* No event handler installed. */
1030 #define SYBEEVOP 20178 /* Called dbregwatch() with a bad options parameter. */
1031 #define SYBENEHA 20179 /* Called dbreghandle() with a NULL handler parameter. */
1032 #define SYBETRAN 20180 /* DBPROCESS is being used for another transaction. */
1033 #define SYBEEVST 20181 /* Must initiate a transaction before calling dbregparam(). */
1034 #define SYBEEINI 20182 /* Must call dbreginit() before dbregraise(). */
1035 #define SYBEECRT 20183 /* Must call dbregdefine() before dbregcreate(). */
1036 #define SYBEECAN 20184 /* Attempted to cancel unrequested event notification. */
1037 #define SYBEEUNR 20185 /* Unsolicited event notification received. */
1038 #define SYBERPCS 20186 /* Must call dbrpcinit() before dbrpcparam(). */
1039 #define SYBETPAR 20187 /* No SYBTEXT or SYBIMAGE parameters were defined. */
1040 #define SYBETEXS 20188 /* Called dbmoretext() with a bad size parameter. */
1041 #define SYBETRAC 20189 /* Attempted to turn off a trace flag that was not on. */
1042 #define SYBETRAS 20190 /* DB-Library internal error - trace structure not found. */
1043 #define SYBEPRTF 20191 /* dbtracestring() may only be called from a printfunc(). */
1044 #define SYBETRSN 20192 /* Bad numbytes parameter passed to dbtracestring(). */
1045 #define SYBEBPKS 20193 /* In DBSETLPACKET(), the packet size parameter must be between 0 and 999999. */
1046 #define SYBEIPV 20194 /* %1! is an illegal value for the %2! parameter of %3!. */
1047 #define SYBEMOV 20195 /* Money arithmetic resulted in overflow in function %1!. */
1048 #define SYBEDIVZ 20196 /* Attempt to divide by $0.00 in function %1!. */
1049 #define SYBEASTL 20197 /* Synchronous I/O attempted at AST level. */
1050 #define SYBESEFA 20198 /* DBSETNOTIFS cannot be called if connections are present. */
1051 #define SYBEPOLL 20199 /* Only one dbpoll() can be active at a time. */
1052 #define SYBENOEV 20200 /* dbpoll() cannot be called if registered procedure notifications have been disabled. */
1053 #define SYBEBADPK 20201 /* Packet size of %1! not supported. -- size of %2! used instead. */
1054 #define SYBESECURE 20202 /* Secure Server function not supported in this version. */
1055 #define SYBECAP 20203 /* DB-Library capabilities not accepted by the Server. */
1056 #define SYBEFUNC 20204 /* Functionality not supported at the specified version level. */
1057 #define SYBERESP 20205 /* Response function address passed to dbresponse() must be non-NULL. */
1058 #define SYBEIVERS 20206 /* Illegal version level specified. */
1059 #define SYBEONCE 20207 /* Function can be called only once. */
1060 #define SYBERPNULL 20208 /* value parameter for dbprcparam() can be NULL, only if the datalen parameter is 0 */
1061 #define SYBERPTXTIM 20209 /* RPC parameters cannot be of type Text/Image. */
1062 #define SYBENEG 20210 /* Negotiated login attempt failed. */
1063 #define SYBELBLEN 20211 /* Security labels should be less than 256 characters long. */
1064 #define SYBEUMSG 20212 /* Unknown message-id in MSG datastream. */
1065 #define SYBECAPTYP 20213 /* Unexpected capability type in CAPABILITY datastream. */
1066 #define SYBEBNUM 20214 /* Bad numbytes parameter passed to dbstrcpy() */
1067 #define SYBEBBL 20215 /* Bad bindlen parameter passed to dbsetnull() */
1068 #define SYBEBPREC 20216 /* Illegal precision specified */
1069 #define SYBEBSCALE 20217 /* Illegal scale specified */
1070 #define SYBECDOMAIN 20218 /* Source field value is not within the domain of legal values. */
1071 #define SYBECINTERNAL 20219 /* Internal Conversion error. */
1072 #define SYBEBTYPSRV 20220 /* Datatype is not supported by the server. */
1073 #define SYBEBCSET 20221 /* Unknown character-set encountered." */
1074 #define SYBEFENC 20222 /* Password Encryption failed." */
1075 #define SYBEFRES 20223 /* Challenge-Response function failed.", */
1076 #define SYBEISRVPREC 20224 /* Illegal precision value returned by the server. */
1077 #define SYBEISRVSCL 20225 /* Illegal scale value returned by the server. */
1078 #define SYBEINUMCL 20226 /* Invalid numeric column length returned by the server. */
1079 #define SYBEIDECCL 20227 /* Invalid decimal column length returned by the server. */
1080 #define SYBEBCMTXT 20228 /* bcp_moretext() may be used only when there is at least one text or image column in the server table. */
1081 #define SYBEBCPREC 20229 /* Column %1!: Illegal precision value encountered. */
1082 #define SYBEBCBNPR 20230 /* bcp_bind(): if varaddr is NULL, prefixlen must be 0 and no terminator should be specified. */
1083 #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. */
1084 #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. */
1085 #define SYBEBCPCTYP 20233 /* bcp_colfmt(): If table_colnum is 0, host_type cannot be 0. */
1086 #define SYBEBCVLEN 20234 /* varlen should be greater than or equal to -1. */
1087 #define SYBEBCHLEN 20235 /* host_collen should be greater than or equal to -1. */
1088 #define SYBEBCBPREF 20236 /* Illegal prefix length. Legal values are 0, 1, 2 or 4. */
1089 #define SYBEBCPREF 20237 /* Illegal prefix length. Legal values are -1, 0, 1, 2 or 4. */
1090 #define SYBEBCITBNM 20238 /* bcp_init(): tblname parameter cannot be NULL. */
1091 #define SYBEBCITBLEN 20239 /* bcp_init(): tblname parameter is too long. */
1092 #define SYBEBCSNDROW 20240 /* bcp_sendrow() may NOT be called unless all text data for the previous row has been sent using bcp_moretext(). */
1093 #define SYBEBPROCOL 20241 /* bcp protocol error: returned column count differs from the actual number of columns received. */
1094 #define SYBEBPRODEF 20242 /* bcp protocol error: expected default information and got none. */
1095 #define SYBEBPRONUMDEF 20243 /* bcp protocol error: expected number of defaults differs from the actual number of defaults received. */
1096 #define SYBEBPRODEFID 20244 /* bcp protocol error: default column id and actual column id are not same */
1097 #define SYBEBPRONODEF 20245 /* bcp protocol error: default value received for column that does not have default. */
1098 #define SYBEBPRODEFTYP 20246 /* bcp protocol error: default value datatype differs from column datatype. */
1099 #define SYBEBPROEXTDEF 20247 /* bcp protocol error: more than one row of default information received. */
1100 #define SYBEBPROEXTRES 20248 /* bcp protocol error: unexpected set of results received. */
1101 #define SYBEBPROBADDEF 20249 /* bcp protocol error: illegal default column id received. */
1102 #define SYBEBPROBADTYP 20250 /* bcp protocol error: unknown column datatype. */
1103 #define SYBEBPROBADLEN 20251 /* bcp protocol error: illegal datatype length received. */
1104 #define SYBEBPROBADPREC 20252 /* bcp protocol error: illegal precision value received. */
1105 #define SYBEBPROBADSCL 20253 /* bcp protocol error: illegal scale value received. */
1106 #define SYBEBADTYPE 20254 /* Illegal value for type parameter given to %1!. */
1107 #define SYBECRSNORES 20255 /* Cursor statement generated no results. */
1108 #define SYBECRSNOIND 20256 /* One of the tables involved in the cursor statement does not have a unique index. */
1109 #define SYBECRSVIEW 20257 /* A view cannot be joined with another table or a view in a cursor statement. */
1110 #define SYBECRSVIIND 20258 /* The view used in the cursor statement does not include all the unique index columns of the underlying tables. */
1111 #define SYBECRSORD 20259 /* Only fully keyset driven cursors can have 'order by', ' group by', or 'having' phrases. */
1112 #define SYBECRSBUFR 20260 /* Row buffering should not be turned on when using cursor APIs. */
1113 #define SYBECRSNOFREE 20261 /* The DBNOAUTOFREE option should not be turned on when using cursor APIs. */
1114 #define SYBECRSDIS 20262 /* Cursor statement contains one of the disallowed phrases 'compute', 'union', 'for browse', or 'select into'. */
1115 #define SYBECRSAGR 20263 /* Aggregate functions are not allowed in a cursor statement. */
1116 #define SYBECRSFRAND 20264 /* Fetch types RANDOM and RELATIVE can only be used within the keyset of keyset driven cursors. */
1117 #define SYBECRSFLAST 20265 /* Fetch type LAST requires fully keyset driven cursors. */
1118 #define SYBECRSBROL 20266 /* Backward scrolling cannot be used in a forward scrolling cursor. */
1119 #define SYBECRSFROWN 20267 /* Row number to be fetched is outside valid range. */
1120 #define SYBECRSBSKEY 20268 /* Keyset cannot be scrolled backward in mixed cursors with a previous fetch type. */
1121 #define SYBECRSRO 20269 /* Data locking or modifications cannot be made in a READONLY cursor. */
1122 #define SYBECRSNOCOUNT 20270 /* The DBNOCOUNT option should not be turned on when doing updates or deletes with dbcursor(). */
1123 #define SYBECRSTAB 20271 /* Table name must be determined in operations involving data locking or modifications. */
1124 #define SYBECRSUPDNB 20272 /* Update or insert operations cannot use bind variables when binding type is NOBIND. */
1125 #define SYBECRSNOWHERE 20273 /* A WHERE clause is not allowed in a cursor update or insert. */
1126 #define SYBECRSSET 20274 /* A SET clause is required for a cursor update or insert. */
1127 #define SYBECRSUPDTAB 20275 /* Update or insert operations using bind variables require single table cursors. */
1128 #define SYBECRSNOUPD 20276 /* Update or delete operation did not affect any rows. */
1129 #define SYBECRSINV 20277 /* Invalid cursor statement. */
1130 #define SYBECRSNOKEYS 20278 /* The entire keyset must be defined for KEYSET cursors. */
1131 #define SYBECRSNOBIND 20279 /* Cursor bind must be called prior to updating cursor */
1132 #define SYBECRSFTYPE 20280 /* Unknown fetch type. */
1133 #define SYBECRSINVALID 20281 /* The cursor handle is invalid. */
1134 #define SYBECRSMROWS 20282 /* Multiple rows are returned, only one is expected. */
1135 #define SYBECRSNROWS 20283 /* No rows returned, at least one is expected. */
1136 #define SYBECRSNOLEN 20284 /* No unique index found. */
1137 #define SYBECRSNOPTCC 20285 /* No OPTCC was found. */
1138 #define SYBECRSNORDER 20286 /* The order of clauses must be from, where, and order by. */
1139 #define SYBECRSNOTABLE 20287 /* Table name is NULL. */
1140 #define SYBECRSNUNIQUE 20288 /* No unique keys associated with this view. */
1141 #define SYBECRSVAR 20289 /* There is no valid address associated with this bind. */
1142 #define SYBENOVALUE 20290 /* Security labels require both a name and a value */
1143 #define SYBEVOIDRET 20291 /* Parameter of type SYBVOID cannot be a return parameter. */
1144 #define SYBECLOSEIN 20292 /* Unable to close interface file. */
1145 #define SYBEBOOL 20293 /* Boolean parameters must be TRUE or FALSE. */
1146 #define SYBEBCPOPT 20294 /* The option cannot be called while a bulk copy operation is progress. */
1147 #define SYBEERRLABEL 20295 /* An illegal value was returned from the security label handler. */
1148 #define SYBEATTNACK 20296 /* Timed out waiting for server to acknowledge attention." */
1149 #define SYBEBBFL 20297 /* -001- Batch failed in bulk-copy to SQL Server */
1150 #define SYBEDCL 20298 /* -004- DCL Error */
1151 #define SYBECS 20299 /* -004- cs context Error */
1152 #define SYBEBULKINSERT 20599 /* cannot build bulk insert statement */
1153 #define SYBECOLSIZE 22000 /* Invalid column information structure size */
1154
1155 int dbtds(DBPROCESS * dbprocess);
1156
1157 #define DBTDS(a) dbtds(a)
1158 DBINT dbtextsize(DBPROCESS * dbprocess);
1159 DBBINARY *dbtxptr(DBPROCESS * dbproc, int column);
1160 DBBINARY *dbtxtimestamp(DBPROCESS * dbproc, int column);
1161 DBBINARY *dbtxtsnewval(DBPROCESS * dbprocess);
1162 RETCODE dbtxtsput(DBPROCESS * dbprocess, DBBINARY newtxts, int colnum);
1163 RETCODE dbuse(DBPROCESS * dbproc, const char *name);
1164 const char *dbversion(void);
1165 DBBOOL dbwillconvert(int srctype, int desttype);
1166 RETCODE dbwritetext(DBPROCESS * dbproc, char *objname, DBBINARY * textptr, DBTINYINT textptrlen, DBBINARY * timestamp,
1167 DBBOOL log, DBINT size, BYTE * text);
1168
1169 /* LOGINREC manipulation */
1170 RETCODE dbsetlname(LOGINREC * login, const char *value, int which);
1171 RETCODE dbsetlbool(LOGINREC * login, int value, int which);
1172 RETCODE dbsetllong(LOGINREC * login, long value, int which);
1173 RETCODE dbsetlversion (LOGINREC * login, BYTE version);
1174
1175 #define DBSETHOST 1
1176 #define DBSETLHOST(x,y) dbsetlname((x), (y), DBSETHOST)
1177 #define dbsetlhost(x,y) dbsetlname((x), (y), DBSETHOST)
1178 #define DBSETUSER 2
1179 #define DBSETLUSER(x,y) dbsetlname((x), (y), DBSETUSER)
1180 #define dbsetluser(x,y) dbsetlname((x), (y), DBSETUSER)
1181 #define DBSETPWD 3
1182 #define DBSETLPWD(x,y) dbsetlname((x), (y), DBSETPWD)
1183 #define dbsetlpwd(x,y) dbsetlname((x), (y), DBSETPWD)
1184 #if defined(DBLIB_UNIMPLEMENTED)
1185 # define DBSETHID 4 /* not implemented */
1186 # define DBSETLHID(x,y) dbsetlname((x), (y), DBSETHID)
1187 #endif
1188 #define DBSETAPP 5
1189 #define DBSETLAPP(x,y) dbsetlname((x), (y), DBSETAPP)
1190 #define dbsetlapp(x,y) dbsetlname((x), (y), DBSETAPP)
1191 #define DBSETBCP 6
1192 #define BCP_SETL(x,y) dbsetlbool((x), (y), DBSETBCP)
1193 #define DBSETLSECURE(x) dbsetlbool((x), (1), DBSETBCP)
1194 #define DBSETNATLANG 7
1195 #define DBSETLNATLANG(x,y) dbsetlname((x), (y), DBSETNATLANG)
1196 #define dbsetlnatlang(x,y) dbsetlname((x), (y), DBSETNATLANG)
1197 #if defined(DBLIB_UNIMPLEMENTED)
1198 # define DBSETNOSHORT 8 /* not implemented */
1199 # define DBSETLNOSHORT(x,y) dbsetlbool((x), (y), DBSETNOSHORT)
1200 # define DBSETHIER 9 /* not implemented */
1201 # define DBSETLHIER(x,y) dbsetlshort((x), (y), DBSETHIER)
1202 #endif
1203 #define DBSETCHARSET 10
1204 #define DBSETLCHARSET(x,y) dbsetlname((x), (y), DBSETCHARSET)
1205 #define DBSETPACKET 11
1206 #define DBSETLPACKET(x,y) dbsetllong((x), (y), DBSETPACKET)
1207 #define dbsetlpacket(x,y) dbsetllong((x), (y), DBSETPACKET)
1208 #define DBSETENCRYPT 12
1209 #define DBSETLENCRYPT(x,y) dbsetlbool((x), (y), DBSETENCRYPT)
1210 #define DBSETLABELED 13
1211 #define DBSETLLABELED(x,y) dbsetlbool((x), (y), DBSETLABELED)
1212 #define BCP_SETLABELED(x,y) dbsetlbool((x), (y), DBSETLABELED)
1213 #define DBSETDBNAME 14
1214 #define DBSETLDBNAME(x,y) dbsetlname((x), (y), DBSETDBNAME)
1215 #define DBSETLVERSION(login, version) dbsetlversion((login), (version))
1216
1217 RETCODE bcp_init(DBPROCESS * dbproc, const char *tblname, const char *hfile, const char *errfile, int direction);
1218 DBINT bcp_done(DBPROCESS * dbproc);
1219
1220 DBINT bcp_batch(DBPROCESS * dbproc);
1221 RETCODE bcp_bind(DBPROCESS * dbproc, BYTE * varaddr, int prefixlen, DBINT varlen, BYTE * terminator, int termlen, int type,
1222 int table_column);
1223 RETCODE bcp_collen(DBPROCESS * dbproc, DBINT varlen, int table_column);
1224 RETCODE bcp_columns(DBPROCESS * dbproc, int host_colcount);
1225 RETCODE bcp_colfmt(DBPROCESS * dbproc, int host_column, int host_type, int host_prefixlen, DBINT host_collen,
1226 const BYTE * host_term, int host_termlen, int colnum);
1227 RETCODE bcp_colfmt_ps(DBPROCESS * dbproc, int host_column, int host_type, int host_prefixlen, DBINT host_collen,
1228 BYTE * host_term, int host_termlen, int colnum, DBTYPEINFO * typeinfo);
1229 RETCODE bcp_colptr(DBPROCESS * dbproc, BYTE * colptr, int table_column);
1230 RETCODE bcp_control(DBPROCESS * dbproc, int field, DBINT value);
1231 int bcp_getbatchsize(DBPROCESS * dbproc); /* FreeTDS only */
1232 RETCODE bcp_exec(DBPROCESS * dbproc, DBINT * rows_copied);
1233 DBBOOL bcp_getl(LOGINREC * login);
1234 RETCODE bcp_options(DBPROCESS * dbproc, int option, BYTE * value, int valuelen);
1235 RETCODE bcp_readfmt(DBPROCESS * dbproc, const char filename[]);
1236 RETCODE bcp_sendrow(DBPROCESS * dbproc);
1237
1238 #ifdef __cplusplus
1239 #if 0
1240 {
1241 #endif
1242 }
1243 #endif
1244
1245 #endif
dbbind
RETCODE dbbind(DBPROCESS *dbproc, int column, int vartype, DBINT varlen, BYTE *varaddr)
Tie a host variable to a resultset column.
Definition: dblib.c:2580
dbretstatus
DBINT dbretstatus(DBPROCESS *dbproc)
Fetch status value returned by query or remote procedure call.
Definition: dblib.c:4476
dbnumalts
int dbnumalts(DBPROCESS *dbproc, int computeid)
Get count of columns in a compute row.
Definition: dblib.c:4745
DBVARYBIN
Definition: sybdb.h:251
dbcancel
RETCODE dbcancel(DBPROCESS *dbproc)
Cancel the current command batch.
Definition: dblib.c:3199
dbexit
void dbexit(void)
Close server connections and free all related structures.
Definition: dblib.c:1527
dbmny4sub
RETCODE dbmny4sub(DBPROCESS *dbproc, DBMONEY4 *m1, DBMONEY4 *m2, DBMONEY4 *diff)
Subtract two DBMONEY4 values.
Definition: dblib.c:5429
DBCOL
Definition: sybdb.h:323
dbhasretstat
DBBOOL dbhasretstat(DBPROCESS *dbproc)
Determine if query generated a return status number.
Definition: dblib.c:4452
dbsetlogintime
RETCODE dbsetlogintime(int seconds)
Set maximum seconds db-lib waits for a server response to a login attempt.
Definition: dblib.c:4046
dbtxtimestamp
DBBINARY * dbtxtimestamp(DBPROCESS *dbproc, int column)
Get text timestamp for a column in the current row.
Definition: dblib.c:6295
bcp_readfmt
RETCODE bcp_readfmt(DBPROCESS *dbproc, const char filename[])
Read a format definition file.
Definition: bcp.c:1614
dbcoltype
int dbcoltype(DBPROCESS *dbproc, int column)
Get the datatype of a regular result set column.
Definition: dblib.c:2837
dbcollen
DBINT dbcollen(DBPROCESS *dbproc, int column)
Get size of a regular result column.
Definition: dblib.c:3040
bcp_getl
DBBOOL bcp_getl(LOGINREC *login)
See if BCP_SETL() was used to set the LOGINREC for BCP work.
Definition: bcp.c:693
tds_dblib_dbprocess
Definition: dblib.h:125
dbrpcsend
RETCODE dbrpcsend(DBPROCESS *dbproc)
Execute the procedure and free associated memory.
Definition: rpc.c:278
dbmnymaxpos
RETCODE dbmnymaxpos(DBPROCESS *dbproc, DBMONEY *dest)
Get maximum positive DBMONEY value supported.
Definition: dblib.c:5150
dbcmd
RETCODE dbcmd(DBPROCESS *dbproc, const char cmdstring[])
Append SQL to the command buffer.
Definition: dblib.c:1336
dbiscount
BOOL dbiscount(DBPROCESS *dbproc)
Indicates whether or not the count returned by dbcount is real (Microsoft-compatibility feature)...
Definition: dblib.c:2750
dbmnyinc
RETCODE dbmnyinc(DBPROCESS *dbproc, DBMONEY *mnyptr)
Add $0.0001 to a DBMONEY value.
Definition: dblib.c:5268
DBDATETIME4
Definition: sybdb.h:283
dbgetchar
char * dbgetchar(DBPROCESS *dbprocess, int n)
Get address of a position in the command buffer.
Definition: dblib.c:6078
dbsetlname
RETCODE dbsetlname(LOGINREC *login, const char *value, int which)
Set the value of a string in a LOGINREC structure.
Definition: dblib.c:763
dbprhead
void dbprhead(DBPROCESS *dbproc)
Print result set headings to stdout.
Definition: dblib.c:3768
dbcmdrow
RETCODE dbcmdrow(DBPROCESS *dbproc)
See if the current command can return rows.
Definition: dblib.c:4067
dbinit
RETCODE dbinit(void)
Initialize db-lib.
Definition: dblib.c:668
dbgetpacket
int dbgetpacket(DBPROCESS *dbproc)
Get TDS packet size for the connection.
Definition: dblib.c:3884
dbsetmaxprocs
RETCODE dbsetmaxprocs(int maxprocs)
Set maximum simultaneous connections db-lib will open to the server.
Definition: dblib.c:3908
dbsetversion
RETCODE dbsetversion(DBINT version)
Specify a db-lib version level.
Definition: dblib.c:5759
DBNUMERIC
Definition: sybdb.h:257
dbwillconvert
DBBOOL dbwillconvert(int srctype, int desttype)
Test whether or not a datatype can be converted to another datatype.
Definition: dblib.c:2820
dbmsghandle
MHANDLEFUNC dbmsghandle(MHANDLEFUNC handler)
Set a message handler, for messages from the server.
Definition: dblib.c:4945
DBMONEY
Definition: sybdb.h:266
dbaltlen
DBINT dbaltlen(DBPROCESS *dbproc, int computeid, int column)
Get size of data in compute column.
Definition: dblib.c:6904
dbfreebuf
void dbfreebuf(DBPROCESS *dbproc)
Erase the command buffer, in case DBNOAUTOFREE was set with dbsetopt().
Definition: dblib.c:5843
dbnumcols
int dbnumcols(DBPROCESS *dbproc)
Return number of regular columns in a result set.
Definition: dblib.c:1825
dbloginfree
void dbloginfree(LOGINREC *login)
free the LOGINREC
Definition: dblib.c:741
col_t
Definition: dbpivot.c:79
dbconvert
DBINT dbconvert(DBPROCESS *dbproc, int srctype, const BYTE *src, DBINT srclen, int desttype, BYTE *dest, DBINT destlen)
Convert one datatype to another.
Definition: dblib.c:2229
dbsprhead
RETCODE dbsprhead(DBPROCESS *dbproc, char *buffer, DBINT buf_len)
Print result set headings to a buffer.
Definition: dblib.c:3705
dbmny4copy
RETCODE dbmny4copy(DBPROCESS *dbprocess, DBMONEY4 *m1, DBMONEY4 *m2)
Copy a DBMONEY4 value.
Definition: dblib.c:5545
dbtypeinfo
Definition: sybdb.h:304
dbretdata
BYTE * dbretdata(DBPROCESS *dbproc, int retnum)
Get value of an output parameter filled by a stored procedure.
Definition: dblib.c:4555
dbdatecrack
RETCODE dbdatecrack(DBPROCESS *dbproc, DBDATEREC *di, DBDATETIME *dt)
Break a DBDATETIME value into useful pieces.
Definition: dblib.c:5615
dbrecftos
void dbrecftos(const char filename[])
Record to a file all SQL commands sent to the server.
Definition: dblib.c:6535
dbadlen
DBINT dbadlen(DBPROCESS *dbproc, int computeid, int column)
Get size of data in a compute column.
Definition: dblib.c:4118
dbstrlen
int dbstrlen(DBPROCESS *dbproc)
Get size of the command buffer, in bytes.
Definition: dblib.c:6059
dbrowtype
STATUS dbrowtype(DBPROCESS *dbprocess)
Get returned row's type.
Definition: dblib.c:5969
dbdead
DBBOOL dbdead(DBPROCESS *dbproc)
Check if dbproc is an ex-parrot.
Definition: dblib.c:4863
dbadata
BYTE * dbadata(DBPROCESS *dbproc, int computeid, int column)
Get address of compute column data.
Definition: dblib.c:4231
dbdata
BYTE * dbdata(DBPROCESS *dbproc, int column)
Get address of data in a regular result column.
Definition: dblib.c:3166
dbiordesc
int dbiordesc(DBPROCESS *dbproc)
Get file descriptor of the socket used by a DBPROCESS to read data coming from the server...
Definition: dblib.c:6998
dbcount
DBINT dbcount(DBPROCESS *dbproc)
Get count of rows processed.
Definition: dblib.c:2770
dbname
char * dbname(DBPROCESS *dbproc)
Get name of current database.
Definition: dblib.c:6773
dbfcmd
RETCODE dbfcmd(DBPROCESS *dbproc, const char *fmt,...)
printf-like way to form SQL to send to the server.
Definition: dblib.c:1297
bcp_collen
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
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.
Definition: dbpivot.c:905
dbmny4minus
RETCODE dbmny4minus(DBPROCESS *dbproc, DBMONEY4 *src, DBMONEY4 *dest)
Negate a DBMONEY4 value.
Definition: dblib.c:5351
bcp_exec
RETCODE bcp_exec(DBPROCESS *dbproc, DBINT *rows_copied)
Write a datafile to a table.
Definition: bcp.c:1553
dbmny4cmp
int dbmny4cmp(DBPROCESS *dbproc, DBMONEY4 *m1, DBMONEY4 *m2)
Compare two DBMONEY4 values.
Definition: dblib.c:5517
dbaltutype
DBINT dbaltutype(DBPROCESS *dbproc, int computeid, int column)
Get user-defined datatype of a compute column.
Definition: dblib.c:6880
DBMONEY4
Definition: sybdb.h:272
dbprcollen
DBINT dbprcollen(DBPROCESS *dbproc, int column)
Get size of a result column needed to print column.
Definition: dblib.c:3063
dbreadtext
STATUS dbreadtext(DBPROCESS *dbproc, void *buf, DBINT bufsize)
Fetch part of a text or image value from the server.
Definition: dblib.c:6431
bcp_control
RETCODE bcp_control(DBPROCESS *dbproc, int field, DBINT value)
Set BCP options for uploading a datafile.
Definition: bcp.c:535
dbresults
RETCODE dbresults(DBPROCESS *dbproc)
Set up query results.
Definition: dblib.c:1676
dbsetlbool
RETCODE dbsetlbool(LOGINREC *login, int value, int which)
Set a boolean value in a LOGINREC structure.
Definition: dblib.c:897
dbnullbind
RETCODE dbnullbind(DBPROCESS *dbproc, int column, DBINT *indicator)
Tie a null-indicator to a regular result column.
Definition: dblib.c:2686
dbmnyminus
RETCODE dbmnyminus(DBPROCESS *dbproc, DBMONEY *src, DBMONEY *dest)
Negate a DBMONEY value.
Definition: dblib.c:5324
dblogin
LOGINREC * dblogin(void)
Allocate a LOGINREC structure.
Definition: dblib.c:713
dbtds
int dbtds(DBPROCESS *dbprocess)
Get the TDS version in use for dbproc.
Definition: dblib.c:6569
dbversion
const char * dbversion(void)
See which version of db-lib is in use.
Definition: dblib.c:6606
dbgetmaxprocs
int dbgetmaxprocs(void)
get maximum simultaneous connections db-lib will open to the server.
Definition: dblib.c:3982
dbrows
RETCODE dbrows(DBPROCESS *dbproc)
Indicate whether a query returned rows.
Definition: dblib.c:3843
dbstrbuild
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:7067
dbsettime
RETCODE dbsettime(int seconds)
Set maximum seconds db-lib waits for a server response to query.
Definition: dblib.c:4003
dbsetopt
RETCODE dbsetopt(DBPROCESS *dbproc, int option, const char *char_param, int int_param)
Set db-lib or server option.
Definition: dblib.c:4289
dbtablecolinfo
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:6233
DBDATETIME
Definition: sybdb.h:277
dbsetnull
RETCODE dbsetnull(DBPROCESS *dbprocess, int bindtype, int bindlen, BYTE *bindval)
Define substitution values to be used when binding null values.
Definition: dblib.c:1913
dbmorecmds
RETCODE dbmorecmds(DBPROCESS *dbproc)
See if more commands are to be processed.
Definition: dblib.c:6003
dbrpcinit
RETCODE dbrpcinit(DBPROCESS *dbproc, const char rpcname[], DBSMALLINT options)
Initialize a remote procedure call.
Definition: rpc.c:74
dbgetrow
RETCODE dbgetrow(DBPROCESS *dbproc, DBINT row)
Read a row from the row buffer.
Definition: dblib.c:1881
dbnumrets
int dbnumrets(DBPROCESS *dbproc)
Get count of output parameters filled by a stored procedure.
Definition: dblib.c:4494
dbclropt
RETCODE dbclropt(DBPROCESS *dbproc, int option, const char param[])
Reset an option.
Definition: dblib.c:5877
bcp_sendrow
RETCODE bcp_sendrow(DBPROCESS *dbproc)
Write data in host variables to the table.
Definition: bcp.c:1326
dbwritetext
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:6362
dbsafestr
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:6155
dbservcharset
char * dbservcharset(DBPROCESS *dbprocess)
Get syscharset name of the server character set.
Definition: dblib.c:6789
dbsetifile
void dbsetifile(char *filename)
set name and location of the interfaces file FreeTDS should use to look up a servername.
Definition: dblib.c:2657
dbfirstrow
DBINT dbfirstrow(DBPROCESS *dbproc)
See if a server response has arrived.
Definition: dblib.c:6959
dbrettype
int dbrettype(DBPROCESS *dbproc, int retnum)
Get datatype of a stored procedure's return parameter.
Definition: dblib.c:6034
tds_microsoft_dbdaterec
Definition: sybdb.h:426
dbmnycopy
RETCODE dbmnycopy(DBPROCESS *dbproc, DBMONEY *src, DBMONEY *dest)
Copy a DBMONEY value.
Definition: dblib.c:5792
dbcolsource
char * dbcolsource(DBPROCESS *dbproc, int colnum)
Get base database column name for a result set column.
Definition: dblib.c:3015
dblastrow
DBINT dblastrow(DBPROCESS *dbproc)
Get number of the last row in the row buffer.
Definition: dblib.c:6974
bcp_columns
RETCODE bcp_columns(DBPROCESS *dbproc, int host_colcount)
Indicate how many columns are to be found in the datafile.
Definition: bcp.c:298
dbcolutype
DBINT dbcolutype(DBPROCESS *dbprocess, int column)
Get user-defined datatype of a regular result column.
Definition: dblib.c:2866
dbspid
int dbspid(DBPROCESS *dbproc)
Get server process ID for a DBPROCESS.
Definition: dblib.c:5697
dbmoretext
RETCODE dbmoretext(DBPROCESS *dbproc, DBINT size, const BYTE text[])
Send chunk of a text/image value to the server.
Definition: dblib.c:6500
dbmny4zero
RETCODE dbmny4zero(DBPROCESS *dbproc, DBMONEY4 *dest)
Zero a DBMONEY4 value.
Definition: dblib.c:5375
dbopen
DBPROCESS * dbopen(LOGINREC *login, const char *server)
Normally not used.
Definition: dbopen.c:37
bcp_done
DBINT bcp_done(DBPROCESS *dbproc)
Conclude the transfer of data from program variables.
Definition: bcp.c:1966
dbstring
Definition: sybdb.h:310
dbsetuserdata
void dbsetuserdata(DBPROCESS *dbproc, BYTE *ptr)
Associate client-allocated (and defined) data with a DBPROCESS.
Definition: dblib.c:5723
dberrhandle
EHANDLEFUNC dberrhandle(EHANDLEFUNC handler)
Set an error handler, for messages from db-lib.
Definition: dblib.c:4926
bcp_colfmt_ps
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:500
dbsqlexec
RETCODE dbsqlexec(DBPROCESS *dbproc)
send the SQL command to the server and wait for an answer.
Definition: dblib.c:1388
dbstrcpy
RETCODE dbstrcpy(DBPROCESS *dbproc, int start, int numbytes, char *dest)
Get a copy of a chunk of the command buffer.
Definition: dblib.c:6111
dbprtype
const char * dbprtype(int token)
Print a token value's name to a buffer.
Definition: dblib.c:6216
dbprrow
RETCODE dbprrow(DBPROCESS *dbproc)
Print a result set to stdout.
Definition: dblib.c:3344
bcp_init
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:163
dbcoltypeinfo
DBTYPEINFO * dbcoltypeinfo(DBPROCESS *dbproc, int column)
Get precision and scale information for a regular result column.
Definition: dblib.c:2889
dbmnycmp
int dbmnycmp(DBPROCESS *dbproc, DBMONEY *m1, DBMONEY *m2)
Compare two DBMONEY values.
Definition: dblib.c:5071
dbaltcolid
int dbaltcolid(DBPROCESS *dbproc, int computeid, int column)
Get column ID of a compute column.
Definition: dblib.c:4091
dbsetlversion
RETCODE dbsetlversion(LOGINREC *login, BYTE version)
Set TDS version for future connections.
Definition: dblib.c:926
bcp_colptr
RETCODE bcp_colptr(DBPROCESS *dbproc, BYTE *colptr, int table_column)
Override bcp_bind() by pointing to a different host variable.
Definition: bcp.c:657
dbspr1row
RETCODE dbspr1row(DBPROCESS *dbproc, char *buffer, DBINT buf_len)
Print a regular result row to a buffer.
Definition: dblib.c:3262
dbretname
char * dbretname(DBPROCESS *dbproc, int retnum)
Get name of an output parameter filled by a stored procedure.
Definition: dblib.c:4526
dbsprline
RETCODE dbsprline(DBPROCESS *dbproc, char *buffer, DBINT buf_len, DBCHAR line_char)
Get formatted string for underlining dbsprhead() column names.
Definition: dblib.c:3647
dbsetinterrupt
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:4433
dbaltbind
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:4185
DBVARYCHAR
Definition: sybdb.h:245
dbdatlen
DBINT dbdatlen(DBPROCESS *dbproc, int column)
Get size of current row's data in a regular result column.
Definition: dblib.c:3138
tdsdbopen
DBPROCESS * tdsdbopen(LOGINREC *login, const char *server, int msdblib)
Form a connection with the server.
Definition: dblib.c:1152
dbcurrow
DBINT dbcurrow(DBPROCESS *dbproc)
Get number of the row currently being read.
Definition: dblib.c:5952
dbbylist
BYTE * dbbylist(DBPROCESS *dbproc, int computeid, int *size)
Get bylist for a compute row.
Definition: dblib.c:4804
pivot_t
Definition: dbpivot.c:761
DBCOL2
Definition: sybdb.h:342
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).
Definition: dblib.c:2918
dbisopt
DBBOOL dbisopt(DBPROCESS *dbproc, int option, const char param[])
Get value of an option.
Definition: dblib.c:5929
bcp_batch
DBINT bcp_batch(DBPROCESS *dbproc)
Commit a set of rows to the table.
Definition: bcp.c:1939
dbaltop
int dbaltop(DBPROCESS *dbproc, int computeid, int column)
Get aggregation operator for a compute column.
Definition: dblib.c:4261
dbconvert_ps
DBINT dbconvert_ps(DBPROCESS *dbprocess, int srctype, const BYTE *src, DBINT srclen, int desttype, BYTE *dest, DBINT destlen, DBTYPEINFO *typeinfo)
cf.
Definition: dblib.c:2539
LOGINREC
Definition: bsqlodbc.c:97
dbsqlok
RETCODE dbsqlok(DBPROCESS *dbproc)
Wait for results of a query from the server.
Definition: dblib.c:4619
dbvarylen
DBINT dbvarylen(DBPROCESS *dbproc, int column)
Determine whether a column can vary in size.
Definition: dblib.c:3089
dbcolname
char * dbcolname(DBPROCESS *dbproc, int column)
Return name of a regular result column.
Definition: dblib.c:1849
dbrpcparam
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:157
dbclrbuf
void dbclrbuf(DBPROCESS *dbproc, DBINT n)
Clear n rows from the row buffer.
Definition: dblib.c:2790
dbnumcompute
int dbnumcompute(DBPROCESS *dbprocess)
Get count of COMPUTE clauses for a result set.
Definition: dblib.c:4778
bcp_options
RETCODE bcp_options(DBPROCESS *dbproc, int option, BYTE *value, int valuelen)
Set "hints" for uploading a file.
Definition: bcp.c:609
dbanullbind
RETCODE dbanullbind(DBPROCESS *dbprocess, int computeid, int column, DBINT *indicator)
Tie a null-indicator to a compute result column.
Definition: dblib.c:2722
dbchange
char * dbchange(DBPROCESS *dbprocess)
See if a command caused the current database to change.
Definition: dblib.c:6753
dbgetuserdata
BYTE * dbgetuserdata(DBPROCESS *dbproc)
Get address of user-allocated data from a DBPROCESS.
Definition: dblib.c:5741
dbmnyzero
RETCODE dbmnyzero(DBPROCESS *dbproc, DBMONEY *dest)
Set a DBMONEY value to zero.
Definition: dblib.c:5129
bcp_colfmt
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
dbsqlsend
RETCODE dbsqlsend(DBPROCESS *dbproc)
Transmit the command buffer to the server.
Definition: dblib.c:6809
dbsetrow
STATUS dbsetrow(DBPROCESS *dbprocess, DBINT row)
Make a buffered row "current" without fetching it into bound variables.
Definition: dblib.c:1992
dbuse
RETCODE dbuse(DBPROCESS *dbproc, const char *name)
Change current database.
Definition: dblib.c:1414
dbmnymaxneg
RETCODE dbmnymaxneg(DBPROCESS *dbproc, DBMONEY *dest)
Get maximum negative DBMONEY value supported.
Definition: dblib.c:5171
dbalttype
int dbalttype(DBPROCESS *dbproc, int computeid, int column)
Get datatype for a compute column.
Definition: dblib.c:4149
dbcurcmd
int dbcurcmd(DBPROCESS *dbproc)
Get number of the row just returned.
Definition: dblib.c:5986
dbretlen
int dbretlen(DBPROCESS *dbproc, int retnum)
Get size of an output parameter filled by a stored procedure.
Definition: dblib.c:4584
dbmnydec
RETCODE dbmnydec(DBPROCESS *dbproc, DBMONEY *mnyptr)
Subtract $0.0001 from a DBMONEY value.
Definition: dblib.c:5296
dbgettime
int dbgettime(void)
Get maximum seconds db-lib waits for a server response to query.
Definition: dblib.c:4030
dbsetllong
RETCODE dbsetllong(LOGINREC *login, long value, int which)
Set an integer value in a LOGINREC structure.
Definition: dblib.c:826
tds_sybase_dbdaterec
Definition: sybdb.h:442
tds_dblib_loginrec
Definition: dblib.h:44
dbsetavail
void dbsetavail(DBPROCESS *dbprocess)
Mark a DBPROCESS as "available".
Definition: dblib.c:7042
dbmny4add
RETCODE dbmny4add(DBPROCESS *dbproc, DBMONEY4 *m1, DBMONEY4 *m2, DBMONEY4 *sum)
Add two DBMONEY4 values.
Definition: dblib.c:5398
dbspr1rowlen
DBINT dbspr1rowlen(DBPROCESS *dbproc)
Determine size buffer required to hold the results returned by dbsprhead(), dbsprline(), and dbspr1row().
Definition: dblib.c:3224
dbdatecmp
int dbdatecmp(DBPROCESS *dbproc, DBDATETIME *d1, DBDATETIME *d2)
Compare DBDATETIME values, similar to strcmp(3).
Definition: dblib.c:5570
bcp_bind
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:2008
dbcanquery
RETCODE dbcanquery(DBPROCESS *dbproc)
Cancel the query currently being retrieved, discarding all pending rows.
Definition: dblib.c:5813
dbiowdesc
int dbiowdesc(DBPROCESS *dbproc)
Get file descriptor of the socket used by a DBPROCESS to write data coming to the server...
Definition: dblib.c:7014
dbclose
void dbclose(DBPROCESS *dbproc)
Close a connection to the server and free associated resources.
Definition: dblib.c:1457
dbtxptr
DBBINARY * dbtxptr(DBPROCESS *dbproc, int column)
Get text pointer for a column in the current row.
Definition: dblib.c:6325
dbmonthname
const char * dbmonthname(DBPROCESS *dbproc, char *language, int monthnum, DBBOOL shortform)
Get name of a month, in some human language.
Definition: dblib.c:6724