<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> <title>FreeTDS API: /usr/local/users/home/jklowden/projects/releases/freetds/0.82/include/ctlib.h Source File</title> <link href="doxygen.css" rel="stylesheet" type="text/css"> </head><body> <!-- Generated by Doxygen 1.4.1 --> <div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="modules.html">Modules</a> | <a class="qindex" href="annotated.html">Class List</a> | <a class="qindex" href="dirs.html">Directories</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Class Members</a> | <a class="qindex" href="globals.html">File Members</a> | <a class="qindex" href="pages.html">Related Pages</a></div> <div class="nav"> <a class="el" href="dir_000000.html">include</a></div> <h1>ctlib.h</h1><div class="fragment"><pre class="fragment">00001 <span class="comment">/* FreeTDS - Library of routines accessing Sybase and Microsoft databases</span> 00002 <span class="comment"> * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 Brian Bruns</span> 00003 <span class="comment"> *</span> 00004 <span class="comment"> * This library is free software; you can redistribute it and/or</span> 00005 <span class="comment"> * modify it under the terms of the GNU Library General Public</span> 00006 <span class="comment"> * License as published by the Free Software Foundation; either</span> 00007 <span class="comment"> * version 2 of the License, or (at your option) any later version.</span> 00008 <span class="comment"> *</span> 00009 <span class="comment"> * This library is distributed in the hope that it will be useful,</span> 00010 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span> 00011 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</span> 00012 <span class="comment"> * Library General Public License for more details.</span> 00013 <span class="comment"> *</span> 00014 <span class="comment"> * You should have received a copy of the GNU Library General Public</span> 00015 <span class="comment"> * License along with this library; if not, write to the</span> 00016 <span class="comment"> * Free Software Foundation, Inc., 59 Temple Place - Suite 330,</span> 00017 <span class="comment"> * Boston, MA 02111-1307, USA.</span> 00018 <span class="comment"> */</span> 00019 00020 <span class="preprocessor">#ifndef _ctlib_h_</span> 00021 <span class="preprocessor"></span><span class="preprocessor">#define _ctlib_h_</span> 00022 <span class="preprocessor"></span> 00023 <span class="comment">/*</span> 00024 <span class="comment"> * Internal (not part of the exposed API) prototypes and such.</span> 00025 <span class="comment"> */</span> 00026 00027 <span class="preprocessor">#if defined(__GNUC__) && __GNUC__ >= 4</span> 00028 <span class="preprocessor"></span><span class="preprocessor">#pragma GCC visibility push(hidden)</span> 00029 <span class="preprocessor"></span><span class="preprocessor">#endif</span> 00030 <span class="preprocessor"></span> 00031 <span class="preprocessor">#ifdef __cplusplus</span> 00032 <span class="preprocessor"></span><span class="keyword">extern</span> <span class="stringliteral">"C"</span> 00033 { 00034 <span class="preprocessor">#if 0</span> 00035 <span class="preprocessor"></span>} 00036 <span class="preprocessor">#endif</span> 00037 <span class="preprocessor"></span><span class="preprocessor">#endif</span> 00038 <span class="preprocessor"></span> 00039 <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">char</span> rcsid_ctlib_h[] = <span class="stringliteral">"$Id: ctlib.h,v 1.25 2007/06/25 09:48:20 freddy77 Exp $"</span>; 00040 <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">void</span> *<span class="keyword">const</span> no_unused_ctlib_h_warn[] = { rcsid_ctlib_h, no_unused_ctlib_h_warn }; 00041 00042 <span class="preprocessor">#include <<a class="code" href="a00163.html">tds.h</a>></span> 00043 <span class="comment">/*</span> 00044 <span class="comment"> * internal types</span> 00045 <span class="comment"> */</span> 00046 <span class="keyword">struct </span>_cs_config 00047 { 00048 <span class="keywordtype">short</span> cs_expose_formats; 00049 }; 00050 00051 <span class="comment">/* Code changed for error handling */</span> 00052 <span class="comment">/* Code changes starts here - CT_DIAG - 01 */</span> 00053 00054 <span class="comment">/* This structure is used in CT_DIAG */</span> 00055 00056 <span class="keyword">struct </span>cs_diag_msg_client 00057 { 00058 CS_CLIENTMSG *clientmsg; 00059 <span class="keyword">struct </span>cs_diag_msg_client *next; 00060 }; 00061 00062 <span class="keyword">struct </span>cs_diag_msg_svr 00063 { 00064 CS_SERVERMSG *servermsg; 00065 <span class="keyword">struct </span>cs_diag_msg_svr *next; 00066 }; 00067 00068 <span class="comment">/* Code changes ends here - CT_DIAG - 01 */</span> 00069 00070 <span class="keyword">struct </span>cs_diag_msg 00071 { 00072 CS_CLIENTMSG *msg; 00073 <span class="keyword">struct </span>cs_diag_msg *next; 00074 }; 00075 00076 <span class="keyword">struct </span>_cs_context 00077 { 00078 CS_INT date_convert_fmt; 00079 CS_INT cs_errhandletype; 00080 CS_INT cs_diag_msglimit; 00081 00082 <span class="comment">/* added for storing the maximum messages limit CT_DIAG */</span> 00083 <span class="comment">/* code changes starts here - CT_DIAG - 02 */</span> 00084 00085 CS_INT cs_diag_msglimit_client; 00086 CS_INT cs_diag_msglimit_server; 00087 CS_INT cs_diag_msglimit_total; 00088 <span class="keyword">struct </span>cs_diag_msg_client *clientstore; 00089 <span class="keyword">struct </span>cs_diag_msg_svr *svrstore; 00090 00091 <span class="comment">/* code changes ends here - CT_DIAG - 02 */</span> 00092 00093 <span class="keyword">struct </span>cs_diag_msg *msgstore; 00094 CS_CSLIBMSG_FUNC _cslibmsg_cb; 00095 CS_CLIENTMSG_FUNC _clientmsg_cb; 00096 CS_SERVERMSG_FUNC _servermsg_cb; 00097 <span class="comment">/* code changes start here - CS_CONFIG - 01*/</span> 00098 <span class="keywordtype">void</span> *userdata; 00099 <span class="keywordtype">int</span> userdata_len; 00100 <span class="comment">/* code changes end here - CS_CONFIG - 01*/</span> 00101 TDSCONTEXT *tds_ctx; 00102 CS_CONFIG config; 00103 }; 00104 00105 <span class="comment">/*</span> 00106 <span class="comment"> * internal typedefs</span> 00107 <span class="comment"> */</span> 00108 <span class="keyword">typedef</span> <span class="keyword">struct </span>_ct_colinfo 00109 { 00110 TDS_SMALLINT *indicator; 00111 } 00112 CT_COLINFO; 00113 00114 <span class="keyword">typedef</span> <span class="keyword">struct </span>_cs_command_list CS_COMMAND_LIST; 00115 <span class="keyword">typedef</span> <span class="keyword">struct </span>_cs_dynamic CS_DYNAMIC_LIST; 00116 <span class="keyword">typedef</span> <span class="keyword">struct </span>_cs_dynamic CS_DYNAMIC; 00117 00118 <span class="keyword">struct </span>_cs_connection 00119 { 00120 CS_CONTEXT *ctx; 00121 TDSLOGIN *tds_login; 00122 <a class="code" href="a00144.html">TDSSOCKET</a> *<a class="code" href="a00144.html">tds_socket</a>; 00123 CS_CLIENTMSG_FUNC _clientmsg_cb; 00124 CS_SERVERMSG_FUNC _servermsg_cb; 00125 <span class="keywordtype">void</span> *userdata; 00126 <span class="keywordtype">int</span> userdata_len; 00127 CS_LOCALE *locale; 00128 CS_COMMAND_LIST *cmds; 00129 CS_DYNAMIC_LIST *dynlist; 00130 }; 00131 00132 <span class="comment">/*</span> 00133 <span class="comment"> * Formerly CSREMOTE_PROC_PARAM, this structure can be used in other</span> 00134 <span class="comment"> * places, too.</span> 00135 <span class="comment"> */</span> 00136 00137 <span class="keyword">typedef</span> <span class="keyword">struct </span>_cs_param 00138 { 00139 <span class="keyword">struct </span>_cs_param *next; 00140 <span class="keywordtype">char</span> *name; 00141 <span class="keywordtype">int</span> status; 00142 <span class="keywordtype">int</span> type; 00143 CS_INT maxlen; 00144 CS_INT scale; 00145 CS_INT precision; 00146 CS_INT *datalen; 00147 CS_SMALLINT *ind; 00148 CS_BYTE *value; 00149 <span class="keywordtype">int</span> param_by_value; 00150 CS_INT datalen_value; 00151 CS_SMALLINT indicator_value; 00152 } CS_PARAM; 00153 00154 <span class="comment">/*</span> 00155 <span class="comment"> * Code added for RPC functionality - SUHA</span> 00156 <span class="comment"> * RPC Code changes starts here</span> 00157 <span class="comment"> */</span> 00158 00159 <span class="keyword">typedef</span> CS_PARAM CSREMOTE_PROC_PARAM; 00160 00161 <span class="keyword">typedef</span> <span class="keyword">struct </span>_csremote_proc 00162 { 00163 <span class="keywordtype">char</span> *name; 00164 CS_SMALLINT options; 00165 CSREMOTE_PROC_PARAM *param_list; 00166 } CSREMOTE_PROC; 00167 00168 <span class="comment">/*</span> 00169 <span class="comment"> * Structure CS_COMMAND changed for RPC functionality -SUHA</span> 00170 <span class="comment"> * Added CSREMOTE_PROC *rpc to CS_COMMAND structure</span> 00171 <span class="comment"> */</span> 00172 00173 <span class="keyword">typedef</span> CS_PARAM CS_DYNAMIC_PARAM; 00174 00175 <span class="keyword">struct </span>_cs_dynamic 00176 { 00177 <span class="keywordtype">char</span> *id; 00178 <span class="keywordtype">char</span> *stmt; 00179 CS_DYNAMIC_PARAM *param_list; 00180 <span class="keyword">struct </span>_cs_dynamic *next; 00181 }; 00182 00183 <span class="comment">/* specific FreeTDS commands */</span> 00184 <span class="preprocessor">#define CS_DYNAMIC_CMD 160</span> 00185 <span class="preprocessor"></span><span class="preprocessor">#define CS_CUR_CMD 161</span> 00186 <span class="preprocessor"></span> 00187 <span class="comment">/* values for cs_command.results_state */</span> 00188 00189 <span class="preprocessor">#define _CS_RES_NONE -1</span> 00190 <span class="preprocessor"></span><span class="preprocessor">#define _CS_RES_INIT 0</span> 00191 <span class="preprocessor"></span><span class="preprocessor">#define _CS_RES_RESULTSET_EMPTY 1</span> 00192 <span class="preprocessor"></span><span class="preprocessor">#define _CS_RES_RESULTSET_ROWS 2</span> 00193 <span class="preprocessor"></span><span class="preprocessor">#define _CS_RES_STATUS 3</span> 00194 <span class="preprocessor"></span><span class="preprocessor">#define _CS_RES_CMD_DONE 4</span> 00195 <span class="preprocessor"></span><span class="preprocessor">#define _CS_RES_CMD_SUCCEED 5</span> 00196 <span class="preprocessor"></span><span class="preprocessor">#define _CS_RES_END_RESULTS 6</span> 00197 <span class="preprocessor"></span><span class="preprocessor">#define _CS_RES_DESCRIBE_RESULT 7</span> 00198 <span class="preprocessor"></span> 00199 <span class="comment">/* values for cs_command.command_state */</span> 00200 00201 <span class="preprocessor">#define _CS_COMMAND_IDLE 0</span> 00202 <span class="preprocessor"></span><span class="preprocessor">#define _CS_COMMAND_BUILDING 1</span> 00203 <span class="preprocessor"></span><span class="preprocessor">#define _CS_COMMAND_READY 2</span> 00204 <span class="preprocessor"></span><span class="preprocessor">#define _CS_COMMAND_SENT 3</span> 00205 <span class="preprocessor"></span> 00206 <span class="comment">/* values for cs_command.cancel_state */</span> 00207 <span class="preprocessor">#define _CS_CANCEL_NOCANCEL 0</span> 00208 <span class="preprocessor"></span><span class="preprocessor">#define _CS_CANCEL_PENDING 1</span> 00209 <span class="preprocessor"></span> 00210 <span class="keyword">struct </span>_cs_command 00211 { 00212 CS_INT command_state; 00213 CS_INT results_state; 00214 CS_INT cancel_state; 00215 CS_INT cursor_state; 00216 CS_CONNECTION *con; 00217 CS_INT command_type; 00218 CS_CHAR *query; 00219 <span class="keywordtype">short</span> dynamic_cmd; 00220 CS_DYNAMIC *dyn; 00221 <span class="keywordtype">int</span> row_prefetched; 00222 <span class="keywordtype">int</span> curr_result_type; 00223 <span class="keywordtype">int</span> bind_count; 00224 <span class="keywordtype">int</span> get_data_item; 00225 <span class="keywordtype">int</span> get_data_bytes_returned; 00226 CS_IODESC *iodesc; 00227 CS_INT send_data_started; 00228 CSREMOTE_PROC *rpc; 00229 CS_PARAM *input_params; 00230 CS_INT client_cursor_id; 00231 <a class="code" href="a00135.html">TDSCURSOR</a> *cursor; 00232 <span class="keywordtype">void</span> *userdata; 00233 <span class="keywordtype">int</span> userdata_len; 00234 }; 00235 00236 <span class="keyword">struct </span>_cs_command_list 00237 { 00238 <span class="keyword">struct </span>_cs_command *cmd; 00239 <span class="keyword">struct </span>_cs_command_list *next; 00240 }; 00241 00242 <span class="keyword">struct </span>_cs_blkdesc 00243 { 00244 CS_CONNECTION *con; 00245 CS_CHAR *tablename; 00246 CS_CHAR *insert_stmt; 00247 CS_INT direction; 00248 CS_INT identity_insert_on; 00249 CS_INT bind_count; 00250 CS_INT xfer_init; 00251 CS_INT var_cols; 00252 <a class="code" href="a00143.html">TDSRESULTINFO</a> *bindinfo; 00253 }; 00254 00255 00256 <span class="preprocessor">#define _CS_ERRHAND_INLINE 1</span> 00257 <span class="preprocessor"></span><span class="preprocessor">#define _CS_ERRHAND_CB 2</span> 00258 <span class="preprocessor"></span> 00259 <span class="keyword">struct </span>_cs_locale 00260 { 00261 <span class="keywordtype">char</span> *language; 00262 <span class="keywordtype">char</span> *charset; 00263 <span class="keywordtype">char</span> *time; 00264 <span class="keywordtype">char</span> *collate; 00265 }; 00266 00267 <span class="comment">/* internal defines for cursor processing */</span> 00268 00269 <span class="preprocessor">#define _CS_CURS_TYPE_UNACTIONED 0</span> 00270 <span class="preprocessor"></span><span class="preprocessor">#define _CS_CURS_TYPE_REQUESTED 1</span> 00271 <span class="preprocessor"></span><span class="preprocessor">#define _CS_CURS_TYPE_SENT 2</span> 00272 <span class="preprocessor"></span> 00273 <span class="comment">/*</span> 00274 <span class="comment"> * internal prototypes</span> 00275 <span class="comment"> */</span> 00276 <span class="keywordtype">int</span> _ct_handle_server_message(<span class="keyword">const</span> TDSCONTEXT * ctxptr, <a class="code" href="a00144.html">TDSSOCKET</a> * tdsptr, TDSMESSAGE * msgptr); 00277 <span class="keywordtype">int</span> _ct_handle_client_message(<span class="keyword">const</span> TDSCONTEXT * ctxptr, <a class="code" href="a00144.html">TDSSOCKET</a> * tdsptr, TDSMESSAGE * msgptr); 00278 <span class="keywordtype">int</span> _ct_get_server_type(<span class="keywordtype">int</span> datatype); 00279 <span class="keywordtype">int</span> _ct_bind_data(CS_CONTEXT *ctx, <a class="code" href="a00143.html">TDSRESULTINFO</a> * resinfo, <a class="code" href="a00143.html">TDSRESULTINFO</a> *bindinfo, CS_INT offset); 00280 <span class="keywordtype">int</span> _ct_get_client_type(<span class="keywordtype">int</span> datatype, <span class="keywordtype">int</span> usertype, <span class="keywordtype">int</span> size); 00281 <span class="keywordtype">void</span> _ctclient_msg(CS_CONNECTION * con, <span class="keyword">const</span> <span class="keywordtype">char</span> *funcname, <span class="keywordtype">int</span> layer, <span class="keywordtype">int</span> origin, <span class="keywordtype">int</span> severity, <span class="keywordtype">int</span> number, 00282 <span class="keyword">const</span> <span class="keywordtype">char</span> *fmt, ...); 00283 CS_INT _ct_diag_clearmsg(CS_CONTEXT * context, CS_INT type); 00284 <span class="keywordtype">void</span> _cs_locale_free(CS_LOCALE *locale); 00285 CS_LOCALE *_cs_locale_copy(CS_LOCALE *orig); 00286 <span class="keywordtype">int</span> _cs_locale_copy_inplace(CS_LOCALE *new_locale, CS_LOCALE *orig); 00287 00288 <span class="preprocessor">#ifdef __cplusplus</span> 00289 <span class="preprocessor"></span><span class="preprocessor">#if 0</span> 00290 <span class="preprocessor"></span>{ 00291 <span class="preprocessor">#endif</span> 00292 <span class="preprocessor"></span>} 00293 <span class="preprocessor">#endif</span> 00294 <span class="preprocessor"></span> 00295 <span class="preprocessor">#if defined(__GNUC__) && __GNUC__ >= 4</span> 00296 <span class="preprocessor"></span><span class="preprocessor">#pragma GCC visibility pop</span> 00297 <span class="preprocessor"></span><span class="preprocessor">#endif</span> 00298 <span class="preprocessor"></span> 00299 <span class="preprocessor">#endif</span> </pre></div><hr size="1"><address style="align: right;"><small>Generated on Wed May 7 19:22:08 2008 for FreeTDS API by <a href="http://www.doxygen.org/index.html"> <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.1 </small></address> </body> </html>