Main Page | Modules | Class List | Directories | File List | Class 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.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  * 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 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  * Formerly CSREMOTE_PROC_PARAM, this structure can be used in other
00130  * places, too.
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  * Code added for RPC functionality - SUHA
00150  * RPC Code changes starts here
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  * Structure CS_COMMAND changed for RPC functionality -SUHA
00164  * Added CSREMOTE_PROC *rpc to CS_COMMAND structure
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 /* values for cs_command.results_state */
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 /* values for cs_command.command_state */
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 /* values for cs_command.cancel_state */
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 /* internal defines for cursor processing */
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  * internal prototypes
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

Generated on Thu Sep 1 00:36:10 2005 for FreeTDS API by  doxygen 1.4.4