FreeTDS API

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

- File List
- File Members

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