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

- File List
- File Members

# /home/jklowden/releases/freetds-0.91/include/tdsodbc.h

    00001 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases
    00002  * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005  Brian Bruns
    00003  * Copyright (C) 2004-2010  Frediano Ziglio
    00004  *
    00005  * This library is free software; you can redistribute it and/or
    00006  * modify it under the terms of the GNU Library General Public
    00007  * License as published by the Free Software Foundation; either
    00008  * version 2 of the License, or (at your option) any later version.
    00009  *
    00010  * This library is distributed in the hope that it will be useful,
    00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00013  * Library General Public License for more details.
    00014  *
    00015  * You should have received a copy of the GNU Library General Public
    00016  * License along with this library; if not, write to the
    00017  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    00018  * Boston, MA 02111-1307, USA.
    00019  */
    00020
    00021 #ifndef _sql_h_
    00022 #define _sql_h_
    00023
    00024 #include "tds.h"
    00025
    00026 #if defined(UNIXODBC) || defined(TDS_NO_DM)
    00027 #include <sql.h>
    00028 #include <sqlext.h>
    00029 #ifdef UNIXODBC
    00030 #include <odbcinst.h>
    00031 #endif
    00032 #else /* IODBC */
    00033 #include <isql.h>
    00034 #include <isqlext.h>
    00035 #ifdef HAVE_IODBCINST_H
    00036 #include <iodbcinst.h>
    00037 #endif /* HAVE_IODBCINST_H */
    00038 #endif
    00039
    00040 #ifndef HAVE_SQLLEN
    00041 #ifndef SQLULEN
    00042 #define SQLULEN SQLUINTEGER
    00043 #endif
    00044 #ifndef SQLLEN
    00045 #define SQLLEN SQLINTEGER
    00046 #endif
    00047 #endif
    00048
    00049 #ifndef HAVE_SQLSETPOSIROW
    00050 #define SQLSETPOSIROW SQLUSMALLINT
    00051 #endif
    00052
    00053 #ifndef HAVE_SQLROWOFFSET
    00054 #define SQLROWOFFSET SQLLEN
    00055 #endif
    00056
    00057 #ifndef HAVE_SQLROWSETSIZE
    00058 #define SQLROWSETSIZE SQLULEN
    00059 #endif
    00060
    00061 #ifdef __cplusplus
    00062 extern "C"
    00063 {
    00064 #if 0
    00065 }
    00066 #endif
    00067 #endif
    00068
    00069 /* $Id: tdsodbc.h,v 1.127 2010/11/09 15:46:42 freddy77 Exp $ */
    00070
    00071 #if defined(__GNUC__) && __GNUC__ >= 4 && !defined(__MINGW32__)
    00072 #pragma GCC visibility push(hidden)
    00073 #define ODBC_API SQL_API __attribute__((externally_visible))
    00074 #else
    00075 #define ODBC_API SQL_API
    00076 #endif
    00077
    00078 #if (defined(_WIN32) || defined(__CYGWIN__)) && defined(__GNUC__)
    00079 #  define ODBC_PUBLIC __attribute__((dllexport))
    00080 #else
    00081 #  define ODBC_PUBLIC
    00082 #endif
    00083
    00084 #define ODBC_MAX(a,b) ( (a) > (b) ? (a) : (b) )
    00085 #define ODBC_MIN(a,b) ( (a) < (b) ? (a) : (b) )
    00086
    00087 struct _sql_error
    00088 {
    00089         const char *msg;
    00090         char state2[6];
    00091         char state3[6];
    00092         TDS_UINT native;
    00093         char *server;
    00094         int linenum;
    00095         int msgstate;
    00096 };
    00097
    00098 struct _sql_errors
    00099 {
    00100         struct _sql_error *errs;
    00101         int num_errors;
    00102         SQLRETURN lastrc;
    00103         char ranked;
    00104 };
    00105
    00106 typedef struct _sql_errors TDS_ERRS;
    00107
    00108 #if ENABLE_EXTRA_CHECKS
    00109 void odbc_check_struct_extra(void *p);
    00110
    00111 #define ODBC_RETURN(handle, rc) \
    00112         do { odbc_check_struct_extra(handle); return (handle->errs.lastrc = (rc)); } while(0)
    00113 #define ODBC_RETURN_(handle) \
    00114         do { odbc_check_struct_extra(handle); return handle->errs.lastrc; } while(0)
    00115 #else
    00116 #define ODBC_RETURN(handle, rc) \
    00117         do { return (handle->errs.lastrc = (rc)); } while(0)
    00118 #define ODBC_RETURN_(handle) \
    00119         do { return handle->errs.lastrc; } while(0)
    00120 #endif
    00121
    00123 void odbc_errs_reset(struct _sql_errors *errs);
    00124
    00126 void odbc_errs_add(struct _sql_errors *errs, const char *sqlstate, const char *msg);
    00127
    00129 void odbc_errs_add_rdbms(struct _sql_errors *errs, TDS_UINT native, const char *sqlstate, const char *msg, int linenum,
    00130                          int msgstate, const char *server);
    00131
    00132 struct _dheader
    00133 {
    00134         SQLSMALLINT sql_desc_alloc_type;
    00135         SQLINTEGER sql_desc_bind_type;
    00136         SQLULEN sql_desc_array_size;
    00137         /* TODO SQLLEN ?? see http://support.microsoft.com/default.aspx?scid=kb;en-us;298678 */
    00138         SQLSMALLINT sql_desc_count;
    00139         SQLUSMALLINT *sql_desc_array_status_ptr;
    00140         SQLULEN *sql_desc_rows_processed_ptr;
    00141         SQLLEN *sql_desc_bind_offset_ptr;
    00142 };
    00143
    00144 struct _drecord
    00145 {
    00146         SQLUINTEGER sql_desc_auto_unique_value;
    00147         DSTR sql_desc_base_column_name;
    00148         DSTR sql_desc_base_table_name;
    00149         SQLINTEGER sql_desc_case_sensitive;
    00150         DSTR sql_desc_catalog_name;
    00151         SQLSMALLINT sql_desc_concise_type;
    00152         SQLPOINTER sql_desc_data_ptr;
    00153         SQLSMALLINT sql_desc_datetime_interval_code;
    00154         SQLINTEGER sql_desc_datetime_interval_precision;
    00155         SQLLEN sql_desc_display_size;
    00156         SQLSMALLINT sql_desc_fixed_prec_scale;
    00157         SQLLEN *sql_desc_indicator_ptr;
    00158         DSTR sql_desc_label;
    00159         SQLULEN sql_desc_length;
    00160         /* this point to a constant buffer, do not free or modify */
    00161         const char *sql_desc_literal_prefix;
    00162         /* this point to a constant buffer, do not free or modify */
    00163         const char *sql_desc_literal_suffix;
    00164         DSTR sql_desc_local_type_name;
    00165         DSTR sql_desc_name;
    00166         SQLSMALLINT sql_desc_nullable;
    00167         SQLINTEGER sql_desc_num_prec_radix;
    00168         SQLLEN sql_desc_octet_length;
    00169         SQLLEN *sql_desc_octet_length_ptr;
    00170         SQLSMALLINT sql_desc_parameter_type;
    00171         SQLSMALLINT sql_desc_precision;
    00172         SQLSMALLINT sql_desc_rowver;
    00173         SQLSMALLINT sql_desc_scale;
    00174         DSTR sql_desc_schema_name;
    00175         SQLSMALLINT sql_desc_searchable;
    00176         DSTR sql_desc_table_name;
    00177         SQLSMALLINT sql_desc_type;
    00178         /* this point to a constant buffer, do not free or modify */
    00179         const char *sql_desc_type_name;
    00180         SQLSMALLINT sql_desc_unnamed;
    00181         SQLSMALLINT sql_desc_unsigned;
    00182         SQLSMALLINT sql_desc_updatable;
    00183 };
    00184
    00185 struct _hdesc
    00186 {
    00187         SQLSMALLINT htype;      /* do not reorder this field */
    00188         struct _sql_errors errs;        /* do not reorder this field */
    00189         int type;
    00190         SQLHANDLE parent;
    00191         struct _dheader header;
    00192         struct _drecord *records;
    00193 };
    00194
    00195 typedef struct _hdesc TDS_DESC;
    00196
    00197 #define DESC_IRD        1
    00198 #define DESC_IPD        2
    00199 #define DESC_ARD        3
    00200 #define DESC_APD        4
    00201
    00202 struct _heattr
    00203 {
    00204         SQLUINTEGER connection_pooling;
    00205         SQLUINTEGER cp_match;
    00206         SQLINTEGER odbc_version;
    00207         SQLINTEGER output_nts;
    00208 };
    00209
    00210 struct _hchk
    00211 {
    00212         SQLSMALLINT htype;      /* do not reorder this field */
    00213         struct _sql_errors errs;        /* do not reorder this field */
    00214 };
    00215
    00216 struct _henv
    00217 {
    00218         SQLSMALLINT htype;      /* do not reorder this field */
    00219         struct _sql_errors errs;        /* do not reorder this field */
    00220         TDSCONTEXT *tds_ctx;
    00221         struct _heattr attr;
    00222 };
    00223
    00224 struct _hcattr
    00225 {
    00226         SQLUINTEGER access_mode;
    00227         SQLUINTEGER async_enable;
    00228         SQLUINTEGER auto_ipd;
    00229         SQLUINTEGER autocommit;
    00230         SQLUINTEGER connection_dead;
    00231         SQLUINTEGER connection_timeout;
    00232         DSTR current_catalog;
    00233         SQLUINTEGER login_timeout;
    00234         SQLUINTEGER metadata_id;
    00235         SQLUINTEGER odbc_cursors;
    00236         SQLUINTEGER packet_size;
    00237         SQLHWND quite_mode;
    00238         DSTR translate_lib;
    00239         SQLUINTEGER translate_option;
    00240         SQLUINTEGER txn_isolation;
    00241         SQLUINTEGER cursor_type;
    00242 #ifdef TDS_NO_DM
    00243         SQLUINTEGER trace;
    00244         DSTR tracefile;
    00245 #endif
    00246 };
    00247
    00248 #define TDS_MAX_APP_DESC        100
    00249
    00250 struct _hstmt;
    00251 struct _hdbc
    00252 {
    00253         SQLSMALLINT htype;      /* do not reorder this field */
    00254         struct _sql_errors errs;        /* do not reorder this field */
    00255         struct _henv *env;
    00256         TDSSOCKET *tds_socket;
    00257         DSTR dsn;
    00258         DSTR server;            /* aka Instance */
    00259 #ifdef ENABLE_ODBC_WIDE
    00260         DSTR original_charset;
    00261         TDSICONV *mb_conv;
    00262 #endif
    00263
    00269         struct _hstmt *current_statement;
    00271         struct _hstmt *stmt_list;
    00272         struct _hcattr attr;
    00274         TDS_DESC *uad[TDS_MAX_APP_DESC];
    00276         unsigned int cursor_support;
    00277         TDS_INT default_query_timeout;
    00278 };
    00279
    00280 struct _hsattr
    00281 {
    00282         /* TODO remove IRD, ARD, IPD, APD from statement, do not duplicate */
    00283 /*      TDS_DESC *app_row_desc; */
    00284 /*      TDS_DESC *app_param_desc; */
    00285         SQLUINTEGER async_enable;
    00286         SQLUINTEGER concurrency;
    00287         SQLUINTEGER cursor_scrollable;
    00288         SQLUINTEGER cursor_sensitivity;
    00289         SQLUINTEGER cursor_type;
    00290         SQLUINTEGER enable_auto_ipd;
    00291         SQLPOINTER fetch_bookmark_ptr;
    00292         SQLULEN keyset_size;
    00293         SQLULEN max_length;
    00294         SQLULEN max_rows;
    00295         SQLUINTEGER metadata_id;
    00296         SQLUINTEGER noscan;
    00297         /* apd->sql_desc_bind_offset_ptr */
    00298         /* SQLUINTEGER *param_bind_offset_ptr; */
    00299         /* apd->sql_desc_bind_type */
    00300         /* SQLUINTEGER param_bind_type; */
    00301         /* apd->sql_desc_array_status_ptr */
    00302         /* SQLUSMALLINT *param_operation_ptr; */
    00303         /* ipd->sql_desc_array_status_ptr */
    00304         /* SQLUSMALLINT *param_status_ptr; */
    00305         /* ipd->sql_desc_rows_processed_ptr */
    00306         /* SQLUSMALLINT *params_processed_ptr; */
    00307         /* apd->sql_desc_array_size */
    00308         /* SQLUINTEGER paramset_size; */
    00309         SQLUINTEGER query_timeout;
    00310         SQLUINTEGER retrieve_data;
    00311         /* ard->sql_desc_bind_offset_ptr */
    00312         /* SQLUINTEGER *row_bind_offset_ptr; */
    00313         /* ard->sql_desc_array_size */
    00314         /* SQLUINTEGER row_array_size; */
    00315         /* ard->sql_desc_bind_type */
    00316         /* SQLUINTEGER row_bind_type; */
    00317         SQLULEN row_number;
    00318         /* ard->sql_desc_array_status_ptr */
    00319         /* SQLUINTEGER *row_operation_ptr; */
    00320         /* ird->sql_desc_array_status_ptr */
    00321         /* SQLUINTEGER *row_status_ptr; */
    00322         /* ird->sql_desc_rows_processed_ptr */
    00323         /* SQLUINTEGER *rows_fetched_ptr; */
    00324         SQLUINTEGER simulate_cursor;
    00325         SQLUINTEGER use_bookmarks;
    00326         /* SQLGetStmtAttr only */
    00327 /*      TDS_DESC *imp_row_desc; */
    00328 /*      TDS_DESC *imp_param_desc; */
    00329 };
    00330
    00331 typedef enum
    00332 {
    00333         NOT_IN_ROW,
    00334         IN_NORMAL_ROW,
    00335         IN_COMPUTE_ROW,
    00336         AFTER_COMPUTE_ROW,
    00337         PRE_NORMAL_ROW
    00338 } TDS_ODBC_ROW_STATUS;
    00339
    00340 typedef enum
    00341 {
    00342         ODBC_SPECIAL_NONE = 0,
    00343         ODBC_SPECIAL_GETTYPEINFO = 1,
    00344         ODBC_SPECIAL_COLUMNS = 2,
    00345         ODBC_SPECIAL_PROCEDURECOLUMNS = 3,
    00346         ODBC_SPECIAL_SPECIALCOLUMNS = 4
    00347 } TDS_ODBC_SPECIAL_ROWS;
    00348
    00349 struct _hstmt
    00350 {
    00351         SQLSMALLINT htype;      /* do not reorder this field */
    00352         struct _sql_errors errs;        /* do not reorder this field */
    00353         struct _hdbc *dbc;
    00355         char *query;
    00356
    00358         struct _hstmt *next;
    00360         struct _hstmt *prev;
    00361
    00362         /* begin prepared query stuff */
    00363         char *prepared_query;
    00364         unsigned prepared_query_is_func:1;
    00365         unsigned prepared_query_is_rpc:1;
    00366         unsigned need_reprepare:1;
    00367         unsigned param_data_called:1;
    00368         /* end prepared query stuff */
    00369
    00371         TDSPARAMINFO *params;
    00373         int param_num;
    00375         char *prepared_pos;
    00376
    00377         unsigned int curr_param_row, num_param_rows;
    00378
    00380         unsigned int param_count;
    00381         int row;
    00383         TDS_INT8 row_count;
    00385         TDS_ODBC_ROW_STATUS row_status;
    00386         /* do NOT free dynamic, free from socket or attach to connection */
    00387         TDSDYNAMIC *dyn;
    00388         TDS_DESC *ard, *ird, *apd, *ipd;
    00389         TDS_DESC *orig_ard, *orig_apd;
    00390         SQLULEN sql_rowset_size;
    00391         struct _hsattr attr;
    00392         DSTR cursor_name;       /* auto generated cursor name */
    00393         TDS_ODBC_SPECIAL_ROWS special_row;
    00394         /* do NOT free cursor, free from socket or attach to connection */
    00395         TDSCURSOR *cursor;
    00396         unsigned char cancel_sent;
    00397 };
    00398
    00399 typedef struct _henv TDS_ENV;
    00400 typedef struct _hdbc TDS_DBC;
    00401 typedef struct _hstmt TDS_STMT;
    00402 typedef struct _hchk TDS_CHK;
    00403
    00404 #define IS_HENV(x) (((TDS_CHK *)x)->htype == SQL_HANDLE_ENV)
    00405 #define IS_HDBC(x) (((TDS_CHK *)x)->htype == SQL_HANDLE_DBC)
    00406 #define IS_HSTMT(x) (((TDS_CHK *)x)->htype == SQL_HANDLE_STMT)
    00407 #define IS_HDESC(x) (((TDS_CHK *)x)->htype == SQL_HANDLE_DESC)
    00408
    00409 /* fix a bug in MingW headers */
    00410 #ifdef __MINGW32__
    00411 #if SQL_INTERVAL_YEAR == (100 + SQL_CODE_SECOND)
    00412
    00413 #undef SQL_INTERVAL_YEAR
    00414 #undef SQL_INTERVAL_MONTH
    00415 #undef SQL_INTERVAL_DAY
    00416 #undef SQL_INTERVAL_HOUR
    00417 #undef SQL_INTERVAL_MINUTE
    00418 #undef SQL_INTERVAL_SECOND
    00419 #undef SQL_INTERVAL_YEAR_TO_MONTH
    00420 #undef SQL_INTERVAL_DAY_TO_HOUR
    00421 #undef SQL_INTERVAL_DAY_TO_MINUTE
    00422 #undef SQL_INTERVAL_DAY_TO_SECOND
    00423 #undef SQL_INTERVAL_HOUR_TO_MINUTE
    00424 #undef SQL_INTERVAL_HOUR_TO_SECOND
    00425 #undef SQL_INTERVAL_MINUTE_TO_SECOND
    00426
    00427 #define SQL_INTERVAL_YEAR                                       (100 + SQL_CODE_YEAR)
    00428 #define SQL_INTERVAL_MONTH                                      (100 + SQL_CODE_MONTH)
    00429 #define SQL_INTERVAL_DAY                                        (100 + SQL_CODE_DAY)
    00430 #define SQL_INTERVAL_HOUR                                       (100 + SQL_CODE_HOUR)
    00431 #define SQL_INTERVAL_MINUTE                                     (100 + SQL_CODE_MINUTE)
    00432 #define SQL_INTERVAL_SECOND                     (100 + SQL_CODE_SECOND)
    00433 #define SQL_INTERVAL_YEAR_TO_MONTH                      (100 + SQL_CODE_YEAR_TO_MONTH)
    00434 #define SQL_INTERVAL_DAY_TO_HOUR                        (100 + SQL_CODE_DAY_TO_HOUR)
    00435 #define SQL_INTERVAL_DAY_TO_MINUTE                      (100 + SQL_CODE_DAY_TO_MINUTE)
    00436 #define SQL_INTERVAL_DAY_TO_SECOND                      (100 + SQL_CODE_DAY_TO_SECOND)
    00437 #define SQL_INTERVAL_HOUR_TO_MINUTE                     (100 + SQL_CODE_HOUR_TO_MINUTE)
    00438 #define SQL_INTERVAL_HOUR_TO_SECOND                     (100 + SQL_CODE_HOUR_TO_SECOND)
    00439 #define SQL_INTERVAL_MINUTE_TO_SECOND           (100 + SQL_CODE_MINUTE_TO_SECOND)
    00440
    00441 #endif
    00442 #endif
    00443
    00444 #ifdef _WIN32
    00445 BOOL get_login_info(HWND hwndParent, TDSCONNECTION * connection);
    00446 #endif
    00447
    00448 #define ODBC_PARAM_LIST \
    00449         ODBC_PARAM(Servername) \
    00450         ODBC_PARAM(Server) \
    00451         ODBC_PARAM(DSN) \
    00452         ODBC_PARAM(UID) \
    00453         ODBC_PARAM(PWD) \
    00454         ODBC_PARAM(Address) \
    00455         ODBC_PARAM(Port) \
    00456         ODBC_PARAM(TDS_Version) \
    00457         ODBC_PARAM(Language) \
    00458         ODBC_PARAM(Database) \
    00459         ODBC_PARAM(TextSize) \
    00460         ODBC_PARAM(PacketSize) \
    00461         ODBC_PARAM(ClientCharset) \
    00462         ODBC_PARAM(DumpFile) \
    00463         ODBC_PARAM(DumpFileAppend) \
    00464         ODBC_PARAM(DebugFlags) \
    00465         ODBC_PARAM(Encryption) \
    00466         ODBC_PARAM(Trusted_Connection) \
    00467         ODBC_PARAM(APP) \
    00468         ODBC_PARAM(WSID) \
    00469         ODBC_PARAM(UseNTLMv2)
    00470
    00471 #define ODBC_PARAM(p) ODBC_PARAM_##p,
    00472 enum {
    00473         ODBC_PARAM_LIST
    00474         ODBC_PARAM_SIZE
    00475 };
    00476 #undef ODBC_PARAM
    00477
    00478
    00479 /*
    00480  * connectparams.h
    00481  */
    00482
    00483 typedef struct {
    00484         const char *p;
    00485         size_t len;
    00486 } TDS_PARSED_PARAM;
    00487
    00495 int odbc_parse_connect_string(TDS_ERRS *errs, const char *connect_string, const char *connect_string_end, TDSCONNECTION * connection, TDS_PARSED_PARAM *parsed_params);
    00496 int odbc_get_dsn_info(TDS_ERRS *errs, const char *DSN, TDSCONNECTION * connection);
    00497 #ifdef _WIN32
    00498 int odbc_build_connect_string(TDS_ERRS *errs, TDS_PARSED_PARAM *params, char **out);
    00499 #endif
    00500
    00501 /*
    00502  * convert_tds2sql.c
    00503  */
    00504 SQLLEN odbc_tds2sql(TDS_STMT * stmt, TDSCOLUMN *curcol, int srctype, TDS_CHAR * src, TDS_UINT srclen, int desttype, TDS_CHAR * dest, SQLULEN destlen, const struct _drecord *drec_ixd);
    00505
    00506 /*
    00507  * descriptor.c
    00508  */
    00509 TDS_DESC *desc_alloc(SQLHANDLE parent, int desc_type, int alloc_type);
    00510 SQLRETURN desc_free(TDS_DESC * desc);
    00511 SQLRETURN desc_alloc_records(TDS_DESC * desc, unsigned count);
    00512 SQLRETURN desc_copy(TDS_DESC * dest, TDS_DESC * src);
    00513 SQLRETURN desc_free_records(TDS_DESC * desc);
    00514 TDS_DBC *desc_get_dbc(TDS_DESC *desc);
    00515
    00516 /*
    00517  * odbc.c
    00518  */
    00519 SQLRETURN _SQLRowCount(SQLHSTMT hstmt, SQLLEN FAR * pcrow);
    00520
    00521 /*
    00522  * odbc_checks.h
    00523  */
    00524 #if ENABLE_EXTRA_CHECKS
    00525 /* macro */
    00526 #define CHECK_ENV_EXTRA(env) odbc_check_env_extra(env)
    00527 #define CHECK_DBC_EXTRA(dbc) odbc_check_dbc_extra(dbc)
    00528 #define CHECK_STMT_EXTRA(stmt) odbc_check_stmt_extra(stmt)
    00529 #define CHECK_DESC_EXTRA(desc) odbc_check_desc_extra(desc)
    00530 /* declarations*/
    00531 void odbc_check_env_extra(TDS_ENV * env);
    00532 void odbc_check_dbc_extra(TDS_DBC * dbc);
    00533 void odbc_check_stmt_extra(TDS_STMT * stmt);
    00534 void odbc_check_desc_extra(TDS_DESC * desc);
    00535 #else
    00536 /* macro */
    00537 #define CHECK_ENV_EXTRA(env)
    00538 #define CHECK_DBC_EXTRA(dbc)
    00539 #define CHECK_STMT_EXTRA(stmt)
    00540 #define CHECK_DESC_EXTRA(desc)
    00541 #endif
    00542
    00543 /*
    00544  * odbc_util.h
    00545  */
    00546
    00547 /* helpers for ODBC wide string support */
    00548 #undef _wide
    00549 #undef _WIDE
    00550 #ifdef ENABLE_ODBC_WIDE
    00551 typedef union {
    00552         char mb[1];
    00553         SQLWCHAR wide[1];
    00554 } ODBC_CHAR;
    00555 # define _wide ,wide
    00556 # define _wide0 ,0
    00557 # define _WIDE ,int wide
    00558 #else
    00559 # define _wide
    00560 # define _wide0
    00561 # define _WIDE
    00562 # define ODBC_CHAR SQLCHAR
    00563 #endif
    00564 int odbc_set_stmt_query(struct _hstmt *stmt, const ODBC_CHAR *sql, int sql_len _WIDE);
    00565 int odbc_set_stmt_prepared_query(struct _hstmt *stmt, const ODBC_CHAR *sql, int sql_len _WIDE);
    00566 void odbc_set_return_status(struct _hstmt *stmt, unsigned int n_row);
    00567 void odbc_set_return_params(struct _hstmt *stmt, unsigned int n_row);
    00568
    00569 SQLSMALLINT odbc_server_to_sql_type(int col_type, int col_size);
    00570 int odbc_sql_to_c_type_default(int sql_type);
    00571 int odbc_sql_to_server_type(TDSSOCKET * tds, int sql_type);
    00572 int odbc_c_to_server_type(int c_type);
    00573
    00574 void odbc_set_sql_type_info(TDSCOLUMN * col, struct _drecord *drec, SQLINTEGER odbc_ver);
    00575 SQLINTEGER odbc_sql_to_displaysize(int sqltype, TDSCOLUMN *col);
    00576 int odbc_get_string_size(int size, ODBC_CHAR * str _WIDE);
    00577 void odbc_rdbms_version(TDSSOCKET * tds_socket, char *pversion_string);
    00578 SQLINTEGER odbc_get_param_len(const struct _drecord *drec_axd, const struct _drecord *drec_ixd, const TDS_DESC* axd, unsigned int n_row);
    00579
    00580 #ifdef ENABLE_ODBC_WIDE
    00581 DSTR* odbc_dstr_copy_flag(TDS_DBC *dbc, DSTR *s, int size, ODBC_CHAR * str, int flag);
    00582 #define odbc_dstr_copy(dbc, s, len, out) \
    00583         odbc_dstr_copy_flag(dbc, s, len, sizeof((out)->mb) ? (out) : (out), wide)
    00584 #define odbc_dstr_copy_oct(dbc, s, len, out) \
    00585         odbc_dstr_copy_flag(dbc, s, len, out, wide|0x20)
    00586 #else
    00587 DSTR* odbc_dstr_copy(TDS_DBC *dbc, DSTR *s, int size, ODBC_CHAR * str);
    00588 #define odbc_dstr_copy_oct odbc_dstr_copy
    00589 #endif
    00590
    00591
    00592 SQLRETURN odbc_set_string_flag(TDS_DBC *dbc, SQLPOINTER buffer, SQLINTEGER cbBuffer, void FAR * pcbBuffer, const char *s, int len, int flag);
    00593 #ifdef ENABLE_ODBC_WIDE
    00594 #define odbc_set_string(dbc, buf, buf_len, out_len, s, s_len) \
    00595         odbc_set_string_flag(dbc, sizeof((buf)->mb) ? (buf) : (buf), buf_len, out_len, s, s_len, (wide) | (sizeof(*(out_len)) == sizeof(SQLSMALLINT)?0:0x10))
    00596 #define odbc_set_string_oct(dbc, buf, buf_len, out_len, s, s_len) \
    00597         odbc_set_string_flag(dbc, buf, buf_len, out_len, s, s_len, (wide) | (sizeof(*(out_len)) == sizeof(SQLSMALLINT)?0x20:0x30))
    00598 #else
    00599 #define odbc_set_string(dbc, buf, buf_len, out_len, s, s_len) \
    00600         odbc_set_string_flag(dbc, buf, buf_len, out_len, s, s_len, (sizeof(*(out_len)) == sizeof(SQLSMALLINT)?0:0x10))
    00601 #define odbc_set_string_oct(dbc, buf, buf_len, out_len, s, s_len) \
    00602         odbc_set_string_flag(dbc, buf, buf_len, out_len, s, s_len, (sizeof(*(out_len)) == sizeof(SQLSMALLINT)?0x20:0x30))
    00603 #endif
    00604
    00605 SQLSMALLINT odbc_get_concise_sql_type(SQLSMALLINT type, SQLSMALLINT interval);
    00606 SQLRETURN odbc_set_concise_sql_type(SQLSMALLINT concise_type, struct _drecord *drec, int check_only);
    00607 SQLSMALLINT odbc_get_concise_c_type(SQLSMALLINT type, SQLSMALLINT interval);
    00608 SQLRETURN odbc_set_concise_c_type(SQLSMALLINT concise_type, struct _drecord *drec, int check_only);
    00609
    00610 SQLLEN odbc_get_octet_len(int c_type, const struct _drecord *drec);
    00611 void odbc_convert_err_set(struct _sql_errors *errs, TDS_INT err);
    00612
    00613 /*
    00614  * prepare_query.c
    00615  */
    00616 SQLRETURN prepare_call(struct _hstmt *stmt);
    00617 SQLRETURN native_sql(struct _hdbc *dbc, char *s);
    00618 int parse_prepared_query(struct _hstmt *stmt, int compute_row);
    00619 int start_parse_prepared_query(struct _hstmt *stmt, int compute_row);
    00620 int continue_parse_prepared_query(struct _hstmt *stmt, SQLPOINTER DataPtr, SQLLEN StrLen_or_Ind);
    00621 const char *parse_const_param(const char * s, TDS_SERVER_TYPE *type);
    00622
    00623 /*
    00624  * sql2tds.c
    00625  */
    00626 SQLRETURN odbc_sql2tds(TDS_STMT * stmt, const struct _drecord *drec_ixd, const struct _drecord *drec_axd, TDSCOLUMN *curcol, int compute_row, const TDS_DESC* axd, unsigned int n_row);
    00627
    00628 /*
    00629  * sqlwchar.c
    00630  */
    00631 #if SIZEOF_SQLWCHAR != SIZEOF_WCHAR_T
    00632 size_t sqlwcslen(const SQLWCHAR * s);
    00633 #else
    00634 #define sqlwcslen wcslen
    00635 #endif
    00636
    00637 #if SIZEOF_SQLWCHAR == 2
    00638 # if WORDS_BIGENDIAN
    00639 #  define ODBC_WIDE_NAME "UCS-2BE"
    00640 # else
    00641 #  define ODBC_WIDE_NAME "UCS-2LE"
    00642 # endif
    00643 #elif SIZEOF_SQLWCHAR == 4
    00644 # if WORDS_BIGENDIAN
    00645 #  define ODBC_WIDE_NAME "UCS-4BE"
    00646 # else
    00647 #  define ODBC_WIDE_NAME "UCS-4LE"
    00648 # endif
    00649 #else
    00650 #error SIZEOF_SQLWCHAR not supported !!
    00651 #endif
    00652
    00653 #if defined(__GNUC__) && __GNUC__ >= 4 && !defined(__MINGW32__)
    00654 #pragma GCC visibility pop
    00655 #endif
    00656
    00657 #ifdef __cplusplus
    00658 #if 0
    00659 {
    00660 #endif
    00661 }
    00662 #endif
    00663
    00664 #endif

All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines