FreeTDS API: include/cspublic.h Source File

FreeTDS API

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

- File List
- File Members

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