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