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

# ctlib.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 _ctlib_h_
    00021 #define _ctlib_h_
    00022
    00023 /*
    00024  * Internal (not part of the exposed API) prototypes and such.
    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.18 2004/10/28 12:42:11 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  * internal types
    00041  */
    00042 struct _cs_config
    00043 {
    00044         short cs_expose_formats;
    00045 };
    00046
    00047 /* Code changed for error handling */
    00048 /* Code changes starts here - CT_DIAG - 01 */
    00049
    00050 /* This structure is used in CT_DIAG */
    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 /* Code changes ends here - CT_DIAG - 01 */
    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         /* added for storing the maximum messages limit CT_DIAG */
    00079         /* code changes starts here - CT_DIAG - 02 */
    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         /* code changes ends here - CT_DIAG - 02 */
    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         /* code changes start here - CS_CONFIG - 01*/
    00094         void *userdata;
    00095         int userdata_len;
    00096         /* code changes end here - CS_CONFIG - 01*/
    00097         TDSCONTEXT *tds_ctx;
    00098         CS_CONFIG config;
    00099 };
    00100
    00101 /*
    00102  * internal typedefs
    00103  */
    00104 typedef struct _ct_colinfo
    00105 {
    00106         TDS_SMALLINT *indicator;
    00107 }
    00108 CT_COLINFO;
    00109
    00110 struct _cs_connection
    00111 {
    00112         CS_CONTEXT *ctx;
    00113         TDSLOGIN *tds_login;
    00114         TDSSOCKET *tds_socket;
    00115         CS_CLIENTMSG_FUNC _clientmsg_cb;
    00116         CS_SERVERMSG_FUNC _servermsg_cb;
    00117         void *userdata;
    00118         int userdata_len;
    00119         CS_LOCALE *locale;
    00120 };
    00121
    00122 /*
    00123  * Formerly CSREMOTE_PROC_PARAM, this structure can be used in other
    00124  * places, too.
    00125  */
    00126
    00127 typedef struct _cs_param
    00128 {
    00129         struct _cs_param *next;
    00130         char *name;
    00131         int status;
    00132         int type;
    00133         CS_INT maxlen;
    00134         CS_INT *datalen;
    00135         CS_SMALLINT *ind;
    00136         CS_BYTE *value;
    00137         int param_by_value;
    00138         CS_INT datalen_value;
    00139         CS_SMALLINT indicator_value;
    00140 } CS_PARAM;
    00141
    00142 /*
    00143  * Code added for RPC functionality - SUHA
    00144  * RPC Code changes starts here
    00145  */
    00146
    00147 typedef CS_PARAM CSREMOTE_PROC_PARAM;
    00148
    00149 typedef struct _csremote_proc
    00150 {
    00151         char *name;
    00152         CS_SMALLINT options;
    00153         CSREMOTE_PROC_PARAM *param_list;
    00154 } CSREMOTE_PROC;
    00155
    00156 /*
    00157  * Structure CS_COMMAND changed for RPC functionality -SUHA
    00158  * Added CSREMOTE_PROC *rpc to CS_COMMAND structure
    00159  */
    00160
    00161 /* values for cs_command.results_state */
    00162
    00163 #define _CS_RES_INIT            0
    00164 #define _CS_RES_RESULTSET_EMPTY 1
    00165 #define _CS_RES_RESULTSET_ROWS  2
    00166 #define _CS_RES_STATUS          3
    00167 #define _CS_RES_CMD_DONE        4
    00168 #define _CS_RES_CMD_SUCCEED     5
    00169
    00170 struct _cs_command
    00171 {
    00172         CS_CHAR *query;
    00173         CS_INT command_type;
    00174         CS_CONNECTION *con;
    00175         short dynamic_cmd;
    00176         char *dyn_id;
    00177         int row_prefetched;
    00178         int results_state;
    00179         int curr_result_type;
    00180         /* Array Binding Code changes start here */
    00181         int bind_count;
    00182         /* Array Binding Code changes end here */
    00183         int get_data_item;
    00184         int get_data_bytes_returned;
    00185         CS_IODESC *iodesc;
    00186         CS_INT send_data_started;
    00187         CSREMOTE_PROC *rpc;
    00188         CS_PARAM *input_params;
    00189         CS_INT client_cursor_id;
    00190 };
    00191
    00192 struct _cs_blkdesc
    00193 {
    00194         CS_CONNECTION *con;
    00195         CS_CHAR *tablename;
    00196         CS_CHAR *insert_stmt;
    00197         CS_INT direction;
    00198         CS_INT identity_insert_on;
    00199         CS_INT bind_count;
    00200         CS_INT xfer_init;
    00201         CS_INT var_cols;
    00202         TDSRESULTINFO *bindinfo;
    00203 };
    00204
    00205
    00206 #define _CS_ERRHAND_INLINE 1
    00207 #define _CS_ERRHAND_CB     2
    00208
    00209 struct _cs_locale
    00210 {
    00211         char *language;
    00212         char *charset;
    00213         char *time;
    00214         char *collate;
    00215 };
    00216
    00217 /* internal defines for cursor processing */
    00218
    00219 #define _CS_CURS_TYPE_UNACTIONED 0
    00220 #define _CS_CURS_TYPE_REQUESTED  1
    00221 #define _CS_CURS_TYPE_SENT       2
    00222
    00223 /*
    00224  * internal prototypes
    00225  */
    00226 int _ct_handle_server_message(TDSCONTEXT * ctxptr, TDSSOCKET * tdsptr, TDSMESSAGE * msgptr);
    00227 int _ct_handle_client_message(TDSCONTEXT * ctxptr, TDSSOCKET * tdsptr, TDSMESSAGE * msgptr);
    00228 int _ct_get_server_type(int datatype);
    00229 int _ct_bind_data(CS_CONTEXT *ctx, TDSRESULTINFO * resinfo, TDSRESULTINFO *bindinfo, CS_INT offset);
    00230 int _ct_get_client_type(int datatype, int usertype, int size);
    00231 void _ctclient_msg(CS_CONNECTION * con, const char *funcname, int layer, int origin, int severity, int number,
    00232                    const char *fmt, ...);
    00233 CS_INT _ct_diag_clearmsg(CS_CONTEXT * context, CS_INT type);
    00234
    00235 #ifdef __cplusplus
    00236 #if 0
    00237 {
    00238 #endif
    00239 }
    00240 #endif
    00241
    00242 #endif