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