00001 #ifndef _SQLITE3ODBC_H 00002 #define _SQLITE3ODBC_H 00003 00027 #ifdef _WIN32 00028 #include <windows.h> 00029 #include <stdio.h> 00030 #else 00031 #include <sys/time.h> 00032 #include <sys/types.h> 00033 #include <stdio.h> 00034 #include <stdlib.h> 00035 #include <unistd.h> 00036 #endif 00037 #if defined(HAVE_LOCALECONV) || defined(_WIN32) 00038 #include <locale.h> 00039 #endif 00040 #include <stdarg.h> 00041 #include <string.h> 00042 #include <sql.h> 00043 #include <sqlext.h> 00044 #include <time.h> 00045 00046 #include "sqlite3.h" 00047 #ifdef HAVE_IODBC 00048 #include <iodbcinst.h> 00049 #endif 00050 #if defined(HAVE_UNIXODBC) || defined(_WIN32) 00051 #include <odbcinst.h> 00052 #endif 00053 00054 #ifndef SQL_API 00055 #define SQL_API 00056 #endif 00057 00058 #ifndef HAVE_SQLLEN 00059 #define SQLLEN SQLINTEGER 00060 #endif 00061 00062 #define SQLLEN_PTR SQLLEN * 00063 00064 #ifndef HAVE_SQLULEN 00065 #define SQLULEN SQLUINTEGER 00066 #endif 00067 00068 #ifndef HAVE_SQLROWCOUNT 00069 #define SQLROWCOUNT SQLUINTEGER 00070 #endif 00071 00072 struct dbc; 00073 struct stmt; 00074 00081 typedef struct { 00082 int magic; 00083 int ov3; 00084 struct dbc *dbcs; 00085 } ENV; 00086 00093 typedef struct dbc { 00094 int magic; 00095 ENV *env; 00096 struct dbc *next; 00097 sqlite3 *sqlite; 00098 int version; 00099 char *dbname; 00100 char *dsn; 00101 int timeout; 00102 long t0; 00103 int *ov3; 00104 int ov3val; 00105 int autocommit; 00106 int intrans; 00107 struct stmt *stmt; 00108 int naterr; 00109 char sqlstate[6]; 00110 SQLCHAR logmsg[1024]; 00111 int longnames; 00112 int curtype; 00113 int step_enable; 00114 int trans_disable; 00115 struct stmt *cur_s3stmt; 00116 int s3stmt_rownum; 00117 FILE *trace; 00118 #ifdef USE_DLOPEN_FOR_GPPS 00119 void *instlib; 00120 int (*gpps)(); 00121 #endif 00122 } DBC; 00123 00130 typedef struct { 00131 char *db; 00132 char *table; 00133 char *column; 00134 int type; 00135 int size; 00136 int index; 00137 int nosign; 00138 int scale; 00139 int prec; 00140 int autoinc; 00141 char *typename; 00142 char *label; 00143 } COL; 00144 00151 typedef struct { 00152 SQLSMALLINT type; 00153 SQLINTEGER max; 00154 SQLLEN *lenp; 00155 SQLPOINTER valp; 00156 int index; 00157 int offs; 00158 } BINDCOL; 00159 00166 typedef struct { 00167 int type, stype; 00168 int max, *lenp; 00169 void *param; 00170 void *param0; 00171 int inc; 00172 int need; 00173 int offs, len; 00174 void *parbuf; 00175 char strbuf[64]; 00176 } BINDPARM; 00177 00184 typedef struct stmt { 00185 struct stmt *next; 00186 HDBC dbc; 00187 SQLCHAR cursorname[32]; 00188 SQLCHAR *query; 00189 int *ov3; 00190 int isselect; 00191 int ncols; 00192 COL *cols; 00193 COL *dyncols; 00194 int dcols; 00195 int bkmrk; 00196 BINDCOL bkmrkcol; 00197 BINDCOL *bindcols; 00198 int nbindcols; 00199 int nbindparms; 00200 BINDPARM *bindparms; 00201 int nparams; 00202 int nrows; 00203 int rowp; 00204 char **rows; 00205 void (*rowfree)(); 00206 int naterr; 00207 char sqlstate[6]; 00208 SQLCHAR logmsg[1024]; 00209 int longnames; 00210 int retr_data; 00211 SQLUINTEGER rowset_size; 00212 SQLUSMALLINT *row_status; 00213 SQLUSMALLINT *row_status0; 00214 SQLUSMALLINT row_status1; 00215 SQLUINTEGER *row_count; 00216 SQLUINTEGER row_count0; 00217 SQLUINTEGER paramset_size; 00218 SQLUINTEGER paramset_count; 00219 SQLUINTEGER paramset_nrows; 00220 SQLUINTEGER bind_type; 00221 SQLUINTEGER *bind_offs; 00222 /* Dummies to make ADO happy */ 00223 SQLUINTEGER *parm_bind_offs; 00224 SQLUSMALLINT *parm_oper; 00225 SQLUSMALLINT *parm_status; 00226 SQLUINTEGER *parm_proc; 00227 int curtype; 00228 sqlite3_stmt *s3stmt; 00229 char *bincell; 00230 char *bincache; 00231 int binlen; 00232 } STMT; 00233 00234 #endif