FreeTDS API

Loading...
Searching...
No Matches
cspublic.h
1/* FreeTDS - Library of routines accessing Sybase and Microsoft databases
2 * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 Brian Bruns
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
13 *
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
18 */
19
20#ifndef _cspublic_h_
21#define _cspublic_h_
22
23#include <cstypes.h>
24
25#undef TDS_STATIC_CAST
26#ifdef __cplusplus
27#define TDS_STATIC_CAST(type, a) static_cast<type>(a)
28 extern "C"
29{
30#if 0
31}
32#endif
33#else
34#define TDS_STATIC_CAST(type, a) ((type)(a))
35#endif
36
37#define CS_PUBLIC
38#define CS_STATIC static
39
40#define CS_SUCCEED 1
41#define CS_FAIL 0
42#define CS_MEM_ERROR -1
43#define CS_PENDING -2
44#define CS_QUIET -3
45#define CS_BUSY -4
46#define CS_INTERRUPT -5
47#define CS_BLK_HAS_TEXT -6
48#define CS_CONTINUE -7
49#define CS_FATAL -8
50#define CS_RET_HAFAILOVER -9
51#define CS_UNSUPPORTED -10
52
53#define CS_CANCELED -202
54#define CS_ROW_FAIL -203
55#define CS_END_DATA -204
56#define CS_END_RESULTS -205
57#define CS_END_ITEM -206
58#define CS_NOMSG -207
59#define CS_TIMED_OUT -208
60
61#define CS_SIZEOF(x) sizeof(x)
62
63#define CS_LAYER(x) (((x) >> 24) & 0xFF)
64#define CS_ORIGIN(x) (((x) >> 16) & 0xFF)
65#define CS_SEVERITY(x) (((x) >> 8) & 0xFF)
66#define CS_NUMBER(x) ((x) & 0xFF)
67
68/* forward declarations */
69 typedef CS_RETCODE(*CS_CSLIBMSG_FUNC) (CS_CONTEXT *, CS_CLIENTMSG *);
70 typedef CS_RETCODE(*CS_CLIENTMSG_FUNC) (CS_CONTEXT *, CS_CONNECTION *, CS_CLIENTMSG *);
71 typedef CS_RETCODE(*CS_SERVERMSG_FUNC) (CS_CONTEXT *, CS_CONNECTION *, CS_SERVERMSG *);
72
73
74#define CS_IODATA TDS_STATIC_CAST(CS_INT, 1600)
75#define CS_SRC_VALUE -2562
76
77
78
79/* status bits for CS_SERVERMSG */
80#define CS_HASEED 0x01
81
82 typedef struct _cs_blkdesc CS_BLKDESC;
83
84/* CS_CAP_REQUEST values */
85#define CS_REQ_LANG 1
86#define CS_REQ_RPC 2
87#define CS_REQ_NOTIF 3
88#define CS_REQ_MSTMT 4
89#define CS_REQ_BCP 5
90#define CS_REQ_CURSOR 6
91#define CS_REQ_DYN 7
92#define CS_REQ_MSG 8
93#define CS_REQ_PARAM 9
94#define CS_DATA_INT1 10
95#define CS_DATA_INT2 11
96#define CS_DATA_INT4 12
97#define CS_DATA_BIT 13
98#define CS_DATA_CHAR 14
99#define CS_DATA_VCHAR 15
100#define CS_DATA_BIN 16
101#define CS_DATA_VBIN 17
102#define CS_DATA_MNY8 18
103#define CS_DATA_MNY4 19
104#define CS_DATA_DATE8 20
105#define CS_DATA_DATE4 21
106#define CS_DATA_FLT4 22
107#define CS_DATA_FLT8 23
108#define CS_DATA_NUM 24
109#define CS_DATA_TEXT 25
110#define CS_DATA_IMAGE 26
111#define CS_DATA_DEC 27
112#define CS_DATA_LCHAR 28
113#define CS_DATA_LBIN 29
114#define CS_DATA_INTN 30
115#define CS_DATA_DATETIMEN 31
116#define CS_DATA_MONEYN 32
117#define CS_CSR_PREV 33
118#define CS_CSR_FIRST 34
119#define CS_CSR_LAST 35
120#define CS_CSR_ABS 36
121#define CS_CSR_REL 37
122#define CS_CSR_MULTI 38
123#define CS_CON_OOB 39
124#define CS_CON_INBAND 40
125#define CS_CON_LOGICAL 41
126#define CS_PROTO_TEXT 42
127#define CS_PROTO_BULK 43
128#define CS_REQ_URGNOTIF 44
129#define CS_DATA_SENSITIVITY 45
130#define CS_DATA_BOUNDARY 46
131#define CS_PROTO_DYNAMIC 47
132#define CS_PROTO_DYNPROC 48
133#define CS_DATA_FLTN 49
134#define CS_DATA_BITN 50
135#define CS_OPTION_GET 51
136#define CS_DATA_INT8 52
137#define CS_DATA_VOID 53
138
139/* CS_CAP_RESPONSE values */
140#define CS_RES_NOMSG 1
141#define CS_RES_NOEED 2
142#define CS_RES_NOPARAM 3
143#define CS_DATA_NOINT1 4
144#define CS_DATA_NOINT2 5
145#define CS_DATA_NOINT4 6
146#define CS_DATA_NOBIT 7
147#define CS_DATA_NOCHAR 8
148#define CS_DATA_NOVCHAR 9
149#define CS_DATA_NOBIN 10
150#define CS_DATA_NOVBIN 11
151#define CS_DATA_NOMNY8 12
152#define CS_DATA_NOMNY4 13
153#define CS_DATA_NODATE8 14
154#define CS_DATA_NODATE4 15
155#define CS_DATA_NOFLT4 16
156#define CS_DATA_NOFLT8 17
157#define CS_DATA_NONUM 18
158#define CS_DATA_NOTEXT 19
159#define CS_DATA_NOIMAGE 20
160#define CS_DATA_NODEC 21
161#define CS_DATA_NOLCHAR 22
162#define CS_DATA_NOLBIN 23
163#define CS_DATA_NOINTN 24
164#define CS_DATA_NODATETIMEN 25
165#define CS_DATA_NOMONEYN 26
166#define CS_CON_NOOOB 27
167#define CS_CON_NOINBAND 28
168#define CS_PROTO_NOTEXT 29
169#define CS_PROTO_NOBULK 30
170#define CS_DATA_NOSENSITIVITY 31
171#define CS_DATA_NOBOUNDARY 32
172#define CS_RES_NOTDSDEBUG 33
173#define CS_RES_NOSTRIPBLANKS 34
174#define CS_DATA_NOINT8 35
175
176/* Properties */
177 enum
178{
179/*
180 * These defines looks weird but programs can test support for defines,
181 * compiler can check enum and there are no define side effecs
182 */
183 CS_USERNAME = 9100,
184#define CS_USERNAME CS_USERNAME
185 CS_PASSWORD = 9101,
186#define CS_PASSWORD CS_PASSWORD
187 CS_APPNAME = 9102,
188#define CS_APPNAME CS_APPNAME
189 CS_HOSTNAME = 9103,
190#define CS_HOSTNAME CS_HOSTNAME
191 CS_LOGIN_STATUS = 9104,
192#define CS_LOGIN_STATUS CS_LOGIN_STATUS
193 CS_TDS_VERSION = 9105,
194#define CS_TDS_VERSION CS_TDS_VERSION
195 CS_CHARSETCNV = 9106,
196#define CS_CHARSETCNV CS_CHARSETCNV
197 CS_PACKETSIZE = 9107,
198#define CS_PACKETSIZE CS_PACKETSIZE
199 CS_USERDATA = 9108,
200#define CS_USERDATA CS_USERDATA
201 CS_NETIO = 9110,
202#define CS_NETIO CS_NETIO
203 CS_TEXTLIMIT = 9112,
204#define CS_TEXTLIMIT CS_TEXTLIMIT
205 CS_HIDDEN_KEYS = 9113,
206#define CS_HIDDEN_KEYS CS_HIDDEN_KEYS
207 CS_VERSION = 9114,
208#define CS_VERSION CS_VERSION
209 CS_IFILE = 9115,
210#define CS_IFILE CS_IFILE
211 CS_LOGIN_TIMEOUT = 9116,
212#define CS_LOGIN_TIMEOUT CS_LOGIN_TIMEOUT
213 CS_TIMEOUT = 9117,
214#define CS_TIMEOUT CS_TIMEOUT
215 CS_MAX_CONNECT = 9118,
216#define CS_MAX_CONNECT CS_MAX_CONNECT
217 CS_EXPOSE_FMTS = 9120,
218#define CS_EXPOSE_FMTS CS_EXPOSE_FMTS
219 CS_EXTRA_INF = 9121,
220#define CS_EXTRA_INF CS_EXTRA_INF
221 CS_ANSI_BINDS = 9123,
222#define CS_ANSI_BINDS CS_ANSI_BINDS
223 CS_BULK_LOGIN = 9124,
224#define CS_BULK_LOGIN CS_BULK_LOGIN
225 CS_LOC_PROP = 9125,
226#define CS_LOC_PROP CS_LOC_PROP
227 CS_PARENT_HANDLE = 9130,
228#define CS_PARENT_HANDLE CS_PARENT_HANDLE
229 CS_EED_CMD = 9131,
230#define CS_EED_CMD CS_EED_CMD
231 CS_DIAG_TIMEOUT = 9132,
232#define CS_DIAG_TIMEOUT CS_DIAG_TIMEOUT
233 CS_DISABLE_POLL = 9133,
234#define CS_DISABLE_POLL CS_DISABLE_POLL
235 CS_SEC_ENCRYPTION = 9135,
236#define CS_SEC_ENCRYPTION CS_SEC_ENCRYPTION
237 CS_SEC_CHALLENGE = 9136,
238#define CS_SEC_CHALLENGE CS_SEC_CHALLENGE
239 CS_SEC_NEGOTIATE = 9137,
240#define CS_SEC_NEGOTIATE CS_SEC_NEGOTIATE
241 CS_CON_STATUS = 9143,
242#define CS_CON_STATUS CS_CON_STATUS
243 CS_VER_STRING = 9144,
244#define CS_VER_STRING CS_VER_STRING
245 CS_SERVERNAME = 9146,
246#define CS_SERVERNAME CS_SERVERNAME
247 CS_SEC_APPDEFINED = 9149,
248#define CS_SEC_APPDEFINED CS_SEC_APPDEFINED
249 CS_STICKY_BINDS = 9151,
250#define CS_STICKY_BINDS CS_STICKY_BINDS
251 CS_SEC_NETWORKAUTH = 9175,
252#define CS_SEC_NETWORKAUTH CS_SEC_NETWORKAUTH
253 CS_SEC_DELEGATION = 9176,
254#define CS_SEC_DELEGATION CS_SEC_DELEGATION
255 CS_SEC_MUTUALAUTH = 9177,
256#define CS_SEC_MUTUALAUTH CS_SEC_MUTUALAUTH
257 CS_SEC_SERVERPRINCIPAL = 9188,
258#define CS_SEC_SERVERPRINCIPAL CS_SEC_SERVERPRINCIPAL
259 CS_SERVERADDR = 9206,
260#define CS_SERVERADDR CS_SERVERADDR
261 CS_PORT = 9300,
262#define CS_PORT CS_PORT
263 CS_CLIENTCHARSET = 9301,
264#define CS_CLIENTCHARSET CS_CLIENTCHARSET
265 CS_DATABASE = 9302
266#define CS_DATABASE CS_DATABASE
267};
268
269/* Arbitrary precision math operators */
270 enum
271{
272 CS_ADD = 1,
273 CS_SUB,
274 CS_MULT,
275 CS_DIV
276};
277
278 enum
279{
280#define CS_TDS_AUTO CS_TDS_AUTO
281 CS_TDS_AUTO = 0,
282 CS_TDS_40 = 7360,
283 CS_TDS_42,
284 CS_TDS_46,
285 CS_TDS_495,
286 CS_TDS_50,
287 CS_TDS_70,
288 CS_TDS_71,
289#define CS_TDS_71 CS_TDS_71
290 CS_TDS_72,
291#define CS_TDS_72 CS_TDS_72
292 CS_TDS_73,
293#define CS_TDS_73 CS_TDS_73
294 CS_TDS_74,
295#define CS_TDS_74 CS_TDS_74
296};
297
298/* bit mask values used by CS_DATAFMT.status */
299#define CS_HIDDEN (1 << 0)
300#define CS_KEY (1 << 1)
301#define CS_VERSION_KEY (1 << 2)
302#define CS_NODATA (1 << 3)
303#define CS_UPDATABLE (1 << 4)
304#define CS_CANBENULL (1 << 5)
305#define CS_DESCIN (1 << 6)
306#define CS_DESCOUT (1 << 7)
307#define CS_INPUTVALUE (1 << 8)
308#define CS_UPDATECOL (1 << 9)
309#define CS_RETURN (1 << 10)
310#define CS_TIMESTAMP (1 << 13)
311#define CS_NODEFAULT (1 << 14)
312#define CS_IDENTITY (1 << 15)
313
314/*
315 * DBD::Sybase compares indicator to CS_NULLDATA so this is -1
316 * (the documentation states -1)
317 */
318#define CS_GOODDATA 0
319#define CS_NULLDATA (-1)
320
321/* CS_CON_STATUS read-only property bit mask values */
322#define CS_CONSTAT_CONNECTED 0x01
323#define CS_CONSTAT_DEAD 0x02
324
325/*
326 * Code added for CURSOR support
327 * types accepted by ct_cursor
328 */
329#define CS_CURSOR_DECLARE 700
330#define CS_CURSOR_OPEN 701
331#define CS_CURSOR_ROWS 703
332#define CS_CURSOR_UPDATE 704
333#define CS_CURSOR_DELETE 705
334#define CS_CURSOR_CLOSE 706
335#define CS_CURSOR_DEALLOC 707
336#define CS_CURSOR_OPTION 725
337
338#define CS_FOR_UPDATE TDS_STATIC_CAST(CS_INT, 0x1)
339#define CS_READ_ONLY TDS_STATIC_CAST(CS_INT, 0x2)
340#define CS_RESTORE_OPEN TDS_STATIC_CAST(CS_INT, 0x8)
341#define CS_IMPLICIT_CURSOR TDS_STATIC_CAST(CS_INT, 0x40)
342
343
344#define CS_CURSTAT_NONE TDS_STATIC_CAST(CS_INT, 0x0)
345#define CS_CURSTAT_DECLARED TDS_STATIC_CAST(CS_INT, 0x1)
346#define CS_CURSTAT_OPEN TDS_STATIC_CAST(CS_INT, 0x2)
347#define CS_CURSTAT_CLOSED TDS_STATIC_CAST(CS_INT, 0x4)
348#define CS_CURSTAT_RDONLY TDS_STATIC_CAST(CS_INT, 0x8)
349#define CS_CURSTAT_UPDATABLE TDS_STATIC_CAST(CS_INT, 0x10)
350#define CS_CURSTAT_ROWCOUNT TDS_STATIC_CAST(CS_INT, 0x20)
351#define CS_CURSTAT_DEALLOC TDS_STATIC_CAST(CS_INT, 0x40)
352
353#define CS_CUR_STATUS TDS_STATIC_CAST(CS_INT, 9126)
354#define CS_CUR_ID TDS_STATIC_CAST(CS_INT, 9127)
355#define CS_CUR_NAME TDS_STATIC_CAST(CS_INT, 9128)
356#define CS_CUR_ROWCOUNT TDS_STATIC_CAST(CS_INT, 9129)
357
358/* options accepted by ct_options() */
359#define CS_OPT_DATEFIRST 5001
360#define CS_OPT_TEXTSIZE 5002
361#define CS_OPT_STATS_TIME 5003
362#define CS_OPT_STATS_IO 5004
363#define CS_OPT_ROWCOUNT 5005
364#define CS_OPT_DATEFORMAT 5007
365#define CS_OPT_ISOLATION 5008
366#define CS_OPT_AUTHON 5009
367#define CS_OPT_SHOWPLAN 5013
368#define CS_OPT_NOEXEC 5014
369#define CS_OPT_ARITHIGNORE 5015
370#define CS_OPT_TRUNCIGNORE 5016
371#define CS_OPT_ARITHABORT 5017
372#define CS_OPT_PARSEONLY 5018
373#define CS_OPT_GETDATA 5020
374#define CS_OPT_NOCOUNT 5021
375#define CS_OPT_FORCEPLAN 5023
376#define CS_OPT_FORMATONLY 5024
377#define CS_OPT_CHAINXACTS 5025
378#define CS_OPT_CURCLOSEONXACT 5026
379#define CS_OPT_FIPSFLAG 5027
380#define CS_OPT_RESTREES 5028
381#define CS_OPT_IDENTITYON 5029
382#define CS_OPT_CURREAD 5030
383#define CS_OPT_CURWRITE 5031
384#define CS_OPT_IDENTITYOFF 5032
385#define CS_OPT_AUTHOFF 5033
386#define CS_OPT_ANSINULL 5034
387#define CS_OPT_QUOTED_IDENT 5035
388#define CS_OPT_ANSIPERM 5036
389#define CS_OPT_STR_RTRUNC 5037
390
391/* options accepted by ct_command() */
392 enum ct_command_options
393{
394 CS_MORE = 16,
395 CS_END = 32,
396 CS_RECOMPILE = 188,
397 CS_NO_RECOMPILE,
398 CS_BULK_INIT,
399 CS_BULK_CONT,
400 CS_BULK_DATA,
401 CS_COLUMN_DATA
402};
403
404
405/*
406 * bind formats, should be mapped to TDS types
407 * can be a combination of bit
408 */
409 enum
410{
411 CS_FMT_UNUSED = 0,
412#define CS_FMT_UNUSED CS_FMT_UNUSED
413 CS_FMT_NULLTERM = 1,
414#define CS_FMT_NULLTERM CS_FMT_NULLTERM
415 CS_FMT_PADNULL = 2,
416#define CS_FMT_PADBLANK CS_FMT_PADBLANK
417 CS_FMT_PADBLANK = 4,
418#define CS_FMT_PADNULL CS_FMT_PADNULL
419 CS_FMT_JUSTIFY_RT = 8
420#define CS_FMT_JUSTIFY_RT CS_FMT_JUSTIFY_RT
421};
422
423/* callbacks */
424#define CS_COMPLETION_CB 1
425#define CS_SERVERMSG_CB 2
426#define CS_CLIENTMSG_CB 3
427#define CS_NOTIF_CB 4
428#define CS_ENCRYPT_CB 5
429#define CS_CHALLENGE_CB 6
430#define CS_DS_LOOKUP_CB 7
431#define CS_SECSESSION_CB 8
432#define CS_SIGNAL_CB 100
433#define CS_MESSAGE_CB 9119
434
435/* string types */
436#define CS_NULLTERM -9
437#define CS_WILDCARD -99
438#define CS_NO_LIMIT -9999
439#define CS_UNUSED -99999
440
441/* other */
442#define CS_GET 33
443#define CS_SET 34
444#define CS_CLEAR 35
445#define CS_INIT 36
446#define CS_STATUS 37
447#define CS_MSGLIMIT 38
448#define CS_SUPPORTED 40
449
450#define CS_CMD_DONE 4046
451#define CS_CMD_SUCCEED 4047
452#define CS_CMD_FAIL 4048
453
454/* commands */
455#define CS_LANG_CMD 148
456#define CS_RPC_CMD 149
457#define CS_SEND_DATA_CMD 151
458#define CS_SEND_BULK_CMD 153
459
460#ifdef CS_NO_LARGE_IDENTIFIERS
461#define CS_VERSION_100 112
462#define CS_VERSION_110 1100
463#define CS_VERSION_120 1100
464#define CS_VERSION_125 12500
465#define CS_VERSION_150 15000
466#else
467#define CS_VERSION_100 113
468#define CS_VERSION_110 1101
469#define CS_VERSION_120 CS_VERSION_110
470#define CS_VERSION_125 12501
471#define CS_VERSION_150 15001
472#define CS_VERSION_155 15501
473#define CS_VERSION_157 15701
474#define CS_VERSION_160 16001
475#endif
476
477#define BLK_VERSION_100 CS_VERSION_100
478#define BLK_VERSION_110 CS_VERSION_110
479#define BLK_VERSION_120 CS_VERSION_120
480#define BLK_VERSION_125 CS_VERSION_125
481#define BLK_VERSION_150 CS_VERSION_150
482
483#define CS_FORCE_EXIT 300
484#define CS_FORCE_CLOSE 301
485
486#define CS_SYNC_IO 8111
487#define CS_ASYNC_IO 8112
488#define CS_DEFER_IO 8113
489
490#define CS_CANCEL_CURRENT 6000
491#define CS_CANCEL_ALL 6001
492#define CS_CANCEL_ATTN 6002
493
494#define CS_ROW_COUNT 800
495#define CS_CMD_NUMBER 801
496#define CS_NUM_COMPUTES 802
497#define CS_NUMDATA 803
498#define CS_NUMORDERCOLS 805
499#define CS_MSGTYPE 806
500#define CS_BROWSE_INFO 807
501#define CS_TRANS_STATE 808
502
503#define CS_TRAN_UNDEFINED 0
504#define CS_TRAN_IN_PROGRESS 1
505#define CS_TRAN_COMPLETED 2
506#define CS_TRAN_FAIL 3
507#define CS_TRAN_STMT_FAIL 4
508
509#define CS_COMP_OP 5350
510#define CS_COMP_ID 5351
511#define CS_COMP_COLID 5352
512#define CS_COMP_BYLIST 5353
513#define CS_BYLIST_LEN 5354
514
515#define CS_NO_COUNT -1
516
517#define CS_OP_SUM 5370
518#define CS_OP_AVG 5371
519#define CS_OP_COUNT 5372
520#define CS_OP_MIN 5373
521#define CS_OP_MAX 5374
522
523#define CS_CAP_REQUEST 1
524#define CS_CAP_RESPONSE 2
525
526#define CS_PREPARE 717
527#define CS_EXECUTE 718
528#define CS_DESCRIBE_INPUT 720
529#define CS_DESCRIBE_OUTPUT 721
530
531#define CS_DEALLOC 711
532
533#define CS_LC_ALL 7
534#define CS_SYB_LANG 8
535#define CS_SYB_CHARSET 9
536#define CS_SYB_SORTORDER 10
537#define CS_SYB_COLLATE CS_SYB_SORTORDER
538#define CS_SYB_LANG_CHARSET 11
539
540#define CS_BLK_IN 1
541#define CS_BLK_OUT 2
542
543#define CS_BLK_BATCH 1
544#define CS_BLK_ALL 2
545#define CS_BLK_CANCEL 3
546
547/* to do support these */
548
549#define CS_BLK_ARRAY_MAXLEN 0x1000
550#define CS_DEF_PREC 18
551
552/* Error Severities */
553#define CS_SV_INFORM TDS_STATIC_CAST(CS_INT, 0)
554#define CS_SV_API_FAIL TDS_STATIC_CAST(CS_INT, 1)
555#define CS_SV_RETRY_FAIL TDS_STATIC_CAST(CS_INT, 2)
556#define CS_SV_RESOURCE_FAIL TDS_STATIC_CAST(CS_INT, 3)
557#define CS_SV_CONFIG_FAIL TDS_STATIC_CAST(CS_INT, 4)
558#define CS_SV_COMM_FAIL TDS_STATIC_CAST(CS_INT, 5)
559#define CS_SV_INTERNAL_FAIL TDS_STATIC_CAST(CS_INT, 6)
560#define CS_SV_FATAL TDS_STATIC_CAST(CS_INT, 7)
561
562/* result_types */
563#define CS_COMPUTE_RESULT 4045
564#define CS_CURSOR_RESULT 4041
565#define CS_PARAM_RESULT 4042
566#define CS_ROW_RESULT 4040
567#define CS_STATUS_RESULT 4043
568#define CS_COMPUTEFMT_RESULT 4050
569#define CS_ROWFMT_RESULT 4049
570#define CS_MSG_RESULT 4044
571#define CS_DESCRIBE_RESULT 4051
572
573/* bind types */
574#define CS_ILLEGAL_TYPE TDS_STATIC_CAST(CS_INT, -1)
575#define CS_CHAR_TYPE TDS_STATIC_CAST(CS_INT, 0)
576#define CS_BINARY_TYPE TDS_STATIC_CAST(CS_INT, 1)
577#define CS_LONGCHAR_TYPE TDS_STATIC_CAST(CS_INT, 2)
578#define CS_LONGBINARY_TYPE TDS_STATIC_CAST(CS_INT, 3)
579#define CS_TEXT_TYPE TDS_STATIC_CAST(CS_INT, 4)
580#define CS_IMAGE_TYPE TDS_STATIC_CAST(CS_INT, 5)
581#define CS_TINYINT_TYPE TDS_STATIC_CAST(CS_INT, 6)
582#define CS_SMALLINT_TYPE TDS_STATIC_CAST(CS_INT, 7)
583#define CS_INT_TYPE TDS_STATIC_CAST(CS_INT, 8)
584#define CS_REAL_TYPE TDS_STATIC_CAST(CS_INT, 9)
585#define CS_FLOAT_TYPE TDS_STATIC_CAST(CS_INT, 10)
586#define CS_BIT_TYPE TDS_STATIC_CAST(CS_INT, 11)
587#define CS_DATETIME_TYPE TDS_STATIC_CAST(CS_INT, 12)
588#define CS_DATETIME4_TYPE TDS_STATIC_CAST(CS_INT, 13)
589#define CS_MONEY_TYPE TDS_STATIC_CAST(CS_INT, 14)
590#define CS_MONEY4_TYPE TDS_STATIC_CAST(CS_INT, 15)
591#define CS_NUMERIC_TYPE TDS_STATIC_CAST(CS_INT, 16)
592#define CS_DECIMAL_TYPE TDS_STATIC_CAST(CS_INT, 17)
593#define CS_VARCHAR_TYPE TDS_STATIC_CAST(CS_INT, 18)
594#define CS_VARBINARY_TYPE TDS_STATIC_CAST(CS_INT, 19)
595#define CS_LONG_TYPE TDS_STATIC_CAST(CS_INT, 20)
596#define CS_SENSITIVITY_TYPE TDS_STATIC_CAST(CS_INT, 21)
597#define CS_BOUNDARY_TYPE TDS_STATIC_CAST(CS_INT, 22)
598#define CS_VOID_TYPE TDS_STATIC_CAST(CS_INT, 23)
599#define CS_USHORT_TYPE TDS_STATIC_CAST(CS_INT, 24)
600#define CS_UNICHAR_TYPE TDS_STATIC_CAST(CS_INT, 25)
601#define CS_BLOB_TYPE TDS_STATIC_CAST(CS_INT, 26)
602#define CS_DATE_TYPE TDS_STATIC_CAST(CS_INT, 27)
603#define CS_TIME_TYPE TDS_STATIC_CAST(CS_INT, 28)
604#define CS_UNITEXT_TYPE TDS_STATIC_CAST(CS_INT, 29)
605#define CS_BIGINT_TYPE TDS_STATIC_CAST(CS_INT, 30)
606#define CS_USMALLINT_TYPE TDS_STATIC_CAST(CS_INT, 31)
607#define CS_UINT_TYPE TDS_STATIC_CAST(CS_INT, 32)
608#define CS_UBIGINT_TYPE TDS_STATIC_CAST(CS_INT, 33)
609#define CS_XML_TYPE TDS_STATIC_CAST(CS_INT, 34)
610#define CS_BIGDATETIME_TYPE TDS_STATIC_CAST(CS_INT, 35)
611#define CS_BIGTIME_TYPE TDS_STATIC_CAST(CS_INT, 36)
612#define CS_UNIQUE_TYPE TDS_STATIC_CAST(CS_INT, 40)
613
614#define CS_MIN_SYBTYPE CS_CHAR_TYPE
615#define CS_MAX_SYBTYPE CS_UNIQUE_TYPE
616
617#define CS_USER_TYPE TDS_STATIC_CAST(CS_INT, 100)
618/* cs_dt_info type values */
619 enum
620{
621 CS_MONTH = 7340,
622#define CS_MONTH CS_MONTH
623 CS_SHORTMONTH,
624#define CS_SHORTMONTH CS_SHORTMONTH
625 CS_DAYNAME,
626#define CS_DAYNAME CS_DAYNAME
627 CS_DATEORDER,
628#define CS_DATEORDER CS_DATEORDER
629 CS_12HOUR,
630#define CS_12HOUR CS_12HOUR
631 CS_DT_CONVFMT
632#define CS_DT_CONVFMT CS_DT_CONVFMT
633};
634
635/* DT_CONVFMT types */
636 enum
637{
638 CS_DATES_SHORT = 0,
639#define CS_DATES_SHORT CS_DATES_SHORT
640 CS_DATES_MDY1,
641#define CS_DATES_MDY1 CS_DATES_MDY1
642 CS_DATES_YMD1,
643#define CS_DATES_YMD1 CS_DATES_YMD1
644 CS_DATES_DMY1,
645#define CS_DATES_DMY1 CS_DATES_DMY1
646 CS_DATES_DMY2,
647#define CS_DATES_DMY2 CS_DATES_DMY2
648 CS_DATES_DMY3,
649#define CS_DATES_DMY3 CS_DATES_DMY3
650 CS_DATES_DMY4,
651#define CS_DATES_DMY4 CS_DATES_DMY4
652 CS_DATES_MDY2,
653#define CS_DATES_MDY2 CS_DATES_MDY2
654 CS_DATES_HMS,
655#define CS_DATES_HMS CS_DATES_HMS
656 CS_DATES_LONG,
657#define CS_DATES_LONG CS_DATES_LONG
658 CS_DATES_MDY3,
659#define CS_DATES_MDY3 CS_DATES_MDY3
660 CS_DATES_YMD2,
661#define CS_DATES_YMD2 CS_DATES_YMD2
662 CS_DATES_YMD3,
663#define CS_DATES_YMD3 CS_DATES_YMD3
664 CS_DATES_YDM1,
665#define CS_DATES_YDM1 CS_DATES_YDM1
666 CS_DATES_MYD1,
667#define CS_DATES_MYD1 CS_DATES_MYD1
668 CS_DATES_DYM1,
669#define CS_DATES_DYM1 CS_DATES_DYM1
670 CS_DATES_MDY1_YYYY = 101,
671#define CS_DATES_MDY1_YYYY CS_DATES_MDY1_YYYY
672 CS_DATES_YMD1_YYYY,
673#define CS_DATES_YMD1_YYYY CS_DATES_YMD1_YYYY
674 CS_DATES_DMY1_YYYY,
675#define CS_DATES_DMY1_YYYY CS_DATES_DMY1_YYYY
676 CS_DATES_DMY2_YYYY,
677#define CS_DATES_DMY2_YYYY CS_DATES_DMY2_YYYY
678 CS_DATES_DMY3_YYYY,
679#define CS_DATES_DMY3_YYYY CS_DATES_DMY3_YYYY
680 CS_DATES_DMY4_YYYY,
681#define CS_DATES_DMY4_YYYY CS_DATES_DMY4_YYYY
682 CS_DATES_MDY2_YYYY,
683#define CS_DATES_MDY2_YYYY CS_DATES_MDY2_YYYY
684 CS_DATES_MDY3_YYYY = 110,
685#define CS_DATES_MDY3_YYYY CS_DATES_MDY3_YYYY
686 CS_DATES_YMD2_YYYY,
687#define CS_DATES_YMD2_YYYY CS_DATES_YMD2_YYYY
688 CS_DATES_YMD3_YYYY
689#define CS_DATES_YMD3_YYYY CS_DATES_YMD3_YYYY
690};
691
692 typedef CS_RETCODE(*CS_CONV_FUNC) (CS_CONTEXT * context, CS_DATAFMT * srcfmt, CS_VOID * src, CS_DATAFMT * detsfmt, CS_VOID * dest,
693 CS_INT * destlen);
694
695 typedef struct _cs_objname
696{
697 CS_BOOL thinkexists;
698 CS_INT object_type;
699#ifdef CS_NO_LARGE_IDENTIFIERS
700 CS_CHAR last_name[CS_MAX_NAME];
701 CS_INT lnlen;
702 CS_CHAR first_name[CS_MAX_NAME];
703#else
704 CS_CHAR last_name[CS_MAX_CHAR];
705 CS_INT lnlen;
706 CS_CHAR first_name[CS_MAX_CHAR];
707#endif
708 CS_INT fnlen;
709 CS_VOID *scope;
710 CS_INT scopelen;
711 CS_VOID *thread;
712 CS_INT threadlen;
713} CS_OBJNAME;
714
715 typedef struct _cs_objdata
716{
717 CS_BOOL actuallyexists;
718 CS_CONNECTION *connection;
719 CS_COMMAND *command;
720 CS_VOID *buffer;
721 CS_INT buflen;
722} CS_OBJDATA;
723
724/* Eventually, these should be in terms of TDS values */
725 enum
726{
727 CS_OPT_MONDAY = 1,
728 CS_OPT_TUESDAY,
729 CS_OPT_WEDNESDAY,
730 CS_OPT_THURSDAY,
731 CS_OPT_FRIDAY,
732 CS_OPT_SATURDAY,
733 CS_OPT_SUNDAY
734};
735 enum
736{
737 CS_OPT_FMTMDY = 1,
738 CS_OPT_FMTDMY,
739 CS_OPT_FMTYMD,
740 CS_OPT_FMTYDM,
741 CS_OPT_FMTMYD,
742 CS_OPT_FMTDYM
743};
744 enum
745{
746 CS_OPT_LEVEL0 = 0,
747 CS_OPT_LEVEL1,
748 CS_OPT_LEVEL2,
749 CS_OPT_LEVEL3
750};
751
752#define CS_FALSE 0
753#define CS_TRUE 1
754
755#define SRV_PROC CS_VOID
756
757/* constants required for ct_diag (not jet implemented) */
758#define CS_CLIENTMSG_TYPE 4700
759#define CS_SERVERMSG_TYPE 4701
760#define CS_ALLMSG_TYPE 4702
761
762CS_RETCODE cs_convert(CS_CONTEXT * ctx, CS_DATAFMT * srcfmt, CS_VOID * srcdata, CS_DATAFMT * destfmt, CS_VOID * destdata,
763 CS_INT * resultlen);
764CS_RETCODE cs_ctx_alloc(CS_INT version, CS_CONTEXT ** ctx);
765CS_RETCODE cs_ctx_global(CS_INT version, CS_CONTEXT ** ctx);
766CS_RETCODE cs_ctx_drop(CS_CONTEXT * ctx);
767CS_RETCODE cs_config(CS_CONTEXT * ctx, CS_INT action, CS_INT property, CS_VOID * buffer, CS_INT buflen, CS_INT * outlen);
768CS_RETCODE cs_strbuild(CS_CONTEXT * ctx, CS_CHAR * buffer, CS_INT buflen, CS_INT * resultlen, CS_CHAR * text, CS_INT textlen,
769 CS_CHAR * formats, CS_INT formatlen, ...);
770#undef cs_dt_crack
771CS_RETCODE cs_dt_crack(CS_CONTEXT * ctx, CS_INT datetype, CS_VOID * dateval, CS_DATEREC * daterec);
772CS_RETCODE cs_dt_crack_v2(CS_CONTEXT * ctx, CS_INT datetype, CS_VOID * dateval, CS_DATEREC * daterec);
773#define cs_dt_crack cs_dt_crack_v2
774CS_RETCODE cs_loc_alloc(CS_CONTEXT * ctx, CS_LOCALE ** locptr);
775CS_RETCODE cs_loc_drop(CS_CONTEXT * ctx, CS_LOCALE * locale);
776CS_RETCODE cs_locale(CS_CONTEXT * ctx, CS_INT action, CS_LOCALE * locale, CS_INT type, CS_VOID * buffer, CS_INT buflen,
777 CS_INT * outlen);
778CS_RETCODE cs_dt_info(CS_CONTEXT * ctx, CS_INT action, CS_LOCALE * locale, CS_INT type, CS_INT item, CS_VOID * buffer,
779 CS_INT buflen, CS_INT * outlen);
780
781CS_RETCODE cs_calc(CS_CONTEXT * ctx, CS_INT op, CS_INT datatype, CS_VOID * var1, CS_VOID * var2, CS_VOID * dest);
782CS_RETCODE cs_cmp(CS_CONTEXT * ctx, CS_INT datatype, CS_VOID * var1, CS_VOID * var2, CS_INT * result);
783CS_RETCODE cs_conv_mult(CS_CONTEXT * ctx, CS_LOCALE * srcloc, CS_LOCALE * destloc, CS_INT * conv_multiplier);
784CS_RETCODE cs_diag(CS_CONTEXT * ctx, CS_INT operation, CS_INT type, CS_INT idx, CS_VOID * buffer);
785CS_RETCODE cs_manage_convert(CS_CONTEXT * ctx, CS_INT action, CS_INT srctype, CS_CHAR * srcname, CS_INT srcnamelen, CS_INT desttype,
786 CS_CHAR * destname, CS_INT destnamelen, CS_INT * conv_multiplier, CS_CONV_FUNC * func);
787CS_RETCODE cs_objects(CS_CONTEXT * ctx, CS_INT action, CS_OBJNAME * objname, CS_OBJDATA * objdata);
788CS_RETCODE cs_set_convert(CS_CONTEXT * ctx, CS_INT action, CS_INT srctype, CS_INT desttype, CS_CONV_FUNC * func);
789CS_RETCODE cs_setnull(CS_CONTEXT * ctx, CS_DATAFMT * datafmt, CS_VOID * buffer, CS_INT buflen);
790CS_RETCODE cs_strcmp(CS_CONTEXT * ctx, CS_LOCALE * locale, CS_INT type, CS_CHAR * str1, CS_INT len1, CS_CHAR * str2, CS_INT len2,
791 CS_INT * result);
792CS_RETCODE cs_time(CS_CONTEXT * ctx, CS_LOCALE * locale, CS_VOID * buffer, CS_INT buflen, CS_INT * outlen, CS_DATEREC * daterec);
793CS_RETCODE cs_will_convert(CS_CONTEXT * ctx, CS_INT srctype, CS_INT desttype, CS_BOOL * result);
794
795 const char * cs_prretcode(int retcode);
796
797#ifdef __cplusplus
798#if 0
799{
800#endif
801}
802#endif
803
804#endif
_cs_objname
Definition cspublic.h:696
_cs_objdata
Definition cspublic.h:716
_cs_datafmt
Definition cstypes.h:119
_cs_daterec
Definition cstypes.h:168
_cs_clientmsg
Definition cstypes.h:186
_cs_servermsg
Definition cstypes.h:200
_cs_context
Definition ctlib.h:134
_cs_connection
Definition ctlib.h:186
_cs_command
Definition ctlib.h:281
_cs_blkdesc
Definition ctlib.h:308
_cs_locale
Definition ctlib.h:317