00001 #ifndef _SQLITEODBC_H
00002 #define _SQLITEODBC_H
00003
00027 #ifdef _WIN32
00028 #include <windows.h>
00029 #else
00030 #include <sys/time.h>
00031 #include <sys/types.h>
00032 #include <stdio.h>
00033 #include <stdlib.h>
00034 #include <unistd.h>
00035 #endif
00036 #if defined(HAVE_LOCALECONV) || defined(_WIN32)
00037 #include <locale.h>
00038 #endif
00039 #include <stdarg.h>
00040 #include <string.h>
00041 #include <sql.h>
00042 #include <sqlext.h>
00043 #include <time.h>
00044
00045 #include "sqlite.h"
00046 #ifdef HAVE_IODBC
00047 #include <iodbcinst.h>
00048 #endif
00049 #if defined(HAVE_UNIXODBC) || defined(_WIN32)
00050 #include <odbcinst.h>
00051 #endif
00052
00053 #ifndef SQL_API
00054 #define SQL_API
00055 #endif
00056
00057 struct dbc;
00058 struct stmt;
00059
00066 typedef struct {
00067 int magic;
00068 int ov3;
00069 struct dbc *dbcs;
00070 } ENV;
00071
00078 typedef struct dbc {
00079 int magic;
00080 ENV *env;
00081 struct dbc *next;
00082 sqlite *sqlite;
00083 int version;
00084 char *dbname;
00085 char *dsn;
00086 int timeout;
00087 long t0;
00088 int *ov3;
00089 int ov3val;
00090 int autocommit;
00091 int intrans;
00092 struct stmt *stmt;
00093 int naterr;
00094 char sqlstate[6];
00095 SQLCHAR logmsg[1024];
00096 int nowchar;
00097 int curtype;
00098 int step_enable;
00099 struct stmt *vm_stmt;
00100 int vm_rownum;
00101 #if defined(HAVE_SQLITETRACE) && HAVE_SQLITETRACE
00102 FILE *trace;
00103 #endif
00104 #ifdef USE_DLOPEN_FOR_GPPS
00105 void *instlib;
00106 int (*gpps)();
00107 #endif
00108 } DBC;
00109
00116 typedef struct {
00117 char *db;
00118 char *table;
00119 char *column;
00120 int type;
00121 int size;
00122 int index;
00123 int nosign;
00124 int scale;
00125 int prec;
00126 int autoinc;
00127 char *typename;
00128 char *label;
00129 } COL;
00130
00137 typedef struct {
00138 SQLSMALLINT type;
00139 SQLINTEGER max;
00140 SQLINTEGER *lenp;
00141 SQLPOINTER valp;
00142 int index;
00143 int offs;
00144 } BINDCOL;
00145
00152 typedef struct {
00153 int type, stype;
00154 int max, *lenp;
00155 void *param;
00156 void *param0;
00157 int inc;
00158 void *ind;
00159 int need;
00160 int offs, len;
00161 } BINDPARM;
00162
00169 typedef struct stmt {
00170 struct stmt *next;
00171 HDBC dbc;
00172 SQLCHAR cursorname[32];
00173 SQLCHAR *query;
00174 char **parmnames;
00175 int *ov3;
00176 int isselect;
00177 int ncols;
00178 COL *cols;
00179 COL *dyncols;
00180 int dcols;
00181 int bkmrk;
00182 BINDCOL bkmrkcol;
00183 BINDCOL *bindcols;
00184 int nbindcols;
00185 int nbindparms;
00186 BINDPARM *bindparms;
00187 int nparams;
00188 int nrows;
00189 int rowp;
00190 char **rows;
00191 void (*rowfree)();
00192 int naterr;
00193 char sqlstate[6];
00194 SQLCHAR logmsg[1024];
00195 int nowchar;
00196 int retr_data;
00197 SQLUINTEGER rowset_size;
00198 SQLUSMALLINT *row_status;
00199 SQLUSMALLINT *row_status0;
00200 SQLUSMALLINT row_status1;
00201 SQLUINTEGER *row_count;
00202 SQLUINTEGER row_count0;
00203 SQLUINTEGER paramset_size;
00204 SQLUINTEGER paramset_count;
00205 SQLUINTEGER paramset_nrows;
00206 SQLUINTEGER bind_type;
00207 SQLUINTEGER *bind_offs;
00208
00209 SQLUINTEGER *parm_bind_offs;
00210 SQLUSMALLINT *parm_oper;
00211 SQLUSMALLINT *parm_status;
00212 SQLUINTEGER *parm_proc;
00213 int curtype;
00214 sqlite_vm *vm;
00215 #if HAVE_ENCDEC
00216 char *bincell;
00217 char *bincache;
00218 int binlen;
00219 char *hexcache;
00220 #endif
00221 } STMT;
00222
00223 #endif