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