Main Page Modules Compound List File List Compound Members File Members Related Pages

# 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 "tds_sysdep_public.h"
    00024
    00025 #ifdef __cplusplus
    00026 extern "C"
    00027 {
    00028 #if 0
    00029 }
    00030 #endif
    00031 #endif
    00032
    00033 static const char rcsid_cspublic_h[] = "$Id: cspublic.h,v 1.53 2004/10/28 12:42:11 freddy77 Exp $";
    00034 static const void *const no_unused_cspublic_h_warn[] = { rcsid_cspublic_h, no_unused_cspublic_h_warn };
    00035
    00036 typedef int CS_RETCODE;
    00037
    00038 #define CS_PUBLIC
    00039 #define CS_STATIC static
    00040
    00041 typedef tds_sysdep_int32_type CS_INT;
    00042 typedef unsigned tds_sysdep_int32_type CS_UINT;
    00043 typedef tds_sysdep_int16_type CS_SMALLINT;
    00044 typedef unsigned char CS_TINYINT;
    00045 typedef char CS_CHAR;
    00046 typedef unsigned char CS_BYTE;
    00047 typedef struct _cs_numeric
    00048 {
    00049         unsigned char precision;
    00050         unsigned char scale;
    00051         unsigned char array[33];
    00052 } CS_NUMERIC;
    00053 typedef tds_sysdep_real32_type CS_REAL;
    00054 typedef tds_sysdep_real64_type CS_FLOAT;
    00055 typedef char CS_BOOL;
    00056 typedef void CS_VOID;
    00057 typedef struct _cs_varbinary
    00058 {
    00059         CS_INT len;
    00060         CS_CHAR array[256];
    00061 } CS_VARBINARY;
    00062 typedef CS_NUMERIC CS_DECIMAL;
    00063 typedef unsigned char CS_IMAGE;
    00064 typedef unsigned char CS_TEXT;
    00065 typedef unsigned char CS_LONGBINARY;
    00066 typedef unsigned char CS_LONGCHAR;
    00067 typedef tds_sysdep_int32_type CS_LONG;
    00068 typedef unsigned char CS_BINARY;
    00069 typedef unsigned tds_sysdep_int16_type CS_USHORT;
    00070 typedef unsigned char CS_BIT;
    00071
    00072 #define CS_FAIL    0
    00073 #define CS_SUCCEED 1
    00074 #define CS_SIZEOF(x) sizeof(x)
    00075 #define CS_NOMSG   -99
    00076
    00077 #define CS_LAYER(x)    (((x) >> 24) & 0xFF)
    00078 #define CS_ORIGIN(x)   (((x) >> 16) & 0xFF)
    00079 #define CS_SEVERITY(x) (((x) >>  8) & 0xFF)
    00080 #define CS_NUMBER(x)   ((x) & 0xFF)
    00081
    00082 #define CS_OBJ_NAME 400         /* full name length */
    00083 #define CS_TP_SIZE  16          /* text pointer */
    00084 #define CS_TS_SIZE  8           /* length of timestamp */
    00085
    00086 /* forward declarations */
    00087 typedef struct _cs_config CS_CONFIG;
    00088 typedef struct _cs_context CS_CONTEXT;
    00089 typedef struct _cs_clientmsg CS_CLIENTMSG;
    00090 typedef struct _cs_connection CS_CONNECTION;
    00091 typedef struct _cs_servermsg CS_SERVERMSG;
    00092 typedef struct _cs_locale CS_LOCALE;
    00093 typedef struct _cs_command CS_COMMAND;
    00094 typedef CS_RETCODE(*CS_CSLIBMSG_FUNC) (CS_CONTEXT *, CS_CLIENTMSG *);
    00095 typedef CS_RETCODE(*CS_CLIENTMSG_FUNC) (CS_CONTEXT *, CS_CONNECTION *, CS_CLIENTMSG *);
    00096 typedef CS_RETCODE(*CS_SERVERMSG_FUNC) (CS_CONTEXT *, CS_CONNECTION *, CS_SERVERMSG *);
    00097
    00098
    00099 #define CS_IODATA          (CS_INT)1600
    00100
    00101 typedef struct _cs_iodesc
    00102 {
    00103         CS_INT iotype;
    00104         CS_INT datatype;
    00105         CS_LOCALE *locale;
    00106         CS_INT usertype;
    00107         CS_INT total_txtlen;
    00108         CS_INT offset;
    00109         CS_BOOL log_on_update;
    00110         CS_CHAR name[CS_OBJ_NAME];
    00111         CS_INT namelen;
    00112         CS_BYTE timestamp[CS_TS_SIZE];
    00113         CS_INT timestamplen;
    00114         CS_BYTE textptr[CS_TP_SIZE];
    00115         CS_INT textptrlen;
    00116 } CS_IODESC;
    00117
    00118 #define CS_MAX_MSG 1024
    00119 #define CS_MAX_NAME 132
    00120 #define CS_MAX_SCALE 77
    00121 #define CS_MAX_PREC 77          /* used by php */
    00122 #define CS_SQLSTATE_SIZE 8
    00123
    00124
    00125 #define CS_SRC_VALUE   -2562
    00126
    00127 typedef struct _cs_datafmt
    00128 {
    00129         CS_CHAR name[CS_MAX_NAME];
    00130         CS_INT namelen;
    00131         CS_INT datatype;
    00132         CS_INT format;
    00133         CS_INT maxlength;
    00134         CS_INT scale;
    00135         CS_INT precision;
    00136         CS_INT status;
    00137         CS_INT count;
    00138         CS_INT usertype;
    00139         CS_LOCALE *locale;
    00140 } CS_DATAFMT;
    00141
    00142 typedef struct _cs_money
    00143 {
    00144         CS_INT mnyhigh;
    00145         CS_UINT mnylow;
    00146 } CS_MONEY;
    00147
    00148 typedef struct _cs_money4
    00149 {
    00150         CS_INT mny4;
    00151 } CS_MONEY4;
    00152
    00153 typedef struct _cs_datetime
    00154 {
    00155         CS_INT dtdays;
    00156         CS_INT dttime;
    00157 } CS_DATETIME;
    00158
    00159 typedef struct _cs_datetime4
    00160 {
    00161         CS_USHORT days;
    00162         CS_USHORT minutes;
    00163 } CS_DATETIME4;
    00164
    00165 typedef struct _cs_daterec
    00166 {
    00167         CS_INT dateyear;
    00168         CS_INT datemonth;
    00169         CS_INT datedmonth;
    00170         CS_INT datedyear;
    00171         CS_INT datedweek;
    00172         CS_INT datehour;
    00173         CS_INT dateminute;
    00174         CS_INT datesecond;
    00175         CS_INT datemsecond;
    00176         CS_INT datetzone;
    00177 } CS_DATEREC;
    00178
    00179 typedef CS_INT CS_MSGNUM;
    00180
    00181 struct _cs_clientmsg
    00182 {
    00183         CS_INT severity;
    00184         CS_MSGNUM msgnumber;
    00185         CS_CHAR msgstring[CS_MAX_MSG];
    00186         CS_INT msgstringlen;
    00187         CS_INT osnumber;
    00188         CS_CHAR osstring[CS_MAX_MSG];
    00189         CS_INT osstringlen;
    00190         CS_INT status;
    00191         CS_BYTE sqlstate[CS_SQLSTATE_SIZE];
    00192         CS_INT sqlstatelen;
    00193 };
    00194
    00195 struct _cs_servermsg
    00196 {
    00197         CS_MSGNUM msgnumber;
    00198         CS_INT state;
    00199         CS_INT severity;
    00200         CS_CHAR text[CS_MAX_MSG];
    00201         CS_INT textlen;
    00202         CS_CHAR svrname[CS_MAX_NAME];
    00203         CS_INT svrnlen;
    00204         CS_CHAR proc[CS_MAX_NAME];
    00205         CS_INT proclen;
    00206         CS_INT line;
    00207         CS_INT status;
    00208         CS_BYTE sqlstate[CS_SQLSTATE_SIZE];
    00209         CS_INT sqlstatelen;
    00210 };
    00211
    00212 /* status bits for CS_SERVERMSG */
    00213 #define CS_HASEED 0x01
    00214
    00215 typedef struct _cs_blkdesc CS_BLKDESC;
    00216
    00217 /* CS_CAP_REQUEST values */
    00218 #define CS_REQ_LANG     1
    00219 #define CS_REQ_RPC      2
    00220 #define CS_REQ_NOTIF    3
    00221 #define CS_REQ_MSTMT    4
    00222 #define CS_REQ_BCP      5
    00223 #define CS_REQ_CURSOR   6
    00224 #define CS_REQ_DYN      7
    00225 #define CS_REQ_MSG      8
    00226 #define CS_REQ_PARAM    9
    00227 #define CS_DATA_INT1    10
    00228 #define CS_DATA_INT2    11
    00229 #define CS_DATA_INT4    12
    00230 #define CS_DATA_BIT     13
    00231 #define CS_DATA_CHAR    14
    00232 #define CS_DATA_VCHAR   15
    00233 #define CS_DATA_BIN     16
    00234 #define CS_DATA_VBIN    17
    00235 #define CS_DATA_MNY8    18
    00236 #define CS_DATA_MNY4    19
    00237 #define CS_DATA_DATE8   20
    00238 #define CS_DATA_DATE4   21
    00239 #define CS_DATA_FLT4    22
    00240 #define CS_DATA_FLT8    23
    00241 #define CS_DATA_NUM     24
    00242 #define CS_DATA_TEXT    25
    00243 #define CS_DATA_IMAGE   26
    00244 #define CS_DATA_DEC     27
    00245 #define CS_DATA_LCHAR   28
    00246 #define CS_DATA_LBIN    29
    00247 #define CS_DATA_INTN    30
    00248 #define CS_DATA_DATETIMEN       31
    00249 #define CS_DATA_MONEYN  32
    00250 #define CS_CSR_PREV     33
    00251 #define CS_CSR_FIRST    34
    00252 #define CS_CSR_LAST     35
    00253 #define CS_CSR_ABS      36
    00254 #define CS_CSR_REL      37
    00255 #define CS_CSR_MULTI    38
    00256 #define CS_CON_OOB      39
    00257 #define CS_CON_INBAND   40
    00258 #define CS_CON_LOGICAL  41
    00259 #define CS_PROTO_TEXT   42
    00260 #define CS_PROTO_BULK   43
    00261 #define CS_REQ_URGNOTIF 44
    00262 #define CS_DATA_SENSITIVITY     45
    00263 #define CS_DATA_BOUNDARY        46
    00264 #define CS_PROTO_DYNAMIC        47
    00265 #define CS_PROTO_DYNPROC        48
    00266 #define CS_DATA_FLTN    49
    00267 #define CS_DATA_BITN    50
    00268 #define CS_DATA_INT8    51
    00269 #define CS_DATA_VOID    52
    00270 #define CS_OPTION_GET   53
    00271
    00272 /* CS_CAP_RESPONSE values */
    00273 #define CS_RES_NOMSG    1
    00274 #define CS_RES_NOEED    2
    00275 #define CS_RES_NOPARAM  3
    00276 #define CS_DATA_NOINT1  4
    00277 #define CS_DATA_NOINT2  5
    00278 #define CS_DATA_NOINT4  6
    00279 #define CS_DATA_NOBIT   7
    00280 #define CS_DATA_NOCHAR  8
    00281 #define CS_DATA_NOVCHAR 9
    00282 #define CS_DATA_NOBIN   10
    00283 #define CS_DATA_NOVBIN  11
    00284 #define CS_DATA_NOMNY8  12
    00285 #define CS_DATA_NOMNY4  13
    00286 #define CS_DATA_NODATE8 14
    00287 #define CS_DATA_NODATE4 15
    00288 #define CS_DATA_NOFLT4  16
    00289 #define CS_DATA_NOFLT8  17
    00290 #define CS_DATA_NONUM   18
    00291 #define CS_DATA_NOTEXT  19
    00292 #define CS_DATA_NOIMAGE 20
    00293 #define CS_DATA_NODEC   21
    00294 #define CS_DATA_NOLCHAR 22
    00295 #define CS_DATA_NOLBIN  23
    00296 #define CS_DATA_NOINTN  24
    00297 #define CS_DATA_NODATETIMEN     25
    00298 #define CS_DATA_NOMONEYN        26
    00299 #define CS_CON_NOOOB    27
    00300 #define CS_CON_NOINBAND 28
    00301 #define CS_PROTO_NOTEXT 29
    00302 #define CS_PROTO_NOBULK 30
    00303 #define CS_DATA_NOSENSITIVITY   31
    00304 #define CS_DATA_NOBOUNDARY      32
    00305 #define CS_DATA_NOTDSDEBUG      33
    00306 #define CS_RES_NOSTRIPBLANKS    34
    00307 #define CS_DATA_NOINT8  35
    00308
    00309 /* Properties */
    00310 enum
    00311 {
    00312         CS_USERNAME = 1,
    00313 /*
    00314  * These defines looks weird but programs can test support for defines,
    00315  * compiler can check enum and there are no define side effecs
    00316  */
    00317 #define CS_USERNAME CS_USERNAME
    00318         CS_PASSWORD,
    00319 #define CS_PASSWORD CS_PASSWORD
    00320         CS_APPNAME,
    00321 #define CS_APPNAME CS_APPNAME
    00322         CS_HOSTNAME,
    00323 #define CS_HOSTNAME CS_HOSTNAME
    00324         CS_PACKETSIZE,
    00325 #define CS_PACKETSIZE CS_PACKETSIZE
    00326         CS_SEC_ENCRYPTION,
    00327 #define CS_SEC_ENCRYPTION CS_SEC_ENCRYPTION
    00328         CS_LOC_PROP,
    00329 #define CS_LOC_PROP CS_LOC_PROP
    00330         CS_SEC_CHALLENGE,
    00331 #define CS_SEC_CHALLENGE CS_SEC_CHALLENGE
    00332         CS_SEC_NEGOTIATE,
    00333 #define CS_SEC_NEGOTIATE CS_SEC_NEGOTIATE
    00334         CS_TDS_VERSION,
    00335 #define CS_TDS_VERSION CS_TDS_VERSION
    00336         CS_NETIO,
    00337 #define CS_NETIO CS_NETIO
    00338         CS_IFILE,
    00339 #define CS_IFILE CS_IFILE
    00340         CS_USERDATA,
    00341 #define CS_USERDATA CS_USERDATA
    00342         CS_SEC_APPDEFINED,
    00343 #define CS_SEC_APPDEFINED CS_SEC_APPDEFINED
    00344         CS_CHARSETCNV,
    00345 #define CS_CHARSETCNV CS_CHARSETCNV
    00346         CS_ANSI_BINDS,
    00347 #define CS_ANSI_BINDS CS_ANSI_BINDS
    00348         CS_VER_STRING,
    00349 #define CS_VER_STRING CS_VER_STRING
    00350         CS_SERVERNAME,
    00351 #define CS_SERVERNAME CS_SERVERNAME
    00352         CS_PORT
    00353 #define CS_PORT CS_PORT
    00354 };
    00355
    00356 /* Arbitrary precision math operators */
    00357 enum
    00358 {
    00359         CS_ADD = 1,
    00360         CS_SUB,
    00361         CS_MULT,
    00362         CS_DIV
    00363 };
    00364
    00365 enum
    00366 {
    00367         CS_TDS_40 = 1,
    00368         CS_TDS_42,
    00369         CS_TDS_46,
    00370         CS_TDS_495,
    00371         CS_TDS_50,
    00372         CS_TDS_70,
    00373         CS_TDS_80
    00374 };
    00375
    00376 /* bit mask values used by CS_DATAFMT.status */
    00377 #define CS_CANBENULL   (1)
    00378 #define CS_HIDDEN      (1 << 1)
    00379 #define CS_IDENTITY    (1 << 2)
    00380 #define CS_KEY         (1 << 3)
    00381 #define CS_VERSION_KEY (1 << 4)
    00382 #define CS_TIMESTAMP   (1 << 5)
    00383 #define CS_UPDATABLE   (1 << 6)
    00384 #define CS_UPDATECOL   (1 << 7)
    00385 #define CS_RETURN      (1 << 8)
    00386
    00387 /*
    00388  * DBD::Sybase compares indicator to CS_NULLDATA so this is -1
    00389  * (the documentation states -1)
    00390  */
    00391 #define CS_NULLDATA     (-1)
    00392
    00393 /* CS_CON_STATUS read-only property bit mask values */
    00394 #define CS_CONSTAT_CONNECTED    0x01
    00395 #define CS_CONSTAT_DEAD         0x02
    00396
    00397 /*
    00398  * Code added for CURSOR support
    00399  * types accepted by ct_cursor
    00400  */
    00401 #define CS_CURSOR_DECLARE  1
    00402 #define CS_CURSOR_OPEN     2
    00403 #define CS_CURSOR_ROWS     3
    00404 #define CS_CURSOR_OPTION   4
    00405 #define CS_CURSOR_UPDATE   5
    00406 #define CS_CURSOR_DELETE   6
    00407 #define CS_CURSOR_DEALLOC  7
    00408 #define CS_IMPLICIT_CURSOR 8
    00409 #define CS_CURSOR_CLOSE    9
    00410
    00411 /* options accepted by ct_options() */
    00412 #define CS_OPT_ANSINULL         1
    00413 #define CS_OPT_ANSIPERM         2
    00414 #define CS_OPT_ARITHABORT       3
    00415 #define CS_OPT_ARITHIGNORE      4
    00416 #define CS_OPT_AUTHOFF          5
    00417 #define CS_OPT_AUTHON           6
    00418 #define CS_OPT_CHAINXACTS       7
    00419 #define CS_OPT_CURCLOSEONXACT   8
    00420 #define CS_OPT_CURREAD          9
    00421 #define CS_OPT_CURWRITE         10
    00422 #define CS_OPT_DATEFIRST        11
    00423 #define CS_OPT_DATEFORMAT       12
    00424 #define CS_OPT_FIPSFLAG         13
    00425 #define CS_OPT_FORCEPLAN        14
    00426 #define CS_OPT_FORMATONLY       15
    00427 #define CS_OPT_GETDATA          16
    00428 #define CS_OPT_IDENTITYOFF      17
    00429 #define CS_OPT_IDENTITYON       18
    00430 #define CS_OPT_ISOLATION        19
    00431 #define CS_OPT_NOCOUNT          20
    00432 #define CS_OPT_NOEXEC           21
    00433 #define CS_OPT_PARSEONLY        22
    00434 #define CS_OPT_QUOTED_IDENT     23
    00435 #define CS_OPT_RESTREES         24
    00436 #define CS_OPT_ROWCOUNT         25
    00437 #define CS_OPT_SHOWPLAN         26
    00438 #define CS_OPT_STATS_IO         27
    00439 #define CS_OPT_STATS_TIME       28
    00440 #define CS_OPT_STR_RTRUNC       29
    00441 #define CS_OPT_TEXTSIZE         30
    00442 #define CS_OPT_TRUNCIGNORE      31
    00443
    00444 /* options accepted by ct_command() */
    00445 enum ct_command_options
    00446 {
    00447         CS_MORE,
    00448         CS_END,
    00449         CS_UNUSED,
    00450         CS_RECOMPILE,
    00451         CS_NO_RECOMPILE,
    00452         CS_COLUMN_DATA,
    00453         CS_BULK_DATA,
    00454         CS_BULK_INIT,
    00455         CS_BULK_CONT
    00456 };
    00457
    00458
    00459 /*
    00460  * bind formats, should be mapped to TDS types
    00461  * can be a combination of bit
    00462  */
    00463 enum
    00464 {
    00465         CS_FMT_UNUSED = 0,
    00466 #define CS_FMT_UNUSED CS_FMT_UNUSED
    00467         CS_FMT_NULLTERM = 1,
    00468 #define CS_FMT_NULLTERM CS_FMT_NULLTERM
    00469         CS_FMT_PADNULL = 2,
    00470 #define CS_FMT_PADBLANK CS_FMT_PADBLANK
    00471         CS_FMT_PADBLANK = 4
    00472 #define CS_FMT_PADNULL CS_FMT_PADNULL
    00473 };
    00474
    00475 /* callbacks */
    00476 #define CS_COMPLETION_CB        1
    00477 #define CS_SERVERMSG_CB         2
    00478 #define CS_CLIENTMSG_CB         3
    00479 #define CS_NOTIF_CB             4
    00480 #define CS_ENCRYPT_CB           5
    00481 #define CS_CHALLENGE_CB         6
    00482 #define CS_DS_LOOKUP_CB         7
    00483 #define CS_SECSESSION_CB        8
    00484 #define CS_SIGNAL_CB            100
    00485 #define CS_MESSAGE_CB           9119
    00486
    00487 /* string types */
    00488 #define CS_NULLTERM     -9
    00489 #define CS_WILDCARD     -99
    00490 #define CS_NO_LIMIT     -9999
    00491 #define CS_UNUSED       -99999
    00492
    00493 /* other */
    00494 #define CS_CLEAR        3
    00495 #define CS_SET          4
    00496 #define CS_LANG_CMD     7
    00497 #define CS_ROW_FAIL     9
    00498 #define CS_END_DATA     10
    00499 #define CS_END_ITEM 11
    00500 #define CS_CMD_SUCCEED  4047
    00501 #define CS_CMD_FAIL     4048
    00502 #define CS_CMD_DONE     4046
    00503 #define CS_END_RESULTS  15
    00504 #define CS_VERSION_100  16
    00505 #define CS_FORCE_EXIT   17
    00506 #define CS_GET          25
    00507 #define CS_CON_STATUS 26
    00508 #define CS_FORCE_CLOSE 27
    00509 #define CS_SYNC_IO      29
    00510 #define CS_LC_ALL       37
    00511 #define CS_SYB_LANG     38
    00512 #define CS_SYB_CHARSET  39
    00513 #define CS_SV_COMM_FAIL 41
    00514 #define CS_BULK_LOGIN   42
    00515 #define BLK_VERSION_100 CS_VERSION_100
    00516 #define CS_BLK_IN       43
    00517 #define CS_BLK_OUT      44
    00518 #define CS_BLK_BATCH    45
    00519 #define CS_BLK_ALL      46
    00520 #define CS_BLK_CANCEL   47
    00521 #define CS_CANCEL_ALL   48
    00522 #define CS_NUMDATA      49
    00523 #define CS_CANCEL_ATTN  50
    00524 #define CS_PARENT_HANDLE        51
    00525 #define CS_COMP_ID      52
    00526 #define CS_BYLIST_LEN   53
    00527 #define CS_COMP_BYLIST  54
    00528 #define CS_COMP_OP      55
    00529 #define CS_COMP_COLID   56
    00530 #define CS_NO_COUNT     -1
    00531 #define CS_ROW_COUNT    59
    00532 #define CS_OP_SUM       60
    00533 #define CS_OP_AVG       61
    00534 #define CS_OP_MIN       62
    00535 #define CS_OP_MAX       63
    00536 #define CS_OP_COUNT     64
    00537 #define CS_CANCEL_CURRENT       67
    00538 #define CS_CAPREQUEST   73
    00539 #define CS_EED_CMD      77
    00540 #define CS_LOGIN_TIMEOUT        78
    00541 #define CS_CAP_REQUEST  79
    00542 #define CS_DESCRIBE_INPUT       80
    00543 #define CS_PREPARE      81
    00544 #define CS_EXECUTE      82
    00545 #define CS_DEALLOC      83
    00546 #define CS_CAP_RESPONSE 84
    00547 #define CS_RPC_CMD      85
    00548 /* need correct value for CS_SEND_BULK_CMD  */
    00549 #define CS_SEND_BULK_CMD 0xFFFF
    00550 #define CS_INPUTVALUE   86
    00551 #define CS_GOODDATA     87
    00552 /* define CS_RETURN     88 */
    00553 #define CS_CMD_NUMBER   89
    00554 #define CS_BROWSE_INFO  90
    00555 #define CS_NUMORDERCOLS 91
    00556 #define CS_NUM_COMPUTES 92
    00557 #define CS_NODATA       96
    00558 #define CS_DESCIN       98
    00559 #define CS_DESCOUT      99
    00560 /* define CS_UPDATECOL  100 */
    00561 #define CS_NODEFAULT    102
    00562 #define CS_FMT_JUSTIFY_RT       106
    00563 #define CS_TRANS_STATE  107
    00564 #define CS_TRAN_IN_PROGRESS     108
    00565 #define CS_TRAN_COMPLETED       109
    00566 #define CS_TRAN_STMT_FAIL       110
    00567 #define CS_TRAN_FAIL    111
    00568 #define CS_TRAN_UNDEFINED       112
    00569 #define CS_SV_RETRY_FAIL        114
    00570 #define CS_TIMEOUT      115
    00571 #define CS_CANCELED     116
    00572 #define CS_NO_RECOMPILE 117
    00573 #define CS_COLUMN_DATA  118
    00574 #define CS_SEND_DATA_CMD        119
    00575 #define CS_SUPPORTED 120
    00576 #define CS_EXPOSE_FMTS 121
    00577 #define CS_DYNAMIC_CMD 122
    00578 #define CS_MSGTYPE 123
    00579 #define CS_VERSION      9114
    00580 #define CS_EXTRA_INF    9121
    00581 #define CS_CUR_CMD 133
    00582
    00583 /* result_types */
    00584 #define CS_COMPUTE_RESULT       4045
    00585 #define CS_CURSOR_RESULT        4041
    00586 #define CS_PARAM_RESULT         4042
    00587 #define CS_ROW_RESULT           4040
    00588 #define CS_STATUS_RESULT        4043
    00589 #define CS_COMPUTEFMT_RESULT    4050
    00590 #define CS_ROWFMT_RESULT        4049
    00591 #define CS_MSG_RESULT           4044
    00592 #define CS_DESCRIBE_RESULT      4051
    00593
    00594 /* bind types */
    00595 #define CS_CHAR_TYPE    1
    00596 #define CS_INT_TYPE     2
    00597 #define CS_SMALLINT_TYPE        3
    00598 #define CS_TINYINT_TYPE 4
    00599 #define CS_MONEY_TYPE   5
    00600 #define CS_DATETIME_TYPE        6
    00601 #define CS_NUMERIC_TYPE 7
    00602 #define CS_DECIMAL_TYPE 8
    00603 #define CS_DATETIME4_TYPE       9
    00604 #define CS_MONEY4_TYPE  10
    00605 #define CS_IMAGE_TYPE   11
    00606 #define CS_BINARY_TYPE  12
    00607 #define CS_BIT_TYPE     13
    00608 #define CS_REAL_TYPE    14
    00609 #define CS_FLOAT_TYPE   15
    00610 #define CS_TEXT_TYPE    16
    00611 #define CS_VARCHAR_TYPE 17
    00612 #define CS_VARBINARY_TYPE       18
    00613 #define CS_LONGCHAR_TYPE        19
    00614 #define CS_LONGBINARY_TYPE      20
    00615 #define CS_LONG_TYPE    21
    00616 #define CS_ILLEGAL_TYPE 22
    00617 #define CS_SENSITIVITY_TYPE     23
    00618 #define CS_BOUNDARY_TYPE        24
    00619 #define CS_VOID_TYPE    25
    00620 #define CS_USHORT_TYPE  26
    00621 #define CS_UNIQUE_TYPE  27
    00622 #define CS_UNICHAR_TYPE  28
    00623
    00624 /* cs_dt_info type values */
    00625 enum
    00626 {
    00627         CS_MONTH = 1,
    00628 #define CS_MONTH CS_MONTH
    00629         CS_SHORTMONTH,
    00630 #define CS_SHORTMONTH CS_SHORTMONTH
    00631         CS_DAYNAME,
    00632 #define CS_DAYNAME CS_DAYNAME
    00633         CS_DATEORDER,
    00634 #define CS_DATEORDER CS_DATEORDER
    00635         CS_12HOUR,
    00636 #define CS_12HOUR CS_12HOUR
    00637         CS_DT_CONVFMT
    00638 #define CS_DT_CONVFMT CS_DT_CONVFMT
    00639 };
    00640
    00641 /* DT_CONVFMT types */
    00642 enum
    00643 {
    00644         CS_DATES_HMS = 1,
    00645 #define CS_DATES_HMS CS_DATES_HMS
    00646         CS_DATES_SHORT,
    00647 #define CS_DATES_SHORT CS_DATES_SHORT
    00648         CS_DATES_LONG,
    00649 #define CS_DATES_LONG CS_DATES_LONG
    00650         CS_DATES_MDY1,
    00651 #define CS_DATES_MDY1 CS_DATES_MDY1
    00652         CS_DATES_MYD1,
    00653 #define CS_DATES_MYD1 CS_DATES_MYD1
    00654         CS_DATES_DMY1,
    00655 #define CS_DATES_DMY1 CS_DATES_DMY1
    00656         CS_DATES_DYM1,
    00657 #define CS_DATES_DYM1 CS_DATES_DYM1
    00658         CS_DATES_YDM1,
    00659 #define CS_DATES_YDM1 CS_DATES_YDM1
    00660         CS_DATES_YMD2,
    00661 #define CS_DATES_YMD2 CS_DATES_YMD2
    00662         CS_DATES_MDY1_YYYY,
    00663 #define CS_DATES_MDY1_YYYY CS_DATES_MDY1_YYYY
    00664         CS_DATES_DMY1_YYYY,
    00665 #define CS_DATES_DMY1_YYYY CS_DATES_DMY1_YYYY
    00666         CS_DATES_YMD2_YYYY,
    00667 #define CS_DATES_YMD2_YYYY CS_DATES_YMD2_YYYY
    00668         CS_DATES_DMY2,
    00669 #define CS_DATES_DMY2 CS_DATES_DMY2
    00670         CS_DATES_YMD1,
    00671 #define CS_DATES_YMD1 CS_DATES_YMD1
    00672         CS_DATES_DMY2_YYYY,
    00673 #define CS_DATES_DMY2_YYYY CS_DATES_DMY2_YYYY
    00674         CS_DATES_YMD1_YYYY,
    00675 #define CS_DATES_YMD1_YYYY CS_DATES_YMD1_YYYY
    00676         CS_DATES_DMY4,
    00677 #define CS_DATES_DMY4 CS_DATES_DMY4
    00678         CS_DATES_DMY4_YYYY,
    00679 #define CS_DATES_DMY4_YYYY CS_DATES_DMY4_YYYY
    00680         CS_DATES_MDY2,
    00681 #define CS_DATES_MDY2 CS_DATES_MDY2
    00682         CS_DATES_MDY2_YYYY,
    00683 #define CS_DATES_MDY2_YYYY CS_DATES_MDY2_YYYY
    00684         CS_DATES_DMY3,
    00685 #define CS_DATES_DMY3 CS_DATES_DMY3
    00686         CS_DATES_MDY3,
    00687 #define CS_DATES_MDY3 CS_DATES_MDY3
    00688         CS_DATES_DMY3_YYYY,
    00689 #define CS_DATES_DMY3_YYYY CS_DATES_DMY3_YYYY
    00690         CS_DATES_MDY3_YYYY,
    00691 #define CS_DATES_MDY3_YYYY CS_DATES_MDY3_YYYY
    00692         CS_DATES_YMD3,
    00693 #define CS_DATES_YMD3 CS_DATES_YMD3
    00694         CS_DATES_YMD3_YYYY
    00695 #define CS_DATES_YMD3_YYYY CS_DATES_YMD3_YYYY
    00696 };
    00697
    00698 typedef CS_RETCODE(*CS_CONV_FUNC) (CS_CONTEXT * context, CS_DATAFMT * srcfmt, CS_VOID * src, CS_DATAFMT * detsfmt, CS_VOID * dest,
    00699                                    CS_INT * destlen);
    00700
    00701 typedef struct _cs_objname
    00702 {
    00703         CS_BOOL thinkexists;
    00704         CS_INT object_type;
    00705         CS_CHAR last_name[CS_MAX_NAME];
    00706         CS_INT lnlen;
    00707         CS_CHAR first_name[CS_MAX_NAME];
    00708         CS_INT fnlen;
    00709         CS_VOID *scope;
    00710         CS_INT scopelen;
    00711         CS_VOID *thread;
    00712         CS_INT threadlen;
    00713 } CS_OBJNAME;
    00714
    00715 typedef struct _cs_objdata
    00716 {
    00717         CS_BOOL actuallyexists;
    00718         CS_CONNECTION *connection;
    00719         CS_COMMAND *command;
    00720         CS_VOID *buffer;
    00721         CS_INT buflen;
    00722 } CS_OBJDATA;
    00723
    00724 /* Eventually, these should be in terms of TDS values */
    00725 enum
    00726 {
    00727         CS_OPT_SUNDAY,
    00728         CS_OPT_MONDAY,
    00729         CS_OPT_TUESDAY,
    00730         CS_OPT_WEDNESDAY,
    00731         CS_OPT_THURSDAY,
    00732         CS_OPT_FRIDAY,
    00733         CS_OPT_SATURDAY
    00734 };
    00735 enum
    00736 {
    00737         CS_OPT_FMTMDY,
    00738         CS_OPT_FMTDMY,
    00739         CS_OPT_FMTYMD,
    00740         CS_OPT_FMTYDM,
    00741         CS_OPT_FMTMYD,
    00742         CS_OPT_FMTDYM
    00743 };
    00744 enum
    00745 {
    00746         CS_OPT_LEVEL0,
    00747         CS_OPT_LEVEL1,
    00748         CS_OPT_LEVEL3
    00749 };
    00750
    00751 #define CS_FALSE        0
    00752 #define CS_TRUE 1
    00753
    00754 #define SRV_PROC        CS_VOID
    00755 typedef struct _cs_blk_row CS_BLK_ROW;
    00756
    00757 /* constants required for ct_diag (not jet implemented) */
    00758 #define CS_INIT 36
    00759 #define CS_STATUS 37
    00760 #define CS_MSGLIMIT 38
    00761 #define CS_CLIENTMSG_TYPE 4700
    00762 #define CS_SERVERMSG_TYPE 4701
    00763 #define CS_ALLMSG_TYPE 4702
    00764
    00765 CS_RETCODE cs_convert(CS_CONTEXT * ctx, CS_DATAFMT * srcfmt, CS_VOID * srcdata, CS_DATAFMT * destfmt, CS_VOID * destdata,
    00766                       CS_INT * resultlen);
    00767 CS_RETCODE cs_ctx_alloc(CS_INT version, CS_CONTEXT ** ctx);
    00768 CS_RETCODE cs_ctx_global(CS_INT version, CS_CONTEXT ** ctx);
    00769 CS_RETCODE cs_ctx_drop(CS_CONTEXT * ctx);
    00770 CS_RETCODE cs_config(CS_CONTEXT * ctx, CS_INT action, CS_INT property, CS_VOID * buffer, CS_INT buflen, CS_INT * outlen);
    00771 CS_RETCODE cs_strbuild(CS_CONTEXT * ctx, CS_CHAR * buffer, CS_INT buflen, CS_INT * resultlen, CS_CHAR * text, CS_INT textlen,
    00772                        CS_CHAR * formats, CS_INT formatlen, ...);
    00773 CS_RETCODE cs_dt_crack(CS_CONTEXT * ctx, CS_INT datetype, CS_VOID * dateval, CS_DATEREC * daterec);
    00774 CS_RETCODE cs_loc_alloc(CS_CONTEXT * ctx, CS_LOCALE ** locptr);
    00775 CS_RETCODE cs_loc_drop(CS_CONTEXT * ctx, CS_LOCALE * locale);
    00776 CS_RETCODE cs_locale(CS_CONTEXT * ctx, CS_INT action, CS_LOCALE * locale, CS_INT type, CS_VOID * buffer, CS_INT buflen,
    00777                      CS_INT * outlen);
    00778 CS_RETCODE cs_dt_info(CS_CONTEXT * ctx, CS_INT action, CS_LOCALE * locale, CS_INT type, CS_INT item, CS_VOID * buffer,
    00779                       CS_INT buflen, CS_INT * outlen);
    00780
    00781 CS_RETCODE cs_calc(CS_CONTEXT * ctx, CS_INT op, CS_INT datatype, CS_VOID * var1, CS_VOID * var2, CS_VOID * dest);
    00782 CS_RETCODE cs_cmp(CS_CONTEXT * ctx, CS_INT datatype, CS_VOID * var1, CS_VOID * var2, CS_INT * result);
    00783 CS_RETCODE cs_conv_mult(CS_CONTEXT * ctx, CS_LOCALE * srcloc, CS_LOCALE * destloc, CS_INT * conv_multiplier);
    00784 CS_RETCODE cs_diag(CS_CONTEXT * ctx, CS_INT operation, CS_INT type, CS_INT idx, CS_VOID * buffer);
    00785 CS_RETCODE cs_manage_convert(CS_CONTEXT * ctx, CS_INT action, CS_INT srctype, CS_CHAR * srcname, CS_INT srcnamelen, CS_INT desttype,
    00786                              CS_CHAR * destname, CS_INT destnamelen, CS_INT * conv_multiplier, CS_CONV_FUNC * func);
    00787 CS_RETCODE cs_objects(CS_CONTEXT * ctx, CS_INT action, CS_OBJNAME * objname, CS_OBJDATA * objdata);
    00788 CS_RETCODE cs_set_convert(CS_CONTEXT * ctx, CS_INT action, CS_INT srctype, CS_INT desttype, CS_CONV_FUNC * func);
    00789 CS_RETCODE cs_setnull(CS_CONTEXT * ctx, CS_DATAFMT * datafmt, CS_VOID * buffer, CS_INT buflen);
    00790 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,
    00791                      CS_INT * result);
    00792 CS_RETCODE cs_time(CS_CONTEXT * ctx, CS_LOCALE * locale, CS_VOID * buffer, CS_INT buflen, CS_INT * outlen, CS_DATEREC * daterec);
    00793 CS_RETCODE cs_will_convert(CS_CONTEXT * ctx, CS_INT srctype, CS_INT desttype, CS_BOOL * result);
    00794
    00795 #ifdef __cplusplus
    00796 #if 0
    00797 {
    00798 #endif
    00799 }
    00800 #endif
    00801
    00802 #endif