FreeTDS API: include/ctlib.h Source File

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

- File List
- File Members

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

All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines