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