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.23 2005/12/21 08:11:58 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 scale;
00141 CS_INT precision;
00142 CS_INT *datalen;
00143 CS_SMALLINT *ind;
00144 CS_BYTE *value;
00145 int param_by_value;
00146 CS_INT datalen_value;
00147 CS_SMALLINT indicator_value;
00148 } CS_PARAM;
00149
00150
00151
00152
00153
00154
00155 typedef CS_PARAM CSREMOTE_PROC_PARAM;
00156
00157 typedef struct _csremote_proc
00158 {
00159 char *name;
00160 CS_SMALLINT options;
00161 CSREMOTE_PROC_PARAM *param_list;
00162 } CSREMOTE_PROC;
00163
00164
00165
00166
00167
00168
00169 typedef CS_PARAM CS_DYNAMIC_PARAM;
00170
00171 struct _cs_dynamic
00172 {
00173 char *id;
00174 char *stmt;
00175 CS_DYNAMIC_PARAM *param_list;
00176 struct _cs_dynamic *next;
00177 };
00178
00179
00180 #define CS_DYNAMIC_CMD 160
00181 #define CS_CUR_CMD 161
00182
00183
00184
00185 #define _CS_RES_NONE -1
00186 #define _CS_RES_INIT 0
00187 #define _CS_RES_RESULTSET_EMPTY 1
00188 #define _CS_RES_RESULTSET_ROWS 2
00189 #define _CS_RES_STATUS 3
00190 #define _CS_RES_CMD_DONE 4
00191 #define _CS_RES_CMD_SUCCEED 5
00192 #define _CS_RES_END_RESULTS 6
00193 #define _CS_RES_DESCRIBE_RESULT 7
00194
00195
00196
00197 #define _CS_COMMAND_IDLE 0
00198 #define _CS_COMMAND_BUILDING 1
00199 #define _CS_COMMAND_READY 2
00200 #define _CS_COMMAND_SENT 3
00201
00202
00203 #define _CS_CANCEL_NOCANCEL 0
00204 #define _CS_CANCEL_PENDING 1
00205
00206 struct _cs_command
00207 {
00208 CS_INT command_state;
00209 CS_INT results_state;
00210 CS_INT cancel_state;
00211 CS_INT cursor_state;
00212 CS_CONNECTION *con;
00213 CS_INT command_type;
00214 CS_CHAR *query;
00215 short dynamic_cmd;
00216 CS_DYNAMIC *dyn;
00217 int row_prefetched;
00218 int curr_result_type;
00219 int bind_count;
00220 int get_data_item;
00221 int get_data_bytes_returned;
00222 CS_IODESC *iodesc;
00223 CS_INT send_data_started;
00224 CSREMOTE_PROC *rpc;
00225 CS_PARAM *input_params;
00226 CS_INT client_cursor_id;
00227 TDSCURSOR *cursor;
00228 void *userdata;
00229 int userdata_len;
00230 };
00231
00232 struct _cs_command_list
00233 {
00234 struct _cs_command *cmd;
00235 struct _cs_command_list *next;
00236 };
00237
00238 struct _cs_blkdesc
00239 {
00240 CS_CONNECTION *con;
00241 CS_CHAR *tablename;
00242 CS_CHAR *insert_stmt;
00243 CS_INT direction;
00244 CS_INT identity_insert_on;
00245 CS_INT bind_count;
00246 CS_INT xfer_init;
00247 CS_INT var_cols;
00248 TDSRESULTINFO *bindinfo;
00249 };
00250
00251
00252 #define _CS_ERRHAND_INLINE 1
00253 #define _CS_ERRHAND_CB 2
00254
00255 struct _cs_locale
00256 {
00257 char *language;
00258 char *charset;
00259 char *time;
00260 char *collate;
00261 };
00262
00263
00264
00265 #define _CS_CURS_TYPE_UNACTIONED 0
00266 #define _CS_CURS_TYPE_REQUESTED 1
00267 #define _CS_CURS_TYPE_SENT 2
00268
00269
00270
00271
00272 int _ct_handle_server_message(const TDSCONTEXT * ctxptr, TDSSOCKET * tdsptr, TDSMESSAGE * msgptr);
00273 int _ct_handle_client_message(const TDSCONTEXT * ctxptr, TDSSOCKET * tdsptr, TDSMESSAGE * msgptr);
00274 int _ct_get_server_type(int datatype);
00275 int _ct_bind_data(CS_CONTEXT *ctx, TDSRESULTINFO * resinfo, TDSRESULTINFO *bindinfo, CS_INT offset);
00276 int _ct_get_client_type(int datatype, int usertype, int size);
00277 void _ctclient_msg(CS_CONNECTION * con, const char *funcname, int layer, int origin, int severity, int number,
00278 const char *fmt, ...);
00279 CS_INT _ct_diag_clearmsg(CS_CONTEXT * context, CS_INT type);
00280
00281 #ifdef __cplusplus
00282 #if 0
00283 {
00284 #endif
00285 }
00286 #endif
00287
00288 #endif