- Main Page
- Related Pages
- Modules
- Classes
- Files

- File List
- File Members

# /home/jklowden/releases/freetds-0.91/include/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 #if defined(__GNUC__) && __GNUC__ >= 4 && !defined(__MINGW32__)
    00028 #pragma GCC visibility push(hidden)
    00029 #endif
    00030
    00031 #ifdef __cplusplus
    00032 extern "C"
    00033 {
    00034 #if 0
    00035 }
    00036 #endif
    00037 #endif
    00038
    00039 static const char rcsid_ctlib_h[] = "$Id: ctlib.h,v 1.30 2010/10/05 08:36:36 freddy77 Exp $";
    00040 static const void *const no_unused_ctlib_h_warn[] = { rcsid_ctlib_h, no_unused_ctlib_h_warn };
    00041
    00042 #include <tds.h>
    00043 /*
    00044  * internal types
    00045  */
    00046 struct _cs_config
    00047 {
    00048         short cs_expose_formats;
    00049 };
    00050
    00051 /* Code changed for error handling */
    00052 /* Code changes starts here - CT_DIAG - 01 */
    00053
    00054 /* This structure is used in CT_DIAG */
    00055
    00056 struct cs_diag_msg_client
    00057 {
    00058         CS_CLIENTMSG *clientmsg;
    00059         struct cs_diag_msg_client *next;
    00060 };
    00061
    00062 struct cs_diag_msg_svr
    00063 {
    00064         CS_SERVERMSG *servermsg;
    00065         struct cs_diag_msg_svr *next;
    00066 };
    00067
    00068 /* Code changes ends here - CT_DIAG - 01 */
    00069
    00070 struct cs_diag_msg
    00071 {
    00072         CS_CLIENTMSG *msg;
    00073         struct cs_diag_msg *next;
    00074 };
    00075
    00076 struct _cs_context
    00077 {
    00078         CS_INT date_convert_fmt;
    00079         CS_INT cs_errhandletype;
    00080         CS_INT cs_diag_msglimit;
    00081
    00082         /* added for storing the maximum messages limit CT_DIAG */
    00083         /* code changes starts here - CT_DIAG - 02 */
    00084
    00085         CS_INT cs_diag_msglimit_client;
    00086         CS_INT cs_diag_msglimit_server;
    00087         CS_INT cs_diag_msglimit_total;
    00088         struct cs_diag_msg_client *clientstore;
    00089         struct cs_diag_msg_svr *svrstore;
    00090
    00091         /* code changes ends here - CT_DIAG - 02 */
    00092
    00093         struct cs_diag_msg *msgstore;
    00094         CS_CSLIBMSG_FUNC _cslibmsg_cb;
    00095         CS_CLIENTMSG_FUNC _clientmsg_cb;
    00096         CS_SERVERMSG_FUNC _servermsg_cb;
    00097         /* code changes start here - CS_CONFIG - 01*/
    00098         void *userdata;
    00099         int userdata_len;
    00100         /* code changes end here - CS_CONFIG - 01*/
    00101         TDSCONTEXT *tds_ctx;
    00102         CS_CONFIG config;
    00103 };
    00104
    00105 /*
    00106  * internal typedefs
    00107  */
    00108 typedef struct _ct_colinfo
    00109 {
    00110         TDS_SMALLINT *indicator;
    00111 }
    00112 CT_COLINFO;
    00113
    00114 typedef struct _cs_command_list CS_COMMAND_LIST;
    00115 typedef struct _cs_dynamic CS_DYNAMIC_LIST;
    00116 typedef struct _cs_dynamic CS_DYNAMIC;
    00117
    00118 struct _cs_connection
    00119 {
    00120         CS_CONTEXT *ctx;
    00121         TDSLOGIN *tds_login;
    00122         TDSSOCKET *tds_socket;
    00123         CS_CLIENTMSG_FUNC _clientmsg_cb;
    00124         CS_SERVERMSG_FUNC _servermsg_cb;
    00125         void *userdata;
    00126         int userdata_len;
    00127         CS_LOCALE *locale;
    00128         CS_COMMAND_LIST *cmds;
    00129         CS_DYNAMIC_LIST *dynlist;
    00130         char *server_addr;
    00131 };
    00132
    00133 /*
    00134  * Formerly CSREMOTE_PROC_PARAM, this structure can be used in other
    00135  * places, too.
    00136  */
    00137
    00138 typedef struct _cs_param
    00139 {
    00140         struct _cs_param *next;
    00141         char *name;
    00142         int status;
    00143         int datatype;
    00144         CS_INT maxlen;
    00145         CS_INT scale;
    00146         CS_INT precision;
    00147         CS_INT *datalen;
    00148         CS_SMALLINT *ind;
    00149         CS_BYTE *value;
    00150         int param_by_value;
    00151         CS_INT datalen_value;
    00152         CS_SMALLINT indicator_value;
    00153 } CS_PARAM;
    00154
    00155 /*
    00156  * Code added for RPC functionality - SUHA
    00157  * RPC Code changes starts here
    00158  */
    00159
    00160 typedef CS_PARAM CSREMOTE_PROC_PARAM;
    00161
    00162 typedef struct _csremote_proc
    00163 {
    00164         char *name;
    00165         CS_SMALLINT options;
    00166         CSREMOTE_PROC_PARAM *param_list;
    00167 } CSREMOTE_PROC;
    00168
    00169 /*
    00170  * Structure CS_COMMAND changed for RPC functionality -SUHA
    00171  * Added CSREMOTE_PROC *rpc to CS_COMMAND structure
    00172  */
    00173
    00174 typedef CS_PARAM CS_DYNAMIC_PARAM;
    00175
    00176 struct _cs_dynamic
    00177 {
    00178         char *id;
    00179         char *stmt;
    00180         CS_DYNAMIC_PARAM *param_list;
    00181         struct _cs_dynamic *next;
    00182 };
    00183
    00184 /* specific FreeTDS commands */
    00185 #define CS_DYNAMIC_CMD   160
    00186 #define CS_CUR_CMD       161
    00187
    00188 /* values for cs_command.results_state */
    00189
    00190 #define _CS_RES_NONE            -1
    00191 #define _CS_RES_INIT            0
    00192 #define _CS_RES_RESULTSET_EMPTY 1
    00193 #define _CS_RES_RESULTSET_ROWS  2
    00194 #define _CS_RES_STATUS          3
    00195 #define _CS_RES_CMD_DONE        4
    00196 #define _CS_RES_CMD_SUCCEED     5
    00197 #define _CS_RES_END_RESULTS     6
    00198 #define _CS_RES_DESCRIBE_RESULT 7
    00199
    00200 /* values for cs_command.command_state */
    00201
    00202 #define _CS_COMMAND_IDLE        0
    00203 #define _CS_COMMAND_BUILDING    1
    00204 #define _CS_COMMAND_READY       2
    00205 #define _CS_COMMAND_SENT        3
    00206
    00207 /* values for cs_command.cancel_state */
    00208 #define _CS_CANCEL_NOCANCEL     0
    00209 #define _CS_CANCEL_PENDING      1
    00210
    00211 struct _cs_command
    00212 {
    00213         CS_INT command_state;
    00214         CS_INT results_state;
    00215         CS_INT cancel_state;
    00216         CS_INT cursor_state;
    00217         CS_CONNECTION *con;
    00218         CS_INT command_type;
    00219         CS_CHAR *query;
    00220         short dynamic_cmd;
    00221         CS_DYNAMIC *dyn;
    00222         int row_prefetched;
    00223         int curr_result_type;
    00224         int bind_count;
    00225         int get_data_item;
    00226         int get_data_bytes_returned;
    00227         CS_IODESC *iodesc;
    00228         CS_INT send_data_started;
    00229         CSREMOTE_PROC *rpc;
    00230         CS_PARAM *input_params;
    00231         CS_INT client_cursor_id;
    00232         TDSCURSOR *cursor;
    00233         void *userdata;
    00234         int userdata_len;
    00235 };
    00236
    00237 struct _cs_command_list
    00238 {
    00239         struct _cs_command *cmd;
    00240         struct _cs_command_list *next;
    00241 };
    00242
    00243 struct _cs_blkdesc
    00244 {
    00245         CS_CONNECTION *con;
    00246         TDSBCPINFO bcpinfo;
    00247 };
    00248
    00249
    00250 #define _CS_ERRHAND_INLINE 1
    00251 #define _CS_ERRHAND_CB     2
    00252
    00253 struct _cs_locale
    00254 {
    00255         char *language;
    00256         char *charset;
    00257         char *time;
    00258         char *collate;
    00259 };
    00260
    00261 /* internal defines for cursor processing */
    00262
    00263 #define _CS_CURS_TYPE_UNACTIONED 0
    00264 #define _CS_CURS_TYPE_REQUESTED  1
    00265 #define _CS_CURS_TYPE_SENT       2
    00266
    00267 /*
    00268  * internal prototypes
    00269  */
    00270 int _ct_handle_server_message(const TDSCONTEXT * ctxptr, TDSSOCKET * tdsptr, TDSMESSAGE * msgptr);
    00271 int _ct_handle_client_message(const TDSCONTEXT * ctxptr, TDSSOCKET * tdsptr, TDSMESSAGE * msgptr);
    00272 int _ct_get_server_type(int datatype);
    00273 int _ct_bind_data(CS_CONTEXT *ctx, TDSRESULTINFO * resinfo, TDSRESULTINFO *bindinfo, CS_INT offset);
    00274 int _ct_get_client_type(TDSCOLUMN *col);
    00275 void _ctclient_msg(CS_CONNECTION * con, const char *funcname, int layer, int origin, int severity, int number,
    00276                    const char *fmt, ...);
    00277 CS_INT _ct_diag_clearmsg(CS_CONTEXT * context, CS_INT type);
    00278 void _cs_locale_free(CS_LOCALE *locale);
    00279 CS_LOCALE *_cs_locale_copy(CS_LOCALE *orig);
    00280 int _cs_locale_copy_inplace(CS_LOCALE *new_locale, CS_LOCALE *orig);
    00281
    00282 #ifdef __cplusplus
    00283 #if 0
    00284 {
    00285 #endif
    00286 }
    00287 #endif
    00288
    00289 #if defined(__GNUC__) && __GNUC__ >= 4 && !defined(__MINGW32__)
    00290 #pragma GCC visibility pop
    00291 #endif
    00292
    00293 #endif

All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines