# cspublic.h

    00001 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases
    00002  * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004  Brian Bruns
    00003  *
    00004  * This library is free software; you can redistribute it and/or
    00005  * modify it under the terms of the GNU Library General Public
    00006  * License as published by the Free Software Foundation; either
    00007  * version 2 of the License, or (at your option) any later version.
    00008  *
    00009  * This library is distributed in the hope that it will be useful,
    00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00012  * Library General Public License for more details.
    00013  *
    00014  * You should have received a copy of the GNU Library General Public
    00015  * License along with this library; if not, write to the
    00016  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    00017  * Boston, MA 02111-1307, USA.
    00018  */
    00019
    00020 #ifndef _cspublic_h_
    00021 #define _cspublic_h_
    00022
    00023 #include <cstypes.h>
    00024
    00025 #undef TDS_STATIC_CAST
    00026 #ifdef __cplusplus
    00027 #define TDS_STATIC_CAST(type, a) static_cast<type>(a)
    00028 extern "C"
    00029 {
    00030 #if 0
    00031 }
    00032 #endif
    00033 #else
    00034 #define TDS_STATIC_CAST(type, a) ((type)(a))
    00035 #endif
    00036
    00037 static const char rcsid_cspublic_h[] = "$Id: cspublic.h,v 1.56 2005/09/21 14:46:00 freddy77 Exp $";
    00038 static const void *const no_unused_cspublic_h_warn[] = { rcsid_cspublic_h, no_unused_cspublic_h_warn };
    00039
    00040 #define CS_PUBLIC
    00041 #define CS_STATIC static
    00042
    00043
    00044 #define CS_FAIL         0
    00045 #define CS_SUCCEED      1
    00046 #define CS_CANCELED     -202
    00047 #define CS_ROW_FAIL     -203
    00048 #define CS_END_DATA     -204
    00049 #define CS_END_RESULTS  -205
    00050 #define CS_END_ITEM     -206
    00051 #define CS_NOMSG        -207
    00052 #define CS_TIMED_OUT    -208
    00053 #define CS_PENDING      -2
    00054 #define CS_INTERRUPT    -5
    00055 #define CS_QUIET        -3
    00056
    00057 #define CS_SIZEOF(x) sizeof(x)
    00058
    00059 #define CS_LAYER(x)    (((x) >> 24) & 0xFF)
    00060 #define CS_ORIGIN(x)   (((x) >> 16) & 0xFF)
    00061 #define CS_SEVERITY(x) (((x) >>  8) & 0xFF)
    00062 #define CS_NUMBER(x)   ((x) & 0xFF)
    00063
    00064 /* forward declarations */
    00065 typedef CS_RETCODE(*CS_CSLIBMSG_FUNC) (CS_CONTEXT *, CS_CLIENTMSG *);
    00066 typedef CS_RETCODE(*CS_CLIENTMSG_FUNC) (CS_CONTEXT *, CS_CONNECTION *, CS_CLIENTMSG *);
    00067 typedef CS_RETCODE(*CS_SERVERMSG_FUNC) (CS_CONTEXT *, CS_CONNECTION *, CS_SERVERMSG *);
    00068
    00069
    00070 #define CS_IODATA          TDS_STATIC_CAST(CS_INT, 1600)
    00071 #define CS_SRC_VALUE   -2562
    00072
    00073
    00074
    00075 /* status bits for CS_SERVERMSG */
    00076 #define CS_HASEED 0x01
    00077
    00078 typedef struct _cs_blkdesc CS_BLKDESC;
    00079
    00080 /* CS_CAP_REQUEST values */
    00081 #define CS_REQ_LANG     1
    00082 #define CS_REQ_RPC      2
    00083 #define CS_REQ_NOTIF    3
    00084 #define CS_REQ_MSTMT    4
    00085 #define CS_REQ_BCP      5
    00086 #define CS_REQ_CURSOR   6
    00087 #define CS_REQ_DYN      7
    00088 #define CS_REQ_MSG      8
    00089 #define CS_REQ_PARAM    9
    00090 #define CS_DATA_INT1    10
    00091 #define CS_DATA_INT2    11
    00092 #define CS_DATA_INT4    12
    00093 #define CS_DATA_BIT     13
    00094 #define CS_DATA_CHAR    14
    00095 #define CS_DATA_VCHAR   15
    00096 #define CS_DATA_BIN     16
    00097 #define CS_DATA_VBIN    17
    00098 #define CS_DATA_MNY8    18
    00099 #define CS_DATA_MNY4    19
    00100 #define CS_DATA_DATE8   20
    00101 #define CS_DATA_DATE4   21
    00102 #define CS_DATA_FLT4    22
    00103 #define CS_DATA_FLT8    23
    00104 #define CS_DATA_NUM     24
    00105 #define CS_DATA_TEXT    25
    00106 #define CS_DATA_IMAGE   26
    00107 #define CS_DATA_DEC     27
    00108 #define CS_DATA_LCHAR   28
    00109 #define CS_DATA_LBIN    29
    00110 #define CS_DATA_INTN    30
    00111 #define CS_DATA_DATETIMEN       31
    00112 #define CS_DATA_MONEYN  32
    00113 #define CS_CSR_PREV     33
    00114 #define CS_CSR_FIRST    34
    00115 #define CS_CSR_LAST     35
    00116 #define CS_CSR_ABS      36
    00117 #define CS_CSR_REL      37
    00118 #define CS_CSR_MULTI    38
    00119 #define CS_CON_OOB      39
    00120 #define CS_CON_INBAND   40
    00121 #define CS_CON_LOGICAL  41
    00122 #define CS_PROTO_TEXT   42
    00123 #define CS_PROTO_BULK   43
    00124 #define CS_REQ_URGNOTIF 44
    00125 #define CS_DATA_SENSITIVITY     45
    00126 #define CS_DATA_BOUNDARY        46
    00127 #define CS_PROTO_DYNAMIC        47
    00128 #define CS_PROTO_DYNPROC        48
    00129 #define CS_DATA_FLTN    49
    00130 #define CS_DATA_BITN    50
    00131 #define CS_OPTION_GET   51
    00132 #define CS_DATA_INT8    52
    00133 #define CS_DATA_VOID    53
    00134
    00135 /* CS_CAP_RESPONSE values */
    00136 #define CS_RES_NOMSG    1
    00137 #define CS_RES_NOEED    2
    00138 #define CS_RES_NOPARAM  3
    00139 #define CS_DATA_NOINT1  4
    00140 #define CS_DATA_NOINT2  5
    00141 #define CS_DATA_NOINT4  6
    00142 #define CS_DATA_NOBIT   7
    00143 #define CS_DATA_NOCHAR  8
    00144 #define CS_DATA_NOVCHAR 9
    00145 #define CS_DATA_NOBIN   10
    00146 #define CS_DATA_NOVBIN  11
    00147 #define CS_DATA_NOMNY8  12
    00148 #define CS_DATA_NOMNY4  13
    00149 #define CS_DATA_NODATE8 14
    00150 #define CS_DATA_NODATE4 15
    00151 #define CS_DATA_NOFLT4  16
    00152 #define CS_DATA_NOFLT8  17
    00153 #define CS_DATA_NONUM   18
    00154 #define CS_DATA_NOTEXT  19
    00155 #define CS_DATA_NOIMAGE 20
    00156 #define CS_DATA_NODEC   21
    00157 #define CS_DATA_NOLCHAR 22
    00158 #define CS_DATA_NOLBIN  23
    00159 #define CS_DATA_NOINTN  24
    00160 #define CS_DATA_NODATETIMEN     25
    00161 #define CS_DATA_NOMONEYN        26
    00162 #define CS_CON_NOOOB    27
    00163 #define CS_CON_NOINBAND 28
    00164 #define CS_PROTO_NOTEXT 29
    00165 #define CS_PROTO_NOBULK 30
    00166 #define CS_DATA_NOSENSITIVITY   31
    00167 #define CS_DATA_NOBOUNDARY      32
    00168 #define CS_RES_NOTDSDEBUG       33
    00169 #define CS_RES_NOSTRIPBLANKS    34
    00170 #define CS_DATA_NOINT8  35
    00171
    00172 /* Properties */
    00173 enum
    00174 {
    00175 /*
    00176  * These defines looks weird but programs can test support for defines,
    00177  * compiler can check enum and there are no define side effecs
    00178  */
    00179         CS_USERNAME = 9100,
    00180 #define CS_USERNAME CS_USERNAME
    00181         CS_PASSWORD = 9101,
    00182 #define CS_PASSWORD CS_PASSWORD
    00183         CS_APPNAME = 9102,
    00184 #define CS_APPNAME CS_APPNAME
    00185         CS_HOSTNAME = 9103,
    00186 #define CS_HOSTNAME CS_HOSTNAME
    00187         CS_LOGIN_STATUS = 9104,
    00188 #define CS_LOGIN_STATUS CS_LOGIN_STATUS
    00189         CS_TDS_VERSION = 9105,
    00190 #define CS_TDS_VERSION CS_TDS_VERSION
    00191         CS_CHARSETCNV = 9106,
    00192 #define CS_CHARSETCNV CS_CHARSETCNV
    00193         CS_PACKETSIZE = 9107,
    00194 #define CS_PACKETSIZE CS_PACKETSIZE
    00195         CS_USERDATA = 9108,
    00196 #define CS_USERDATA CS_USERDATA
    00197         CS_NETIO = 9110,
    00198 #define CS_NETIO CS_NETIO
    00199         CS_TEXTLIMIT = 9112,
    00200 #define CS_TEXTLIMIT CS_TEXTLIMIT
    00201         CS_HIDDEN_KEYS = 9113,
    00202 #define CS_HIDDEN_KEYS CS_HIDDEN_KEYS
    00203         CS_VERSION = 9114,
    00204 #define CS_VERSION CS_VERSION
    00205         CS_IFILE = 9115,
    00206 #define CS_IFILE CS_IFILE
    00207         CS_LOGIN_TIMEOUT = 9116,
    00208 #define CS_LOGIN_TIMEOUT CS_LOGIN_TIMEOUT
    00209         CS_TIMEOUT = 9117,
    00210 #define CS_TIMEOUT CS_TIMEOUT
    00211         CS_MAX_CONNECT = 9118,
    00212 #define CS_MAX_CONNECT CS_MAX_CONNECT
    00213         CS_EXPOSE_FMTS = 9120,
    00214 #define CS_EXPOSE_FMTS CS_EXPOSE_FMTS
    00215         CS_EXTRA_INF = 9121,
    00216 #define CS_EXTRA_INF CS_EXTRA_INF
    00217         CS_ANSI_BINDS = 9123,
    00218 #define CS_ANSI_BINDS CS_ANSI_BINDS
    00219         CS_BULK_LOGIN = 9124,
    00220 #define CS_BULK_LOGIN CS_BULK_LOGIN
    00221         CS_LOC_PROP = 9125,
    00222 #define CS_LOC_PROP CS_LOC_PROP
    00223         CS_PARENT_HANDLE = 9130,
    00224 #define CS_PARENT_HANDLE CS_PARENT_HANDLE
    00225         CS_EED_CMD = 9131,
    00226 #define CS_EED_CMD CS_EED_CMD
    00227         CS_DIAG_TIMEOUT = 9132,
    00228 #define CS_DIAG_TIMEOUT CS_DIAG_TIMEOUT
    00229         CS_DISABLE_POLL = 9133,
    00230 #define CS_DISABLE_POLL CS_DISABLE_POLL
    00231         CS_SEC_ENCRYPTION = 9135,
    00232 #define CS_SEC_ENCRYPTION CS_SEC_ENCRYPTION
    00233         CS_SEC_CHALLENGE = 9136,
    00234 #define CS_SEC_CHALLENGE CS_SEC_CHALLENGE
    00235         CS_SEC_NEGOTIATE = 9137,
    00236 #define CS_SEC_NEGOTIATE CS_SEC_NEGOTIATE
    00237         CS_CON_STATUS = 9143,
    00238 #define CS_CON_STATUS CS_CON_STATUS
    00239         CS_VER_STRING = 9144,
    00240 #define CS_VER_STRING CS_VER_STRING
    00241         CS_SERVERNAME = 9146,
    00242 #define CS_SERVERNAME CS_SERVERNAME
    00243         CS_SEC_APPDEFINED = 9149,
    00244 #define CS_SEC_APPDEFINED CS_SEC_APPDEFINED
    00245         CS_STICKY_BINDS = 9151,
    00246 #define CS_STICKY_BINDS CS_STICKY_BINDS
    00247         CS_SERVERADDR = 9206,
    00248 #define CS_SERVERADDR CS_SERVERADDR
    00249         CS_PORT = 9300
    00250 #define CS_PORT CS_PORT
    00251 };
    00252
    00253 /* Arbitrary precision math operators */
    00254 enum
    00255 {
    00256         CS_ADD = 1,
    00257         CS_SUB,
    00258         CS_MULT,
    00259         CS_DIV
    00260 };
    00261
    00262 enum
    00263 {
    00264         CS_TDS_40 = 7360,
    00265         CS_TDS_42,
    00266         CS_TDS_46,
    00267         CS_TDS_495,
    00268         CS_TDS_50,
    00269         CS_TDS_70,
    00270         CS_TDS_80
    00271 };
    00272
    00273 /* bit mask values used by CS_DATAFMT.status */
    00274 #define CS_HIDDEN      (1 <<  0)
    00275 #define CS_KEY         (1 <<  1)
    00276 #define CS_VERSION_KEY (1 <<  2)
    00277 #define CS_NODATA      (1 <<  3)
    00278 #define CS_UPDATABLE   (1 <<  4)
    00279 #define CS_CANBENULL   (1 <<  5)
    00280 #define CS_DESCIN      (1 <<  6)
    00281 #define CS_DESCOUT     (1 <<  7)
    00282 #define CS_INPUTVALUE  (1 <<  8)
    00283 #define CS_UPDATECOL   (1 <<  9)
    00284 #define CS_RETURN      (1 << 10)
    00285 #define CS_TIMESTAMP   (1 << 13)
    00286 #define CS_NODEFAULT   (1 << 14)
    00287 #define CS_IDENTITY    (1 << 15)
    00288
    00289 /*
    00290  * DBD::Sybase compares indicator to CS_NULLDATA so this is -1
    00291  * (the documentation states -1)
    00292  */
    00293 #define CS_GOODDATA     0
    00294 #define CS_NULLDATA     (-1)
    00295
    00296 /* CS_CON_STATUS read-only property bit mask values */
    00297 #define CS_CONSTAT_CONNECTED    0x01
    00298 #define CS_CONSTAT_DEAD         0x02
    00299
    00300 /*
    00301  * Code added for CURSOR support
    00302  * types accepted by ct_cursor
    00303  */
    00304 #define CS_CURSOR_DECLARE  700
    00305 #define CS_CURSOR_OPEN     701
    00306 #define CS_CURSOR_ROWS     703
    00307 #define CS_CURSOR_UPDATE   704
    00308 #define CS_CURSOR_DELETE   705
    00309 #define CS_CURSOR_CLOSE    706
    00310 #define CS_CURSOR_DEALLOC  707
    00311 #define CS_CURSOR_OPTION   725
    00312
    00313 #define CS_FOR_UPDATE      TDS_STATIC_CAST(CS_INT, 0x1)
    00314 #define CS_READ_ONLY       TDS_STATIC_CAST(CS_INT, 0x2)
    00315 #define CS_RESTORE_OPEN    TDS_STATIC_CAST(CS_INT, 0x8)
    00316 #define CS_IMPLICIT_CURSOR TDS_STATIC_CAST(CS_INT, 0x40)
    00317
    00318
    00319 #define CS_CURSTAT_NONE      TDS_STATIC_CAST(CS_INT, 0x0)
    00320 #define CS_CURSTAT_DECLARED  TDS_STATIC_CAST(CS_INT, 0x1)
    00321 #define CS_CURSTAT_OPEN      TDS_STATIC_CAST(CS_INT, 0x2)
    00322 #define CS_CURSTAT_CLOSED    TDS_STATIC_CAST(CS_INT, 0x4)
    00323 #define CS_CURSTAT_RDONLY    TDS_STATIC_CAST(CS_INT, 0x8)
    00324 #define CS_CURSTAT_UPDATABLE TDS_STATIC_CAST(CS_INT, 0x10)
    00325 #define CS_CURSTAT_ROWCOUNT  TDS_STATIC_CAST(CS_INT, 0x20)
    00326 #define CS_CURSTAT_DEALLOC   TDS_STATIC_CAST(CS_INT, 0x40)
    00327
    00328 #define CS_CUR_STATUS        TDS_STATIC_CAST(CS_INT, 9126)
    00329 #define CS_CUR_ID            TDS_STATIC_CAST(CS_INT, 9127)
    00330 #define CS_CUR_NAME          TDS_STATIC_CAST(CS_INT, 9128)
    00331 #define CS_CUR_ROWCOUNT      TDS_STATIC_CAST(CS_INT, 9129)
    00332
    00333 /* options accepted by ct_options() */
    00334 #define CS_OPT_DATEFIRST        5001
    00335 #define CS_OPT_TEXTSIZE         5002
    00336 #define CS_OPT_STATS_TIME       5003
    00337 #define CS_OPT_STATS_IO         5004
    00338 #define CS_OPT_ROWCOUNT         5005
    00339 #define CS_OPT_DATEFORMAT       5007
    00340 #define CS_OPT_ISOLATION        5008
    00341 #define CS_OPT_AUTHON           5009
    00342 #define CS_OPT_SHOWPLAN         5013
    00343 #define CS_OPT_NOEXEC           5014
    00344 #define CS_OPT_ARITHIGNORE      5015
    00345 #define CS_OPT_TRUNCIGNORE      5016
    00346 #define CS_OPT_ARITHABORT       5017
    00347 #define CS_OPT_PARSEONLY        5018
    00348 #define CS_OPT_GETDATA          5020
    00349 #define CS_OPT_NOCOUNT          5021
    00350 #define CS_OPT_FORCEPLAN        5023
    00351 #define CS_OPT_FORMATONLY       5024
    00352 #define CS_OPT_CHAINXACTS       5025
    00353 #define CS_OPT_CURCLOSEONXACT   5026
    00354 #define CS_OPT_FIPSFLAG         5027
    00355 #define CS_OPT_RESTREES         5028
    00356 #define CS_OPT_IDENTITYON       5029
    00357 #define CS_OPT_CURREAD          5030
    00358 #define CS_OPT_CURWRITE         5031
    00359 #define CS_OPT_IDENTITYOFF      5032
    00360 #define CS_OPT_AUTHOFF          5033
    00361 #define CS_OPT_ANSINULL         5034
    00362 #define CS_OPT_QUOTED_IDENT     5035
    00363 #define CS_OPT_ANSIPERM         5036
    00364 #define CS_OPT_STR_RTRUNC       5037
    00365
    00366 /* options accepted by ct_command() */
    00367 enum ct_command_options
    00368 {
    00369         CS_MORE = 16,
    00370         CS_END = 32,
    00371         CS_RECOMPILE = 188,
    00372         CS_NO_RECOMPILE,
    00373         CS_BULK_INIT,
    00374         CS_BULK_CONT,
    00375         CS_BULK_DATA,
    00376         CS_COLUMN_DATA
    00377 };
    00378
    00379
    00380 /*
    00381  * bind formats, should be mapped to TDS types
    00382  * can be a combination of bit
    00383  */
    00384 enum
    00385 {
    00386         CS_FMT_UNUSED = 0,
    00387 #define CS_FMT_UNUSED CS_FMT_UNUSED
    00388         CS_FMT_NULLTERM = 1,
    00389 #define CS_FMT_NULLTERM CS_FMT_NULLTERM
    00390         CS_FMT_PADNULL = 2,
    00391 #define CS_FMT_PADBLANK CS_FMT_PADBLANK
    00392         CS_FMT_PADBLANK = 4,
    00393 #define CS_FMT_PADNULL CS_FMT_PADNULL
    00394         CS_FMT_JUSTIFY_RT = 8
    00395 #define CS_FMT_JUSTIFY_RT CS_FMT_JUSTIFY_RT
    00396 };
    00397
    00398 /* callbacks */
    00399 #define CS_COMPLETION_CB        1
    00400 #define CS_SERVERMSG_CB         2
    00401 #define CS_CLIENTMSG_CB         3
    00402 #define CS_NOTIF_CB             4
    00403 #define CS_ENCRYPT_CB           5
    00404 #define CS_CHALLENGE_CB         6
    00405 #define CS_DS_LOOKUP_CB         7
    00406 #define CS_SECSESSION_CB        8
    00407 #define CS_SIGNAL_CB            100
    00408 #define CS_MESSAGE_CB           9119
    00409
    00410 /* string types */
    00411 #define CS_NULLTERM     -9
    00412 #define CS_WILDCARD     -99
    00413 #define CS_NO_LIMIT     -9999
    00414 #define CS_UNUSED       -99999
    00415
    00416 /* other */
    00417 #define CS_GET          33
    00418 #define CS_SET          34
    00419 #define CS_CLEAR        35
    00420 #define CS_INIT         36
    00421 #define CS_STATUS       37
    00422 #define CS_MSGLIMIT     38
    00423 #define CS_SUPPORTED    40
    00424
    00425 #define CS_CMD_DONE     4046
    00426 #define CS_CMD_SUCCEED  4047
    00427 #define CS_CMD_FAIL     4048
    00428
    00429 /* commands */
    00430 #define CS_LANG_CMD      148
    00431 #define CS_RPC_CMD       149
    00432 #define CS_SEND_DATA_CMD 151
    00433 #define CS_SEND_BULK_CMD 153
    00434
    00435 #define CS_VERSION_100  112
    00436 #define CS_VERSION_110  1100
    00437 #define BLK_VERSION_100 CS_VERSION_100
    00438 #define BLK_VERSION_110 CS_VERSION_100
    00439
    00440 #define CS_FORCE_EXIT   300
    00441 #define CS_FORCE_CLOSE  301
    00442
    00443 #define CS_SYNC_IO      8111
    00444 #define CS_ASYNC_IO     8112
    00445 #define CS_DEFER_IO     8113
    00446
    00447 #define CS_CANCEL_CURRENT 6000
    00448 #define CS_CANCEL_ALL     6001
    00449 #define CS_CANCEL_ATTN    6002
    00450
    00451 #define CS_ROW_COUNT    800
    00452 #define CS_CMD_NUMBER   801
    00453 #define CS_NUM_COMPUTES 802
    00454 #define CS_NUMDATA      803
    00455 #define CS_NUMORDERCOLS 805
    00456 #define CS_MSGTYPE      806
    00457 #define CS_BROWSE_INFO  807
    00458 #define CS_TRANS_STATE  808
    00459
    00460 #define CS_TRAN_UNDEFINED   0
    00461 #define CS_TRAN_IN_PROGRESS 1
    00462 #define CS_TRAN_COMPLETED   2
    00463 #define CS_TRAN_FAIL        3
    00464 #define CS_TRAN_STMT_FAIL   4
    00465
    00466 #define CS_COMP_OP      5350
    00467 #define CS_COMP_ID      5351
    00468 #define CS_COMP_COLID   5352
    00469 #define CS_COMP_BYLIST  5353
    00470 #define CS_BYLIST_LEN   5354
    00471
    00472 #define CS_NO_COUNT     -1
    00473
    00474 #define CS_OP_SUM       5370
    00475 #define CS_OP_AVG       5371
    00476 #define CS_OP_COUNT     5372
    00477 #define CS_OP_MIN       5373
    00478 #define CS_OP_MAX       5374
    00479
    00480 #define CS_CAP_REQUEST  1
    00481 #define CS_CAP_RESPONSE 2
    00482
    00483 #define CS_PREPARE      717
    00484 #define CS_EXECUTE      718
    00485 #define CS_DESCRIBE_INPUT       720
    00486 #define CS_DESCRIBE_OUTPUT      721
    00487
    00488 #define CS_DEALLOC      711
    00489
    00490 #define CS_LC_ALL       7
    00491 #define CS_SYB_LANG     8
    00492 #define CS_SYB_CHARSET  9
    00493
    00494 #define CS_BLK_IN       1
    00495 #define CS_BLK_OUT      2
    00496
    00497 #define CS_BLK_BATCH    1
    00498 #define CS_BLK_ALL      2
    00499 #define CS_BLK_CANCEL   3
    00500
    00501 /* to do support these */
    00502
    00503 #define CS_BLK_ARRAY_MAXLEN 0x1000
    00504 #define CS_DEF_PREC     18
    00505
    00506 /* Error Severities  */
    00507 #define CS_SV_INFORM        TDS_STATIC_CAST(CS_INT, 0)
    00508 #define CS_SV_API_FAIL      TDS_STATIC_CAST(CS_INT, 1)
    00509 #define CS_SV_RETRY_FAIL    TDS_STATIC_CAST(CS_INT, 2)
    00510 #define CS_SV_RESOURCE_FAIL TDS_STATIC_CAST(CS_INT, 3)
    00511 #define CS_SV_CONFIG_FAIL   TDS_STATIC_CAST(CS_INT, 4)
    00512 #define CS_SV_COMM_FAIL     TDS_STATIC_CAST(CS_INT, 5)
    00513 #define CS_SV_INTERNAL_FAIL TDS_STATIC_CAST(CS_INT, 6)
    00514 #define CS_SV_FATAL         TDS_STATIC_CAST(CS_INT, 7)
    00515
    00516 /* result_types */
    00517 #define CS_COMPUTE_RESULT       4045
    00518 #define CS_CURSOR_RESULT        4041
    00519 #define CS_PARAM_RESULT         4042
    00520 #define CS_ROW_RESULT           4040
    00521 #define CS_STATUS_RESULT        4043
    00522 #define CS_COMPUTEFMT_RESULT    4050
    00523 #define CS_ROWFMT_RESULT        4049
    00524 #define CS_MSG_RESULT           4044
    00525 #define CS_DESCRIBE_RESULT      4051
    00526
    00527 /* bind types */
    00528 #define CS_ILLEGAL_TYPE     TDS_STATIC_CAST(CS_INT, -1)
    00529 #define CS_CHAR_TYPE        TDS_STATIC_CAST(CS_INT, 0)
    00530 #define CS_BINARY_TYPE      TDS_STATIC_CAST(CS_INT, 1)
    00531 #define CS_LONGCHAR_TYPE    TDS_STATIC_CAST(CS_INT, 2)
    00532 #define CS_LONGBINARY_TYPE  TDS_STATIC_CAST(CS_INT, 3)
    00533 #define CS_TEXT_TYPE        TDS_STATIC_CAST(CS_INT, 4)
    00534 #define CS_IMAGE_TYPE       TDS_STATIC_CAST(CS_INT, 5)
    00535 #define CS_TINYINT_TYPE     TDS_STATIC_CAST(CS_INT, 6)
    00536 #define CS_SMALLINT_TYPE    TDS_STATIC_CAST(CS_INT, 7)
    00537 #define CS_INT_TYPE         TDS_STATIC_CAST(CS_INT, 8)
    00538 #define CS_REAL_TYPE        TDS_STATIC_CAST(CS_INT, 9)
    00539 #define CS_FLOAT_TYPE       TDS_STATIC_CAST(CS_INT, 10)
    00540 #define CS_BIT_TYPE         TDS_STATIC_CAST(CS_INT, 11)
    00541 #define CS_DATETIME_TYPE    TDS_STATIC_CAST(CS_INT, 12)
    00542 #define CS_DATETIME4_TYPE   TDS_STATIC_CAST(CS_INT, 13)
    00543 #define CS_MONEY_TYPE       TDS_STATIC_CAST(CS_INT, 14)
    00544 #define CS_MONEY4_TYPE      TDS_STATIC_CAST(CS_INT, 15)
    00545 #define CS_NUMERIC_TYPE     TDS_STATIC_CAST(CS_INT, 16)
    00546 #define CS_DECIMAL_TYPE     TDS_STATIC_CAST(CS_INT, 17)
    00547 #define CS_VARCHAR_TYPE     TDS_STATIC_CAST(CS_INT, 18)
    00548 #define CS_VARBINARY_TYPE   TDS_STATIC_CAST(CS_INT, 19)
    00549 #define CS_LONG_TYPE        TDS_STATIC_CAST(CS_INT, 20)
    00550 #define CS_SENSITIVITY_TYPE TDS_STATIC_CAST(CS_INT, 21)
    00551 #define CS_BOUNDARY_TYPE    TDS_STATIC_CAST(CS_INT, 22)
    00552 #define CS_VOID_TYPE        TDS_STATIC_CAST(CS_INT, 23)
    00553 #define CS_USHORT_TYPE      TDS_STATIC_CAST(CS_INT, 24)
    00554 #define CS_UNICHAR_TYPE     TDS_STATIC_CAST(CS_INT, 25)
    00555 #define CS_UNIQUE_TYPE      TDS_STATIC_CAST(CS_INT, 40)
    00556
    00557 #define CS_USER_TYPE        TDS_STATIC_CAST(CS_INT, 100)
    00558 /* cs_dt_info type values */
    00559 enum
    00560 {
    00561         CS_MONTH = 7340,
    00562 #define CS_MONTH CS_MONTH
    00563         CS_SHORTMONTH,
    00564 #define CS_SHORTMONTH CS_SHORTMONTH
    00565         CS_DAYNAME,
    00566 #define CS_DAYNAME CS_DAYNAME
    00567         CS_DATEORDER,
    00568 #define CS_DATEORDER CS_DATEORDER
    00569         CS_12HOUR,
    00570 #define CS_12HOUR CS_12HOUR
    00571         CS_DT_CONVFMT
    00572 #define CS_DT_CONVFMT CS_DT_CONVFMT
    00573 };
    00574
    00575 /* DT_CONVFMT types */
    00576 enum
    00577 {
    00578         CS_DATES_SHORT = 0,
    00579 #define CS_DATES_SHORT CS_DATES_SHORT
    00580         CS_DATES_MDY1,
    00581 #define CS_DATES_MDY1 CS_DATES_MDY1
    00582         CS_DATES_YMD1,
    00583 #define CS_DATES_YMD1 CS_DATES_YMD1
    00584         CS_DATES_DMY1,
    00585 #define CS_DATES_DMY1 CS_DATES_DMY1
    00586         CS_DATES_DMY2,
    00587 #define CS_DATES_DMY2 CS_DATES_DMY2
    00588         CS_DATES_DMY3,
    00589 #define CS_DATES_DMY3 CS_DATES_DMY3
    00590         CS_DATES_DMY4,
    00591 #define CS_DATES_DMY4 CS_DATES_DMY4
    00592         CS_DATES_MDY2,
    00593 #define CS_DATES_MDY2 CS_DATES_MDY2
    00594         CS_DATES_HMS,
    00595 #define CS_DATES_HMS CS_DATES_HMS
    00596         CS_DATES_LONG,
    00597 #define CS_DATES_LONG CS_DATES_LONG
    00598         CS_DATES_MDY3,
    00599 #define CS_DATES_MDY3 CS_DATES_MDY3
    00600         CS_DATES_YMD2,
    00601 #define CS_DATES_YMD2 CS_DATES_YMD2
    00602         CS_DATES_YMD3,
    00603 #define CS_DATES_YMD3 CS_DATES_YMD3
    00604         CS_DATES_YDM1,
    00605 #define CS_DATES_YDM1 CS_DATES_YDM1
    00606         CS_DATES_MYD1,
    00607 #define CS_DATES_MYD1 CS_DATES_MYD1
    00608         CS_DATES_DYM1,
    00609 #define CS_DATES_DYM1 CS_DATES_DYM1
    00610         CS_DATES_MDY1_YYYY = 101,
    00611 #define CS_DATES_MDY1_YYYY CS_DATES_MDY1_YYYY
    00612         CS_DATES_YMD1_YYYY,
    00613 #define CS_DATES_YMD1_YYYY CS_DATES_YMD1_YYYY
    00614         CS_DATES_DMY1_YYYY,
    00615 #define CS_DATES_DMY1_YYYY CS_DATES_DMY1_YYYY
    00616         CS_DATES_DMY2_YYYY,
    00617 #define CS_DATES_DMY2_YYYY CS_DATES_DMY2_YYYY
    00618         CS_DATES_DMY3_YYYY,
    00619 #define CS_DATES_DMY3_YYYY CS_DATES_DMY3_YYYY
    00620         CS_DATES_DMY4_YYYY,
    00621 #define CS_DATES_DMY4_YYYY CS_DATES_DMY4_YYYY
    00622         CS_DATES_MDY2_YYYY,
    00623 #define CS_DATES_MDY2_YYYY CS_DATES_MDY2_YYYY
    00624         CS_DATES_MDY3_YYYY = 110,
    00625 #define CS_DATES_MDY3_YYYY CS_DATES_MDY3_YYYY
    00626         CS_DATES_YMD2_YYYY,
    00627 #define CS_DATES_YMD2_YYYY CS_DATES_YMD2_YYYY
    00628         CS_DATES_YMD3_YYYY
    00629 #define CS_DATES_YMD3_YYYY CS_DATES_YMD3_YYYY
    00630 };
    00631
    00632 typedef CS_RETCODE(*CS_CONV_FUNC) (CS_CONTEXT * context, CS_DATAFMT * srcfmt, CS_VOID * src, CS_DATAFMT * detsfmt, CS_VOID * dest,
    00633                                    CS_INT * destlen);
    00634
    00635 typedef struct _cs_objname
    00636 {
    00637         CS_BOOL thinkexists;
    00638         CS_INT object_type;
    00639         CS_CHAR last_name[CS_MAX_NAME];
    00640         CS_INT lnlen;
    00641         CS_CHAR first_name[CS_MAX_NAME];
    00642         CS_INT fnlen;
    00643         CS_VOID *scope;
    00644         CS_INT scopelen;
    00645         CS_VOID *thread;
    00646         CS_INT threadlen;
    00647 } CS_OBJNAME;
    00648
    00649 typedef struct _cs_objdata
    00650 {
    00651         CS_BOOL actuallyexists;
    00652         CS_CONNECTION *connection;
    00653         CS_COMMAND *command;
    00654         CS_VOID *buffer;
    00655         CS_INT buflen;
    00656 } CS_OBJDATA;
    00657
    00658 /* Eventually, these should be in terms of TDS values */
    00659 enum
    00660 {
    00661         CS_OPT_MONDAY = 1,
    00662         CS_OPT_TUESDAY,
    00663         CS_OPT_WEDNESDAY,
    00664         CS_OPT_THURSDAY,
    00665         CS_OPT_FRIDAY,
    00666         CS_OPT_SATURDAY,
    00667         CS_OPT_SUNDAY
    00668 };
    00669 enum
    00670 {
    00671         CS_OPT_FMTMDY = 1,
    00672         CS_OPT_FMTDMY,
    00673         CS_OPT_FMTYMD,
    00674         CS_OPT_FMTYDM,
    00675         CS_OPT_FMTMYD,
    00676         CS_OPT_FMTDYM
    00677 };
    00678 enum
    00679 {
    00680         CS_OPT_LEVEL0 = 0,
    00681         CS_OPT_LEVEL1,
    00682         CS_OPT_LEVEL2,
    00683         CS_OPT_LEVEL3
    00684 };
    00685
    00686 #define CS_FALSE        0
    00687 #define CS_TRUE 1
    00688
    00689 #define SRV_PROC        CS_VOID
    00690
    00691 /* constants required for ct_diag (not jet implemented) */
    00692 #define CS_CLIENTMSG_TYPE 4700
    00693 #define CS_SERVERMSG_TYPE 4701
    00694 #define CS_ALLMSG_TYPE 4702
    00695
    00696 CS_RETCODE cs_convert(CS_CONTEXT * ctx, CS_DATAFMT * srcfmt, CS_VOID * srcdata, CS_DATAFMT * destfmt, CS_VOID * destdata,
    00697                       CS_INT * resultlen);
    00698 CS_RETCODE cs_ctx_alloc(CS_INT version, CS_CONTEXT ** ctx);
    00699 CS_RETCODE cs_ctx_global(CS_INT version, CS_CONTEXT ** ctx);
    00700 CS_RETCODE cs_ctx_drop(CS_CONTEXT * ctx);
    00701 CS_RETCODE cs_config(CS_CONTEXT * ctx, CS_INT action, CS_INT property, CS_VOID * buffer, CS_INT buflen, CS_INT * outlen);
    00702 CS_RETCODE cs_strbuild(CS_CONTEXT * ctx, CS_CHAR * buffer, CS_INT buflen, CS_INT * resultlen, CS_CHAR * text, CS_INT textlen,
    00703                        CS_CHAR * formats, CS_INT formatlen, ...);
    00704 CS_RETCODE cs_dt_crack(CS_CONTEXT * ctx, CS_INT datetype, CS_VOID * dateval, CS_DATEREC * daterec);
    00705 CS_RETCODE cs_loc_alloc(CS_CONTEXT * ctx, CS_LOCALE ** locptr);
    00706 CS_RETCODE cs_loc_drop(CS_CONTEXT * ctx, CS_LOCALE * locale);
    00707 CS_RETCODE cs_locale(CS_CONTEXT * ctx, CS_INT action, CS_LOCALE * locale, CS_INT type, CS_VOID * buffer, CS_INT buflen,
    00708                      CS_INT * outlen);
    00709 CS_RETCODE cs_dt_info(CS_CONTEXT * ctx, CS_INT action, CS_LOCALE * locale, CS_INT type, CS_INT item, CS_VOID * buffer,
    00710                       CS_INT buflen, CS_INT * outlen);
    00711
    00712 CS_RETCODE cs_calc(CS_CONTEXT * ctx, CS_INT op, CS_INT datatype, CS_VOID * var1, CS_VOID * var2, CS_VOID * dest);
    00713 CS_RETCODE cs_cmp(CS_CONTEXT * ctx, CS_INT datatype, CS_VOID * var1, CS_VOID * var2, CS_INT * result);
    00714 CS_RETCODE cs_conv_mult(CS_CONTEXT * ctx, CS_LOCALE * srcloc, CS_LOCALE * destloc, CS_INT * conv_multiplier);
    00715 CS_RETCODE cs_diag(CS_CONTEXT * ctx, CS_INT operation, CS_INT type, CS_INT idx, CS_VOID * buffer);
    00716 CS_RETCODE cs_manage_convert(CS_CONTEXT * ctx, CS_INT action, CS_INT srctype, CS_CHAR * srcname, CS_INT srcnamelen, CS_INT desttype,
    00717                              CS_CHAR * destname, CS_INT destnamelen, CS_INT * conv_multiplier, CS_CONV_FUNC * func);
    00718 CS_RETCODE cs_objects(CS_CONTEXT * ctx, CS_INT action, CS_OBJNAME * objname, CS_OBJDATA * objdata);
    00719 CS_RETCODE cs_set_convert(CS_CONTEXT * ctx, CS_INT action, CS_INT srctype, CS_INT desttype, CS_CONV_FUNC * func);
    00720 CS_RETCODE cs_setnull(CS_CONTEXT * ctx, CS_DATAFMT * datafmt, CS_VOID * buffer, CS_INT buflen);
    00721 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,
    00722                      CS_INT * result);
    00723 CS_RETCODE cs_time(CS_CONTEXT * ctx, CS_LOCALE * locale, CS_VOID * buffer, CS_INT buflen, CS_INT * outlen, CS_DATEREC * daterec);
    00724 CS_RETCODE cs_will_convert(CS_CONTEXT * ctx, CS_INT srctype, CS_INT desttype, CS_BOOL * result);
    00725
    00726 #ifdef __cplusplus
    00727 #if 0
    00728 {
    00729 #endif
    00730 }
    00731 #endif
    00732
    00733 #endif