00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef _ctlib_h_
00021 #define _ctlib_h_
00022
00023
00024
00025
00026
00027 #ifdef __cplusplus
00028 extern "C"
00029 {
00030 #if 0
00031 }
00032 #endif
00033 #endif
00034
00035 static const char rcsid_ctlib_h[] = "$Id: ctlib.h,v 1.21 2005/04/15 11:51:40 freddy77 Exp $";
00036 static const void *const no_unused_ctlib_h_warn[] = { rcsid_ctlib_h, no_unused_ctlib_h_warn };
00037
00038 #include <tds.h>
00039
00040
00041
00042 struct _cs_config
00043 {
00044 short cs_expose_formats;
00045 };
00046
00047
00048
00049
00050
00051
00052 struct cs_diag_msg_client
00053 {
00054 CS_CLIENTMSG *clientmsg;
00055 struct cs_diag_msg_client *next;
00056 };
00057
00058 struct cs_diag_msg_svr
00059 {
00060 CS_SERVERMSG *servermsg;
00061 struct cs_diag_msg_svr *next;
00062 };
00063
00064
00065
00066 struct cs_diag_msg
00067 {
00068 CS_CLIENTMSG *msg;
00069 struct cs_diag_msg *next;
00070 };
00071
00072 struct _cs_context
00073 {
00074 CS_INT date_convert_fmt;
00075 CS_INT cs_errhandletype;
00076 CS_INT cs_diag_msglimit;
00077
00078
00079
00080
00081 CS_INT cs_diag_msglimit_client;
00082 CS_INT cs_diag_msglimit_server;
00083 CS_INT cs_diag_msglimit_total;
00084 struct cs_diag_msg_client *clientstore;
00085 struct cs_diag_msg_svr *svrstore;
00086
00087
00088
00089 struct cs_diag_msg *msgstore;
00090 CS_CSLIBMSG_FUNC _cslibmsg_cb;
00091 CS_CLIENTMSG_FUNC _clientmsg_cb;
00092 CS_SERVERMSG_FUNC _servermsg_cb;
00093
00094 void *userdata;
00095 int userdata_len;
00096
00097 TDSCONTEXT *tds_ctx;
00098 CS_CONFIG config;
00099 };
00100
00101
00102
00103
00104 typedef struct _ct_colinfo
00105 {
00106 TDS_SMALLINT *indicator;
00107 }
00108 CT_COLINFO;
00109
00110 typedef struct _cs_command_list CS_COMMAND_LIST;
00111 typedef struct _cs_dynamic CS_DYNAMIC_LIST;
00112 typedef struct _cs_dynamic CS_DYNAMIC;
00113
00114 struct _cs_connection
00115 {
00116 CS_CONTEXT *ctx;
00117 TDSLOGIN *tds_login;
00118 TDSSOCKET *tds_socket;
00119 CS_CLIENTMSG_FUNC _clientmsg_cb;
00120 CS_SERVERMSG_FUNC _servermsg_cb;
00121 void *userdata;
00122 int userdata_len;
00123 CS_LOCALE *locale;
00124 CS_COMMAND_LIST *cmds;
00125 CS_DYNAMIC_LIST *dynlist;
00126 };
00127
00128
00129
00130
00131
00132
00133 typedef struct _cs_param
00134 {
00135 struct _cs_param *next;
00136 char *name;
00137 int status;
00138 int type;
00139 CS_INT maxlen;
00140 CS_INT *datalen;
00141 CS_SMALLINT *ind;
00142 CS_BYTE *value;
00143 int param_by_value;
00144 CS_INT datalen_value;
00145 CS_SMALLINT indicator_value;
00146 } CS_PARAM;
00147
00148
00149
00150
00151
00152
00153 typedef CS_PARAM CSREMOTE_PROC_PARAM;
00154
00155 typedef struct _csremote_proc
00156 {
00157 char *name;
00158 CS_SMALLINT options;
00159 CSREMOTE_PROC_PARAM *param_list;
00160 } CSREMOTE_PROC;
00161
00162
00163
00164
00165
00166
00167 typedef CS_PARAM CS_DYNAMIC_PARAM;
00168
00169 struct _cs_dynamic
00170 {
00171 char *id;
00172 char *stmt;
00173 CS_DYNAMIC_PARAM *param_list;
00174 struct _cs_dynamic *next;
00175 };
00176
00177
00178
00179 #define _CS_RES_NONE -1
00180 #define _CS_RES_INIT 0
00181 #define _CS_RES_RESULTSET_EMPTY 1
00182 #define _CS_RES_RESULTSET_ROWS 2
00183 #define _CS_RES_STATUS 3
00184 #define _CS_RES_CMD_DONE 4
00185 #define _CS_RES_CMD_SUCCEED 5
00186 #define _CS_RES_END_RESULTS 6
00187 #define _CS_RES_DESCRIBE_RESULT 7
00188
00189
00190
00191 #define _CS_COMMAND_IDLE 0
00192 #define _CS_COMMAND_BUILDING 1
00193 #define _CS_COMMAND_READY 2
00194 #define _CS_COMMAND_SENT 3
00195
00196
00197 #define _CS_CANCEL_NOCANCEL 0
00198 #define _CS_CANCEL_PENDING 1
00199
00200 struct _cs_command
00201 {
00202 CS_INT command_state;
00203 CS_INT results_state;
00204 CS_INT cancel_state;
00205 CS_INT cursor_state;
00206 CS_CONNECTION *con;
00207 CS_INT command_type;
00208 CS_CHAR *query;
00209 short dynamic_cmd;
00210 CS_DYNAMIC *dyn;
00211 int row_prefetched;
00212 int curr_result_type;
00213 int bind_count;
00214 int get_data_item;
00215 int get_data_bytes_returned;
00216 CS_IODESC *iodesc;
00217 CS_INT send_data_started;
00218 CSREMOTE_PROC *rpc;
00219 CS_PARAM *input_params;
00220 CS_INT client_cursor_id;
00221 TDSCURSOR *cursor;
00222 void *userdata;
00223 int userdata_len;
00224 };
00225
00226 struct _cs_command_list
00227 {
00228 struct _cs_command *cmd;
00229 struct _cs_command_list *next;
00230 };
00231
00232 struct _cs_blkdesc
00233 {
00234 CS_CONNECTION *con;
00235 CS_CHAR *tablename;
00236 CS_CHAR *insert_stmt;
00237 CS_INT direction;
00238 CS_INT identity_insert_on;
00239 CS_INT bind_count;
00240 CS_INT xfer_init;
00241 CS_INT var_cols;
00242 TDSRESULTINFO *bindinfo;
00243 };
00244
00245
00246 #define _CS_ERRHAND_INLINE 1
00247 #define _CS_ERRHAND_CB 2
00248
00249 struct _cs_locale
00250 {
00251 char *language;
00252 char *charset;
00253 char *time;
00254 char *collate;
00255 };
00256
00257
00258
00259 #define _CS_CURS_TYPE_UNACTIONED 0
00260 #define _CS_CURS_TYPE_REQUESTED 1
00261 #define _CS_CURS_TYPE_SENT 2
00262
00263
00264
00265
00266 int _ct_handle_server_message(const TDSCONTEXT * ctxptr, TDSSOCKET * tdsptr, TDSMESSAGE * msgptr);
00267 int _ct_handle_client_message(const TDSCONTEXT * ctxptr, TDSSOCKET * tdsptr, TDSMESSAGE * msgptr);
00268 int _ct_get_server_type(int datatype);
00269 int _ct_bind_data(CS_CONTEXT *ctx, TDSRESULTINFO * resinfo, TDSRESULTINFO *bindinfo, CS_INT offset);
00270 int _ct_get_client_type(int datatype, int usertype, int size);
00271 void _ctclient_msg(CS_CONNECTION * con, const char *funcname, int layer, int origin, int severity, int number,
00272 const char *fmt, ...);
00273 CS_INT _ct_diag_clearmsg(CS_CONTEXT * context, CS_INT type);
00274
00275 #ifdef __cplusplus
00276 #if 0
00277 {
00278 #endif
00279 }
00280 #endif
00281
00282 #endif