00001 #ifndef _SQLITE3ODBC_H 00002 #define _SQLITE3ODBC_H 00003 00027 #if defined(_WIN32) || defined(_WIN64) 00028 #include <windows.h> 00029 #include <stdio.h> 00030 #include <io.h> 00031 #else 00032 #include <sys/time.h> 00033 #include <sys/types.h> 00034 #include <stdio.h> 00035 #include <unistd.h> 00036 #endif 00037 #include <stdlib.h> 00038 #if defined(HAVE_LOCALECONV) || defined(_WIN32) || defined(_WIN64) 00039 #include <locale.h> 00040 #endif 00041 #include <stdarg.h> 00042 #include <stddef.h> 00043 #include <string.h> 00044 #include <sql.h> 00045 #include <sqlext.h> 00046 #include <time.h> 00047 00048 #include "sqlite3.h" 00049 #ifdef HAVE_IODBC 00050 #include <iodbcinst.h> 00051 #endif 00052 #if defined(HAVE_UNIXODBC) || defined(_WIN32) || defined(_WIN64) 00053 #include <odbcinst.h> 00054 #endif 00055 00056 #ifndef SQL_API 00057 #define SQL_API 00058 #endif 00059 00060 #ifndef HAVE_SQLLEN 00061 #define SQLLEN SQLINTEGER 00062 #endif 00063 00064 #define SQLLEN_PTR SQLLEN * 00065 00066 #ifndef HAVE_SQLULEN 00067 #define SQLULEN SQLUINTEGER 00068 #endif 00069 00070 #ifndef HAVE_SQLROWCOUNT 00071 #define SQLROWCOUNT SQLUINTEGER 00072 #endif 00073 00074 #ifndef HAVE_SQLSETPOSIROW 00075 #define SQLSETPOSIROW SQLUSMALLINT 00076 #endif 00077 00078 #ifndef HAVE_SQLROWOFFSET 00079 #define SQLROWOFFSET SQLLEN 00080 #endif 00081 00082 #ifndef HAVE_SQLROWSETSIZE 00083 #define SQLROWSETSIZE SQLULEN 00084 #endif 00085 00086 struct dbc; 00087 struct stmt; 00088 00095 typedef struct { 00096 int magic; 00097 int ov3; 00098 #if defined(_WIN32) || defined(_WIN64) 00099 CRITICAL_SECTION cs; 00100 DWORD owner; 00101 #endif 00102 struct dbc *dbcs; 00103 } ENV; 00104 00111 typedef struct dbc { 00112 int magic; 00113 ENV *env; 00114 struct dbc *next; 00115 sqlite3 *sqlite; 00116 int version; 00117 char *dbname; 00118 char *dsn; 00119 int timeout; 00120 long t0; 00121 int busyint; 00122 int *ov3; 00123 int ov3val; 00124 int autocommit; 00125 int intrans; 00126 struct stmt *stmt; 00127 int naterr; 00128 char sqlstate[6]; 00129 SQLCHAR logmsg[1024]; 00130 int nowchar; 00131 int shortnames; 00132 int longnames; 00133 int nocreat; 00134 int curtype; 00135 int step_enable; 00136 int trans_disable; 00137 struct stmt *cur_s3stmt; 00138 int s3stmt_needmeta; 00139 FILE *trace; 00140 #ifdef USE_DLOPEN_FOR_GPPS 00141 void *instlib; 00142 int (*gpps)(); 00143 #endif 00144 #if defined(_WIN32) || defined(_WIN64) 00145 int xcelqrx; 00146 #endif 00147 } DBC; 00148 00155 typedef struct { 00156 char *db; 00157 char *table; 00158 char *column; 00159 int type; 00160 int size; 00161 int index; 00162 int nosign; 00163 int scale; 00164 int prec; 00165 int autoinc; 00166 int notnull; 00167 char *typename; 00168 char *label; 00169 } COL; 00170 00177 typedef struct { 00178 SQLSMALLINT type; 00179 SQLINTEGER max; 00180 SQLLEN *lenp; 00181 SQLPOINTER valp; 00182 int index; 00183 int offs; 00184 } BINDCOL; 00185 00192 typedef struct { 00193 int type, stype; 00194 int coldef, scale; 00195 SQLLEN max; 00196 SQLLEN *lenp; 00197 SQLLEN *lenp0; 00198 void *param; 00199 void *param0; 00200 int inc; 00201 int need; 00202 int bound; 00203 int offs, len; 00204 void *parbuf; 00205 char strbuf[64]; 00206 int s3type; 00207 int s3size; 00208 void *s3val; 00209 int s3ival; 00210 sqlite_int64 s3lival; 00211 double s3dval; 00212 } BINDPARM; 00213 00220 typedef struct stmt { 00221 struct stmt *next; 00222 HDBC dbc; 00223 SQLCHAR cursorname[32]; 00224 SQLCHAR *query; 00225 int *ov3; 00226 int isselect; 00227 int ncols; 00228 COL *cols; 00229 COL *dyncols; 00230 int dcols; 00231 int bkmrk; 00232 BINDCOL bkmrkcol; 00233 BINDCOL *bindcols; 00234 int nbindcols; 00235 int nbindparms; 00236 BINDPARM *bindparms; 00237 int nparams; 00238 int nrows; 00239 int rowp; 00240 char **rows; 00241 void (*rowfree)(); 00242 int naterr; 00243 char sqlstate[6]; 00244 SQLCHAR logmsg[1024]; 00245 int nowchar[2]; 00246 int longnames; 00247 int retr_data; 00248 SQLUINTEGER rowset_size; 00249 SQLUSMALLINT *row_status; 00250 SQLUSMALLINT *row_status0; 00251 SQLUSMALLINT row_status1; 00252 SQLUINTEGER *row_count; 00253 SQLUINTEGER row_count0; 00254 SQLUINTEGER paramset_size; 00255 SQLUINTEGER paramset_count; 00256 SQLUINTEGER paramset_nrows; 00257 SQLUINTEGER max_rows; 00258 SQLUINTEGER bind_type; 00259 SQLUINTEGER *bind_offs; 00260 /* Dummies to make ADO happy */ 00261 SQLUINTEGER *parm_bind_offs; 00262 SQLUSMALLINT *parm_oper; 00263 SQLUSMALLINT *parm_status; 00264 SQLUINTEGER *parm_proc; 00265 SQLUINTEGER parm_bind_type; 00266 int curtype; 00267 sqlite3_stmt *s3stmt; 00268 int s3stmt_noreset; 00269 int s3stmt_rownum; 00270 char *bincell; 00271 char *bincache; 00272 int binlen; 00273 int guessed_types; 00274 } STMT; 00275 00276 #endif