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 int pool; 00100 #if defined(_WIN32) || defined(_WIN64) 00101 CRITICAL_SECTION cs; 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 int jdconv; 00142 int ilike; 00143 struct stmt *cur_s3stmt; 00144 int s3stmt_needmeta; 00145 FILE *trace; 00146 char *pwd; 00147 int pwdLen; 00148 #ifdef USE_DLOPEN_FOR_GPPS 00149 void *instlib; 00150 int (*gpps)(); 00151 #endif 00152 #if defined(_WIN32) || defined(_WIN64) 00153 CRITICAL_SECTION cs; 00154 DWORD owner; 00155 int xcelqrx; 00156 #endif 00157 } DBC; 00158 00165 typedef struct { 00166 char *db; 00167 char *table; 00168 char *column; 00169 int type; 00170 int size; 00171 int index; 00172 int nosign; 00173 int scale; 00174 int prec; 00175 int autoinc; 00176 int notnull; 00177 int ispk; 00178 int isrowid; 00179 char *typename; 00180 char *label; 00181 } COL; 00182 00189 typedef struct { 00190 SQLSMALLINT type; 00191 SQLINTEGER max; 00192 SQLLEN *lenp; 00193 SQLPOINTER valp; 00194 int index; 00195 int offs; 00196 } BINDCOL; 00197 00204 typedef struct { 00205 int type, stype; 00206 int coldef, scale; 00207 SQLLEN max; 00208 SQLLEN *lenp; 00209 SQLLEN *lenp0; 00210 void *param; 00211 void *param0; 00212 int inc; 00213 int need; 00214 int bound; 00215 int offs, len; 00216 void *parbuf; 00217 char strbuf[64]; 00218 int s3type; 00219 int s3size; 00220 void *s3val; 00221 int s3ival; 00222 sqlite_int64 s3lival; 00223 double s3dval; 00224 } BINDPARM; 00225 00232 typedef struct stmt { 00233 struct stmt *next; 00234 HDBC dbc; 00235 SQLCHAR cursorname[32]; 00236 SQLCHAR *query; 00237 int *ov3; 00238 int *oemcp; 00239 int *jdconv; 00240 int *ilike; 00241 int isselect; 00242 int ncols; 00243 COL *cols; 00244 COL *dyncols; 00245 int dcols; 00246 int bkmrk; 00247 SQLINTEGER *bkmrkptr; 00248 BINDCOL bkmrkcol; 00249 BINDCOL *bindcols; 00250 int nbindcols; 00251 int nbindparms; 00252 BINDPARM *bindparms; 00253 int nparams; 00254 int pdcount; 00255 int nrows; 00256 int rowp; 00257 int rowprs; 00258 char **rows; 00259 void (*rowfree)(); 00260 int naterr; 00261 char sqlstate[6]; 00262 SQLCHAR logmsg[1024]; 00263 int nowchar[2]; 00264 int dobigint; 00265 int longnames; 00266 SQLULEN retr_data; 00267 SQLULEN rowset_size; 00268 SQLUSMALLINT *row_status; 00269 SQLUSMALLINT *row_status0; 00270 SQLUSMALLINT row_status1; 00271 SQLULEN *row_count; 00272 SQLULEN row_count0; 00273 SQLULEN paramset_size; 00274 SQLULEN paramset_count; 00275 SQLUINTEGER paramset_nrows; 00276 SQLULEN max_rows; 00277 SQLULEN bind_type; 00278 SQLULEN *bind_offs; 00279 /* Dummies to make ADO happy */ 00280 SQLULEN *parm_bind_offs; 00281 SQLUSMALLINT *parm_oper; 00282 SQLUSMALLINT *parm_status; 00283 SQLULEN *parm_proc; 00284 SQLULEN parm_bind_type; 00285 int curtype; 00286 sqlite3_stmt *s3stmt; 00287 int s3stmt_noreset; 00288 int s3stmt_rownum; 00289 char *bincell; 00290 char *bincache; 00291 int binlen; 00292 int guessed_types; 00293 int one_tbl; 00294 int has_pk; 00295 int has_rowid; 00296 } STMT; 00297 00298 #endif 00299 00300 /* 00301 * Local Variables: 00302 * mode: c 00303 * c-basic-offset: 4 00304 * fill-column: 78 00305 * tab-width: 8 00306 * End: 00307 */