1#ifndef _DRIVERMANAGER_H
2#define _DRIVERMANAGER_H
3
4#define ODBCVER 0x0380
5
6#ifdef HAVE_SYS_TYPES_H
7#include <sys/types.h>
8#endif
9#ifdef HAVE_PWD_H
10#include <pwd.h>
11#endif
12#include <ltdl.h>
13#ifdef HAVE_STRING_H
14#include <string.h>
15#endif
16#ifdef HAVE_TIME_H
17#include <time.h>
18#endif
19
20#ifdef HAVE_SYNCH_H
21#include <synch.h>
22#endif
23
24#ifdef HAVE_LIBPTH
25#include <pth.h>
26#elif HAVE_LIBPTHREAD
27#include <pthread.h>
28#elif HAVE_LIBTHREAD
29#include <thread.h>
30#endif
31
32#define SQL_NOUNICODEMAP
33#define UNICODE
34
35#include <log.h>
36#include <ini.h>
37#include <odbcinstext.h>
38#include <sqlext.h> /* THIS WILL BRING IN sql.h and
39 sqltypes.h AS WELL AS PROVIDE
40 MS EXTENSIONS */
41#include <sqlucode.h>
42#include "__stats.h"
43
44/*
45 * iconv support
46 */
47
48#ifdef HAVE_ICONV
49#include <stdlib.h>
50#include <iconv.h>
51#endif
52
53#ifdef UNICODE_ENCODING
54#define DEFAULT_ICONV_ENCODING UNICODE_ENCODING
55#else
56#define DEFAULT_ICONV_ENCODING "auto-search"
57#endif
58
59#define ERROR_PREFIX "[unixODBC]"
60#define DM_ERROR_PREFIX "[Driver Manager]"
61#define LOG_MESSAGE_LEN 128 /* length of string to display in log */
62
63/*
64 * SQLSetStmt/ConnectionAttr limits
65 */
66
67#define SQL_CONN_DRIVER_MIN 20000
68#define SQL_STMT_DRIVER_MIN 20000
69
70/*
71 * its possible that the driver has a different definition of a handle to the driver
72 * manager, DB2 64bit is a example of this
73 */
74
75#define DRV_SQLHANDLE SQLHANDLE
76#define DRV_SQLHDESC SQLHDESC
77
78/*
79 * DEFAULT FILE NAMES
80 *
81 */
82
83/*
84 * magic numbers
85 */
86
87#define HENV_MAGIC 19289
88#define HDBC_MAGIC 19290
89#define HSTMT_MAGIC 19291
90#define HDESC_MAGIC 19292
91
92/*
93 * states
94 */
95
96#define STATE_E0 0
97#define STATE_E1 1
98#define STATE_E2 2
99
100#define STATE_C0 0
101#define STATE_C1 1
102#define STATE_C2 2
103#define STATE_C3 3
104#define STATE_C4 4
105#define STATE_C5 5
106#define STATE_C6 6
107
108#define STATE_S0 0
109#define STATE_S1 1
110#define STATE_S2 2
111#define STATE_S3 3
112#define STATE_S4 4
113#define STATE_S5 5
114#define STATE_S6 6
115#define STATE_S7 7
116#define STATE_S8 8
117#define STATE_S9 9
118#define STATE_S10 10
119#define STATE_S11 11
120#define STATE_S12 12
121
122#define STATE_S13 13 /* SQLExecute/SQLExecDirect/SQLMoreResult returned SQL_PARAM_DATA_AVAILABLE */
123#define STATE_S14 14 /* SQL_PARAM_DATA_AVAILABLE version of S9, Must Get */
124#define STATE_S15 15 /* SQL_PARAM_DATA_AVAILABLE version of S10, Can Get */
125
126#define STATE_D0 0
127#define STATE_D1i 1
128#define STATE_D1e 2
129
130/*
131 * structure to contain the loaded lib entry points
132 */
133
134struct driver_func
135{
136 int ordinal;
137 char *name;
138 void *dm_func; /* this is to fix what seems a bug in */
139 /* some dlopen implemnations where dlsym */
140 /* will return the driver manager func */
141 /* not the driver one */
142 void *dm_funcW;
143 SQLRETURN (*func)();
144 SQLRETURN (*funcW)(); /* function with a unicode W */
145 SQLRETURN (*funcA)(); /* function with a unicode A */
146 int can_supply; /* this is used to indicate that */
147 /* the DM can execute the function */
148 /* even if the driver does not */
149 /* supply it */
150};
151
152typedef struct error
153{
154 SQLWCHAR sqlstate[ 6 ];
155 SQLWCHAR *msg;
156 SQLINTEGER native_error;
157 int return_val;
158 SQLRETURN diag_column_number_ret;
159 SQLRETURN diag_row_number_ret;
160 SQLRETURN diag_class_origin_ret;
161 SQLRETURN diag_subclass_origin_ret;
162 SQLRETURN diag_connection_name_ret;
163 SQLRETURN diag_server_name_ret;
164 SQLINTEGER diag_column_number;
165 SQLLEN diag_row_number;
166 SQLWCHAR diag_class_origin[ 128 ];
167 SQLWCHAR diag_subclass_origin[ 128 ];
168 SQLWCHAR diag_connection_name[ 128 ];
169 SQLWCHAR diag_server_name[ 128 ];
170 struct error *next;
171 struct error *prev;
172
173} ERROR;
174
175typedef struct error_header
176{
177 int error_count;
178 ERROR *error_list_head;
179 ERROR *error_list_tail;
180 int internal_count;
181 ERROR *internal_list_head;
182 ERROR *internal_list_tail;
183} EHEADER;
184
185typedef struct error_head
186{
187 EHEADER sql_error_head;
188 EHEADER sql_diag_head;
189 void *owning_handle;
190 int handle_type;
191 SQLRETURN return_code;
192 SQLINTEGER header_set;
193 SQLRETURN diag_cursor_row_count_ret;
194 SQLRETURN diag_dynamic_function_ret;
195 SQLRETURN diag_dynamic_function_code_ret;
196 SQLRETURN diag_number_ret;
197 SQLRETURN diag_row_count_ret;
198 SQLLEN diag_cursor_row_count;
199 SQLWCHAR diag_dynamic_function[ 128 ];
200 SQLINTEGER diag_dynamic_function_code;
201 SQLLEN diag_number;
202 SQLLEN diag_row_count;
203} EHEAD;
204
205struct log_structure
206{
207 char *program_name;
208 char *log_file_name;
209 int log_flag;
210 int pid_logging; /* the log path specifies a directory, and a */
211 /* log file per pid is created */
212
213};
214
215extern struct log_structure log_info;
216
217/*
218 * save connection attr untill after the connect, and then pass on
219 */
220
221struct save_attr
222{
223 int attr_type;
224 char *str_attr;
225 int str_len;
226 SQLLEN int_attr;
227 struct save_attr *next;
228};
229
230/*
231 * attribute extension support
232 */
233
234struct attr_set
235{
236 char *keyword;
237 char *value;
238 int override;
239 int attribute;
240 int is_int_type;
241 int int_value;
242 struct attr_set *next;
243};
244
245struct attr_struct
246{
247 int count;
248 struct attr_set *list;
249};
250
251int __parse_attribute_string( struct attr_struct *attr_str,
252 char *str, int str_len );
253void __release_attr_str( struct attr_struct *attr_str );
254void __set_attributes( void *handle, int type );
255void __set_local_attributes( void *handle, int type );
256void *__attr_override( void *handle, int type, int attribute, void * value, SQLINTEGER *string_length );
257void *__attr_override_wide( void *handle, int type, int attribute, void * value, SQLINTEGER *string_length, SQLWCHAR *buffer );
258
259/*
260 * use this to maintain a list of the drivers that are loaded under this env,
261 * and to decide if we want to call SQLAllocHandle( SQL_ENV ) om them
262 */
263
264struct env_lib_struct
265{
266 char *lib_name;
267 DRV_SQLHANDLE env_handle;
268 int count;
269 struct env_lib_struct *next;
270};
271
272typedef struct environment
273{
274 int type; /* magic number */
275 struct environment *next_class_list;/* static list of all env handles */
276 char msg[ LOG_MSG_MAX ]; /* buff to format msgs */
277 int state; /* state of environment */
278 int version_set; /* whether ODBC version has been set */
279 SQLINTEGER requested_version; /* SQL_OV_ODBC2 or SQL_OV_ODBC3 */
280 int connection_count; /* number of hdbc of this env */
281 int sql_driver_count; /* used for SQLDrivers */
282 EHEAD error; /* keep track of errors */
283 SQLINTEGER connection_pooling; /* does connection pooling operate */
284 SQLINTEGER cp_match;
285 int fetch_mode; /* for SQLDataSources */
286 int entry;
287 void *sh; /* statistics handle */
288 int driver_act_ver; /* real version of the driver */
289 struct env_lib_struct *env_lib_list;/* use this to avoid multiple AllocEnv in the driver */
290} *DMHENV;
291
292
293#ifdef FAST_HANDLE_VALIDATE
294 struct statement;
295#endif
296
297
298/*
299 * connection pooling attributes
300 */
301
302typedef struct connection
303{
304 int type; /* magic number */
305 struct connection *next_class_list; /* static list of all dbc handles */
306 char msg[ LOG_MSG_MAX ]; /* buff to format msgs */
307 int state; /* state of connection */
308 DMHENV environment; /* environment that own's the
309 connection */
310#ifdef FAST_HANDLE_VALIDATE
311 struct statement *statements; /* List of statements owned by this
312 connection */
313#endif
314
315 void *dl_handle; /* handle of the loaded lib */
316 char dl_name[ 256 ]; /* name of loaded lib */
317 struct driver_func *functions; /* entry points */
318 struct driver_func ini_func; /* optinal start end functions */
319 struct driver_func fini_func;
320 int unicode_driver; /* do we use the W functions in the */
321 /* driver ? */
322 DRV_SQLHANDLE driver_env; /* environment handle in client */
323 DRV_SQLHANDLE driver_dbc; /* connection handle in client */
324 int driver_version; /* required version of the connected */
325 /* driver */
326 int driver_act_ver; /* real version of the driver */
327 int statement_count; /* number of statements on this dbc */
328 EHEAD error; /* keep track of errors */
329 char dsn[ SQL_MAX_DSN_LENGTH + 1 ]; /* where we are connected */
330 int access_mode; /* variables set via SQLSetConnectAttr */
331 int access_mode_set;
332 int login_timeout;
333 int login_timeout_set;
334 int auto_commit;
335 int auto_commit_set;
336 int async_enable;
337 int async_enable_set;
338 int auto_ipd;
339 int auto_ipd_set;
340 int connection_timeout;
341 int connection_timeout_set;
342 int metadata_id;
343 int metadata_id_set;
344 int packet_size;
345 int packet_size_set;
346 SQLLEN quite_mode;
347 int quite_mode_set;
348 int txn_isolation;
349 int txn_isolation_set;
350
351 SQLINTEGER cursors;
352 void *cl_handle; /* handle to the cursor lib */
353 int trace;
354 char tracefile[ INI_MAX_PROPERTY_VALUE + 1 ];
355#ifdef HAVE_LIBPTH
356 pth_mutex_t mutex; /* protect the object */
357 int protection_level;
358#elif HAVE_LIBPTHREAD
359 pthread_mutex_t mutex; /* protect the object */
360 int protection_level;
361#elif HAVE_LIBTHREAD
362 mutex_t mutex; /* protect the object */
363 int protection_level;
364#endif
365 int ex_fetch_mapping; /* disable SQLFetch -> SQLExtendedFetch */
366 int disable_gf; /* dont call SQLGetFunctions in the driver */
367 int dont_dlclose; /* disable dlclosing of the handle */
368 int bookmarks_on; /* bookmarks are set on */
369 void *pooled_connection; /* points to t connection pool structure */
370 int pooling_timeout;
371 int ttl;
372 char driver_connect_string[ 1024 ];
373 int dsn_length;
374 char server[ 128 ];
375 int server_length;
376 char user[ 128 ];
377 int user_length;
378 char password[ 128 ];
379 int password_length;
380 char cli_year[ 5 ];
381 struct attr_struct env_attribute; /* Extended attribute set info */
382 struct attr_struct dbc_attribute;
383 struct attr_struct stmt_attribute;
384 struct save_attr *save_attr; /* SQLConnectAttr before connect */
385#ifdef HAVE_ICONV
386 iconv_t iconv_cd_uc_to_ascii; /* in and out conversion descriptor */
387 iconv_t iconv_cd_ascii_to_uc;
388 char unicode_string[ 64 ]; /* name of unicode conversion */
389#endif
390 struct env_lib_struct *env_list_ent; /* pointer to reference in the env list */
391 char probe_sql[ 512 ]; /* SQL to use to check a pool is valid */
392 int threading_level; /* level of thread protection the DM proves */
393 int cbs_found; /* Have we queried the driver for the effect of a */
394 SQLSMALLINT ccb_value; /* COMMIT or a ROLLBACK */
395 SQLSMALLINT crb_value;
396} *DMHDBC;
397
398typedef struct connection_pool
399{
400 char driver_connect_string[ 1024 ];
401 int dsn_length;
402 char server[ 128 ];
403 int server_length;
404 char user[ 128 ];
405 int user_length;
406 char password[ 128 ];
407 int password_length;
408 time_t expiry_time;
409 int ttl;
410 int timeout;
411 int in_use;
412 struct connection_pool *next;
413 struct connection connection;
414 int cursors;
415} CPOOL;
416
417typedef struct descriptor
418{
419 int type; /* magic number */
420 struct descriptor *next_class_list; /* static list of all desc handles */
421 char msg[ LOG_MSG_MAX ]; /* buff to format msgs */
422 int state; /* state of descriptor */
423
424#ifdef FAST_HANDLE_VALIDATE
425 struct descriptor *prev_class_list;/* static list of all desc handles */
426#endif
427
428 EHEAD error; /* keep track of errors */
429 DRV_SQLHDESC driver_desc; /* driver descriptor */
430 DMHDBC connection; /* DM connection that owns this */
431 int implicit; /* created by a AllocStmt */
432 void *associated_with; /* statement that this is a descriptor of */
433#ifdef HAVE_LIBPTH
434 pth_mutex_t mutex; /* protect the object */
435#elif HAVE_LIBPTHREAD
436 pthread_mutex_t mutex; /* protect the object */
437#elif HAVE_LIBTHREAD
438 mutex_t mutex; /* protect the object */
439#endif
440} *DMHDESC;
441
442typedef struct statement
443{
444 int type; /* magic number */
445 struct statement *next_class_list; /* static list of all stmt handles */
446 char msg[ LOG_MSG_MAX ]; /* buff to format msgs */
447 int state; /* state of statement */
448#ifdef FAST_HANDLE_VALIDATE
449 struct statement *prev_class_list; /* static list of all stmt handles */
450 struct statement *next_conn_list; /* Single linked list storing statements
451 owned by "connection" connection */
452#endif
453 DMHDBC connection; /* DM connection that owns this */
454 DRV_SQLHANDLE driver_stmt; /* statement in the driver */
455 SQLSMALLINT hascols; /* is there a result set */
456 int prepared; /* the statement has been prepared */
457 int interupted_func; /* current function running async */
458 /* or NEED_DATA */
459 int interupted_state; /* state we went into need data or */
460 /* still executing from */
461 int bookmarks_on; /* bookmarks are set on */
462 EHEAD error; /* keep track of errors */
463 SQLINTEGER metadata_id;
464 DMHDESC ipd; /* current descriptors */
465 DMHDESC apd;
466 DMHDESC ird;
467 DMHDESC ard;
468 DMHDESC implicit_ipd; /* implicit descriptors */
469 DMHDESC implicit_apd;
470 DMHDESC implicit_ird;
471 DMHDESC implicit_ard;
472 SQLULEN *fetch_bm_ptr; /* Saved for ODBC3 to ODBC2 mapping */
473 SQLULEN *row_ct_ptr; /* row count ptr */
474 SQLUSMALLINT *row_st_arr; /* row status array */
475 SQLULEN row_array_size;
476 SQLPOINTER valueptr; /* Default buffer for SQLParamData() */
477
478#ifdef HAVE_LIBPTH
479 pth_mutex_t mutex; /* protect the object */
480#elif HAVE_LIBPTHREAD
481 pthread_mutex_t mutex; /* protect the object */
482#elif HAVE_LIBTHREAD
483 mutex_t mutex; /* protect the object */
484
485#endif
486
487 int eod; /* when in S6 has EOD been returned */
488} *DMHSTMT;
489
490#if defined ( HAVE_LIBPTHREAD ) || defined ( HAVE_LIBTHREAD ) || defined ( HAVE_LIBPTH )
491#define TS_LEVEL0 0 /* no implicit protection, only for */
492 /* dm internal structures */
493#define TS_LEVEL1 1 /* protection on a statement level */
494#define TS_LEVEL2 2 /* protection on a connection level */
495#define TS_LEVEL3 3 /* protection on a environment level */
496#endif
497
498void mutex_lib_entry( void );
499void mutex_lib_exit( void );
500
501void mutex_pool_entry( void );
502void mutex_pool_exit( void );
503
504void mutex_iconv_entry( void );
505void mutex_iconv_exit( void );
506
507typedef struct connection_pair
508{
509 char *name;
510 char *value;
511 struct connection_pair *next;
512} *connection_attribute;
513
514/*
515 * defined down here to get the DMHDBC definition
516 */
517
518void __handle_attr_extensions( DMHDBC connection, char *dsn, char *driver_name );
519
520/*
521 * handle allocation functions
522 */
523
524DMHENV __alloc_env( void );
525int __validate_env( DMHENV );
526void __release_env( DMHENV environment );
527
528DMHDBC __alloc_dbc( void );
529int __validate_dbc( DMHDBC );
530void __release_dbc( DMHDBC connection );
531
532DMHSTMT __alloc_stmt( void );
533void __register_stmt ( DMHDBC connection, DMHSTMT statement );
534void __set_stmt_state ( DMHDBC connection, SQLSMALLINT cb_value );
535int __validate_stmt( DMHSTMT );
536void __release_stmt( DMHSTMT );
537
538DMHDESC __alloc_desc( void );
539int __validate_desc( DMHDESC );
540void __release_desc( DMHDESC );
541
542/*
543 * generic functions
544 */
545
546SQLRETURN __SQLAllocHandle( SQLSMALLINT handle_type,
547 SQLHANDLE input_handle,
548 SQLHANDLE *output_handle,
549 SQLINTEGER requested_version );
550
551SQLRETURN __SQLFreeHandle( SQLSMALLINT handle_type,
552 SQLHANDLE handle );
553
554SQLRETURN __SQLGetInfo( SQLHDBC connection_handle,
555 SQLUSMALLINT info_type,
556 SQLPOINTER info_value,
557 SQLSMALLINT buffer_length,
558 SQLSMALLINT *string_length );
559
560int __connect_part_one( DMHDBC connection, char *driver_lib, char *driver_name, int *warnings );
561void __disconnect_part_one( DMHDBC connection );
562int __connect_part_two( DMHDBC connection );
563void __disconnect_part_two( DMHDBC connection );
564void __disconnect_part_three( DMHDBC connection );
565void __disconnect_part_four( DMHDBC connection );
566DMHDBC __get_dbc_root( void );
567
568void __check_for_function( DMHDBC connection,
569 SQLUSMALLINT function_id,
570 SQLUSMALLINT *supported );
571
572int __clean_stmt_from_dbc( DMHDBC connection );
573int __clean_desc_from_dbc( DMHDBC connection );
574void __map_error_state( char * state, int requested_version );
575void __map_error_state_w( SQLWCHAR * wstate, int requested_version );
576
577/*
578 * mapping from ODBC 2 <-> 3 datetime types
579 */
580
581#define MAP_SQL_DM2D 0
582#define MAP_SQL_D2DM 1
583#define MAP_C_DM2D 2
584#define MAP_C_D2DM 3
585
586SQLSMALLINT __map_type( int map, DMHDBC connection, SQLSMALLINT type);
587
588/*
589 * error functions
590 */
591
592typedef enum error_id
593{
594 ERROR_01000,
595 ERROR_01004,
596 ERROR_01S02,
597 ERROR_01S06,
598 ERROR_07005,
599 ERROR_07009,
600 ERROR_08002,
601 ERROR_08003,
602 ERROR_24000,
603 ERROR_25000,
604 ERROR_25S01,
605 ERROR_S1000,
606 ERROR_S1003,
607 ERROR_S1010,
608 ERROR_S1011,
609 ERROR_S1107,
610 ERROR_S1108,
611 ERROR_S1C00,
612 ERROR_HY001,
613 ERROR_HY003,
614 ERROR_HY004,
615 ERROR_HY007,
616 ERROR_HY009,
617 ERROR_HY010,
618 ERROR_HY011,
619 ERROR_HY012,
620 ERROR_HY013,
621 ERROR_HY017,
622 ERROR_HY024,
623 ERROR_HY090,
624 ERROR_HY092,
625 ERROR_HY095,
626 ERROR_HY097,
627 ERROR_HY098,
628 ERROR_HY099,
629 ERROR_HY100,
630 ERROR_HY101,
631 ERROR_HY103,
632 ERROR_HY105,
633 ERROR_HY106,
634 ERROR_HY110,
635 ERROR_HY111,
636 ERROR_HYC00,
637 ERROR_IM001,
638 ERROR_IM002,
639 ERROR_IM003,
640 ERROR_IM004,
641 ERROR_IM005,
642 ERROR_IM010,
643 ERROR_IM012,
644 ERROR_SL004,
645 ERROR_SL009,
646 ERROR_SL010,
647 ERROR_SL008,
648 ERROR_HY000,
649 ERROR_IM011
650} error_id;
651
652#define IGNORE_THREAD (-1)
653
654#define function_return(l,h,r) function_return_ex(l,h,r,FALSE)
655
656#define SUBCLASS_ODBC 0
657#define SUBCLASS_ISO 1
658
659void __post_internal_error( EHEAD *error_handle,
660 error_id, char *txt, int connection_mode );
661void __post_internal_error_api( EHEAD *error_handle,
662 error_id, char *txt, int connection_mode, int calling_api );
663void __post_internal_error_ex( EHEAD *error_handle,
664 SQLCHAR *sqlstate,
665 SQLINTEGER native_error,
666 SQLCHAR *message_text,
667 int class_origin,
668 int subclass_origin );
669void __post_internal_error_ex_noprefix( EHEAD *error_handle,
670 SQLCHAR *sqlstate,
671 SQLINTEGER native_error,
672 SQLCHAR *message_text,
673 int class_origin,
674 int subclass_origin );
675void __post_internal_error_ex_w( EHEAD *error_handle,
676 SQLWCHAR *sqlstate,
677 SQLINTEGER native_error,
678 SQLWCHAR *message_text,
679 int class_origin,
680 int subclass_origin );
681void __post_internal_error_ex_w_noprefix( EHEAD *error_handle,
682 SQLWCHAR *sqlstate,
683 SQLINTEGER native_error,
684 SQLWCHAR *message_text,
685 int class_origin,
686 int subclass_origin );
687int function_return_nodrv( int level, void *handle, int ret_code );
688int function_return_ex( int level, void * handle, int ret_code, int save_to_diag );
689void function_entry( void *handle );
690void setup_error_head( EHEAD *error_header, void *handle, int handle_type );
691void clear_error_head( EHEAD *error_header );
692SQLWCHAR *ansi_to_unicode_copy( SQLWCHAR * dest, char *src, SQLINTEGER buffer_len, DMHDBC connection, int *wlen );
693SQLWCHAR *ansi_to_unicode_alloc( SQLCHAR *str, SQLINTEGER len, DMHDBC connection, int *wlen );
694char *unicode_to_ansi_copy( char* dest, int dest_len, SQLWCHAR *src, SQLINTEGER len, DMHDBC connection, int *clen );
695char *unicode_to_ansi_alloc( SQLWCHAR *str, SQLINTEGER len, DMHDBC connection, int *clen );
696int unicode_setup( DMHDBC connection );
697void unicode_shutdown( DMHDBC connection );
698char * __get_return_status( SQLRETURN ret, SQLCHAR *buffer );
699char * __sql_as_text( SQLINTEGER type );
700char * __c_as_text( SQLINTEGER type );
701char * __string_with_length( SQLCHAR *out, SQLCHAR *str, SQLINTEGER len );
702char * __string_with_length_pass( SQLCHAR *out, SQLCHAR *str, SQLINTEGER len );
703char * __string_with_length_hide_pwd( SQLCHAR *out, SQLCHAR *str, SQLINTEGER len );
704char * __wstring_with_length( SQLCHAR *out, SQLWCHAR *str, SQLINTEGER len );
705char * __wstring_with_length_pass( SQLCHAR *out, SQLWCHAR *str, SQLINTEGER len );
706char * __wstring_with_length_hide_pwd( SQLCHAR *out, SQLWCHAR *str, SQLINTEGER len );
707SQLWCHAR *wide_strcpy( SQLWCHAR *str1, SQLWCHAR *str2 );
708SQLWCHAR *wide_strncpy( SQLWCHAR *str1, SQLWCHAR *str2, int buffer_length );
709SQLWCHAR *wide_strcat( SQLWCHAR *str1, SQLWCHAR *str2 );
710SQLWCHAR *wide_strdup( SQLWCHAR *str1 );
711int wide_strlen( SQLWCHAR *str1 );
712int wide_ansi_strncmp( SQLWCHAR *str1, char *str2, int len );
713char * __get_pid( SQLCHAR *str );
714char * __iptr_as_string( SQLCHAR *s, SQLINTEGER *ptr );
715char * __ptr_as_string( SQLCHAR *s, SQLLEN *ptr );
716char * __sptr_as_string( SQLCHAR *s, SQLSMALLINT *ptr );
717char * __info_as_string( SQLCHAR *s, SQLINTEGER typ );
718void __clear_internal_error( struct error *error_handle );
719char * __data_as_string( SQLCHAR *s, SQLINTEGER type,
720 SQLLEN *ptr, SQLPOINTER buf );
721char * __sdata_as_string( SQLCHAR *s, SQLINTEGER type,
722 SQLSMALLINT *ptr, SQLPOINTER buf );
723char * __idata_as_string( SQLCHAR *s, SQLINTEGER type,
724 SQLINTEGER *ptr, SQLPOINTER buf );
725char * __col_attr_as_string( SQLCHAR *s, SQLINTEGER type );
726char * __fid_as_string( SQLCHAR *s, SQLINTEGER fid );
727char * __con_attr_as_string( SQLCHAR *s, SQLINTEGER type );
728char * __env_attr_as_string( SQLCHAR *s, SQLINTEGER type );
729char * __stmt_attr_as_string( SQLCHAR *s, SQLINTEGER type );
730char * __desc_attr_as_string( SQLCHAR *s, SQLINTEGER type );
731char * __diag_attr_as_string( SQLCHAR *s, SQLINTEGER type );
732char * __type_as_string( SQLCHAR *s, SQLSMALLINT type );
733DMHDBC __get_connection( EHEAD * head );
734DRV_SQLHANDLE __get_driver_handle( EHEAD * head );
735int __get_version( EHEAD * head );
736int dm_check_connection_attrs( DMHDBC connection, SQLINTEGER attribute, SQLPOINTER value );
737int dm_check_statement_attrs( DMHSTMT statement, SQLINTEGER attribute, SQLPOINTER value );
738int __check_stmt_from_dbc( DMHDBC connection, int state );
739#define MAX_STATE_ARGS 8
740int __check_stmt_from_dbc_v( DMHDBC connection, int statecount, ... );
741int __check_stmt_from_desc( DMHDESC desc, int state );
742int __check_stmt_from_desc_ird( DMHDESC desc, int state );
743
744/*
745 * These are passed to the cursor lib as helper functions
746 */
747
748struct driver_helper_funcs
749{
750 void (*__post_internal_error_ex)( EHEAD *error_header,
751 SQLCHAR *sqlstate,
752 SQLINTEGER native_error,
753 SQLCHAR *message_text,
754 int class_origin,
755 int subclass_origin );
756
757 void (*__post_internal_error)( EHEAD *error_handle,
758 error_id id, char *txt, int connection_mode );
759 void (*dm_log_write)( char *function_name, int line, int type, int severity,
760 char *message );
761};
762
763/*
764 * thread protection funcs
765 */
766
767#if defined ( HAVE_LIBPTHREAD ) || defined ( HAVE_LIBTHREAD ) || defined ( HAVE_LIBPTH )
768
769void thread_protect( int type, void *handle );
770void thread_release( int type, void *handle );
771
772#else
773
774#define thread_protect(a,b)
775#define thread_release(a,b)
776
777#endif
778
779void dbc_change_thread_support( DMHDBC connection, int level );
780
781#ifdef WITH_HANDLE_REDIRECT
782
783void *find_parent_handle( DRV_SQLHANDLE hand, int type );
784
785#endif
786
787/*
788 * lookup functions
789 */
790
791char *__find_lib_name( char *dsn, char *lib_name, char *driver_name );
792
793/*
794 * setup the cursor library
795 */
796
797SQLRETURN SQL_API CLConnect( DMHDBC connection, struct driver_helper_funcs * );
798
799/*
800 * connection string functions
801 */
802
803struct con_pair
804{
805 char *keyword;
806 char *attribute;
807 char *identifier;
808 struct con_pair *next;
809};
810
811struct con_struct
812{
813 int count;
814 struct con_pair *list;
815};
816
817void __generate_connection_string( struct con_struct *con_str, char *str, int str_len );
818int __parse_connection_string( struct con_struct *con_str,
819 char *str, int str_len );
820int __parse_connection_string_w( struct con_struct *con_str,
821 SQLWCHAR *str, int str_len );
822char * __get_attribute_value( struct con_struct * con_str, char * keyword );
823void __release_conn( struct con_struct *con_str );
824void __get_attr( char ** cp, char ** keyword, char ** value );
825struct con_pair * __get_pair( char ** cp );
826int __append_pair( struct con_struct *con_str, char *kword, char *value );
827void __handle_attr_extensions_cs( DMHDBC connection, struct con_struct *con_str );
828void __strip_from_pool( DMHENV env );
829
830/*
831 * the following two are part of a effort to get a particular unicode driver working
832 */
833
834SQLINTEGER map_ca_odbc3_to_2( SQLINTEGER field_identifier );
835SQLINTEGER map_ca_odbc2_to_3( SQLINTEGER field_identifier );
836
837/*
838 * check the type passed to SQLBindCol is a valid C_TYPE
839 */
840
841int check_target_type( int c_type, int connection_mode);
842
843/*
844 * entry exit functions in drivers
845 */
846
847#define ODBC_INI_FUNCTION "SQLDriverLoad"
848#define ODBC_FINI_FUNCTION "SQLDriverUnload"
849
850/*
851 * driver manager logging functions
852 */
853
854void dm_log_open( char *program_name, char *log_file, int pid_logging );
855
856void dm_log_write( char *function_name, int line, int type, int severity, char *message );
857void dm_log_write_diag( char *message );
858
859void dm_log_close( void );
860
861/*
862 * connection pooling functions
863 */
864
865int search_for_pool( DMHDBC connection,
866 SQLCHAR *server_name,
867 SQLSMALLINT name_length1,
868 SQLCHAR *user_name,
869 SQLSMALLINT name_length2,
870 SQLCHAR *authentication,
871 SQLSMALLINT name_length3,
872 SQLCHAR *connect_string,
873 SQLSMALLINT connect_string_length );
874
875void return_to_pool( DMHDBC connection );
876
877/*
878 * Macros to check and call functions in the driver
879 */
880
881#define DM_SQLALLOCCONNECT 0
882#define CHECK_SQLALLOCCONNECT(con) (con->functions[0].func!=NULL)
883#define SQLALLOCCONNECT(con,env,oh)\
884 (con->functions[0].func)(env,oh)
885
886#define DM_SQLALLOCENV 1
887#define CHECK_SQLALLOCENV(con) (con->functions[1].func!=NULL)
888#define SQLALLOCENV(con,oh)\
889 (con->functions[1].func)(oh)
890
891#define DM_SQLALLOCHANDLE 2
892#define CHECK_SQLALLOCHANDLE(con) (con->functions[2].func!=NULL)
893 /*
894 * if the function is in the cursor lib, pass a additional
895 * arg that allows the cursor lib to get the dm handle
896 */
897#define SQLALLOCHANDLE(con,ht,ih,oh,dmh)\
898 (con->cl_handle?\
899 (con->functions[2].func)(ht,ih,oh,dmh):\
900 (con->functions[2].func)(ht,ih,oh))
901
902#define DM_SQLALLOCSTMT 3
903#define CHECK_SQLALLOCSTMT(con) (con->functions[3].func!=NULL)
904#define SQLALLOCSTMT(con,dbc,oh,dmh)\
905 (con->cl_handle?\
906 (con->functions[3].func)(dbc,oh,dmh):\
907 (con->functions[3].func)(dbc,oh))
908
909#define DM_SQLALLOCHANDLESTD 4
910
911#define DM_SQLBINDCOL 5
912#define CHECK_SQLBINDCOL(con) (con->functions[5].func!=NULL)
913#define SQLBINDCOL(con,stmt,cn,tt,tvp,bl,sli)\
914 (con->functions[5].func)\
915 (stmt,cn,tt,tvp,bl,sli)
916
917#define DM_SQLBINDPARAM 6
918#define CHECK_SQLBINDPARAM(con) (con->functions[6].func!=NULL)
919#define SQLBINDPARAM(con,stmt,pn,vt,pt,cs,dd,pvp,ind)\
920 (con->functions[6].func)\
921 (stmt,pn,vt,pt,cs,dd,pvp,ind)
922
923#define DM_SQLBINDPARAMETER 7
924#define CHECK_SQLBINDPARAMETER(con) (con->functions[7].func!=NULL)
925#define SQLBINDPARAMETER(con,stmt,pn,typ,vt,pt,cs,dd,pvp,bl,ind)\
926 (con->functions[7].func)\
927 (stmt,pn,typ,vt,pt,cs,dd,pvp,bl,ind)
928
929#define DM_SQLBROWSECONNECT 8
930#define CHECK_SQLBROWSECONNECT(con) (con->functions[8].func!=NULL)
931#define SQLBROWSECONNECT(con,dbc,ics,sl1,ocs,bl,sl2)\
932 (con->functions[8].func)\
933 (dbc,ics,sl1,ocs,bl,sl2)
934#define CHECK_SQLBROWSECONNECTW(con) (con->functions[8].funcW!=NULL)
935#define SQLBROWSECONNECTW(con,dbc,ics,sl1,ocs,bl,sl2)\
936 (con->functions[8].funcW)\
937 (dbc,ics,sl1,ocs,bl,sl2)
938
939#define DM_SQLBULKOPERATIONS 9
940#define CHECK_SQLBULKOPERATIONS(con) (con->functions[9].func!=NULL)
941#define SQLBULKOPERATIONS(con,stmt,op)\
942 (con->functions[9].func)(stmt,op)
943
944#define DM_SQLCANCEL 10
945#define CHECK_SQLCANCEL(con) (con->functions[10].func!=NULL)
946#define SQLCANCEL(con,stmt)\
947 (con->functions[10].func)(stmt)
948
949#define DM_SQLCLOSECURSOR 11
950#define CHECK_SQLCLOSECURSOR(con) (con->functions[11].func!=NULL)
951#define SQLCLOSECURSOR(con,stmt)\
952 (con->functions[11].func)(stmt)
953
954#define DM_SQLCOLATTRIBUTE 12
955#define CHECK_SQLCOLATTRIBUTE(con) (con->functions[12].func!=NULL)
956#define SQLCOLATTRIBUTE(con,stmt,cn,fi,cap,bl,slp,nap)\
957 (con->functions[12].func)\
958 (stmt,cn,fi,cap,bl,slp,nap)
959#define CHECK_SQLCOLATTRIBUTEW(con) (con->functions[12].funcW!=NULL)
960#define SQLCOLATTRIBUTEW(con,stmt,cn,fi,cap,bl,slp,nap)\
961 (con->functions[12].funcW)\
962 (stmt,cn,fi,cap,bl,slp,nap)
963
964#define DM_SQLCOLATTRIBUTES 13
965#define CHECK_SQLCOLATTRIBUTES(con) (con->functions[13].func!=NULL)
966#define SQLCOLATTRIBUTES(con,stmt,cn,fi,cap,bl,slp,nap)\
967 (con->functions[13].func)\
968 (stmt,cn,fi,cap,bl,slp,nap)
969#define CHECK_SQLCOLATTRIBUTESW(con) (con->functions[13].funcW!=NULL)
970#define SQLCOLATTRIBUTESW(con,stmt,cn,fi,cap,bl,slp,nap)\
971 (con->functions[13].funcW)\
972 (stmt,cn,fi,cap,bl,slp,nap)
973
974#define DM_SQLCOLUMNPRIVILEGES 14
975#define CHECK_SQLCOLUMNPRIVILEGES(con) (con->functions[14].func!=NULL)
976#define SQLCOLUMNPRIVILEGES(con,stmt,cn,nl1,sn,nl2,tn,nl3,col,nl4)\
977 (con->functions[14].func)\
978 (stmt,cn,nl1,sn,nl2,tn,nl3,col,nl4)
979#define CHECK_SQLCOLUMNPRIVILEGESW(con) (con->functions[14].funcW!=NULL)
980#define SQLCOLUMNPRIVILEGESW(con,stmt,cn,nl1,sn,nl2,tn,nl3,col,nl4)\
981 (con->functions[14].funcW)\
982 (stmt,cn,nl1,sn,nl2,tn,nl3,col,nl4)
983
984#define DM_SQLCOLUMNS 15
985#define CHECK_SQLCOLUMNS(con) (con->functions[15].func!=NULL)
986#define SQLCOLUMNS(con,stmt,cn,nl1,sn,nl2,tn,nl3,col,nl4)\
987 (con->functions[15].func)\
988 (stmt,cn,nl1,sn,nl2,tn,nl3,col,nl4)
989#define CHECK_SQLCOLUMNSW(con) (con->functions[15].funcW!=NULL)
990#define SQLCOLUMNSW(con,stmt,cn,nl1,sn,nl2,tn,nl3,col,nl4)\
991 (con->functions[15].funcW)\
992 (stmt,cn,nl1,sn,nl2,tn,nl3,col,nl4)
993
994#define DM_SQLCONNECT 16
995#define CHECK_SQLCONNECT(con) (con->functions[16].func!=NULL)
996#define SQLCONNECT(con,dbc,dsn,l1,uid,l2,at,l3)\
997 (con->functions[16].func)\
998 (dbc,dsn,l1,uid,l2,at,l3)
999#define CHECK_SQLCONNECTW(con) (con->functions[16].funcW!=NULL)
1000#define SQLCONNECTW(con,dbc,dsn,l1,uid,l2,at,l3)\
1001 (con->functions[16].funcW)\
1002 (dbc,dsn,l1,uid,l2,at,l3)
1003
1004#define DM_SQLCOPYDESC 17
1005#define CHECK_SQLCOPYDESC(con) (con->functions[17].func!=NULL)
1006#define SQLCOPYDESC(con,sd,td)\
1007 (con->functions[17].func)(sd,td)
1008
1009#define DM_SQLDATASOURCES 18
1010
1011#define DM_SQLDESCRIBECOL 19
1012#define CHECK_SQLDESCRIBECOL(con) (con->functions[19].func!=NULL)
1013#define SQLDESCRIBECOL(con,stmt,cnum,cn,bli,nl,dt,cs,dd,n)\
1014 (con->functions[19].func)\
1015 (stmt,cnum,cn,bli,nl,dt,cs,dd,n)
1016#define CHECK_SQLDESCRIBECOLW(con) (con->functions[19].funcW!=NULL)
1017#define SQLDESCRIBECOLW(con,stmt,cnum,cn,bli,nl,dt,cs,dd,n)\
1018 (con->functions[19].funcW)\
1019 (stmt,cnum,cn,bli,nl,dt,cs,dd,n)
1020
1021#define DM_SQLDESCRIBEPARAM 20
1022#define CHECK_SQLDESCRIBEPARAM(con) (con->functions[20].func!=NULL)
1023#define SQLDESCRIBEPARAM(con,stmt,pn,dtp,psp,ddp,np)\
1024 (con->functions[20].func)\
1025 (stmt,pn,dtp,psp,ddp,np)
1026
1027#define DM_SQLDISCONNECT 21
1028#define CHECK_SQLDISCONNECT(con) (con->functions[21].func!=NULL)
1029#define SQLDISCONNECT(con,dbc)\
1030 (con->functions[21].func)(dbc)
1031
1032#define DM_SQLDRIVERCONNECT 22
1033#define CHECK_SQLDRIVERCONNECT(con) (con->functions[22].func!=NULL)
1034#define SQLDRIVERCONNECT(con,dbc,wh,ics,sl1,ocs,bl,sl2p,dc)\
1035 (con->functions[22].func)\
1036 (dbc,wh,ics,sl1,ocs,bl,sl2p,dc)
1037
1038#define CHECK_SQLDRIVERCONNECTW(con) (con->functions[22].funcW!=NULL)
1039#define SQLDRIVERCONNECTW(con,dbc,wh,ics,sl1,ocs,bl,sl2p,dc)\
1040 (con->functions[22].funcW)\
1041 (dbc,wh,ics,sl1,ocs,bl,sl2p,dc)
1042
1043#define DM_SQLDRIVERS 23
1044
1045#define DM_SQLENDTRAN 24
1046#define CHECK_SQLENDTRAN(con) (con->functions[24].func!=NULL)
1047#define SQLENDTRAN(con,ht,h,op)\
1048 (con->functions[24].func)(ht,h,op)
1049
1050#define DM_SQLERROR 25
1051#define CHECK_SQLERROR(con) (con->functions[25].func!=NULL)
1052#define SQLERROR(con,env,dbc,stmt,st,nat,msg,mm,pcb)\
1053 (con->functions[25].func)\
1054 (env,dbc,stmt,st,nat,msg,mm,pcb)
1055#define CHECK_SQLERRORW(con) (con->functions[25].funcW!=NULL)
1056#define SQLERRORW(con,env,dbc,stmt,st,nat,msg,mm,pcb)\
1057 (con->functions[25].funcW)\
1058 (env,dbc,stmt,st,nat,msg,mm,pcb)
1059
1060#define DM_SQLEXECDIRECT 26
1061#define CHECK_SQLEXECDIRECT(con) (con->functions[26].func!=NULL)
1062#define SQLEXECDIRECT(con,stmt,sql,len)\
1063 (con->functions[26].func)(stmt,sql,len)
1064#define CHECK_SQLEXECDIRECTW(con) (con->functions[26].funcW!=NULL)
1065#define SQLEXECDIRECTW(con,stmt,sql,len)\
1066 (con->functions[26].funcW)(stmt,sql,len)
1067
1068#define DM_SQLEXECUTE 27
1069#define CHECK_SQLEXECUTE(con) (con->functions[27].func!=NULL)
1070#define SQLEXECUTE(con,stmt)\
1071 (con->functions[27].func)(stmt)
1072
1073#define DM_SQLEXTENDEDFETCH 28
1074#define CHECK_SQLEXTENDEDFETCH(con) (con->functions[28].func!=NULL)
1075#define SQLEXTENDEDFETCH(con,stmt,fo,of,rcp,ssa)\
1076 (con->functions[28].func)\
1077 (stmt,fo,of,rcp,ssa)
1078
1079#define DM_FETCH 29
1080#define CHECK_SQLFETCH(con) (con->functions[29].func!=NULL)
1081#define SQLFETCH(con,stmt)\
1082 (con->functions[29].func)(stmt)
1083
1084#define DM_SQLFETCHSCROLL 30
1085#define CHECK_SQLFETCHSCROLL(con) (con->functions[30].func!=NULL)
1086#define SQLFETCHSCROLL(con,stmt,or,of)\
1087 (con->functions[30].func)\
1088 (stmt,or,of)
1089
1090#define DM_SQLFOREIGNKEYS 31
1091#define CHECK_SQLFOREIGNKEYS(con) (con->functions[31].func!=NULL)
1092#define SQLFOREIGNKEYS(con,stmt,cn,nl1,sn,nl2,tn,nl3,fcn,nl4,fsn,nl5,ftn,nl6)\
1093 (con->functions[31].func)\
1094 (stmt,cn,nl1,sn,nl2,tn,nl3,fcn,nl4,fsn,nl5,ftn,nl6)
1095#define CHECK_SQLFOREIGNKEYSW(con) (con->functions[31].funcW!=NULL)
1096#define SQLFOREIGNKEYSW(con,stmt,cn,nl1,sn,nl2,tn,nl3,fcn,nl4,fsn,nl5,ftn,nl6)\
1097 (con->functions[31].funcW)\
1098 (stmt,cn,nl1,sn,nl2,tn,nl3,fcn,nl4,fsn,nl5,ftn,nl6)
1099
1100#define DM_SQLFREEENV 32
1101#define CHECK_SQLFREEENV(con) (con->functions[32].func!=NULL)
1102#define SQLFREEENV(con,env)\
1103 (con->functions[32].func)(env)
1104
1105#define DM_SQLFREEHANDLE 33
1106#define CHECK_SQLFREEHANDLE(con) (con->functions[33].func!=NULL)
1107#define SQLFREEHANDLE(con,typ,env)\
1108 (con->functions[33].func)(typ,env)
1109
1110#define DM_SQLFREESTMT 34
1111#define CHECK_SQLFREESTMT(con) (con->functions[34].func!=NULL)
1112#define SQLFREESTMT(con,stmt,opt)\
1113 (con->functions[34].func)(stmt,opt)
1114
1115#define DM_SQLFREECONNECT 35
1116#define CHECK_SQLFREECONNECT(con) (con->functions[35].func!=NULL)
1117#define SQLFREECONNECT(con,dbc)\
1118 (con->functions[35].func)(dbc)
1119
1120#define DM_SQLGETCONNECTATTR 36
1121#define CHECK_SQLGETCONNECTATTR(con) (con->functions[36].func!=NULL)
1122#define SQLGETCONNECTATTR(con,dbc,at,vp,bl,slp)\
1123 (con->functions[36].func)\
1124 (dbc,at,vp,bl,slp)
1125#define CHECK_SQLGETCONNECTATTRW(con) (con->functions[36].funcW!=NULL)
1126#define SQLGETCONNECTATTRW(con,dbc,at,vp,bl,slp)\
1127 (con->functions[36].funcW)\
1128 (dbc,at,vp,bl,slp)
1129
1130#define DM_SQLGETCONNECTOPTION 37
1131#define CHECK_SQLGETCONNECTOPTION(con) (con->functions[37].func!=NULL)
1132#define SQLGETCONNECTOPTION(con,dbc,at,val)\
1133 (con->functions[37].func)\
1134 (dbc,at,val)
1135#define CHECK_SQLGETCONNECTOPTIONW(con) (con->functions[37].funcW!=NULL)
1136#define SQLGETCONNECTOPTIONW(con,dbc,at,val)\
1137 (con->functions[37].funcW)\
1138 (dbc,at,val)
1139
1140#define DM_SQLGETCURSORNAME 38
1141#define CHECK_SQLGETCURSORNAME(con) (con->functions[38].func!=NULL)
1142#define SQLGETCURSORNAME(con,stmt,cn,bl,nlp)\
1143 (con->functions[38].func)\
1144 (stmt,cn,bl,nlp)
1145#define CHECK_SQLGETCURSORNAMEW(con) (con->functions[38].funcW!=NULL)
1146#define SQLGETCURSORNAMEW(con,stmt,cn,bl,nlp)\
1147 (con->functions[38].funcW)\
1148 (stmt,cn,bl,nlp)
1149
1150#define DM_SQLGETDATA 39
1151#define CHECK_SQLGETDATA(con) (con->functions[39].func!=NULL)
1152#define SQLGETDATA(con,stmt,cn,tt,tvp,bl,sli)\
1153 (con->functions[39].func)\
1154 (stmt,cn,tt,tvp,bl,sli)
1155
1156#define DM_SQLGETDESCFIELD 40
1157#define CHECK_SQLGETDESCFIELD(con) (con->functions[40].func!=NULL)
1158#define SQLGETDESCFIELD(con,des,rn,fi,vp,bl,slp)\
1159 (con->functions[40].func)\
1160 (des,rn,fi,vp,bl,slp)
1161#define CHECK_SQLGETDESCFIELDW(con) (con->functions[40].funcW!=NULL)
1162#define SQLGETDESCFIELDW(con,des,rn,fi,vp,bl,slp)\
1163 (con->functions[40].funcW)\
1164 (des,rn,fi,vp,bl,slp)
1165
1166#define DM_SQLGETDESCREC 41
1167#define CHECK_SQLGETDESCREC(con) (con->functions[41].func!=NULL)
1168#define SQLGETDESCREC(con,des,rn,n,bl,slp,tp,stp,lp,pp,sp,np)\
1169 (con->functions[41].func)\
1170 (des,rn,n,bl,slp,tp,stp,lp,pp,sp,np)
1171#define CHECK_SQLGETDESCRECW(con) (con->functions[41].funcW!=NULL)
1172#define SQLGETDESCRECW(con,des,rn,n,bl,slp,tp,stp,lp,pp,sp,np)\
1173 (con->functions[41].funcW)\
1174 (des,rn,n,bl,slp,tp,stp,lp,pp,sp,np)
1175
1176#define DM_SQLGETDIAGFIELD 42
1177#define CHECK_SQLGETDIAGFIELD(con) (con->functions[42].func!=NULL)
1178#define SQLGETDIAGFIELD(con,typ,han,rn,di,dip,bl,slp)\
1179 (con->functions[42].func)\
1180 (typ,han,rn,di,dip,bl,slp)
1181#define CHECK_SQLGETDIAGFIELDW(con) (con->functions[42].funcW!=NULL)
1182#define SQLGETDIAGFIELDW(con,typ,han,rn,di,dip,bl,slp)\
1183 (con->functions[42].funcW)\
1184 (typ,han,rn,di,dip,bl,slp)
1185
1186#define DM_SQLGETENVATTR 43
1187#define CHECK_SQLGETENVATTR(con) (con->functions[43].func!=NULL)
1188#define SQLGETENVATTR(con,env,attr,val,len,ol)\
1189 (con->functions[43].func)\
1190 (env,attr,val,len,ol)
1191
1192#define DM_SQLGETFUNCTIONS 44
1193#define CHECK_SQLGETFUNCTIONS(con) (con->functions[44].func!=NULL)
1194#define SQLGETFUNCTIONS(con,dbc,id,ptr)\
1195 (con->functions[44].func)\
1196 (dbc,id,ptr)
1197
1198#define DM_SQLGETINFO 45
1199#define CHECK_SQLGETINFO(con) (con->functions[45].func!=NULL)
1200#define SQLGETINFO(con,dbc,it,ivo,bl,slp)\
1201 (con->functions[45].func)\
1202 (dbc,it,ivo,bl,slp)
1203#define CHECK_SQLGETINFOW(con) (con->functions[45].funcW!=NULL)
1204#define SQLGETINFOW(con,dbc,it,ivo,bl,slp)\
1205 (con->functions[45].funcW)\
1206 (dbc,it,ivo,bl,slp)
1207
1208#define DM_SQLGETSTMTATTR 46
1209#define CHECK_SQLGETSTMTATTR(con) (con->functions[46].func!=NULL)
1210#define SQLGETSTMTATTR(con,stmt,at,vp,bl,slp)\
1211 (con->functions[46].func)\
1212 (stmt,at,vp,bl,slp)
1213#define CHECK_SQLGETSTMTATTRW(con) (con->functions[46].funcW!=NULL)
1214#define SQLGETSTMTATTRW(con,stmt,at,vp,bl,slp)\
1215 (con->functions[46].funcW)\
1216 (stmt,at,vp,bl,slp)
1217#define DM_SQLGETSTMTOPTION 47
1218#define CHECK_SQLGETSTMTOPTION(con) (con->functions[47].func!=NULL)
1219#define SQLGETSTMTOPTION(con,stmt,op,val)\
1220 (con->functions[47].func)\
1221 (stmt,op,val)
1222#define CHECK_SQLGETSTMTOPTIONW(con) (con->functions[47].funcW!=NULL)
1223#define SQLGETSTMTOPTIONW(con,stmt,op,val)\
1224 (con->functions[47].funcW)\
1225 (stmt,op,val)
1226
1227#define DM_SQLGETTYPEINFO 48
1228#define CHECK_SQLGETTYPEINFO(con) (con->functions[48].func!=NULL)
1229#define SQLGETTYPEINFO(con,stmt,typ)\
1230 (con->functions[48].func)(stmt,typ)
1231#define CHECK_SQLGETTYPEINFOW(con) (con->functions[48].funcW!=NULL)
1232#define SQLGETTYPEINFOW(con,stmt,typ)\
1233 (con->functions[48].funcW)(stmt,typ)
1234
1235#define DM_SQLMORERESULTS 49
1236#define CHECK_SQLMORERESULTS(con) (con->functions[49].func!=NULL)
1237#define SQLMORERESULTS(con,stmt)\
1238 (con->functions[49].func)(stmt)
1239
1240#define DM_SQLNATIVESQL 50
1241#define CHECK_SQLNATIVESQL(con) (con->functions[50].func!=NULL)
1242#define SQLNATIVESQL(con,dbc,ist,tl,ost,bl,tlp)\
1243 (con->functions[50].func)\
1244 (dbc,ist,tl,ost,bl,tlp)
1245#define CHECK_SQLNATIVESQLW(con) (con->functions[50].funcW!=NULL)
1246#define SQLNATIVESQLW(con,dbc,ist,tl,ost,bl,tlp)\
1247 (con->functions[50].funcW)\
1248 (dbc,ist,tl,ost,bl,tlp)
1249
1250#define DM_SQLNUMPARAMS 51
1251#define CHECK_SQLNUMPARAMS(con) (con->functions[51].func!=NULL)
1252#define SQLNUMPARAMS(con,stmt,cnt)\
1253 (con->functions[51].func)(stmt,cnt)
1254
1255#define DM_SQLNUMRESULTCOLS 52
1256#define CHECK_SQLNUMRESULTCOLS(con) (con->functions[52].func!=NULL)
1257#define SQLNUMRESULTCOLS(con,stmt,cnt)\
1258 (con->functions[52].func)(stmt,cnt)
1259
1260#define DM_SQLPARAMDATA 53
1261#define CHECK_SQLPARAMDATA(con) (con->functions[53].func!=NULL)
1262#define SQLPARAMDATA(con,stmt,val)\
1263 (con->functions[53].func)(stmt,val)
1264
1265#define DM_SQLPARAMOPTIONS 54
1266#define CHECK_SQLPARAMOPTIONS(con) (con->functions[54].func!=NULL)
1267#define SQLPARAMOPTIONS(con,stmt,cr,pi)\
1268 (con->functions[54].func)(stmt,cr,pi)
1269
1270#define DM_SQLPREPARE 55
1271#define CHECK_SQLPREPARE(con) (con->functions[55].func!=NULL)
1272#define SQLPREPARE(con,stmt,sql,len)\
1273 (con->functions[55].func)(stmt,sql,len)
1274#define CHECK_SQLPREPAREW(con) (con->functions[55].funcW!=NULL)
1275#define SQLPREPAREW(con,stmt,sql,len)\
1276 (con->functions[55].funcW)(stmt,sql,len)
1277
1278#define DM_SQLPRIMARYKEYS 56
1279#define CHECK_SQLPRIMARYKEYS(con) (con->functions[56].func!=NULL)
1280#define SQLPRIMARYKEYS(con,stmt,cn,nl1,sn,nl2,tn,nl3)\
1281 (con->functions[56].func)\
1282 (stmt,cn,nl1,sn,nl2,tn,nl3)
1283#define CHECK_SQLPRIMARYKEYSW(con) (con->functions[56].funcW!=NULL)
1284#define SQLPRIMARYKEYSW(con,stmt,cn,nl1,sn,nl2,tn,nl3)\
1285 (con->functions[56].funcW)\
1286 (stmt,cn,nl1,sn,nl2,tn,nl3)
1287
1288#define DM_SQLPROCEDURECOLUMNS 57
1289#define CHECK_SQLPROCEDURECOLUMNS(con) (con->functions[57].func!=NULL)
1290#define SQLPROCEDURECOLUMNS(con,stmt,cn,nl1,sn,nl2,tn,nl3,col,nl4)\
1291 (con->functions[57].func)\
1292 (stmt,cn,nl1,sn,nl2,tn,nl3,col,nl4)
1293#define CHECK_SQLPROCEDURECOLUMNSW(con) (con->functions[57].funcW!=NULL)
1294#define SQLPROCEDURECOLUMNSW(con,stmt,cn,nl1,sn,nl2,tn,nl3,col,nl4)\
1295 (con->functions[57].funcW)\
1296 (stmt,cn,nl1,sn,nl2,tn,nl3,col,nl4)
1297
1298#define DM_SQLPROCEDURES 58
1299#define CHECK_SQLPROCEDURES(con) (con->functions[58].func!=NULL)
1300#define SQLPROCEDURES(con,stmt,cn,nl1,sn,nl2,tn,nl3)\
1301 (con->functions[58].func)\
1302 (stmt,cn,nl1,sn,nl2,tn,nl3)
1303#define CHECK_SQLPROCEDURESW(con) (con->functions[58].funcW!=NULL)
1304#define SQLPROCEDURESW(con,stmt,cn,nl1,sn,nl2,tn,nl3)\
1305 (con->functions[58].funcW)\
1306 (stmt,cn,nl1,sn,nl2,tn,nl3)
1307
1308#define DM_SQLPUTDATA 59
1309#define CHECK_SQLPUTDATA(con) (con->functions[59].func!=NULL)
1310#define SQLPUTDATA(con,stmt,d,p)\
1311 (con->functions[59].func)(stmt,d,p)
1312
1313#define DM_SQLROWCOUNT 60
1314#define CHECK_SQLROWCOUNT(con) (con->functions[60].func!=NULL)
1315#define DEF_SQLROWCOUNT(con,stmt,cnt)\
1316 (con->functions[60].func)(stmt,cnt)
1317
1318#define DM_SQLSETCONNECTATTR 61
1319#define CHECK_SQLSETCONNECTATTR(con) (con->functions[61].func!=NULL)
1320#define SQLSETCONNECTATTR(con,dbc,at,vp,sl)\
1321 (con->functions[61].func)\
1322 (dbc,at,vp,sl)
1323#define CHECK_SQLSETCONNECTATTRW(con) (con->functions[61].funcW!=NULL)
1324#define SQLSETCONNECTATTRW(con,dbc,at,vp,sl)\
1325 (con->functions[61].funcW)\
1326 (dbc,at,vp,sl)
1327
1328#define DM_SQLSETCONNECTOPTION 62
1329#define CHECK_SQLSETCONNECTOPTION(con) (con->functions[62].func!=NULL)
1330#define SQLSETCONNECTOPTION(con,dbc,op,p)\
1331 (con->functions[62].func)\
1332 (dbc,op,p)
1333#define CHECK_SQLSETCONNECTOPTIONW(con) (con->functions[62].funcW!=NULL)
1334#define SQLSETCONNECTOPTIONW(con,dbc,op,p)\
1335 (con->functions[62].funcW)\
1336 (dbc,op,p)
1337
1338#define DM_SQLSETCURSORNAME 63
1339#define CHECK_SQLSETCURSORNAME(con) (con->functions[63].func!=NULL)
1340#define SQLSETCURSORNAME(con,stmt,nam,len)\
1341 (con->functions[63].func)(stmt,nam,len)
1342#define CHECK_SQLSETCURSORNAMEW(con) (con->functions[63].funcW!=NULL)
1343#define SQLSETCURSORNAMEW(con,stmt,nam,len)\
1344 (con->functions[63].funcW)(stmt,nam,len)
1345
1346#define DM_SQLSETDESCFIELD 64
1347#define CHECK_SQLSETDESCFIELD(con) (con->functions[64].func!=NULL)
1348#define SQLSETDESCFIELD(con,des,rn,fi,vp,bl)\
1349 (con->functions[64].func)\
1350 (des,rn,fi,vp,bl)
1351#define CHECK_SQLSETDESCFIELDW(con) (con->functions[64].funcW!=NULL)
1352#define SQLSETDESCFIELDW(con,des,rn,fi,vp,bl)\
1353 (con->functions[64].funcW)\
1354 (des,rn,fi,vp,bl)
1355
1356#define DM_SQLSETDESCREC 65
1357#define CHECK_SQLSETDESCREC(con) (con->functions[65].func!=NULL)
1358#define SQLSETDESCREC(con,des,rn,t,st,l,p,sc,dp,slp,ip)\
1359 (con->functions[65].func)\
1360 (des,rn,t,st,l,p,sc,dp,slp,ip)
1361
1362#define DM_SQLSETENVATTR 66
1363#define CHECK_SQLSETENVATTR(con) (con->functions[66].func!=NULL)
1364#define SQLSETENVATTR(con,env,attr,val,len)\
1365 (con->functions[66].func)(env,attr,val,len)
1366
1367#define DM_SQLSETPARAM 67
1368#define CHECK_SQLSETPARAM(con) (con->functions[67].func!=NULL)
1369#define SQLSETPARAM(con,stmt,pn,vt,pt,lp,ps,pv,sli)\
1370 (con->functions[67].func)\
1371 (stmt,pn,vt,pt,lp,ps,pv,sli)
1372
1373#define DM_SQLSETPOS 68
1374#define CHECK_SQLSETPOS(con) (con->functions[68].func!=NULL)
1375#define SQLSETPOS(con,stmt,rn,op,lt)\
1376 (con->functions[68].func)\
1377 (stmt,rn,op,lt)
1378
1379#define DM_SQLSETSCROLLOPTIONS 69
1380#define CHECK_SQLSETSCROLLOPTIONS(con) (con->functions[69].func!=NULL)
1381#define SQLSETSCROLLOPTIONS(con,stmt,fc,cr,rs)\
1382 (con->functions[69].func)\
1383 (stmt,fc,cr,rs)
1384#define DM_SQLSETSTMTATTR 70
1385#define CHECK_SQLSETSTMTATTR(con) (con->functions[70].func!=NULL)
1386#define SQLSETSTMTATTR(con,stmt,attr,vp,sl)\
1387 (con->functions[70].func)\
1388 (stmt,attr,vp,sl)
1389#define CHECK_SQLSETSTMTATTRW(con) (con->functions[70].funcW!=NULL)
1390#define SQLSETSTMTATTRW(con,stmt,attr,vp,sl)\
1391 (con->functions[70].funcW)\
1392 (stmt,attr,vp,sl)
1393
1394#define DM_SQLSETSTMTOPTION 71
1395#define CHECK_SQLSETSTMTOPTION(con) (con->functions[71].func!=NULL)
1396#define SQLSETSTMTOPTION(con,stmt,op,val)\
1397 (con->functions[71].func)\
1398 (stmt,op,val)
1399
1400#define CHECK_SQLSETSTMTOPTIONW(con) (con->functions[71].funcW!=NULL)
1401#define SQLSETSTMTOPTIONW(con,stmt,op,val)\
1402 (con->functions[71].funcW)\
1403 (stmt,op,val)
1404
1405#define DM_SQLSPECIALCOLUMNS 72
1406#define CHECK_SQLSPECIALCOLUMNS(con) (con->functions[72].func!=NULL)
1407#define SQLSPECIALCOLUMNS(con,stmt,it,cn,nl1,sn,nl2,tn,nl3,s,n)\
1408 (con->functions[72].func)\
1409 (stmt,it,cn,nl1,sn,nl2,tn,nl3,s,n)
1410#define CHECK_SQLSPECIALCOLUMNSW(con) (con->functions[72].funcW!=NULL)
1411#define SQLSPECIALCOLUMNSW(con,stmt,it,cn,nl1,sn,nl2,tn,nl3,s,n)\
1412 (con->functions[72].funcW)\
1413 (stmt,it,cn,nl1,sn,nl2,tn,nl3,s,n)
1414
1415#define DM_SQLSTATISTICS 73
1416#define CHECK_SQLSTATISTICS(con) (con->functions[73].func!=NULL)
1417#define SQLSTATISTICS(con,stmt,cn,nl1,sn,nl2,tn,nl3,un,res)\
1418 (con->functions[73].func)\
1419 (stmt,cn,nl1,sn,nl2,tn,nl3,un,res)
1420#define CHECK_SQLSTATISTICSW(con) (con->functions[73].funcW!=NULL)
1421#define SQLSTATISTICSW(con,stmt,cn,nl1,sn,nl2,tn,nl3,un,res)\
1422 (con->functions[73].funcW)\
1423 (stmt,cn,nl1,sn,nl2,tn,nl3,un,res)
1424
1425#define DM_SQLTABLEPRIVILEGES 74
1426#define CHECK_SQLTABLEPRIVILEGES(con) (con->functions[74].func!=NULL)
1427#define SQLTABLEPRIVILEGES(con,stmt,cn,nl1,sn,nl2,tn,nl3)\
1428 (con->functions[74].func)\
1429 (stmt,cn,nl1,sn,nl2,tn,nl3)
1430#define CHECK_SQLTABLEPRIVILEGESW(con) (con->functions[74].funcW!=NULL)
1431#define SQLTABLEPRIVILEGESW(con,stmt,cn,nl1,sn,nl2,tn,nl3)\
1432 (con->functions[74].funcW)\
1433 (stmt,cn,nl1,sn,nl2,tn,nl3)
1434
1435#define DM_SQLTABLES 75
1436#define CHECK_SQLTABLES(con) (con->functions[75].func!=NULL)
1437#define SQLTABLES(con,stmt,cn,nl1,sn,nl2,tn,nl3,tt,nl4)\
1438 (con->functions[75].func)\
1439 (stmt,cn,nl1,sn,nl2,tn,nl3,tt,nl4)
1440#define CHECK_SQLTABLESW(con) (con->functions[75].funcW!=NULL)
1441#define SQLTABLESW(con,stmt,cn,nl1,sn,nl2,tn,nl3,tt,nl4)\
1442 (con->functions[75].funcW)\
1443 (stmt,cn,nl1,sn,nl2,tn,nl3,tt,nl4)
1444
1445#define DM_SQLTRANSACT 76
1446#define CHECK_SQLTRANSACT(con) (con->functions[76].func!=NULL)
1447#define SQLTRANSACT(con,eh,ch,op)\
1448 (con->functions[76].func)(eh,ch,op)
1449
1450
1451#define DM_SQLGETDIAGREC 77
1452#define CHECK_SQLGETDIAGREC(con) (con->functions[77].func!=NULL)
1453#define SQLGETDIAGREC(con,typ,han,rn,st,nat,msg,bl,tlp)\
1454 (con->functions[77].func)\
1455 (typ,han,rn,st,nat,msg,bl,tlp)
1456#define CHECK_SQLGETDIAGRECW(con) (con->functions[77].funcW!=NULL)
1457#define SQLGETDIAGRECW(con,typ,han,rn,st,nat,msg,bl,tlp)\
1458 (con->functions[77].funcW)\
1459 (typ,han,rn,st,nat,msg,bl,tlp)
1460
1461#define DM_SQLCANCELHANDLE 78
1462#define CHECK_SQLCANCELHANDLE(con) (con->functions[78].func!=NULL)
1463#define SQLCANCELHANDLE(con,typ,han)\
1464 (con->functions[78].func)\
1465 (typ,han)
1466
1467#endif
1468