sqlite3odbc.h
Go to the documentation of this file.
1 #ifndef _SQLITE3ODBC_H
2 #define _SQLITE3ODBC_H
3 
27 #if defined(_WIN32) || defined(_WIN64)
28 #include <windows.h>
29 #include <stdio.h>
30 #include <io.h>
31 #else
32 #include <sys/time.h>
33 #include <sys/types.h>
34 #include <stdio.h>
35 #include <unistd.h>
36 #include <errno.h>
37 #endif
38 #include <stdlib.h>
39 #if defined(HAVE_LOCALECONV) || defined(_WIN32) || defined(_WIN64)
40 #include <locale.h>
41 #endif
42 #include <stdarg.h>
43 #include <stddef.h>
44 #include <string.h>
45 #include <sql.h>
46 #include <sqlext.h>
47 #include <time.h>
48 
49 #include "sqlite3.h"
50 #ifdef HAVE_IODBC
51 #include <iodbcinst.h>
52 #endif
53 #if defined(HAVE_UNIXODBC) || defined(_WIN32) || defined(_WIN64)
54 #include <odbcinst.h>
55 #endif
56 
57 #ifndef SQL_API
58 #define SQL_API
59 #endif
60 
61 #ifndef HAVE_SQLLEN
62 #define SQLLEN SQLINTEGER
63 #endif
64 
65 #define SQLLEN_PTR SQLLEN *
66 
67 #ifndef HAVE_SQLULEN
68 #define SQLULEN SQLUINTEGER
69 #endif
70 
71 #ifndef HAVE_SQLROWCOUNT
72 #define SQLROWCOUNT SQLUINTEGER
73 #endif
74 
75 #ifndef HAVE_SQLSETPOSIROW
76 #define SQLSETPOSIROW SQLUSMALLINT
77 #endif
78 
79 #ifndef HAVE_SQLROWOFFSET
80 #define SQLROWOFFSET SQLLEN
81 #endif
82 
83 #ifndef HAVE_SQLROWSETSIZE
84 #define SQLROWSETSIZE SQLULEN
85 #endif
86 
87 struct dbc;
88 struct stmt;
89 
96 typedef struct {
97  int magic;
98  int ov3;
99 #if defined(_WIN32) || defined(_WIN64)
100  CRITICAL_SECTION cs;
101 #endif
102  struct dbc *dbcs;
103 } ENV;
104 
111 typedef struct dbc {
112  int magic;
113  ENV *env;
114  struct dbc *next;
115  sqlite3 *sqlite;
116  int version;
117  char *dbname;
118  char *dsn;
119  int timeout;
120  long t0;
121  int busyint;
122  int *ov3;
123  int ov3val;
125  int intrans;
126  struct stmt *stmt;
127  int naterr;
128  char sqlstate[6];
129  SQLCHAR logmsg[1024];
130  int nowchar;
131  int dobigint;
133  int longnames;
134  int nocreat;
135  int fksupport;
136  int curtype;
139  int oemcp;
140  int jdconv;
141  struct stmt *cur_s3stmt;
143  FILE *trace;
144  char *pwd;
145  int pwdLen;
146 #ifdef USE_DLOPEN_FOR_GPPS
147  void *instlib;
148  int (*gpps)();
149 #endif
150 #if defined(_WIN32) || defined(_WIN64)
151  CRITICAL_SECTION cs;
152  DWORD owner;
153  int xcelqrx;
154 #endif
155 } DBC;
156 
163 typedef struct {
164  char *db;
165  char *table;
166  char *column;
167  int type;
168  int size;
169  int index;
170  int nosign;
171  int scale;
172  int prec;
173  int autoinc;
174  int notnull;
175  int ispk;
176  int isrowid;
177  char *typename;
178  char *label;
179 } COL;
180 
187 typedef struct {
188  SQLSMALLINT type;
189  SQLINTEGER max;
191  SQLPOINTER valp;
192  int index;
193  int offs;
194 } BINDCOL;
195 
202 typedef struct {
203  int type, stype;
204  int coldef, scale;
208  void *param;
209  void *param0;
210  int inc;
211  int need;
212  int bound;
213  int offs, len;
214  void *parbuf;
215  char strbuf[64];
216  int s3type;
217  int s3size;
218  void *s3val;
219  int s3ival;
220  sqlite_int64 s3lival;
221  double s3dval;
222 } BINDPARM;
223 
230 typedef struct stmt {
231  struct stmt *next;
232  HDBC dbc;
233  SQLCHAR cursorname[32];
234  SQLCHAR *query;
235  int *ov3;
236  int *oemcp;
237  int *jdconv;
238  int isselect;
239  int ncols;
242  int dcols;
243  int bkmrk;
244  SQLINTEGER *bkmrkptr;
247  int nbindcols;
250  int nparams;
251  int pdcount;
252  int nrows;
253  int rowp;
254  int rowprs;
255  char **rows;
256  void (*rowfree)();
257  int naterr;
258  char sqlstate[6];
259  SQLCHAR logmsg[1024];
260  int nowchar[2];
261  int dobigint;
262  int longnames;
265  SQLUSMALLINT *row_status;
266  SQLUSMALLINT *row_status0;
267  SQLUSMALLINT row_status1;
272  SQLUINTEGER paramset_nrows;
276  /* Dummies to make ADO happy */
278  SQLUSMALLINT *parm_oper;
279  SQLUSMALLINT *parm_status;
282  int curtype;
283  sqlite3_stmt *s3stmt;
286  char *bincell;
287  char *bincache;
288  int binlen;
290  int one_tbl;
291  int has_pk;
292  int has_rowid;
293 } STMT;
294 
295 #endif
296 
297 /*
298  * Local Variables:
299  * mode: c
300  * c-basic-offset: 4
301  * fill-column: 78
302  * tab-width: 8
303  * End:
304  */
sqlite3_stmt * s3stmt
SQLite statement handle or NULL.
Definition: sqlite3odbc.h:283
SQLULEN paramset_size
SQL_ATTR_PARAMSET_SIZE.
Definition: sqlite3odbc.h:270
sqlite_int64 s3lival
SQLite3 64bit integer value.
Definition: sqlite3odbc.h:220
int busyint
Interrupt busy handler from SQLCancel()
Definition: sqlite3odbc.h:121
void * parbuf
Buffer for SQL_LEN_DATA_AT_EXEC etc.
Definition: sqlite3odbc.h:214
Internal dynamic string buffer.
Definition: blobtoxy.c:1212
int longnames
Don't shorten column names.
Definition: sqlite3odbc.h:133
int nocreat
Don't auto create database file.
Definition: sqlite3odbc.h:134
#define SQLLEN
Definition: sqlite3odbc.h:62
#define SQLULEN
Definition: sqlite3odbc.h:68
struct dbc * dbcs
Pointer to first DBC.
Definition: sqlite3odbc.h:102
void * param0
Parameter buffer, initial value.
Definition: sqlite3odbc.h:209
int * ov3
True for SQL_OV_ODBC3.
Definition: sqlite3odbc.h:235
int dobigint
Force SQL_BIGINT for INTEGER columns.
Definition: sqlite3odbc.h:261
SQLCHAR * query
Current query, raw string.
Definition: sqlite3odbc.h:234
sqlite3 * sqlite
SQLITE database handle.
Definition: sqlite3odbc.h:115
int guessed_types
Flag for drvprepare()/drvexecute()
Definition: sqlite3odbc.h:289
SQLCHAR logmsg[1024]
Message for SQLError()
Definition: sqlite3odbc.h:259
char ** rows
2-dim array, result set
Definition: sqlite3odbc.h:255
int step_enable
True for sqlite_compile/step/finalize.
Definition: sqlite3odbc.h:137
int ispk
Flag for primary key (> 0)
Definition: sqlite3odbc.h:175
int intrans
True when transaction started.
Definition: sqlite3odbc.h:125
int shortnames
Always use short column names.
Definition: sqlite3odbc.h:132
SQLULEN * parm_bind_offs
SQL_ATTR_PARAM_BIND_OFFSET_PTR.
Definition: sqlite3odbc.h:277
void * s3val
SQLite3 value buffer.
Definition: sqlite3odbc.h:218
Internal structure for bound column (SQLBindCol).
Definition: sqlite3odbc.h:187
int nrows
Number of result rows.
Definition: sqlite3odbc.h:252
Driver internal structure for database connection (HDBC).
Definition: sqlite3odbc.h:111
SQLULEN row_count0
Row count.
Definition: sqlite3odbc.h:269
int s3ival
SQLite3 integer value.
Definition: sqlite3odbc.h:219
struct stmt * cur_s3stmt
Current STMT executing sqlite statement.
Definition: sqlite3odbc.h:141
int need
True when SQL_LEN_DATA_AT_EXEC.
Definition: sqlite3odbc.h:211
SQLULEN parm_bind_type
SQL_ATTR_PARAM_BIND_TYPE.
Definition: sqlite3odbc.h:281
int * ov3
True for SQL_OV_ODBC3.
Definition: sqlite3odbc.h:122
SQLULEN * row_count
Row count pointer.
Definition: sqlite3odbc.h:268
char sqlstate[6]
SQL state for SQLError()
Definition: sqlite3odbc.h:258
int inc
Increment for paramset size > 1.
Definition: sqlite3odbc.h:210
SQLLEN max
Max.
Definition: sqlite3odbc.h:205
char * column
Column name.
Definition: sqlite3odbc.h:166
int version
SQLITE version number.
Definition: sqlite3odbc.h:116
char * dsn
ODBC data source name.
Definition: sqlite3odbc.h:118
HDBC dbc
Pointer to DBC.
Definition: sqlite3odbc.h:232
int curtype
Default cursor type.
Definition: sqlite3odbc.h:136
Driver internal structure representing SQL statement (HSTMT).
Definition: sqlite3odbc.h:230
SQLUINTEGER paramset_nrows
Row count for paramset handling.
Definition: sqlite3odbc.h:272
int autocommit
Auto commit state.
Definition: sqlite3odbc.h:124
SQLCHAR logmsg[1024]
Message for SQLError()
Definition: sqlite3odbc.h:129
int isrowid
Flag for ROWID column (> 0)
Definition: sqlite3odbc.h:176
struct stmt STMT
int prec
Precision of column.
Definition: sqlite3odbc.h:172
int magic
Magic cookie.
Definition: sqlite3odbc.h:97
ENV * env
Pointer to environment.
Definition: sqlite3odbc.h:113
BINDPARM * bindparms
Array of bound parameters.
Definition: sqlite3odbc.h:249
COL * cols
Result column array.
Definition: sqlite3odbc.h:240
SQLULEN bind_type
SQL_ATTR_ROW_BIND_TYPE.
Definition: sqlite3odbc.h:274
SQLPOINTER valp
Value buffer.
Definition: sqlite3odbc.h:191
int ov3
True for SQL_OV_ODBC3.
Definition: sqlite3odbc.h:98
SQLUSMALLINT * parm_oper
SQL_ATTR_PARAM_OPERATION_PTR.
Definition: sqlite3odbc.h:278
char * dbname
SQLITE database name.
Definition: sqlite3odbc.h:117
int fksupport
Foreign keys on or off.
Definition: sqlite3odbc.h:135
int s3stmt_needmeta
True to get meta data in s3stmt_step().
Definition: sqlite3odbc.h:142
int rowprs
Current start row of rowset.
Definition: sqlite3odbc.h:254
char * table
Table name.
Definition: sqlite3odbc.h:165
int s3stmt_rownum
Current row number.
Definition: sqlite3odbc.h:285
int * jdconv
True for julian day conversion.
Definition: sqlite3odbc.h:237
SQLUSMALLINT row_status1
Internal status array for 1 row rowsets.
Definition: sqlite3odbc.h:267
SQLLEN * lenp
Value return, actual size of value buffer.
Definition: sqlite3odbc.h:190
SQLULEN retr_data
SQL_ATTR_RETRIEVE_DATA.
Definition: sqlite3odbc.h:263
int longnames
Don't shorten column names.
Definition: sqlite3odbc.h:262
int index
Index of column in result.
Definition: sqlite3odbc.h:192
int nosign
Unsigned type.
Definition: sqlite3odbc.h:170
SQLSMALLINT type
ODBC type.
Definition: sqlite3odbc.h:188
struct dbc * next
Pointer to next DBC.
Definition: sqlite3odbc.h:114
int nowchar
Don't try to use WCHAR.
Definition: sqlite3odbc.h:130
double s3dval
SQLite3 float value.
Definition: sqlite3odbc.h:221
struct dbc DBC
int pwdLen
Length of password.
Definition: sqlite3odbc.h:145
int ncols
Number of result columns.
Definition: sqlite3odbc.h:239
SQLUSMALLINT * row_status
Row status pointer.
Definition: sqlite3odbc.h:265
SQLCHAR cursorname[32]
Cursor name.
Definition: sqlite3odbc.h:233
struct stmt * next
Linkage for STMT list in DBC.
Definition: sqlite3odbc.h:231
char * bincache
Cache for blob data.
Definition: sqlite3odbc.h:287
SQLINTEGER * bkmrkptr
SQL_ATTR_FETCH_BOOKMARK_PTR.
Definition: sqlite3odbc.h:244
int notnull
NOT NULL constraint on column.
Definition: sqlite3odbc.h:174
int timeout
Lock timeout value.
Definition: sqlite3odbc.h:119
SQLULEN max_rows
SQL_ATTR_MAX_ROWS.
Definition: sqlite3odbc.h:273
char * label
Column label or NULL.
Definition: sqlite3odbc.h:178
int type
Data type of column.
Definition: sqlite3odbc.h:167
int nowchar[2]
Don't try to use WCHAR.
Definition: sqlite3odbc.h:260
int s3size
SQLite3 size.
Definition: sqlite3odbc.h:217
int binlen
Length of blob data.
Definition: sqlite3odbc.h:288
SQLLEN * lenp0
Actual size of parameter buffer, initial value.
Definition: sqlite3odbc.h:207
int * oemcp
True for Win32 OEM CP translation.
Definition: sqlite3odbc.h:236
SQLUSMALLINT * row_status0
Internal status array.
Definition: sqlite3odbc.h:266
SQLINTEGER max
Max.
Definition: sqlite3odbc.h:189
int nbindcols
Number of entries in bindcols.
Definition: sqlite3odbc.h:247
int isselect
0 if query is a SELECT statement
Definition: sqlite3odbc.h:238
SQLLEN * lenp
Actual size of parameter buffer.
Definition: sqlite3odbc.h:206
char * pwd
Password or NULL.
Definition: sqlite3odbc.h:144
Driver internal structure for environment (HENV).
Definition: sqlite3odbc.h:96
FILE * trace
sqlite3_trace() file pointer or NULL
Definition: sqlite3odbc.h:143
int autoinc
AUTO_INCREMENT column.
Definition: sqlite3odbc.h:173
char * db
Database name.
Definition: sqlite3odbc.h:164
long t0
Start time for SQLITE busy handler.
Definition: sqlite3odbc.h:120
int naterr
Native error code.
Definition: sqlite3odbc.h:127
char sqlstate[6]
SQL state for SQLError()
Definition: sqlite3odbc.h:128
int bound
True when SQLBindParameter() called.
Definition: sqlite3odbc.h:212
void(* rowfree)()
Free function for rows.
Definition: sqlite3odbc.h:256
void * param
Parameter buffer.
Definition: sqlite3odbc.h:208
int one_tbl
Flag for single table (> 0)
Definition: sqlite3odbc.h:290
int curtype
Cursor type.
Definition: sqlite3odbc.h:282
int scale
from SQLBindParameter()
Definition: sqlite3odbc.h:204
COL * dyncols
Column array, but malloc()ed.
Definition: sqlite3odbc.h:241
int dobigint
Force SQL_BIGINT for INTEGER columns.
Definition: sqlite3odbc.h:131
int index
Index of column in result.
Definition: sqlite3odbc.h:169
int bkmrk
True when bookmarks used.
Definition: sqlite3odbc.h:243
SQLULEN * parm_proc
SQL_ATTR_PARAMS_PROCESSED_PTR.
Definition: sqlite3odbc.h:280
SQLULEN * bind_offs
SQL_ATTR_ROW_BIND_OFFSET_PTR.
Definition: sqlite3odbc.h:275
int magic
Magic cookie.
Definition: sqlite3odbc.h:112
int size
Size of column.
Definition: sqlite3odbc.h:168
BINDCOL * bindcols
Array of bound columns.
Definition: sqlite3odbc.h:246
int rowp
Current result row.
Definition: sqlite3odbc.h:253
int scale
Scale of column.
Definition: sqlite3odbc.h:171
int ov3val
True for SQL_OV_ODBC3.
Definition: sqlite3odbc.h:123
SQLUSMALLINT * parm_status
SQL_ATTR_PARAMS_STATUS_PTR.
Definition: sqlite3odbc.h:279
int jdconv
True for julian day conversion.
Definition: sqlite3odbc.h:140
int has_rowid
Flag for ROWID (>= 0 or -1)
Definition: sqlite3odbc.h:292
BINDCOL bkmrkcol
Bookmark bound column.
Definition: sqlite3odbc.h:245
SQLULEN rowset_size
Size of rowset.
Definition: sqlite3odbc.h:264
int oemcp
True for Win32 OEM CP translation.
Definition: sqlite3odbc.h:139
char * bincell
Cache for blob data.
Definition: sqlite3odbc.h:286
int nparams
Number of parameters in query.
Definition: sqlite3odbc.h:250
Internal structure for bound parameter (SQLBindParameter).
Definition: sqlite3odbc.h:202
int nbindparms
Number bound parameters.
Definition: sqlite3odbc.h:248
Internal structure to describe a column in a result set.
Definition: sqlite3odbc.h:163
int has_pk
Flag for primary key (> 0)
Definition: sqlite3odbc.h:291
int offs
Byte offset for SQLGetData()
Definition: sqlite3odbc.h:193
SQLULEN paramset_count
Internal for paramset.
Definition: sqlite3odbc.h:271
int pdcount
SQLParamData() counter.
Definition: sqlite3odbc.h:251
struct stmt * stmt
STMT list of this DBC.
Definition: sqlite3odbc.h:126
int s3stmt_noreset
False when sqlite3_reset() needed.
Definition: sqlite3odbc.h:284
int trans_disable
True for no transaction support.
Definition: sqlite3odbc.h:138
int dcols
Number of entries in dyncols.
Definition: sqlite3odbc.h:242
int s3type
SQLite3 type.
Definition: sqlite3odbc.h:216
int naterr
Native error code.
Definition: sqlite3odbc.h:257

Generated on Sun Oct 25 2015 by doxygen.
Contact: chw@ch-werner.de