Main Page | Alphabetical List | Data Structures | File List | Data Fields | Globals

sqliteodbc.c File Reference


Detailed Description

SQLite ODBC Driver main module.

Id
sqliteodbc.c,v 1.82 2004/09/03 05:28:19 chw Exp chw

Copyright (c) 2001-2004 Christian Werner <chw@ch-werner.de>

See the file "license.terms" for information on usage and redistribution of this file and for a DISCLAIMER OF ALL WARRANTIES.

Definition in file sqliteodbc.c.#include "sqliteodbc.h"

Go to the source code of this file.

Defines

#define ODBC_INI   ".odbc.ini"
#define min(a, b)   ((a) < (b) ? (a) : (b))
#define max(a, b)   ((a) < (b) ? (b) : (a))
#define array_size(x)   (sizeof (x) / sizeof (x[0]))
#define stringify1(s)   #s
#define stringify(s)   stringify1(s)
#define verinfo(maj, min, lev)   ((maj) << 16 | (min) << 8 | (lev))
#define SCOL_VARCHAR   SQL_VARCHAR
#define SCOL_CHAR   SQL_CHAR
#define ENV_MAGIC   0x53544145
#define DBC_MAGIC   0x53544144
#define DEAD_MAGIC   0xdeadbeef
#define xmalloc(x)   malloc(x)
#define xrealloc(x, y)   realloc(x, y)
#define xfree(x)   free(x)
#define xstrdup(x)   strdup_(x)
#define ISDIGIT(c)   ((c) && strchr(digit_chars, (c)) != NULL)
#define ISSPACE(c)   ((c) && strchr(space_chars, (c)) != NULL)
#define ISIDCHAR(c)   ((c) && strchr(id_chars, (c)) != NULL)
#define drvgetgpps(d)
#define drvrelgpps(d)
#define dbtracerc(a, b, c)
#define strmak(dst, src, max, lenp)
#define SET_EXISTS(x)   flags[(x) >> 4] |= (1 << ((x) & 0xF))
#define CLR_EXISTS(x)   flags[(x) >> 4] &= ~(1 << ((x) & 0xF))

Functions

int TOLOWER (int c)
void unbindcols (STMT *s)
 Reset bound columns to unbound state.
SQLRETURN mkbindcols (STMT *s, int ncols)
 Reallocate space for bound columns.
void freeresult (STMT *s, int clrcols)
 Free statement's result.
SQLRETURN freestmt (HSTMT stmt)
 Internal free function for HSTMT.
SQLRETURN substparam (STMT *s, int pnum, char **out, int *size)
 Substitute parameter for statement.
void freedyncols (STMT *s)
 Free dynamically allocated column descriptions of STMT.
SQLRETURN drvexecute (SQLHSTMT stmt)
 Internal query execution used by SQLExecute() and SQLExecDirect().
char * strdup_ (const char *str)
 Duplicate string using xmalloc().
void setstatd (DBC *d, int naterr, char *msg, char *st,...)
 Set error message and SQL state on DBC.
void setstat (STMT *s, int naterr, char *msg, char *st,...)
 Set error message and SQL state on statement.
SQLRETURN drvunimpldbc (HDBC dbc)
 Report IM001 (not implemented) SQL error code for HDBC.
SQLRETURN drvunimplstmt (HSTMT stmt)
 Report IM001 (not implemented) SQL error code for HSTMT.
void freep (void *x)
 Free memory given pointer to memory pointer.
SQLRETURN nomem (STMT *s)
 Report S1000 (out of memory) SQL error given STMT.
SQLRETURN noconn (STMT *s)
 Report S1000 (not connected) SQL error given STMT.
double ln_strtod (const char *data, char **endp)
 Internal locale neutral strtod function.
void ln_sprintfg (char *buf, double value)
 Internal locale neutral sprintf("%g") function.
int busy_handler (void *udata, const char *table, int count)
 Busy callback for SQLite.
int setsqliteopts (sqlite *x, DBC *d)
 Set SQLite options (PRAGMAs) given SQLite handle.
void freerows (char **rowp)
 Free counted array of char pointers.
int mapsqltype (const char *typename, int *nosign, int ov3, int nowchar)
 Map SQL field type from string to ODBC integer type code.
void getmd (const char *typename, int sqltype, int *mp, int *dp)
 Get maximum display size and number of decimal points from field type specification.
int mapdeftype (int type, int stype, int nosign, int nowchar)
 Map SQL_C_DEFAULT to proper C type.
char * fixupsql (char *sql, int sqlLen, int *nparam, int *isselect, char **errmsg, int version, char ***namepp)
 Fixup query string with optional parameter markers.
int findcol (char **cols, int ncols, char *name)
 Find column given name in string array.
void fixupdyncols (STMT *s, sqlite *sqlite, const char **types)
 Fixup column information for a running statement.
int getmdays (int year, int month)
 Return number of month days.
int str2date (char *str, DATE_STRUCT *ds)
 Convert string to ODBC DATE_STRUCT.
int str2time (char *str, TIME_STRUCT *ts)
 Convert string to ODBC TIME_STRUCT.
int str2timestamp (char *str, TIMESTAMP_STRUCT *tss)
 Convert string to ODBC TIMESTAMP_STRUCT.
int getbool (char *string)
 Get boolean flag from string.
SQLRETURN dbopen (DBC *d, char *name, char *dsn, char *sflag, char *busy)
 Open SQLite database file given file name and flags.
int vm_step (STMT *s)
 Do one VM step gathering one result row.
void vm_end (STMT *s)
 Stop running VM.
void vm_end_if (STMT *s)
 Conditionally stop running VM.
SQLRETURN vm_start (STMT *s, char **params)
 Start VM for execution of SELECT statement.
SQLRETURN SQL_API SQLBulkOperations (SQLHSTMT stmt, SQLSMALLINT oper)
 Function not implemented.
SQLRETURN SQL_API SQLDataSources (SQLHENV env, SQLUSMALLINT dir, SQLCHAR *srvname, SQLSMALLINT buflen1, SQLSMALLINT *lenp1, SQLCHAR *desc, SQLSMALLINT buflen2, SQLSMALLINT *lenp2)
 Function not implemented.
SQLRETURN SQL_API SQLDrivers (SQLHENV env, SQLUSMALLINT dir, SQLCHAR *drvdesc, SQLSMALLINT descmax, SQLSMALLINT *desclenp, SQLCHAR *drvattr, SQLSMALLINT attrmax, SQLSMALLINT *attrlenp)
 Function not implemented.
SQLRETURN SQL_API SQLBrowseConnect (SQLHDBC dbc, SQLCHAR *connin, SQLSMALLINT conninLen, SQLCHAR *connout, SQLSMALLINT connoutMax, SQLSMALLINT *connoutLen)
 Function not implemented.
void time_func (sqlite_func *context, int argc, const char **argv)
 SQLite function "current_time_local" etc.
SQLRETURN SQL_API SQLPutData (SQLHSTMT stmt, SQLPOINTER data, SQLINTEGER len)
 Put (partial) parameter data into executing statement.
SQLRETURN freeparams (STMT *s)
 Clear out parameter bindings, if any.
SQLRETURN drvbindparam (SQLHSTMT stmt, SQLUSMALLINT pnum, SQLSMALLINT iotype, SQLSMALLINT buftype, SQLSMALLINT ptype, SQLUINTEGER coldef, SQLSMALLINT scale, SQLPOINTER data, SQLINTEGER buflen, SQLINTEGER *len)
 Internal bind parameter on HSTMT.
SQLRETURN SQL_API SQLBindParameter (SQLHSTMT stmt, SQLUSMALLINT pnum, SQLSMALLINT iotype, SQLSMALLINT buftype, SQLSMALLINT ptype, SQLUINTEGER coldef, SQLSMALLINT scale, SQLPOINTER data, SQLINTEGER buflen, SQLINTEGER *len)
 Bind parameter on HSTMT.
SQLRETURN SQL_API SQLBindParam (SQLHSTMT stmt, SQLUSMALLINT pnum, SQLSMALLINT vtype, SQLSMALLINT ptype, SQLUINTEGER lenprec, SQLSMALLINT scale, SQLPOINTER val, SQLINTEGER *lenp)
 Bind parameter on HSTMT.
SQLRETURN SQL_API SQLNumParams (SQLHSTMT stmt, SQLSMALLINT *nparam)
 Return number of parameters.
SQLRETURN SQL_API SQLParamData (SQLHSTMT stmt, SQLPOINTER *p)
 Retrieve next parameter for sending data to executing query.
SQLRETURN SQL_API SQLDescribeParam (SQLHSTMT stmt, UWORD pnum, SWORD *dtype, UDWORD *size, SWORD *decdigits, SWORD *nullable)
 Return information about parameter.
SQLRETURN SQL_API SQLSetParam (SQLHSTMT stmt, SQLUSMALLINT par, SQLSMALLINT type, SQLSMALLINT sqltype, SQLUINTEGER coldef, SQLSMALLINT scale, SQLPOINTER val, SQLINTEGER *nval)
 Set information on parameter.
SQLRETURN SQL_API SQLParamOptions (SQLHSTMT stmt, UDWORD rows, UDWORD *rowp)
 Function not implemented.
SQLRETURN SQL_API SQLGetDescField (SQLHDESC handle, SQLSMALLINT recno, SQLSMALLINT fieldid, SQLPOINTER value, SQLINTEGER buflen, SQLINTEGER *strlen)
 Function not implemented.
SQLRETURN SQL_API SQLSetDescField (SQLHDESC handle, SQLSMALLINT recno, SQLSMALLINT fieldid, SQLPOINTER value, SQLINTEGER buflen)
 Function not implemented.
SQLRETURN SQL_API SQLGetDescRec (SQLHDESC handle, SQLSMALLINT recno, SQLCHAR *name, SQLSMALLINT buflen, SQLSMALLINT *strlen, SQLSMALLINT *type, SQLSMALLINT *subtype, SQLINTEGER *len, SQLSMALLINT *prec, SQLSMALLINT *scale, SQLSMALLINT *nullable)
 Function not implemented.
SQLRETURN SQL_API SQLSetDescRec (SQLHDESC handle, SQLSMALLINT recno, SQLSMALLINT type, SQLSMALLINT subtype, SQLINTEGER len, SQLSMALLINT prec, SQLSMALLINT scale, SQLPOINTER data, SQLINTEGER *strlen, SQLINTEGER *indicator)
 Function not implemented.
SQLRETURN mkresultset (HSTMT stmt, COL *colspec, int ncols)
 Setup empty result set from constant column specification.
SQLRETURN SQL_API SQLTablePrivileges (SQLHSTMT stmt, SQLCHAR *catalog, SQLSMALLINT catalogLen, SQLCHAR *schema, SQLSMALLINT schemaLen, SQLCHAR *table, SQLSMALLINT tableLen)
 Retrieve privileges on tables and/or views.
SQLRETURN SQL_API SQLColumnPrivileges (SQLHSTMT stmt, SQLCHAR *catalog, SQLSMALLINT catalogLen, SQLCHAR *schema, SQLSMALLINT schemaLen, SQLCHAR *table, SQLSMALLINT tableLen, SQLCHAR *column, SQLSMALLINT columnLen)
 Retrieve privileges on columns.
SQLRETURN drvprimarykeys (SQLHSTMT stmt, SQLCHAR *cat, SQLSMALLINT catLen, SQLCHAR *schema, SQLSMALLINT schemaLen, SQLCHAR *table, SQLSMALLINT tableLen)
 Internal retrieve information about indexed columns.
SQLRETURN SQL_API SQLPrimaryKeys (SQLHSTMT stmt, SQLCHAR *cat, SQLSMALLINT catLen, SQLCHAR *schema, SQLSMALLINT schemaLen, SQLCHAR *table, SQLSMALLINT tableLen)
 Retrieve information about indexed columns.
SQLRETURN drvspecialcolumns (SQLHSTMT stmt, SQLUSMALLINT id, SQLCHAR *cat, SQLSMALLINT catLen, SQLCHAR *schema, SQLSMALLINT schemaLen, SQLCHAR *table, SQLSMALLINT tableLen, SQLUSMALLINT scope, SQLUSMALLINT nullable)
 Internal retrieve information about indexed columns.
SQLRETURN SQL_API SQLSpecialColumns (SQLHSTMT stmt, SQLUSMALLINT id, SQLCHAR *cat, SQLSMALLINT catLen, SQLCHAR *schema, SQLSMALLINT schemaLen, SQLCHAR *table, SQLSMALLINT tableLen, SQLUSMALLINT scope, SQLUSMALLINT nullable)
 Retrieve information about indexed columns.
SQLRETURN SQL_API drvforeignkeys (SQLHSTMT stmt, SQLCHAR *PKcatalog, SQLSMALLINT PKcatalogLen, SQLCHAR *PKschema, SQLSMALLINT PKschemaLen, SQLCHAR *PKtable, SQLSMALLINT PKtableLen, SQLCHAR *FKcatalog, SQLSMALLINT FKcatalogLen, SQLCHAR *FKschema, SQLSMALLINT FKschemaLen, SQLCHAR *FKtable, SQLSMALLINT FKtableLen)
 Internal retrieve information about primary/foreign keys.
SQLRETURN SQL_API SQLForeignKeys (SQLHSTMT stmt, SQLCHAR *PKcatalog, SQLSMALLINT PKcatalogLen, SQLCHAR *PKschema, SQLSMALLINT PKschemaLen, SQLCHAR *PKtable, SQLSMALLINT PKtableLen, SQLCHAR *FKcatalog, SQLSMALLINT FKcatalogLen, SQLCHAR *FKschema, SQLSMALLINT FKschemaLen, SQLCHAR *FKtable, SQLSMALLINT FKtableLen)
 Retrieve information about primary/foreign keys.
SQLRETURN endtran (DBC *d, SQLSMALLINT comptype)
 Internal commit or rollback transaction.
SQLRETURN drvendtran (SQLSMALLINT type, SQLHANDLE handle, SQLSMALLINT comptype)
 Internal commit or rollback transaction.
SQLRETURN SQL_API SQLEndTran (SQLSMALLINT type, SQLHANDLE handle, SQLSMALLINT comptype)
 Commit or rollback transaction.
SQLRETURN SQL_API SQLTransact (SQLHENV env, SQLHDBC dbc, UWORD type)
 Commit or rollback transaction.
SQLRETURN SQL_API SQLCopyDesc (SQLHDESC source, SQLHDESC target)
 Function not implemented.
SQLRETURN SQL_API SQLNativeSql (SQLHSTMT stmt, SQLCHAR *sqlin, SQLINTEGER sqlinLen, SQLCHAR *sql, SQLINTEGER sqlMax, SQLINTEGER *sqlLen)
 Translate SQL string.
SQLRETURN SQL_API SQLProcedures (SQLHSTMT stmt, SQLCHAR *catalog, SQLSMALLINT catalogLen, SQLCHAR *schema, SQLSMALLINT schemaLen, SQLCHAR *proc, SQLSMALLINT procLen)
 Retrieve information about stored procedures.
SQLRETURN SQL_API SQLProcedureColumns (SQLHSTMT stmt, SQLCHAR *catalog, SQLSMALLINT catalogLen, SQLCHAR *schema, SQLSMALLINT schemaLen, SQLCHAR *proc, SQLSMALLINT procLen, SQLCHAR *column, SQLSMALLINT columnLen)
 Retrieve information about columns in result set of stored procedures.
SQLRETURN SQL_API SQLGetEnvAttr (SQLHENV env, SQLINTEGER attr, SQLPOINTER val, SQLINTEGER len, SQLINTEGER *lenp)
 Get information of HENV.
SQLRETURN SQL_API SQLSetEnvAttr (SQLHENV env, SQLINTEGER attr, SQLPOINTER val, SQLINTEGER len)
 Set information in HENV.
SQLRETURN drvgetdiagrec (SQLSMALLINT htype, SQLHANDLE handle, SQLSMALLINT recno, SQLCHAR *sqlstate, SQLINTEGER *nativeerr, SQLCHAR *msg, SQLSMALLINT buflen, SQLSMALLINT *msglen)
 Internal get error message given handle (HENV, HDBC, or HSTMT).
SQLRETURN SQL_API SQLGetDiagRec (SQLSMALLINT htype, SQLHANDLE handle, SQLSMALLINT recno, SQLCHAR *sqlstate, SQLINTEGER *nativeerr, SQLCHAR *msg, SQLSMALLINT buflen, SQLSMALLINT *msglen)
 Get error message given handle (HENV, HDBC, or HSTMT).
SQLRETURN SQL_API SQLGetDiagField (SQLSMALLINT htype, SQLHANDLE handle, SQLSMALLINT recno, SQLSMALLINT id, SQLPOINTER info, SQLSMALLINT buflen, SQLSMALLINT *strlen)
 Function not implemented.
SQLRETURN drvgetstmtattr (SQLHSTMT stmt, SQLINTEGER attr, SQLPOINTER val, SQLINTEGER bufmax, SQLINTEGER *buflen)
 Internal get option of HSTMT.
SQLRETURN SQL_API SQLGetStmtAttr (SQLHSTMT stmt, SQLINTEGER attr, SQLPOINTER val, SQLINTEGER bufmax, SQLINTEGER *buflen)
 Get option of HSTMT.
SQLRETURN drvsetstmtattr (SQLHSTMT stmt, SQLINTEGER attr, SQLPOINTER val, SQLINTEGER buflen)
 Internal set option on HSTMT.
SQLRETURN SQL_API SQLSetStmtAttr (SQLHSTMT stmt, SQLINTEGER attr, SQLPOINTER val, SQLINTEGER buflen)
 Set option on HSTMT.
SQLRETURN drvgetstmtoption (SQLHSTMT stmt, SQLUSMALLINT opt, SQLPOINTER param)
 Internal get option of HSTMT.
SQLRETURN SQL_API SQLGetStmtOption (SQLHSTMT stmt, SQLUSMALLINT opt, SQLPOINTER param)
 Get option of HSTMT.
SQLRETURN drvsetstmtoption (SQLHSTMT stmt, SQLUSMALLINT opt, SQLUINTEGER param)
 Internal set option on HSTMT.
SQLRETURN SQL_API SQLSetStmtOption (SQLHSTMT stmt, SQLUSMALLINT opt, SQLUINTEGER param)
 Set option on HSTMT.
SQLRETURN SQL_API SQLSetPos (SQLHSTMT stmt, SQLUSMALLINT row, SQLUSMALLINT op, SQLUSMALLINT lock)
 Function not implemented.
SQLRETURN SQL_API SQLSetScrollOptions (SQLHSTMT stmt, SQLUSMALLINT concur, SQLINTEGER rowkeyset, SQLUSMALLINT rowset)
 Function not implemented.
SQLRETURN drvgetinfo (SQLHDBC dbc, SQLUSMALLINT type, SQLPOINTER val, SQLSMALLINT valMax, SQLSMALLINT *valLen)
 Internal return information about what this ODBC driver supports.
SQLRETURN SQL_API SQLGetInfo (SQLHDBC dbc, SQLUSMALLINT type, SQLPOINTER val, SQLSMALLINT valMax, SQLSMALLINT *valLen)
 Return information about what this ODBC driver supports.
SQLRETURN SQL_API SQLGetFunctions (SQLHDBC dbc, SQLUSMALLINT func, SQLUSMALLINT *flags)
 Return information about supported ODBC API functions.
SQLRETURN drvallocenv (SQLHENV *env)
 Internal allocate HENV.
SQLRETURN SQL_API SQLAllocEnv (SQLHENV *env)
 Allocate HENV.
SQLRETURN drvfreeenv (SQLHENV env)
 Internal free HENV.
SQLRETURN SQL_API SQLFreeEnv (SQLHENV env)
 Free HENV.
SQLRETURN drvallocconnect (SQLHENV env, SQLHDBC *dbc)
 Internal allocate HDBC.
SQLRETURN SQL_API SQLAllocConnect (SQLHENV env, SQLHDBC *dbc)
 Allocate HDBC.
SQLRETURN drvfreeconnect (SQLHDBC dbc)
 Internal free connection (HDBC).
SQLRETURN SQL_API SQLFreeConnect (SQLHDBC dbc)
 Free connection (HDBC).
SQLRETURN drvgetconnectattr (SQLHDBC dbc, SQLINTEGER attr, SQLPOINTER val, SQLINTEGER bufmax, SQLINTEGER *buflen)
 Internal get connect attribute of HDBC.
SQLRETURN SQL_API SQLGetConnectAttr (SQLHDBC dbc, SQLINTEGER attr, SQLPOINTER val, SQLINTEGER bufmax, SQLINTEGER *buflen)
 Get connect attribute of HDBC.
SQLRETURN drvsetconnectattr (SQLHDBC dbc, SQLINTEGER attr, SQLPOINTER val, SQLINTEGER len)
 Internal set connect attribute of HDBC.
SQLRETURN SQL_API SQLSetConnectAttr (SQLHDBC dbc, SQLINTEGER attr, SQLPOINTER val, SQLINTEGER len)
 Set connect attribute of HDBC.
SQLRETURN drvgetconnectoption (SQLHDBC dbc, SQLUSMALLINT opt, SQLPOINTER param)
 Internal get connect option of HDBC.
SQLRETURN SQL_API SQLGetConnectOption (SQLHDBC dbc, SQLUSMALLINT opt, SQLPOINTER param)
 Get connect option of HDBC.
SQLRETURN drvsetconnectoption (SQLHDBC dbc, SQLUSMALLINT opt, SQLUINTEGER param)
 Internal set option on HDBC.
SQLRETURN SQL_API SQLSetConnectOption (SQLHDBC dbc, SQLUSMALLINT opt, SQLUINTEGER param)
 Set option on HDBC.
int getdsnattr (char *dsn, char *attr, char *out, int outLen)
 Handling of SQLConnect() connection attributes for standalone operation without driver manager.
SQLRETURN drvconnect (SQLHDBC dbc, SQLCHAR *dsn, SQLSMALLINT dsnLen)
 Internal connect to SQLite database.
SQLRETURN SQL_API SQLConnect (SQLHDBC dbc, SQLCHAR *dsn, SQLSMALLINT dsnLen, SQLCHAR *uid, SQLSMALLINT uidLen, SQLCHAR *pass, SQLSMALLINT passLen)
 Connect to SQLite database.
SQLRETURN SQL_API SQLDisconnect (SQLHDBC dbc)
 Disconnect given HDBC.
SQLRETURN drvdriverconnect (SQLHDBC dbc, SQLHWND hwnd, SQLCHAR *connIn, SQLSMALLINT connInLen, SQLCHAR *connOut, SQLSMALLINT connOutMax, SQLSMALLINT *connOutLen, SQLUSMALLINT drvcompl)
 Internal standalone (w/o driver manager) database connect.
SQLRETURN freestmt (SQLHSTMT stmt)
SQLRETURN drvallocstmt (SQLHDBC dbc, SQLHSTMT *stmt)
 Allocate HSTMT given HDBC (driver internal version).
SQLRETURN SQL_API SQLAllocStmt (SQLHDBC dbc, SQLHSTMT *stmt)
 Allocate HSTMT given HDBC.
SQLRETURN drvfreestmt (SQLHSTMT stmt, SQLUSMALLINT opt)
 Internal function to perform certain kinds of free/close on STMT.
SQLRETURN SQL_API SQLFreeStmt (SQLHSTMT stmt, SQLUSMALLINT opt)
 Free HSTMT.
SQLRETURN SQL_API SQLCancel (SQLHSTMT stmt)
 Cancel HSTMT closing cursor.
SQLRETURN drvgetcursorname (SQLHSTMT stmt, SQLCHAR *cursor, SQLSMALLINT buflen, SQLSMALLINT *lenp)
 Internal function to get cursor name of STMT.
SQLRETURN SQL_API SQLGetCursorName (SQLHSTMT stmt, SQLCHAR *cursor, SQLSMALLINT buflen, SQLSMALLINT *lenp)
 Get cursor name of STMT.
SQLRETURN drvsetcursorname (SQLHSTMT stmt, SQLCHAR *cursor, SQLSMALLINT len)
 Internal function to set cursor name on STMT.
SQLRETURN SQL_API SQLSetCursorName (SQLHSTMT stmt, SQLCHAR *cursor, SQLSMALLINT len)
 Set cursor name on STMT.
SQLRETURN SQL_API SQLCloseCursor (SQLHSTMT stmt)
 Close open cursor.
SQLRETURN SQL_API SQLAllocHandle (SQLSMALLINT type, SQLHANDLE input, SQLHANDLE *output)
 Allocate a HENV, HDBC, or HSTMT handle.
SQLRETURN SQL_API SQLFreeHandle (SQLSMALLINT type, SQLHANDLE h)
 Free a HENV, HDBC, or HSTMT handle.
SQLRETURN getrowdata (STMT *s, SQLUSMALLINT col, SQLSMALLINT otype, SQLPOINTER val, SQLINTEGER len, SQLINTEGER *lenp, int partial)
 Internal function to retrieve row data, used by SQLFetch() and friends and SQLGetData().
SQLRETURN SQL_API SQLBindCol (SQLHSTMT stmt, SQLUSMALLINT col, SQLSMALLINT type, SQLPOINTER val, SQLINTEGER max, SQLINTEGER *lenp)
 Bind C variable to column of result set.
SQLRETURN drvtables (SQLHSTMT stmt, SQLCHAR *cat, SQLSMALLINT catLen, SQLCHAR *schema, SQLSMALLINT schemaLen, SQLCHAR *table, SQLSMALLINT tableLen, SQLCHAR *type, SQLSMALLINT typeLen)
 Retrieve information on tables and/or views.
SQLRETURN SQL_API SQLTables (SQLHSTMT stmt, SQLCHAR *cat, SQLSMALLINT catLen, SQLCHAR *schema, SQLSMALLINT schemaLen, SQLCHAR *table, SQLSMALLINT tableLen, SQLCHAR *type, SQLSMALLINT typeLen)
 Retrieve information on tables and/or views.
SQLRETURN drvcolumns (SQLHSTMT stmt, SQLCHAR *cat, SQLSMALLINT catLen, SQLCHAR *schema, SQLSMALLINT schemaLen, SQLCHAR *table, SQLSMALLINT tableLen, SQLCHAR *col, SQLSMALLINT colLen)
 Internal retrieve column information on table.
SQLRETURN SQL_API SQLColumns (SQLHSTMT stmt, SQLCHAR *cat, SQLSMALLINT catLen, SQLCHAR *schema, SQLSMALLINT schemaLen, SQLCHAR *table, SQLSMALLINT tableLen, SQLCHAR *col, SQLSMALLINT colLen)
 Retrieve column information on table.
void mktypeinfo (STMT *s, int row, char *typename, int type, int tind)
 Internal function to build up data type information as row in result set.
int typeinfosort (const void *a, const void *b)
 Helper function to sort type information.
SQLRETURN drvgettypeinfo (SQLHSTMT stmt, SQLSMALLINT sqltype)
 Internal return data type information.
SQLRETURN SQL_API SQLGetTypeInfo (SQLHSTMT stmt, SQLSMALLINT sqltype)
 Return data type information.
SQLRETURN drvstatistics (SQLHSTMT stmt, SQLCHAR *cat, SQLSMALLINT catLen, SQLCHAR *schema, SQLSMALLINT schemaLen, SQLCHAR *table, SQLSMALLINT tableLen, SQLUSMALLINT itype, SQLUSMALLINT resv)
 Internal return statistic information on table indices.
SQLRETURN SQL_API SQLStatistics (SQLHSTMT stmt, SQLCHAR *cat, SQLSMALLINT catLen, SQLCHAR *schema, SQLSMALLINT schemaLen, SQLCHAR *table, SQLSMALLINT tableLen, SQLUSMALLINT itype, SQLUSMALLINT resv)
 Return statistic information on table indices.
SQLRETURN SQL_API SQLGetData (SQLHSTMT stmt, SQLUSMALLINT col, SQLSMALLINT type, SQLPOINTER val, SQLINTEGER len, SQLINTEGER *lenp)
 Retrieve row data after fetch.
SQLRETURN dofetchbind (STMT *s, int rsi)
 Internal: fetch and bind from statement's current row.
SQLRETURN SQL_API SQLFetch (SQLHSTMT stmt)
 Fetch next result row.
SQLRETURN drvfetchscroll (SQLHSTMT stmt, SQLSMALLINT orient, SQLINTEGER offset)
 Internal fetch function for SQLFetchScroll() and SQLExtendedFetch().
SQLRETURN SQL_API SQLFetchScroll (SQLHSTMT stmt, SQLSMALLINT orient, SQLINTEGER offset)
 Fetch result row with scrolling.
SQLRETURN SQL_API SQLExtendedFetch (SQLHSTMT stmt, SQLUSMALLINT orient, SQLINTEGER offset, SQLUINTEGER *rowcount, SQLUSMALLINT *rowstatus)
 Fetch result row with scrolling and row status.
SQLRETURN SQL_API SQLRowCount (SQLHSTMT stmt, SQLINTEGER *nrows)
 Return number of affected rows of HSTMT.
SQLRETURN SQL_API SQLNumResultCols (SQLHSTMT stmt, SQLSMALLINT *ncols)
 Return number of columns of result set given HSTMT.
SQLRETURN drvdescribecol (SQLHSTMT stmt, SQLUSMALLINT col, SQLCHAR *name, SQLSMALLINT nameMax, SQLSMALLINT *nameLen, SQLSMALLINT *type, SQLUINTEGER *size, SQLSMALLINT *digits, SQLSMALLINT *nullable)
 Internal describe column information.
SQLRETURN SQL_API SQLDescribeCol (SQLHSTMT stmt, SQLUSMALLINT col, SQLCHAR *name, SQLSMALLINT nameMax, SQLSMALLINT *nameLen, SQLSMALLINT *type, SQLUINTEGER *size, SQLSMALLINT *digits, SQLSMALLINT *nullable)
 Describe column information.
SQLRETURN drvcolattributes (SQLHSTMT stmt, SQLUSMALLINT col, SQLUSMALLINT id, SQLPOINTER val, SQLSMALLINT valMax, SQLSMALLINT *valLen, SQLINTEGER *val2)
 Internal retrieve column attributes.
SQLRETURN SQL_API SQLColAttributes (SQLHSTMT stmt, SQLUSMALLINT col, SQLUSMALLINT id, SQLPOINTER val, SQLSMALLINT valMax, SQLSMALLINT *valLen, SQLINTEGER *val2)
 Retrieve column attributes.
SQLRETURN drvcolattribute (SQLHSTMT stmt, SQLUSMALLINT col, SQLUSMALLINT id, SQLPOINTER val, SQLSMALLINT valMax, SQLSMALLINT *valLen, SQLPOINTER val2)
 Internal retrieve column attributes.
SQLRETURN SQL_API SQLColAttribute (SQLHSTMT stmt, SQLUSMALLINT col, SQLUSMALLINT id, SQLPOINTER val, SQLSMALLINT valMax, SQLSMALLINT *valLen, SQLPOINTER val2)
 Retrieve column attributes.
SQLRETURN drverror (SQLHENV env, SQLHDBC dbc, SQLHSTMT stmt, SQLCHAR *sqlState, SQLINTEGER *nativeErr, SQLCHAR *errmsg, SQLSMALLINT errmax, SQLSMALLINT *errlen)
 Internal return last HDBC or HSTMT error message.
SQLRETURN SQL_API SQLError (SQLHENV env, SQLHDBC dbc, SQLHSTMT stmt, SQLCHAR *sqlState, SQLINTEGER *nativeErr, SQLCHAR *errmsg, SQLSMALLINT errmax, SQLSMALLINT *errlen)
 Return last HDBC or HSTMT error message.
SQLRETURN SQL_API SQLMoreResults (SQLHSTMT stmt)
 Return information for more result sets.
int selcb (void *arg, int ncols, char **values, char **cols)
 SQLite callback during drvprepare(), used to collect column information.
SQLRETURN drvprepare (SQLHSTMT stmt, SQLCHAR *query, SQLINTEGER queryLen)
 Internal query preparation used by SQLPrepare() and SQLExecDirect().
SQLRETURN SQL_API SQLPrepare (SQLHSTMT stmt, SQLCHAR *query, SQLINTEGER queryLen)
 Prepare HSTMT.
SQLRETURN SQL_API SQLExecute (SQLHSTMT stmt)
 Execute query.
SQLRETURN SQL_API SQLExecDirect (SQLHSTMT stmt, SQLCHAR *query, SQLINTEGER queryLen)
 Execute query directly.
SQLRETURN SQL_API SQLDriverConnect (SQLHDBC dbc, SQLHWND hwnd, SQLCHAR *connIn, SQLSMALLINT connInLen, SQLCHAR *connOut, SQLSMALLINT connOutMax, SQLSMALLINT *connOutLen, SQLUSMALLINT drvcompl)
 Connect using a driver connection string.

Variables

const char upper_chars [] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
const char lower_chars [] = "abcdefghijklmnopqrstuvwxyz"
const char digit_chars [] = "0123456789"
const char space_chars [] = " \f\n\r\t\v"
const char id_chars []
COL tablePrivSpec []
 Columns for result set of SQLTablePrivileges().
COL colPrivSpec []
 Columns for result set of SQLColumnPrivileges().
COL pkeySpec []
 Columns for result set of SQLPrimaryKeys().
COL scolSpec []
 Columns for result set of SQLSpecialColumns().
COL fkeySpec []
 Columns for result set of SQLForeignKeys().
COL procSpec []
 Columns for result set of SQLProcedures().
COL procColSpec []
 Columns for result set of SQLProcedureColumns().
COL tableSpec []
 Columns for result set of SQLTables().
COL colSpec []
 Columns for result set of SQLColumns().
COL typeSpec []
 Columns for result set of SQLGetTypeInfo().
COL statSpec []
 Columns for result set of SQLStatistics().


Define Documentation

#define array_size  )     (sizeof (x) / sizeof (x[0]))
 

Definition at line 31 of file sqliteodbc.c.

Referenced by drvcolumns(), drvforeignkeys(), drvgettypeinfo(), drvprimarykeys(), drvspecialcolumns(), drvstatistics(), drvtables(), fixupdyncols(), mktypeinfo(), SQLColumnPrivileges(), SQLGetFunctions(), SQLProcedureColumns(), SQLProcedures(), and SQLTablePrivileges().

#define CLR_EXISTS  )     flags[(x) >> 4] &= ~(1 << ((x) & 0xF))
 

#define DBC_MAGIC   0x53544144
 

Definition at line 49 of file sqliteodbc.c.

Referenced by drvallocconnect(), drvallocstmt(), drvconnect(), drverror(), drvfreeconnect(), freestmt(), and SQLDisconnect().

#define dbtracerc a,
b,
 ) 
 

Definition at line 2164 of file sqliteodbc.c.

Referenced by drvexecute(), drvprepare(), endtran(), and vm_start().

#define DEAD_MAGIC   0xdeadbeef
 

Definition at line 50 of file sqliteodbc.c.

Referenced by drvfreeconnect(), drvfreeenv(), and drvgetstmtattr().

#define drvgetgpps  ) 
 

Definition at line 624 of file sqliteodbc.c.

Referenced by drvallocconnect().

#define drvrelgpps  ) 
 

Definition at line 625 of file sqliteodbc.c.

Referenced by drvfreeconnect().

#define ENV_MAGIC   0x53544145
 

Definition at line 48 of file sqliteodbc.c.

Referenced by drvallocconnect(), drvallocenv(), drvfreeconnect(), drvfreeenv(), SQLAllocHandle(), SQLGetEnvAttr(), and SQLSetEnvAttr().

#define ISDIGIT  )     ((c) && strchr(digit_chars, (c)) != NULL)
 

Definition at line 213 of file sqliteodbc.c.

Referenced by str2date(), str2time(), and str2timestamp().

#define ISIDCHAR  )     ((c) && strchr(id_chars, (c)) != NULL)
 

Definition at line 233 of file sqliteodbc.c.

Referenced by fixupsql().

#define ISSPACE  )     ((c) && strchr(space_chars, (c)) != NULL)
 

Definition at line 222 of file sqliteodbc.c.

Referenced by fixupsql().

#define max a,
 )     ((a) < (b) ? (b) : (a))
 

Definition at line 29 of file sqliteodbc.c.

Referenced by drvbindparam(), getrowdata(), and SQLBindCol().

#define min a,
 )     ((a) < (b) ? (a) : (b))
 

Definition at line 27 of file sqliteodbc.c.

Referenced by drvallocconnect(), drvcolumns(), drvconnect(), drvdriverconnect(), drverror(), drvforeignkeys(), drvgetcursorname(), drvprimarykeys(), drvsetcursorname(), drvspecialcolumns(), drvstatistics(), drvtables(), getdsnattr(), getrowdata(), SQLNativeSql(), and SQLPutData().

#define ODBC_INI   ".odbc.ini"
 

Definition at line 23 of file sqliteodbc.c.

Referenced by drvconnect(), and drvdriverconnect().

#define SCOL_CHAR   SQL_CHAR
 

Definition at line 45 of file sqliteodbc.c.

#define SCOL_VARCHAR   SQL_VARCHAR
 

Definition at line 44 of file sqliteodbc.c.

#define SET_EXISTS  )     flags[(x) >> 4] |= (1 << ((x) & 0xF))
 

Referenced by SQLGetFunctions().

#define stringify  )     stringify1(s)
 

Definition at line 34 of file sqliteodbc.c.

Referenced by drvcolumns(), drvforeignkeys(), drvspecialcolumns(), drvstatistics(), and mktypeinfo().

#define stringify1  )     #s
 

Definition at line 33 of file sqliteodbc.c.

#define strmak dst,
src,
max,
lenp   ) 
 

Value:

{ \ int len = strlen(src); \ int cnt = min(len + 1, max); \ strncpy(dst, src, cnt); \ *lenp = (cnt > len) ? len : cnt; \ }
Definition at line 6048 of file sqliteodbc.c.

Referenced by drvgetinfo().

#define verinfo maj,
min,
lev   )     ((maj) << 16 | (min) << 8 | (lev))
 

Definition at line 36 of file sqliteodbc.c.

Referenced by drvallocconnect().

#define xfree  )     free(x)
 

Definition at line 176 of file sqliteodbc.c.

Referenced by drvallocconnect(), drvfreeconnect(), drvfreeenv(), freep(), freestmt(), and mapsqltype().

#define xmalloc  )     malloc(x)
 

Definition at line 174 of file sqliteodbc.c.

Referenced by drvallocconnect(), drvallocenv(), drvallocstmt(), drvbindparam(), drvcolumns(), drvexecute(), drvforeignkeys(), drvgettypeinfo(), drvprepare(), drvprimarykeys(), drvsetstmtattr(), drvsetstmtoption(), drvspecialcolumns(), drvstatistics(), drvtables(), fixupdyncols(), fixupsql(), getrowdata(), mapsqltype(), mkbindcols(), selcb(), SQLPutData(), strdup_(), substparam(), and vm_step().

#define xrealloc x,
 )     realloc(x, y)
 

Definition at line 175 of file sqliteodbc.c.

Referenced by drvbindparam(), and mkbindcols().

#define xstrdup  )     strdup_(x)
 

Definition at line 177 of file sqliteodbc.c.

Referenced by dbopen(), drvcolumns(), drvforeignkeys(), drvprimarykeys(), drvspecialcolumns(), drvstatistics(), fixupdyncols(), and vm_step().


Function Documentation

int busy_handler void *  udata,
const char *  table,
int  count
[static]
 

Busy callback for SQLite.

Parameters:
udata user data, pointer to DBC
table table name or NULL
count count of subsequenct calls
Returns:
true of false
Definition at line 873 of file sqliteodbc.c.

References DBC, dbc::t0, and dbc::timeout.

Referenced by setsqliteopts().

SQLRETURN dbopen DBC d,
char *  name,
char *  dsn,
char *  sflag,
char *  busy
[static]
 

Open SQLite database file given file name and flags.

Parameters:
d DBC pointer
name file name
dsn data source name
sflag STEPAPI flag
busy busy/lock timeout
Returns:
ODBC error code
Definition at line 2179 of file sqliteodbc.c.

References dbc::curtype, DBC, dbc::dbname, dbc::dsn, freep(), getbool(), dbc::ov3, setsqliteopts(), setstatd(), dbc::sqlite, dbc::step_enable, dbc::timeout, and xstrdup.

Referenced by drvconnect(), and drvdriverconnect().

SQLRETURN dofetchbind STMT s,
int  rsi
[static]
 

Internal: fetch and bind from statement's current row.

Parameters:
s statement pointer
rsi rowset index
Returns:
ODBC error code
Definition at line 10076 of file sqliteodbc.c.

References stmt::bind_type, stmt::bindcols, stmt::bkmrk, stmt::bkmrkcol, getrowdata(), BINDCOL::lenp, BINDCOL::max, stmt::ncols, BINDCOL::offs, stmt::row_status0, stmt::rowp, STMT, BINDCOL::type, and BINDCOL::valp.

Referenced by drvfetchscroll(), and SQLFetch().

SQLRETURN drvallocconnect SQLHENV  env,
SQLHDBC *  dbc
[static]
 

Internal allocate HDBC.

Parameters:
env environment handle
dbc pointer to database connection handle
Returns:
ODBC error code
Definition at line 6820 of file sqliteodbc.c.

References dbc::autocommit, dbc::curtype, DBC, DBC_MAGIC, ENV::dbcs, drvgetgpps, dbc::env, ENV_MAGIC, dbc::magic, ENV::magic, min, dbc::next, ENV::ov3, dbc::ov3, dbc::ov3val, verinfo, dbc::version, xfree, and xmalloc.

Referenced by SQLAllocConnect(), and SQLAllocHandle().

SQLRETURN drvallocenv SQLHENV *  env  )  [static]
 

Internal allocate HENV.

Parameters:
env pointer to environment handle
Returns:
ODBC error code
Definition at line 6743 of file sqliteodbc.c.

References ENV::dbcs, ENV_MAGIC, ENV::magic, ENV::ov3, and xmalloc.

Referenced by SQLAllocEnv(), and SQLAllocHandle().

SQLRETURN drvallocstmt SQLHDBC  dbc,
SQLHSTMT *  stmt
[static]
 

Allocate HSTMT given HDBC (driver internal version).

Parameters:
dbc database connection handle
stmt pointer to statement handle
Returns:
ODBC error code
Definition at line 7794 of file sqliteodbc.c.

References stmt::bind_type, stmt::cursorname, dbc::curtype, stmt::curtype, stmt::dbc, DBC, DBC_MAGIC, dbc::magic, stmt::next, dbc::nowchar, stmt::nowchar, dbc::ov3, stmt::ov3, stmt::paramset_size, stmt::row_status0, stmt::row_status1, stmt::rowset_size, dbc::stmt, STMT, and xmalloc.

Referenced by SQLAllocHandle(), and SQLAllocStmt().

SQLRETURN drvbindparam SQLHSTMT  stmt,
SQLUSMALLINT  pnum,
SQLSMALLINT  iotype,
SQLSMALLINT  buftype,
SQLSMALLINT  ptype,
SQLUINTEGER  coldef,
SQLSMALLINT  scale,
SQLPOINTER  data,
SQLINTEGER  buflen,
SQLINTEGER *  len
[static]
 

Internal bind parameter on HSTMT.

Parameters:
stmt statement handle
pnum parameter number, starting at 1
iotype input/output type of parameter
buftype type of host variable
ptype 
coldef 
scale 
data pointer to host variable
buflen length of host variable
len output length pointer
Returns:
ODBC error code
Definition at line 3199 of file sqliteodbc.c.

References stmt::bindparms, BINDPARM::inc, BINDPARM::ind, BINDPARM::len, BINDPARM::lenp, BINDPARM::max, max, stmt::nbindparms, BINDPARM::need, nomem(), BINDPARM::offs, stmt::ov3, BINDPARM::param, BINDPARM::param0, setstat(), STMT, BINDPARM::stype, BINDPARM::type, xmalloc, and xrealloc.

Referenced by SQLBindParam(), SQLBindParameter(), and SQLSetParam().

SQLRETURN drvcolattribute SQLHSTMT  stmt,
SQLUSMALLINT  col,
SQLUSMALLINT  id,
SQLPOINTER  val,
SQLSMALLINT  valMax,
SQLSMALLINT *  valLen,
SQLPOINTER  val2
[static]
 

Internal retrieve column attributes.

Parameters:
stmt statement handle
col column number, starting at 1
id attribute id
val output buffer
valMax length of output buffer
valLen output length
val2 integer output buffer
Returns:
ODBC error code
Definition at line 10993 of file sqliteodbc.c.

References COL::autoinc, stmt::cols, COL::column, COL::db, COL::label, stmt::ncols, COL::nosign, stmt::nowchar, stmt::ov3, COL::prec, COL::scale, setstat(), COL::size, STMT, COL::table, COL::type, and COL::typename.

Referenced by SQLColAttribute().

SQLRETURN drvcolattributes SQLHSTMT  stmt,
SQLUSMALLINT  col,
SQLUSMALLINT  id,
SQLPOINTER  val,
SQLSMALLINT  valMax,
SQLSMALLINT *  valLen,
SQLINTEGER *  val2
[static]
 

Internal retrieve column attributes.

Parameters:
stmt statement handle
col column number, starting at 1
id attribute id
val output buffer
valMax length of output buffer
valLen output length
val2 integer output buffer
Returns:
ODBC error code
Definition at line 10684 of file sqliteodbc.c.

References COL::autoinc, stmt::cols, COL::column, COL::label, stmt::ncols, COL::nosign, stmt::nowchar, stmt::ov3, COL::prec, COL::scale, setstat(), COL::size, STMT, COL::table, COL::type, and COL::typename.

Referenced by SQLColAttributes().

SQLRETURN drvcolumns SQLHSTMT  stmt,
SQLCHAR *  cat,
SQLSMALLINT  catLen,
SQLCHAR *  schema,
SQLSMALLINT  schemaLen,
SQLCHAR *  table,
SQLSMALLINT  tableLen,
SQLCHAR *  col,
SQLSMALLINT  colLen
[static]
 

Internal retrieve column information on table.

Parameters:
stmt statement handle
cat catalog name/pattern or NULL
catLen length of catalog name/pattern or SQL_NTS
schema schema name/pattern or NULL
schemaLen length of schema name/pattern or SQL_NTS
table table name/pattern or NULL
tableLen length of table name/pattern or SQL_NTS
col column name/pattern or NULL
colLen length of column name/pattern or SQL_NTS
Returns:
ODBC error code
Definition at line 9100 of file sqliteodbc.c.

References array_size, colSpec, stmt::dbc, DBC, freerows(), getmd(), mapsqltype(), min, mkresultset(), nomem(), stmt::nowchar, stmt::nrows, stmt::ov3, stmt::rowfree, stmt::rows, setstat(), dbc::sqlite, STMT, stringify, xmalloc, and xstrdup.

Referenced by SQLColumns().

SQLRETURN drvconnect SQLHDBC  dbc,
SQLCHAR *  dsn,
SQLSMALLINT  dsnLen
[static]
 

Internal connect to SQLite database.

Parameters:
dbc database connection handle
dsn DSN string
dsnLen length of DSN string or SQL_NTS
Returns:
ODBC error code
Definition at line 7431 of file sqliteodbc.c.

References DBC, DBC_MAGIC, dbopen(), getbool(), getdsnattr(), dbc::magic, min, dbc::nowchar, ODBC_INI, dbc::ov3, setstatd(), and dbc::sqlite.

Referenced by SQLConnect().

SQLRETURN drvdescribecol SQLHSTMT  stmt,
SQLUSMALLINT  col,
SQLCHAR *  name,
SQLSMALLINT  nameMax,
SQLSMALLINT *  nameLen,
SQLSMALLINT *  type,
SQLUINTEGER *  size,
SQLSMALLINT *  digits,
SQLSMALLINT *  nullable
[static]
 

Internal describe column information.

Parameters:
stmt statement handle
col column number, starting at 1
name buffer for column name
nameMax length of name buffer
nameLen output length of column name
type output SQL type
size output column size
digits output number of digits
nullable output NULL allowed indicator
Returns:
ODBC error code
Definition at line 10522 of file sqliteodbc.c.

References stmt::cols, COL::column, stmt::ncols, stmt::nowchar, stmt::ov3, setstat(), COL::size, STMT, and COL::type.

Referenced by SQLDescribeCol().

SQLRETURN drvdriverconnect SQLHDBC  dbc,
SQLHWND  hwnd,
SQLCHAR *  connIn,
SQLSMALLINT  connInLen,
SQLCHAR *  connOut,
SQLSMALLINT  connOutMax,
SQLSMALLINT *  connOutLen,
SQLUSMALLINT  drvcompl
[static]
 

Internal standalone (w/o driver manager) database connect.

Parameters:
dbc database connection handle
hwnd dummy window handle or NULL
connIn driver connect input string
connInLen length of driver connect input string or SQL_NTS
connOut driver connect output string
connOutMax length of driver connect output string
connOutLen output length of driver connect output string
drvcompl completion type
Returns:
ODBC error code
Definition at line 7614 of file sqliteodbc.c.

References DBC, dbopen(), getdsnattr(), min, ODBC_INI, dbc::ov3, setstatd(), and dbc::sqlite.

Referenced by SQLDriverConnect().

SQLRETURN drvendtran SQLSMALLINT  type,
SQLHANDLE  handle,
SQLSMALLINT  comptype
[static]
 

Internal commit or rollback transaction.

Parameters:
type type of handle
handle HDBC, HENV, or HSTMT handle
comptype SQL_COMMIT or SQL_ROLLBACK
Returns:
ODBC error code
Definition at line 4949 of file sqliteodbc.c.

References DBC, endtran(), and dbc::next.

Referenced by SQLEndTran(), and SQLTransact().

SQLRETURN drverror SQLHENV  env,
SQLHDBC  dbc,
SQLHSTMT  stmt,
SQLCHAR *  sqlState,
SQLINTEGER *  nativeErr,
SQLCHAR *  errmsg,
SQLSMALLINT  errmax,
SQLSMALLINT *  errlen
[static]
 

Internal return last HDBC or HSTMT error message.

Parameters:
env environment handle or NULL
dbc database connection handle or NULL
stmt statement handle or NULL
sqlState output buffer for SQL state
nativeErr output buffer for native error code
errmsg output buffer for error message
errmax length of output buffer for error message
errlen output length of error message
Returns:
ODBC error code
Definition at line 11287 of file sqliteodbc.c.

References DBC, DBC_MAGIC, dbc::logmsg, stmt::logmsg, dbc::magic, min, dbc::naterr, stmt::naterr, dbc::sqlstate, stmt::sqlstate, and STMT.

Referenced by SQLError().

SQLRETURN drvexecute SQLHSTMT  stmt  )  [static]
 

Internal query execution used by SQLExecute() and SQLExecDirect().

Parameters:
stmt statement handle
Returns:
ODBC error code
Definition at line 11646 of file sqliteodbc.c.

References dbc::autocommit, COL::autoinc, stmt::bindparms, stmt::cols, COL::column, stmt::curtype, COL::db, stmt::dbc, DBC, dbc::dbname, dbtracerc, stmt::dcols, stmt::dyncols, fixupdyncols(), freedyncols(), freep(), freeresult(), BINDPARM::inc, BINDPARM::ind, COL::index, dbc::intrans, stmt::isselect, COL::label, BINDPARM::len, BINDPARM::lenp, mkbindcols(), stmt::nbindparms, stmt::ncols, noconn(), nomem(), COL::nosign, stmt::nparams, stmt::nrows, stmt::ov3, BINDPARM::param, BINDPARM::param0, stmt::paramset_count, stmt::paramset_nrows, stmt::paramset_size, COL::prec, stmt::query, stmt::rowfree, stmt::rowp, stmt::rows, COL::scale, setstat(), COL::size, dbc::sqlite, dbc::step_enable, STMT, substparam(), COL::table, COL::type, COL::typename, vm_end(), vm_start(), dbc::vm_stmt, and xmalloc.

Referenced by SQLExecDirect(), SQLExecute(), and SQLPutData().

SQLRETURN drvfetchscroll SQLHSTMT  stmt,
SQLSMALLINT  orient,
SQLINTEGER  offset
[static]
 

Internal fetch function for SQLFetchScroll() and SQLExtendedFetch().

Parameters:
stmt statement handle
orient fetch direction
offset offset for fetch direction
Returns:
ODBC error code
Definition at line 10238 of file sqliteodbc.c.

References stmt::bindcols, stmt::bkmrk, stmt::curtype, stmt::dbc, DBC, dofetchbind(), stmt::nrows, stmt::row_count, stmt::row_count0, stmt::row_status, stmt::row_status0, stmt::rowp, stmt::rows, stmt::rowset_size, setstat(), STMT, stmt::vm, and vm_step().

Referenced by SQLExtendedFetch(), and SQLFetchScroll().

SQLRETURN SQL_API drvforeignkeys SQLHSTMT  stmt,
SQLCHAR *  PKcatalog,
SQLSMALLINT  PKcatalogLen,
SQLCHAR *  PKschema,
SQLSMALLINT  PKschemaLen,
SQLCHAR *  PKtable,
SQLSMALLINT  PKtableLen,
SQLCHAR *  FKcatalog,
SQLSMALLINT  FKcatalogLen,
SQLCHAR *  FKschema,
SQLSMALLINT  FKschemaLen,
SQLCHAR *  FKtable,
SQLSMALLINT  FKtableLen
[static]
 

Internal retrieve information about primary/foreign keys.

Parameters:
stmt statement handle
PKcatalog primary key catalog name/pattern or NULL
PKcatalogLen length of PKcatalog or SQL_NTS
PKschema primary key schema name/pattern or NULL
PKschemaLen length of PKschema or SQL_NTS
PKtable primary key table name/pattern or NULL
PKtableLen length of PKtable or SQL_NTS
FKcatalog foreign key catalog name/pattern or NULL
FKcatalogLen length of FKcatalog or SQL_NTS
FKschema foreign key schema name/pattern or NULL
FKschemaLen length of FKschema or SQL_NTS
FKtable foreign key table name/pattern or NULL
FKtableLen length of FKtable or SQL_NTS
Returns:
ODBC error code
Definition at line 4481 of file sqliteodbc.c.

References array_size, stmt::dbc, DBC, findcol(), fkeySpec, freerows(), min, mkresultset(), stmt::ncols, nomem(), stmt::nrows, stmt::ov3, stmt::rowfree, stmt::rows, setstat(), dbc::sqlite, STMT, stringify, xmalloc, and xstrdup.

Referenced by SQLForeignKeys().

SQLRETURN drvfreeconnect SQLHDBC  dbc  )  [static]
 

Internal free connection (HDBC).

Parameters:
dbc database connection handle
Returns:
ODBC error code
Definition at line 6894 of file sqliteodbc.c.

References DBC, DBC_MAGIC, ENV::dbcs, DEAD_MAGIC, drvrelgpps, dbc::env, ENV_MAGIC, freestmt(), ENV::magic, dbc::magic, dbc::next, dbc::ov3, setstatd(), dbc::sqlite, dbc::stmt, and xfree.

Referenced by SQLFreeConnect(), and SQLFreeHandle().

SQLRETURN drvfreeenv SQLHENV  env  )  [static]
 

Internal free HENV.

Parameters:
env environment handle
Returns:
ODBC error code
Definition at line 6781 of file sqliteodbc.c.

References ENV::dbcs, DEAD_MAGIC, ENV_MAGIC, ENV::magic, and xfree.

Referenced by SQLFreeEnv(), and SQLFreeHandle().

SQLRETURN drvfreestmt SQLHSTMT  stmt,
SQLUSMALLINT  opt
[static]
 

Internal function to perform certain kinds of free/close on STMT.

Parameters:
stmt statement handle
opt SQL_RESET_PARAMS, SQL_UNBIND, SQL_CLOSE, or SQL_DROP
Returns:
ODBC error code
Definition at line 7857 of file sqliteodbc.c.

References freeparams(), freeresult(), freestmt(), stmt::ov3, setstat(), STMT, unbindcols(), and vm_end_if().

Referenced by SQLCancel(), SQLCloseCursor(), SQLFreeHandle(), and SQLFreeStmt().

SQLRETURN drvgetconnectattr SQLHDBC  dbc,
SQLINTEGER  attr,
SQLPOINTER  val,
SQLINTEGER  bufmax,
SQLINTEGER *  buflen
[static]
 

Internal get connect attribute of HDBC.

Parameters:
dbc database connection handle
attr option to be retrieved
val output buffer
bufmax size of output buffer
buflen output length
Returns:
ODBC error code
Definition at line 6968 of file sqliteodbc.c.

References dbc::autocommit, dbc::curtype, DBC, dbc::ov3, setstatd(), and dbc::sqlite.

Referenced by SQLGetConnectAttr().

SQLRETURN drvgetconnectoption SQLHDBC  dbc,
SQLUSMALLINT  opt,
SQLPOINTER  param
[static]
 

Internal get connect option of HDBC.

Parameters:
dbc database connection handle
opt option to be retrieved
param output buffer
Returns:
ODBC error code
Definition at line 7197 of file sqliteodbc.c.

References dbc::autocommit, dbc::curtype, DBC, dbc::ov3, and setstatd().

Referenced by SQLGetConnectOption().

SQLRETURN drvgetcursorname SQLHSTMT  stmt,
SQLCHAR *  cursor,
SQLSMALLINT  buflen,
SQLSMALLINT *  lenp
[static]
 

Internal function to get cursor name of STMT.

Parameters:
stmt statement handle
cursor output buffer
buflen length of output buffer
lenp output length
Returns:
ODBC error code
Definition at line 7921 of file sqliteodbc.c.

References stmt::cursorname, min, and STMT.

Referenced by SQLGetCursorName().

SQLRETURN drvgetdiagrec SQLSMALLINT  htype,
SQLHANDLE  handle,
SQLSMALLINT  recno,
SQLCHAR *  sqlstate,
SQLINTEGER *  nativeerr,
SQLCHAR *  msg,
SQLSMALLINT  buflen,
SQLSMALLINT *  msglen
[static]
 

Internal get error message given handle (HENV, HDBC, or HSTMT).

Parameters:
htype handle type
handle HENV, HDBC, or HSTMT
recno 
sqlstate output buffer for SQL state
nativeerr output buffer of native error code
msg output buffer for error message
buflen length of output buffer
msglen output length
Returns:
ODBC error code
Definition at line 5355 of file sqliteodbc.c.

References DBC, stmt::logmsg, dbc::logmsg, stmt::naterr, dbc::naterr, stmt::sqlstate, dbc::sqlstate, and STMT.

Referenced by SQLGetDiagRec().

SQLRETURN drvgetinfo SQLHDBC  dbc,
SQLUSMALLINT  type,
SQLPOINTER  val,
SQLSMALLINT  valMax,
SQLSMALLINT *  valLen
[static]
 

Internal return information about what this ODBC driver supports.

Parameters:
dbc database connection handle
type type of information to be retrieved
val output buffer
valMax length of output buffer
valLen output length
Returns:
ODBC error code
Definition at line 6066 of file sqliteodbc.c.

References DBC, dbc::dbname, dbc::dsn, dbc::ov3, setstatd(), and strmak.

Referenced by SQLGetInfo().

SQLRETURN drvgetstmtattr SQLHSTMT  stmt,
SQLINTEGER  attr,
SQLPOINTER  val,
SQLINTEGER  bufmax,
SQLINTEGER *  buflen
[static]
 

Internal get option of HSTMT.

Parameters:
stmt statement handle
attr attribute to be retrieved
val output buffer
bufmax length of output buffer
buflen output length
Returns:
ODBC error code
Definition at line 5571 of file sqliteodbc.c.

References stmt::bind_offs, stmt::bind_type, stmt::bkmrk, stmt::curtype, stmt::dbc, DBC, DEAD_MAGIC, drvunimplstmt(), stmt::paramset_size, stmt::parm_oper, stmt::parm_proc, stmt::parm_status, stmt::row_count, stmt::row_status, stmt::rowp, stmt::rowset_size, STMT, dbc::vm_rownum, and dbc::vm_stmt.

Referenced by SQLGetStmtAttr().

SQLRETURN drvgetstmtoption SQLHSTMT  stmt,
SQLUSMALLINT  opt,
SQLPOINTER  param
[static]
 

Internal get option of HSTMT.

Parameters:
stmt statement handle
opt option to be retrieved
param output buffer
Returns:
ODBC error code
Definition at line 5861 of file sqliteodbc.c.

References stmt::curtype, stmt::dbc, DBC, drvunimplstmt(), stmt::rowp, stmt::rowset_size, STMT, dbc::vm_rownum, and dbc::vm_stmt.

Referenced by SQLGetStmtOption().

SQLRETURN drvgettypeinfo SQLHSTMT  stmt,
SQLSMALLINT  sqltype
[static]
 

Internal return data type information.

Parameters:
stmt statement handle
sqltype which type to retrieve
Returns:
ODBC error code
Definition at line 9492 of file sqliteodbc.c.

References array_size, stmt::dbc, DBC, mkresultset(), mktypeinfo(), nomem(), stmt::nowchar, stmt::nrows, stmt::ov3, stmt::rowfree, stmt::rows, STMT, typeinfosort(), typeSpec, and xmalloc.

Referenced by SQLGetTypeInfo().

SQLRETURN drvprepare SQLHSTMT  stmt,
SQLCHAR *  query,
SQLINTEGER  queryLen
[static]
 

Internal query preparation used by SQLPrepare() and SQLExecDirect().

Parameters:
stmt statement handle
query query string
queryLen length of query string or SQL_NTS
Returns:
ODBC error code
Definition at line 11571 of file sqliteodbc.c.

References stmt::dbc, DBC, dbtracerc, fixupsql(), freep(), freeresult(), stmt::isselect, mkbindcols(), stmt::ncols, noconn(), nomem(), stmt::nparams, stmt::ov3, stmt::paramset_count, stmt::parmnames, stmt::query, selcb(), setstat(), dbc::sqlite, STMT, dbc::version, vm_end(), and xmalloc.

Referenced by SQLExecDirect(), and SQLPrepare().

SQLRETURN drvprimarykeys SQLHSTMT  stmt,
SQLCHAR *  cat,
SQLSMALLINT  catLen,
SQLCHAR *  schema,
SQLSMALLINT  schemaLen,
SQLCHAR *  table,
SQLSMALLINT  tableLen
[static]
 

Internal retrieve information about indexed columns.

Parameters:
stmt statement handle
cat catalog name/pattern or NULL
catLen length of catalog name/pattern or SQL_NTS
schema schema name/pattern or NULL
schemaLen length of schema name/pattern or SQL_NTS
table table name/pattern or NULL
tableLen length of table name/pattern or SQL_NTS
Returns:
ODBC error code
Definition at line 3839 of file sqliteodbc.c.

References array_size, stmt::dbc, DBC, findcol(), freerows(), min, mkresultset(), stmt::ncols, nomem(), stmt::nrows, stmt::ov3, pkeySpec, stmt::rowfree, stmt::rows, setstat(), dbc::sqlite, STMT, xmalloc, and xstrdup.

Referenced by SQLPrimaryKeys().

SQLRETURN drvsetconnectattr SQLHDBC  dbc,
SQLINTEGER  attr,
SQLPOINTER  val,
SQLINTEGER  len
[static]
 

Internal set connect attribute of HDBC.

Parameters:
dbc database connection handle
attr option to be set
val option value
len size of option
Returns:
ODBC error code
Definition at line 7120 of file sqliteodbc.c.

References dbc::autocommit, DBC, endtran(), dbc::intrans, setstatd(), vm_end(), and dbc::vm_stmt.

Referenced by SQLSetConnectAttr().

SQLRETURN drvsetconnectoption SQLHDBC  dbc,
SQLUSMALLINT  opt,
SQLUINTEGER  param
[static]
 

Internal set option on HDBC.

Parameters:
dbc database connection handle
opt option to be set
param option value
Returns:
ODBC error code
Definition at line 7316 of file sqliteodbc.c.

References dbc::autocommit, DBC, endtran(), dbc::intrans, setstatd(), vm_end(), and dbc::vm_stmt.

Referenced by SQLSetConnectOption().

SQLRETURN drvsetcursorname SQLHSTMT  stmt,
SQLCHAR *  cursor,
SQLSMALLINT  len
[static]
 

Internal function to set cursor name on STMT.

Parameters:
stmt statement handle
cursor new cursor name
len length of cursor name or SQL_NTS
Returns:
ODBC error code
Definition at line 8014 of file sqliteodbc.c.

References stmt::cursorname, min, stmt::ov3, setstat(), and STMT.

Referenced by SQLSetCursorName().

SQLRETURN drvsetstmtattr SQLHSTMT  stmt,
SQLINTEGER  attr,
SQLPOINTER  val,
SQLINTEGER  buflen
[static]
 

Internal set option on HSTMT.

Parameters:
stmt statement handle
attr attribute to be set
val input buffer (attribute value)
buflen length of input buffer
Returns:
ODBC error code
Definition at line 5707 of file sqliteodbc.c.

References stmt::bind_offs, stmt::bind_type, stmt::bkmrk, stmt::curtype, drvunimplstmt(), freep(), nomem(), stmt::paramset_count, stmt::paramset_size, stmt::parm_oper, stmt::parm_proc, stmt::parm_status, stmt::row_count, stmt::row_status, stmt::row_status0, stmt::row_status1, stmt::rowset_size, setstat(), STMT, and xmalloc.

Referenced by SQLSetStmtAttr().

SQLRETURN drvsetstmtoption SQLHSTMT  stmt,
SQLUSMALLINT  opt,
SQLUINTEGER  param
[static]
 

Internal set option on HSTMT.

Parameters:
stmt statement handle
opt option to be set
param input buffer (option value)
Returns:
ODBC error code
Definition at line 5937 of file sqliteodbc.c.

References stmt::curtype, drvunimplstmt(), freep(), nomem(), stmt::row_status0, stmt::row_status1, stmt::rowset_size, setstat(), STMT, and xmalloc.

Referenced by SQLSetStmtOption().

SQLRETURN drvspecialcolumns SQLHSTMT  stmt,
SQLUSMALLINT  id,
SQLCHAR *  cat,
SQLSMALLINT  catLen,
SQLCHAR *  schema,
SQLSMALLINT  schemaLen,
SQLCHAR *  table,
SQLSMALLINT  tableLen,
SQLUSMALLINT  scope,
SQLUSMALLINT  nullable
[static]
 

Internal retrieve information about indexed columns.

Parameters:
stmt statement handle
id type of information, e.g. best row id
cat catalog name/pattern or NULL
catLen length of catalog name/pattern or SQL_NTS
schema schema name/pattern or NULL
schemaLen length of schema name/pattern or SQL_NTS
table table name/pattern or NULL
tableLen length of table name/pattern or SQL_NTS
scope 
nullable 
Returns:
ODBC error code
Definition at line 4124 of file sqliteodbc.c.

References array_size, stmt::dbc, DBC, findcol(), freep(), freerows(), getmd(), mapsqltype(), min, mkresultset(), stmt::ncols, nomem(), stmt::nowchar, stmt::nrows, stmt::ov3, stmt::rowfree, stmt::rows, scolSpec, setstat(), dbc::sqlite, STMT, stringify, xmalloc, and xstrdup.

Referenced by SQLSpecialColumns().

SQLRETURN drvstatistics SQLHSTMT  stmt,
SQLCHAR *  cat,
SQLSMALLINT  catLen,
SQLCHAR *  schema,
SQLSMALLINT  schemaLen,
SQLCHAR *  table,
SQLSMALLINT  tableLen,
SQLUSMALLINT  itype,
SQLUSMALLINT  resv
[static]
 

Internal return statistic information on table indices.

Parameters:
stmt statement handle
cat catalog name/pattern or NULL
catLen length of catalog name/pattern or SQL_NTS
schema schema name/pattern or NULL
schemaLen length of schema name/pattern or SQL_NTS
table table name/pattern or NULL
tableLen length of table name/pattern or SQL_NTS
itype type of index information
resv reserved
Returns:
ODBC error code
Definition at line 9752 of file sqliteodbc.c.

References array_size, stmt::dbc, DBC, findcol(), freerows(), min, mkresultset(), stmt::ncols, nomem(), stmt::nrows, stmt::ov3, stmt::rowfree, stmt::rows, setstat(), dbc::sqlite, statSpec, STMT, stringify, xmalloc, and xstrdup.

Referenced by SQLStatistics().

SQLRETURN drvtables SQLHSTMT  stmt,
SQLCHAR *  cat,
SQLSMALLINT  catLen,
SQLCHAR *  schema,
SQLSMALLINT  schemaLen,
SQLCHAR *  table,
SQLSMALLINT  tableLen,
SQLCHAR *  type,
SQLSMALLINT  typeLen
[static]
 

Retrieve information on tables and/or views.

Parameters:
stmt statement handle
cat catalog name/pattern or NULL
catLen length of catalog name/pattern or SQL_NTS
schema schema name/pattern or NULL
schemaLen length of schema name/pattern or SQL_NTS
table table name/pattern or NULL
tableLen length of table name/pattern or SQL_NTS
type types of tables string or NULL
typeLen length of types of tables string or SQL_NTS
Returns:
ODBC error code
Definition at line 8790 of file sqliteodbc.c.

References array_size, stmt::dbc, DBC, dbc::dbname, freeresult(), min, mkresultset(), stmt::ncols, nomem(), stmt::nrows, stmt::rowfree, stmt::rowp, stmt::rows, dbc::sqlite, STMT, tableSpec, TOLOWER(), and xmalloc.

Referenced by SQLTables().

SQLRETURN drvunimpldbc HDBC  dbc  )  [static]
 

Report IM001 (not implemented) SQL error code for HDBC.

Parameters:
dbc database connection handle
Returns:
ODBC error code
Definition at line 715 of file sqliteodbc.c.

References DBC, and setstatd().

Referenced by SQLBrowseConnect().

SQLRETURN drvunimplstmt HSTMT  stmt  )  [static]
 

Report IM001 (not implemented) SQL error code for HSTMT.

Parameters:
stmt statement handle
Returns:
ODBC error code
Definition at line 734 of file sqliteodbc.c.

References setstat(), and STMT.

Referenced by drvgetstmtattr(), drvgetstmtoption(), drvsetstmtattr(), drvsetstmtoption(), SQLBulkOperations(), SQLParamOptions(), SQLSetPos(), and SQLSetScrollOptions().

SQLRETURN endtran DBC d,
SQLSMALLINT  comptype
[static]
 

Internal commit or rollback transaction.

Parameters:
d database connection pointer
comptype type of transaction's end, SQL_COMMIT or SQL_ROLLBACK
Returns:
ODBC error code
Definition at line 4890 of file sqliteodbc.c.

References dbc::autocommit, DBC, dbtracerc, dbc::intrans, dbc::ov3, setstatd(), and dbc::sqlite.

Referenced by drvendtran(), drvsetconnectattr(), and drvsetconnectoption().

int findcol char **  cols,
int  ncols,
char *  name
[static]
 

Find column given name in string array.

Parameters:
cols string array
ncols number of strings
name column name
Returns:
>= 0 on success, -1 on error
Definition at line 1486 of file sqliteodbc.c.

Referenced by drvforeignkeys(), drvprimarykeys(), drvspecialcolumns(), drvstatistics(), and fixupdyncols().

void fixupdyncols STMT s,
sqlite *  sqlite,
const char **  types
[static]
 

Fixup column information for a running statement.

Parameters:
s statement to get fresh column information
sqlite SQLite database handle
types column types or NULL
The column labels get the table names stripped when there's more than one column and all table names are identical.

The "dyncols" field of STMT is filled with column information obtained by SQLite "PRAGMA table_info" for each column whose table name is known. If the types are already present as with SQLite 2.5.7 this information is used instead. Definition at line 1518 of file sqliteodbc.c.

References array_size, COL::autoinc, COL::column, stmt::dcols, stmt::dyncols, findcol(), freep(), getmd(), COL::label, mapsqltype(), COL::nosign, stmt::nowchar, stmt::ov3, COL::size, STMT, COL::table, COL::type, COL::typename, xmalloc, and xstrdup.

Referenced by drvexecute(), selcb(), and vm_step().

char* fixupsql char *  sql,
int  sqlLen,
int *  nparam,
int *  isselect,
char **  errmsg,
int  version,
char ***  namepp
[static]
 

Fixup query string with optional parameter markers.

Parameters:
sql original query string
sqlLen length of query string or SQL_NTS
nparam output number of parameters
isselect output indicator for SELECT statement
errmsg output error message
version SQLite version information
namepp pointer to parameter names array
Returns:
newly allocated string containing query string for SQLite or NULL
Definition at line 1319 of file sqliteodbc.c.

References freep(), ISIDCHAR, ISSPACE, and xmalloc.

Referenced by drvprepare().

void freedyncols STMT s  )  [static]
 

Free dynamically allocated column descriptions of STMT.

Parameters:
s statement pointer
Definition at line 8158 of file sqliteodbc.c.

References stmt::cols, stmt::dcols, stmt::dyncols, freep(), stmt::ncols, STMT, and COL::typename.

Referenced by drvexecute(), freeresult(), selcb(), and vm_step().

void freep void *  x  )  [static]
 

Free memory given pointer to memory pointer.

Parameters:
x pointer to pointer to memory to be free'd
Definition at line 752 of file sqliteodbc.c.

References xfree.

Referenced by dbopen(), drvexecute(), drvprepare(), drvsetstmtattr(), drvsetstmtoption(), drvspecialcolumns(), fixupdyncols(), fixupsql(), freedyncols(), freeparams(), freeresult(), freerows(), freestmt(), getrowdata(), SQLDisconnect(), and SQLPutData().

SQLRETURN freeparams STMT s  )  [static]
 

Clear out parameter bindings, if any.

Parameters:
s statement pointer
Definition at line 3008 of file sqliteodbc.c.

References stmt::bindparms, freep(), BINDPARM::ind, stmt::nbindparms, BINDPARM::param, and STMT.

Referenced by drvfreestmt(), and freestmt().

void freeresult STMT s,
int  clrcols
[static]
 

Free statement's result.

Parameters:
s statement pointer
clrcols flag to clear column information
The result rows are free'd using the rowfree function pointer. If clrcols is greater than zero, then column bindings and dynamic column descriptions are free'd. If clrcols is less than zero, then dynamic column descriptions are free'd. Definition at line 8178 of file sqliteodbc.c.

References stmt::bindcols, stmt::cols, freedyncols(), freep(), stmt::nbindcols, stmt::ncols, stmt::nrows, stmt::rowfree, stmt::rows, and STMT.

Referenced by drvexecute(), drvfreestmt(), drvprepare(), drvtables(), freestmt(), mkresultset(), and vm_step().

void freerows char **  rowp  )  [static]
 

Free counted array of char pointers.

Parameters:
rowp pointer to char pointer array
The -1-th element of the array holds the array size. All non-NULL pointers of the array and then the array itself are free'd. Definition at line 1024 of file sqliteodbc.c.

References freep().

Referenced by drvcolumns(), drvforeignkeys(), drvprimarykeys(), drvspecialcolumns(), drvstatistics(), and vm_step().

SQLRETURN freestmt SQLHSTMT  stmt  )  [static]
 

Definition at line 7743 of file sqliteodbc.c.

References stmt::bindparms, stmt::dbc, DBC, DBC_MAGIC, freep(), freeparams(), freeresult(), dbc::magic, stmt::next, stmt::query, stmt::row_status0, stmt::row_status1, stmt::rowset_size, dbc::stmt, STMT, and xfree.

Referenced by drvfreeconnect(), and drvfreestmt().

SQLRETURN freestmt HSTMT  stmt  )  [static]
 

Internal free function for HSTMT.

Parameters:
stmt statement handle
Returns:
ODBC error code

int getbool char *  string  )  [static]
 

Get boolean flag from string.

Parameters:
string string to be inspected
Returns:
true or false
Definition at line 2113 of file sqliteodbc.c.

Referenced by dbopen(), and drvconnect().

int getdsnattr char *  dsn,
char *  attr,
char *  out,
int  outLen
[static]
 

Handling of SQLConnect() connection attributes for standalone operation without driver manager.

Parameters:
dsn DSN/driver connection string
attr attribute string to be retrieved
out output buffer
outLen length of output buffer
Returns:
true or false
Definition at line 7385 of file sqliteodbc.c.

References min.

Referenced by drvconnect(), and drvdriverconnect().

void getmd const char *  typename,
int  sqltype,
int *  mp,
int *  dp
[static]
 

Get maximum display size and number of decimal points from field type specification.

Parameters:
typename field type specification
sqltype target SQL data type
mp pointer to maximum display size or NULL
dp pointer to number of decimal points or NULL
Definition at line 1162 of file sqliteodbc.c.

Referenced by drvcolumns(), drvspecialcolumns(), and fixupdyncols().

int getmdays int  year,
int  month
[static]
 

Return number of month days.

Parameters:
year 
month 1..12
Returns:
number of month days or 0
Definition at line 1687 of file sqliteodbc.c.

Referenced by str2date(), and str2timestamp().

SQLRETURN getrowdata STMT s,
SQLUSMALLINT  col,
SQLSMALLINT  otype,
SQLPOINTER  val,
SQLINTEGER  len,
SQLINTEGER *  lenp,
int  partial
[static]
 

Internal function to retrieve row data, used by SQLFetch() and friends and SQLGetData().

Parameters:
s statement pointer
col column number, 0 based
otype output data type
val output buffer
len length of output buffer
lenp output length
partial flag for partial data retrieval
Returns:
ODBC error code
Definition at line 8277 of file sqliteodbc.c.

References stmt::bindcols, stmt::cols, freep(), BINDCOL::lenp, ln_strtod(), mapdeftype(), max, min, stmt::ncols, nomem(), COL::nosign, stmt::nowchar, stmt::nrows, BINDCOL::offs, stmt::ov3, stmt::rowp, stmt::rows, setstat(), STMT, str2date(), str2time(), str2timestamp(), COL::type, and xmalloc.

Referenced by dofetchbind(), and SQLGetData().

void ln_sprintfg char *  buf,
double  value
[static]
 

Internal locale neutral sprintf("%g") function.

Parameters:
buf pointer to string
value double value
Definition at line 843 of file sqliteodbc.c.

Referenced by substparam().

double ln_strtod const char *  data,
char **  endp
[static]
 

Internal locale neutral strtod function.

Parameters:
data pointer to string
endp pointer for ending character
Returns:
double value
Definition at line 802 of file sqliteodbc.c.

Referenced by getrowdata().

int mapdeftype int  type,
int  stype,
int  nosign,
int  nowchar
[static]
 

Map SQL_C_DEFAULT to proper C type.

Parameters:
type input C type
stype input SQL type
nosign 0=signed, 0>unsigned, 0<undefined
nowchar when compiled with SQLITE_UTF8 don't use WCHAR
Returns:
C type
Definition at line 1231 of file sqliteodbc.c.

Referenced by getrowdata(), SQLBindCol(), SQLPutData(), and substparam().

int mapsqltype const char *  typename,
int *  nosign,
int  ov3,
int  nowchar
[static]
 

Map SQL field type from string to ODBC integer type code.

Parameters:
typename field type string
nosign pointer to indicator for unsigned field or NULL
ov3 boolean, true for SQL_OV_ODBC3
nowchar boolean, for SQLITE_UTF8 don't use WCHAR
Returns:
SQL data type
Definition at line 1049 of file sqliteodbc.c.

References TOLOWER(), xfree, and xmalloc.

Referenced by drvcolumns(), drvspecialcolumns(), and fixupdyncols().

SQLRETURN mkbindcols STMT s,
int  ncols
[static]
 

Reallocate space for bound columns.

Parameters:
s statement pointer
ncols number of columns
Returns:
ODBC error code
Definition at line 8230 of file sqliteodbc.c.

References stmt::bindcols, BINDCOL::index, BINDCOL::lenp, BINDCOL::max, stmt::nbindcols, nomem(), BINDCOL::offs, STMT, BINDCOL::type, unbindcols(), BINDCOL::valp, xmalloc, and xrealloc.

Referenced by drvexecute(), drvprepare(), mkresultset(), SQLBindCol(), and vm_step().

SQLRETURN mkresultset HSTMT  stmt,
COL colspec,
int  ncols
[static]
 

Setup empty result set from constant column specification.

Parameters:
stmt statement handle
colspec column specification array
ncols number of columns
Returns:
ODBC error code
Definition at line 3656 of file sqliteodbc.c.

References stmt::cols, stmt::dbc, DBC, freeresult(), mkbindcols(), stmt::ncols, noconn(), stmt::nrows, stmt::rowp, dbc::sqlite, STMT, and vm_end_if().

Referenced by drvcolumns(), drvforeignkeys(), drvgettypeinfo(), drvprimarykeys(), drvspecialcolumns(), drvstatistics(), drvtables(), SQLColumnPrivileges(), SQLProcedureColumns(), SQLProcedures(), and SQLTablePrivileges().

void mktypeinfo STMT s,
int  row,
char *  typename,
int  type,
int  tind
[static]
 

Internal function to build up data type information as row in result set.

Parameters:
s statement pointer
row row number
typename name of type
type integer SQL type
tind type index
Definition at line 9364 of file sqliteodbc.c.

References array_size, stmt::rows, STMT, stringify, and typeSpec.

Referenced by drvgettypeinfo().

SQLRETURN noconn STMT s  )  [static]
 

Report S1000 (not connected) SQL error given STMT.

Parameters:
s statement pointer
Returns:
ODBC error code
Definition at line 780 of file sqliteodbc.c.

References stmt::ov3, setstat(), and STMT.

Referenced by drvexecute(), drvprepare(), and mkresultset().

SQLRETURN nomem STMT s  )  [static]
 

Report S1000 (out of memory) SQL error given STMT.

Parameters:
s statement pointer
Returns:
ODBC error code
Definition at line 767 of file sqliteodbc.c.

References stmt::ov3, setstat(), and STMT.

Referenced by drvbindparam(), drvcolumns(), drvexecute(), drvforeignkeys(), drvgettypeinfo(), drvprepare(), drvprimarykeys(), drvsetstmtattr(), drvsetstmtoption(), drvspecialcolumns(), drvstatistics(), drvtables(), getrowdata(), mkbindcols(), SQLPutData(), substparam(), vm_start(), and vm_step().

int selcb void *  arg,
int  ncols,
char **  values,
char **  cols
[static]
 

SQLite callback during drvprepare(), used to collect column information.

Parameters:
arg user data, actually a statement pointer
ncols number of columns
values value string array
cols column name string array
Returns:
always 1 to abort sqlite_exec()
Definition at line 11497 of file sqliteodbc.c.

References COL::autoinc, stmt::cols, COL::column, COL::db, stmt::dbc, DBC, stmt::dcols, stmt::dyncols, fixupdyncols(), freedyncols(), COL::index, COL::label, stmt::ncols, COL::nosign, COL::prec, COL::scale, COL::size, dbc::sqlite, STMT, COL::table, COL::type, COL::typename, and xmalloc.

Referenced by drvprepare().

int setsqliteopts sqlite *  x,
DBC d
[static]
 

Set SQLite options (PRAGMAs) given SQLite handle.

Parameters:
x SQLite database handle
d DBC pointer
Returns:
SQLite error code
"full_column_names" is always turned on to get the table names in column labels. "count_changes" is always turned on to get the number of affected rows for INSERTs et.al. "empty_result_callbacks" is always turned on to get column labels even when no rows are returned. Starting from SQLite 2.6.0 data types are reported for callback functions when the "show_datatypes" pragma is asserted. Definition at line 936 of file sqliteodbc.c.

References busy_handler(), DBC, and time_func().

Referenced by dbopen().

void setstat STMT s,
int  naterr,
char *  msg,
char *  st,
  ...
[static]
 

Set error message and SQL state on statement.

Parameters:
s statement pointer
naterr native error code
msg error message
st SQL state
Definition at line 682 of file sqliteodbc.c.

References STMT.

Referenced by drvbindparam(), drvcolattribute(), drvcolattributes(), drvcolumns(), drvdescribecol(), drvexecute(), drvfetchscroll(), drvforeignkeys(), drvfreestmt(), drvprepare(), drvprimarykeys(), drvsetcursorname(), drvsetstmtattr(), drvsetstmtoption(), drvspecialcolumns(), drvstatistics(), drvunimplstmt(), getrowdata(), noconn(), nomem(), SQLBindCol(), SQLDescribeParam(), SQLGetData(), SQLNativeSql(), SQLPutData(), substparam(), vm_start(), and vm_step().

void setstatd DBC d,
int  naterr,
char *  msg,
char *  st,
  ...
[static]
 

Set error message and SQL state on DBC.

Parameters:
d database connection pointer
naterr native error code
msg error message
st SQL state
Definition at line 642 of file sqliteodbc.c.

References DBC.

Referenced by dbopen(), drvconnect(), drvdriverconnect(), drvfreeconnect(), drvgetconnectattr(), drvgetconnectoption(), drvgetinfo(), drvsetconnectattr(), drvsetconnectoption(), drvunimpldbc(), endtran(), and SQLDisconnect().

SQLRETURN SQL_API SQLAllocConnect SQLHENV  env,
SQLHDBC *  dbc
 

Allocate HDBC.

Parameters:
env environment handle
dbc pointer to database connection handle
Returns:
ODBC error code
Definition at line 6882 of file sqliteodbc.c.

References drvallocconnect().

SQLRETURN SQL_API SQLAllocEnv SQLHENV *  env  ) 
 

Allocate HENV.

Parameters:
env pointer to environment handle
Returns:
ODBC error code
Definition at line 6769 of file sqliteodbc.c.

References drvallocenv().

SQLRETURN SQL_API SQLAllocHandle SQLSMALLINT  type,
SQLHANDLE  input,
SQLHANDLE *  output
 

Allocate a HENV, HDBC, or HSTMT handle.

Parameters:
type handle type
input input handle (HENV, HDBC)
output pointer to output handle (HENV, HDBC, HSTMT)
Returns:
ODBC error code
Definition at line 8104 of file sqliteodbc.c.

References drvallocconnect(), drvallocenv(), drvallocstmt(), ENV_MAGIC, ENV::magic, and ENV::ov3.

SQLRETURN SQL_API SQLAllocStmt SQLHDBC  dbc,
SQLHSTMT *  stmt
 

Allocate HSTMT given HDBC.

Parameters:
dbc database connection handle
stmt pointer to statement handle
Returns:
ODBC error code
Definition at line 7844 of file sqliteodbc.c.

References drvallocstmt().

SQLRETURN SQL_API SQLBindCol SQLHSTMT  stmt,
SQLUSMALLINT  col,
SQLSMALLINT  type,
SQLPOINTER  val,
SQLINTEGER  max,
SQLINTEGER *  lenp
 

Bind C variable to column of result set.

Parameters:
stmt statement handle
col column number, starting at 1
type output type
val output buffer
max length of output buffer
lenp output length pointer
Returns:
ODBC error code
Definition at line 8679 of file sqliteodbc.c.

References stmt::bindcols, stmt::bkmrk, stmt::bkmrkcol, stmt::cols, BINDCOL::lenp, mapdeftype(), max, BINDCOL::max, mkbindcols(), stmt::nowchar, BINDCOL::offs, stmt::ov3, setstat(), STMT, COL::type, BINDCOL::type, and BINDCOL::valp.

SQLRETURN SQL_API SQLBindParam SQLHSTMT  stmt,
SQLUSMALLINT  pnum,
SQLSMALLINT  vtype,
SQLSMALLINT  ptype,
SQLUINTEGER  lenprec,
SQLSMALLINT  scale,
SQLPOINTER  val,
SQLINTEGER *  lenp
 

Bind parameter on HSTMT.

Parameters:
stmt statement handle
pnum parameter number, starting at 1
vtype input/output type of parameter
ptype 
lenprec 
scale 
val pointer to host variable
lenp output length pointer
Returns:
ODBC error code
Definition at line 3389 of file sqliteodbc.c.

References drvbindparam().

SQLRETURN SQL_API SQLBindParameter SQLHSTMT  stmt,
SQLUSMALLINT  pnum,
SQLSMALLINT  iotype,
SQLSMALLINT  buftype,
SQLSMALLINT  ptype,
SQLUINTEGER  coldef,
SQLSMALLINT  scale,
SQLPOINTER  data,
SQLINTEGER  buflen,
SQLINTEGER *  len
 

Bind parameter on HSTMT.

Parameters:
stmt statement handle
pnum parameter number, starting at 1
iotype input/output type of parameter
buftype type of host variable
ptype 
coldef 
scale 
data pointer to host variable
buflen length of host variable
len output length pointer
Returns:
ODBC error code
Definition at line 3366 of file sqliteodbc.c.

References drvbindparam().

SQLRETURN SQL_API SQLBrowseConnect SQLHDBC  dbc,
SQLCHAR *  connin,
SQLSMALLINT  conninLen,
SQLCHAR *  connout,
SQLSMALLINT  connoutMax,
SQLSMALLINT *  connoutLen
 

Function not implemented.

Definition at line 2523 of file sqliteodbc.c.

References drvunimpldbc().

SQLRETURN SQL_API SQLBulkOperations SQLHSTMT  stmt,
SQLSMALLINT  oper
 

Function not implemented.

Definition at line 2444 of file sqliteodbc.c.

References drvunimplstmt().

SQLRETURN SQL_API SQLCancel SQLHSTMT  stmt  ) 
 

Cancel HSTMT closing cursor.

Parameters:
stmt statement handle
Returns:
ODBC error code
Definition at line 7906 of file sqliteodbc.c.

References drvfreestmt().

SQLRETURN SQL_API SQLCloseCursor SQLHSTMT  stmt  ) 
 

Close open cursor.

Parameters:
stmt statement handle
Returns:
ODBC error code
Definition at line 8088 of file sqliteodbc.c.

References drvfreestmt().

SQLRETURN SQL_API SQLColAttribute SQLHSTMT  stmt,
SQLUSMALLINT  col,
SQLUSMALLINT  id,
SQLPOINTER  val,
SQLSMALLINT  valMax,
SQLSMALLINT *  valLen,
SQLPOINTER  val2
 

Retrieve column attributes.

Parameters:
stmt statement handle
col column number, starting at 1
id attribute id
val output buffer
valMax length of output buffer
valLen output length
val2 integer output buffer
Returns:
ODBC error code
Definition at line 11208 of file sqliteodbc.c.

References drvcolattribute().

SQLRETURN SQL_API SQLColAttributes SQLHSTMT  stmt,
SQLUSMALLINT  col,
SQLUSMALLINT  id,
SQLPOINTER  val,
SQLSMALLINT  valMax,
SQLSMALLINT *  valLen,
SQLINTEGER *  val2
 

Retrieve column attributes.

Parameters:
stmt statement handle
col column number, starting at 1
id attribute id
val output buffer
valMax length of output buffer
valLen output length
val2 integer output buffer
Returns:
ODBC error code
Definition at line 10910 of file sqliteodbc.c.

References drvcolattributes().

SQLRETURN SQL_API SQLColumnPrivileges SQLHSTMT  stmt,
SQLCHAR *  catalog,
SQLSMALLINT  catalogLen,
SQLCHAR *  schema,
SQLSMALLINT  schemaLen,
SQLCHAR *  table,
SQLSMALLINT  tableLen,
SQLCHAR *  column,
SQLSMALLINT  columnLen
 

Retrieve privileges on columns.

Parameters:
stmt statement handle
catalog catalog name/pattern or NULL
catalogLen length of catalog name/pattern or SQL_NTS
schema schema name/pattern or NULL
schemaLen length of schema name/pattern or SQL_NTS
table table name/pattern or NULL
tableLen length of table name/pattern or SQL_NTS
column column name or NULL
columnLen length of column name or SQL_NTS
Returns:
ODBC error code
Definition at line 3775 of file sqliteodbc.c.

References array_size, colPrivSpec, and mkresultset().

SQLRETURN SQL_API SQLColumns SQLHSTMT  stmt,
SQLCHAR *  cat,
SQLSMALLINT  catLen,
SQLCHAR *  schema,
SQLSMALLINT  schemaLen,
SQLCHAR *  table,
SQLSMALLINT  tableLen,
SQLCHAR *  col,
SQLSMALLINT  colLen
 

Retrieve column information on table.

Parameters:
stmt statement handle
cat catalog name/pattern or NULL
catLen length of catalog name/pattern or SQL_NTS
schema schema name/pattern or NULL
schemaLen length of schema name/pattern or SQL_NTS
table table name/pattern or NULL
tableLen length of table name/pattern or SQL_NTS
col column name/pattern or NULL
colLen length of column name/pattern or SQL_NTS
Returns:
ODBC error code
Definition at line 9256 of file sqliteodbc.c.

References drvcolumns().

SQLRETURN SQL_API SQLConnect SQLHDBC  dbc,
SQLCHAR *  dsn,
SQLSMALLINT  dsnLen,
SQLCHAR *  uid,
SQLSMALLINT  uidLen,
SQLCHAR *  pass,
SQLSMALLINT  passLen
 

Connect to SQLite database.

Parameters:
dbc database connection handle
dsn DSN string
dsnLen length of DSN string or SQL_NTS
uid user id string or NULL
uidLen length of user id string or SQL_NTS
pass password string or NULL
passLen length of password string or SQL_NTS
Returns:
ODBC error code
Definition at line 7520 of file sqliteodbc.c.

References drvconnect().

SQLRETURN SQL_API SQLCopyDesc SQLHDESC  source,
SQLHDESC  target
 

Function not implemented.

Definition at line 5017 of file sqliteodbc.c.

SQLRETURN SQL_API SQLDataSources SQLHENV  env,
SQLUSMALLINT  dir,
SQLCHAR *  srvname,
SQLSMALLINT  buflen1,
SQLSMALLINT *  lenp1,
SQLCHAR *  desc,
SQLSMALLINT  buflen2,
SQLSMALLINT *  lenp2
 

Function not implemented.

Definition at line 2455 of file sqliteodbc.c.

SQLRETURN SQL_API SQLDescribeCol SQLHSTMT  stmt,
SQLUSMALLINT  col,
SQLCHAR *  name,
SQLSMALLINT  nameMax,
SQLSMALLINT *  nameLen,
SQLSMALLINT *  type,
SQLUINTEGER *  size,
SQLSMALLINT *  digits,
SQLSMALLINT *  nullable
 

Describe column information.

Parameters:
stmt statement handle
col column number, starting at 1
name buffer for column name
nameMax length of name buffer
nameLen output length of column name
type output SQL type
size output column size
digits output number of digits
nullable output NULL allowed indicator
Returns:
ODBC error code
Definition at line 10604 of file sqliteodbc.c.

References drvdescribecol().

SQLRETURN SQL_API SQLDescribeParam SQLHSTMT  stmt,
UWORD  pnum,
SWORD *  dtype,
UDWORD *  size,
SWORD *  decdigits,
SWORD *  nullable
 

Return information about parameter.

Parameters:
stmt statement handle
pnum parameter number, starting at 1
dtype output type indicator
size output size indicator
decdigits output number of digits
nullable output NULL allowed indicator
Returns:
ODBC error code
Definition at line 3464 of file sqliteodbc.c.

References stmt::nowchar, stmt::nparams, stmt::ov3, setstat(), and STMT.

SQLRETURN SQL_API SQLDisconnect SQLHDBC  dbc  ) 
 

Disconnect given HDBC.

Parameters:
dbc database connection handle
Returns:
ODBC error code
Definition at line 7571 of file sqliteodbc.c.

References DBC, DBC_MAGIC, dbc::dbname, dbc::dsn, freep(), dbc::intrans, dbc::magic, setstatd(), dbc::sqlite, vm_end(), and dbc::vm_stmt.

SQLRETURN SQL_API SQLDriverConnect SQLHDBC  dbc,
SQLHWND  hwnd,
SQLCHAR *  connIn,
SQLSMALLINT  connInLen,
SQLCHAR *  connOut,
SQLSMALLINT  connOutMax,
SQLSMALLINT *  connOutLen,
SQLUSMALLINT  drvcompl
 

Connect using a driver connection string.

Parameters:
dbc database connection handle
hwnd parent window handle
connIn driver connect input string
connInLen length of driver connect input string or SQL_NTS
connOut driver connect output string
connOutMax length of driver connect output string
connOutLen output length of driver connect output string
drvcompl completion type
Returns:
ODBC error code
Definition at line 12544 of file sqliteodbc.c.

References drvdriverconnect().

SQLRETURN SQL_API SQLDrivers SQLHENV  env,
SQLUSMALLINT  dir,
SQLCHAR *  drvdesc,
SQLSMALLINT  descmax,
SQLSMALLINT *  desclenp,
SQLCHAR *  drvattr,
SQLSMALLINT  attrmax,
SQLSMALLINT *  attrlenp
 

Function not implemented.

Definition at line 2489 of file sqliteodbc.c.

SQLRETURN SQL_API SQLEndTran SQLSMALLINT  type,
SQLHANDLE  handle,
SQLSMALLINT  comptype
 

Commit or rollback transaction.

Parameters:
type type of handle
handle HDBC, HENV, or HSTMT handle
comptype SQL_COMMIT or SQL_ROLLBACK
Returns:
ODBC error code
Definition at line 4990 of file sqliteodbc.c.

References drvendtran().

SQLRETURN SQL_API SQLError SQLHENV  env,
SQLHDBC  dbc,
SQLHSTMT  stmt,
SQLCHAR *  sqlState,
SQLINTEGER *  nativeErr,
SQLCHAR *  errmsg,
SQLSMALLINT  errmax,
SQLSMALLINT *  errlen
 

Return last HDBC or HSTMT error message.

Parameters:
env environment handle or NULL
dbc database connection handle or NULL
stmt statement handle or NULL
sqlState output buffer for SQL state
nativeErr output buffer for native error code
errmsg output buffer for error message
errmax length of output buffer for error message
errlen output length of error message
Returns:
ODBC error code
Definition at line 11388 of file sqliteodbc.c.

References drverror().

SQLRETURN SQL_API SQLExecDirect SQLHSTMT  stmt,
SQLCHAR *  query,
SQLINTEGER  queryLen
 

Execute query directly.

Parameters:
stmt statement handle
query query string
queryLen length of query string or SQL_NTS
Returns:
ODBC error code
Definition at line 11924 of file sqliteodbc.c.

References drvexecute(), and drvprepare().

SQLRETURN SQL_API SQLExecute SQLHSTMT  stmt  ) 
 

Execute query.

Parameters:
stmt statement handle
Returns:
ODBC error code
Definition at line 11909 of file sqliteodbc.c.

References drvexecute().

SQLRETURN SQL_API SQLExtendedFetch SQLHSTMT  stmt,
SQLUSMALLINT  orient,
SQLINTEGER  offset,
SQLUINTEGER *  rowcount,
SQLUSMALLINT *  rowstatus
 

Fetch result row with scrolling and row status.

Parameters:
stmt statement handle
orient fetch direction
offset offset for fetch direction
rowcount output number of fetched rows
rowstatus array for row stati
Returns:
ODBC error code
Definition at line 10437 of file sqliteodbc.c.

References drvfetchscroll(), stmt::row_count0, stmt::row_status, stmt::row_status0, stmt::rowset_size, and STMT.

SQLRETURN SQL_API SQLFetch SQLHSTMT  stmt  ) 
 

Fetch next result row.

Parameters:
stmt statement handle
Returns:
ODBC error code
Definition at line 10148 of file sqliteodbc.c.

References stmt::bindcols, stmt::dbc, DBC, dofetchbind(), stmt::nrows, stmt::row_count, stmt::row_count0, stmt::row_status, stmt::row_status0, stmt::rowp, stmt::rows, stmt::rowset_size, STMT, stmt::vm, and vm_step().

SQLRETURN SQL_API SQLFetchScroll SQLHSTMT  stmt,
SQLSMALLINT  orient,
SQLINTEGER  offset
 

Fetch result row with scrolling.

Parameters:
stmt statement handle
orient fetch direction
offset offset for fetch direction
Returns:
ODBC error code
Definition at line 10421 of file sqliteodbc.c.

References drvfetchscroll().

SQLRETURN SQL_API SQLForeignKeys SQLHSTMT  stmt,
SQLCHAR *  PKcatalog,
SQLSMALLINT  PKcatalogLen,
SQLCHAR *  PKschema,
SQLSMALLINT  PKschemaLen,
SQLCHAR *  PKtable,
SQLSMALLINT  PKtableLen,
SQLCHAR *  FKcatalog,
SQLSMALLINT  FKcatalogLen,
SQLCHAR *  FKschema,
SQLSMALLINT  FKschemaLen,
SQLCHAR *  FKtable,
SQLSMALLINT  FKtableLen
 

Retrieve information about primary/foreign keys.

Parameters:
stmt statement handle
PKcatalog primary key catalog name/pattern or NULL
PKcatalogLen length of PKcatalog or SQL_NTS
PKschema primary key schema name/pattern or NULL
PKschemaLen length of PKschema or SQL_NTS
PKtable primary key table name/pattern or NULL
PKtableLen length of PKtable or SQL_NTS
FKcatalog foreign key catalog name/pattern or NULL
FKcatalogLen length of FKcatalog or SQL_NTS
FKschema foreign key schema name/pattern or NULL
FKschemaLen length of FKschema or SQL_NTS
FKtable foreign key table name/pattern or NULL
FKtableLen length of FKtable or SQL_NTS
Returns:
ODBC error code
Definition at line 4778 of file sqliteodbc.c.

References drvforeignkeys().

SQLRETURN SQL_API SQLFreeConnect SQLHDBC  dbc  ) 
 

Free connection (HDBC).

Parameters:
dbc database connection handle
Returns:
ODBC error code
Definition at line 6952 of file sqliteodbc.c.

References drvfreeconnect().

SQLRETURN SQL_API SQLFreeEnv SQLHENV  env  ) 
 

Free HENV.

Parameters:
env environment handle
Returns:
ODBC error code
Definition at line 6807 of file sqliteodbc.c.

References drvfreeenv().

SQLRETURN SQL_API SQLFreeHandle SQLSMALLINT  type,
SQLHANDLE  h
 

Free a HENV, HDBC, or HSTMT handle.

Parameters:
type handle type
h handle (HENV, HDBC, or HSTMT)
Returns:
ODBC error code
Definition at line 8138 of file sqliteodbc.c.

References drvfreeconnect(), drvfreeenv(), and drvfreestmt().

SQLRETURN SQL_API SQLFreeStmt SQLHSTMT  stmt,
SQLUSMALLINT  opt
 

Free HSTMT.

Parameters:
stmt statement handle
opt SQL_RESET_PARAMS, SQL_UNBIND, SQL_CLOSE, or SQL_DROP
Returns:
ODBC error code
Definition at line 7894 of file sqliteodbc.c.

References drvfreestmt().

SQLRETURN SQL_API SQLGetConnectAttr SQLHDBC  dbc,
SQLINTEGER  attr,
SQLPOINTER  val,
SQLINTEGER  bufmax,
SQLINTEGER *  buflen
 

Get connect attribute of HDBC.

Parameters:
dbc database connection handle
attr option to be retrieved
val output buffer
bufmax size of output buffer
buflen output length
Returns:
ODBC error code
Definition at line 7084 of file sqliteodbc.c.

References drvgetconnectattr().

SQLRETURN SQL_API SQLGetConnectOption SQLHDBC  dbc,
SQLUSMALLINT  opt,
SQLPOINTER  param
 

Get connect option of HDBC.

Parameters:
dbc database connection handle
opt option to be retrieved
param output buffer
Returns:
ODBC error code
Definition at line 7285 of file sqliteodbc.c.

References drvgetconnectoption().

SQLRETURN SQL_API SQLGetCursorName SQLHSTMT  stmt,
SQLCHAR *  cursor,
SQLSMALLINT  buflen,
SQLSMALLINT *  lenp
 

Get cursor name of STMT.

Parameters:
stmt statement handle
cursor output buffer
buflen length of output buffer
lenp output length
Returns:
ODBC error code
Definition at line 7957 of file sqliteodbc.c.

References drvgetcursorname().

SQLRETURN SQL_API SQLGetData SQLHSTMT  stmt,
SQLUSMALLINT  col,
SQLSMALLINT  type,
SQLPOINTER  val,
SQLINTEGER  len,
SQLINTEGER *  lenp
 

Retrieve row data after fetch.

Parameters:
stmt statement handle
col column number, starting at 1
type output type
val output buffer
len length of output buffer
lenp output length
Returns:
ODBC error code
Definition at line 10044 of file sqliteodbc.c.

References stmt::bkmrk, getrowdata(), stmt::ncols, stmt::ov3, stmt::rowp, setstat(), and STMT.

SQLRETURN SQL_API SQLGetDescField SQLHDESC  handle,
SQLSMALLINT  recno,
SQLSMALLINT  fieldid,
SQLPOINTER  value,
SQLINTEGER  buflen,
SQLINTEGER *  strlen
 

Function not implemented.

Definition at line 3549 of file sqliteodbc.c.

SQLRETURN SQL_API SQLGetDescRec SQLHDESC  handle,
SQLSMALLINT  recno,
SQLCHAR *  name,
SQLSMALLINT  buflen,
SQLSMALLINT *  strlen,
SQLSMALLINT *  type,
SQLSMALLINT *  subtype,
SQLINTEGER *  len,
SQLSMALLINT *  prec,
SQLSMALLINT *  scale,
SQLSMALLINT *  nullable
 

Function not implemented.

Definition at line 3605 of file sqliteodbc.c.

SQLRETURN SQL_API SQLGetDiagField SQLSMALLINT  htype,
SQLHANDLE  handle,
SQLSMALLINT  recno,
SQLSMALLINT  id,
SQLPOINTER  info,
SQLSMALLINT  buflen,
SQLSMALLINT *  strlen
 

Function not implemented.

Definition at line 5538 of file sqliteodbc.c.

SQLRETURN SQL_API SQLGetDiagRec SQLSMALLINT  htype,
SQLHANDLE  handle,
SQLSMALLINT  recno,
SQLCHAR *  sqlstate,
SQLINTEGER *  nativeerr,
SQLCHAR *  msg,
SQLSMALLINT  buflen,
SQLSMALLINT *  msglen
 

Get error message given handle (HENV, HDBC, or HSTMT).

Parameters:
htype handle type
handle HENV, HDBC, or HSTMT
recno 
sqlstate output buffer for SQL state
nativeerr output buffer of native error code
msg output buffer for error message
buflen length of output buffer
msglen output length
Returns:
ODBC error code
Definition at line 5445 of file sqliteodbc.c.

References drvgetdiagrec().

SQLRETURN SQL_API SQLGetEnvAttr SQLHENV  env,
SQLINTEGER  attr,
SQLPOINTER  val,
SQLINTEGER  len,
SQLINTEGER *  lenp
 

Get information of HENV.

Parameters:
env environment handle
attr attribute to be retrieved
val output buffer
len length of output buffer
lenp output length
Returns:
ODBC error code
Definition at line 5256 of file sqliteodbc.c.

References ENV_MAGIC, ENV::magic, and ENV::ov3.

SQLRETURN SQL_API SQLGetFunctions SQLHDBC  dbc,
SQLUSMALLINT  func,
SQLUSMALLINT *  flags
 

Return information about supported ODBC API functions.

Parameters:
dbc database connection handle
func function code to be retrieved
flags output indicator
Returns:
ODBC error code
Definition at line 6595 of file sqliteodbc.c.

References array_size, DBC, and SET_EXISTS.

SQLRETURN SQL_API SQLGetInfo SQLHDBC  dbc,
SQLUSMALLINT  type,
SQLPOINTER  val,
SQLSMALLINT  valMax,
SQLSMALLINT *  valLen
 

Return information about what this ODBC driver supports.

Parameters:
dbc database connection handle
type type of information to be retrieved
val output buffer
valMax length of output buffer
valLen output length
Returns:
ODBC error code
Definition at line 6487 of file sqliteodbc.c.

References drvgetinfo().

SQLRETURN SQL_API SQLGetStmtAttr SQLHSTMT  stmt,
SQLINTEGER  attr,
SQLPOINTER  val,
SQLINTEGER  bufmax,
SQLINTEGER *  buflen
 

Get option of HSTMT.

Parameters:
stmt statement handle
attr attribute to be retrieved
val output buffer
bufmax length of output buffer
buflen output length
Returns:
ODBC error code
Definition at line 5671 of file sqliteodbc.c.

References drvgetstmtattr().

SQLRETURN SQL_API SQLGetStmtOption SQLHSTMT  stmt,
SQLUSMALLINT  opt,
SQLPOINTER  param
 

Get option of HSTMT.

Parameters:
stmt statement handle
opt option to be retrieved
param output buffer
Returns:
ODBC error code
Definition at line 5907 of file sqliteodbc.c.

References drvgetstmtoption().

SQLRETURN SQL_API SQLGetTypeInfo SQLHSTMT  stmt,
SQLSMALLINT  sqltype
 

Return data type information.

Parameters:
stmt statement handle
sqltype which type to retrieve
Returns:
ODBC error code
Definition at line 9696 of file sqliteodbc.c.

References drvgettypeinfo().

SQLRETURN SQL_API SQLMoreResults SQLHSTMT  stmt  ) 
 

Return information for more result sets.

Parameters:
stmt statement handle
Returns:
ODBC error code
Definition at line 11479 of file sqliteodbc.c.

SQLRETURN SQL_API SQLNativeSql SQLHSTMT  stmt,
SQLCHAR *  sqlin,
SQLINTEGER  sqlinLen,
SQLCHAR *  sql,
SQLINTEGER  sqlMax,
SQLINTEGER *  sqlLen
 

Translate SQL string.

Parameters:
stmt statement handle
sqlin input string
sqlinLen length of input string
sql output string
sqlMax max space in output string
sqlLen value return for length of output string
Returns:
ODBC error code
Definition at line 5035 of file sqliteodbc.c.

References min, setstat(), and STMT.

SQLRETURN SQL_API SQLNumParams SQLHSTMT  stmt,
SQLSMALLINT *  nparam
 

Return number of parameters.

Parameters:
stmt statement handle
nparam output parameter count
Returns:
ODBC error code
Definition at line 3406 of file sqliteodbc.c.

References stmt::nparams, and STMT.

SQLRETURN SQL_API SQLNumResultCols SQLHSTMT  stmt,
SQLSMALLINT *  ncols
 

Return number of columns of result set given HSTMT.

Parameters:
stmt statement handle
ncols output number of columns
Returns:
ODBC error code
Definition at line 10493 of file sqliteodbc.c.

References stmt::ncols, and STMT.

SQLRETURN SQL_API SQLParamData SQLHSTMT  stmt,
SQLPOINTER *  p
 

Retrieve next parameter for sending data to executing query.

Parameters:
stmt statement handle
p pointer to output parameter indicator
Returns:
ODBC error code
Definition at line 3430 of file sqliteodbc.c.

References stmt::bindparms, BINDPARM::ind, BINDPARM::need, stmt::nparams, and STMT.

SQLRETURN SQL_API SQLParamOptions SQLHSTMT  stmt,
UDWORD  rows,
UDWORD *  rowp
 

Function not implemented.

Definition at line 3538 of file sqliteodbc.c.

References drvunimplstmt().

SQLRETURN SQL_API SQLPrepare SQLHSTMT  stmt,
SQLCHAR *  query,
SQLINTEGER  queryLen
 

Prepare HSTMT.

Parameters:
stmt statement handle
query query string
queryLen length of query string or SQL_NTS
Returns:
ODBC error code
Definition at line 11872 of file sqliteodbc.c.

References drvprepare().

SQLRETURN SQL_API SQLPrimaryKeys SQLHSTMT  stmt,
SQLCHAR *  cat,
SQLSMALLINT  catLen,
SQLCHAR *  schema,
SQLSMALLINT  schemaLen,
SQLCHAR *  table,
SQLSMALLINT  tableLen
 

Retrieve information about indexed columns.

Parameters:
stmt statement handle
cat catalog name/pattern or NULL
catLen length of catalog name/pattern or SQL_NTS
schema schema name/pattern or NULL
schemaLen length of schema name/pattern or SQL_NTS
table table name/pattern or NULL
tableLen length of table name/pattern or SQL_NTS
Returns:
ODBC error code
Definition at line 4030 of file sqliteodbc.c.

References drvprimarykeys().

SQLRETURN SQL_API SQLProcedureColumns SQLHSTMT  stmt,
SQLCHAR *  catalog,
SQLSMALLINT  catalogLen,
SQLCHAR *  schema,
SQLSMALLINT  schemaLen,
SQLCHAR *  proc,
SQLSMALLINT  procLen,
SQLCHAR *  column,
SQLSMALLINT  columnLen
 

Retrieve information about columns in result set of stored procedures.

Parameters:
stmt statement handle
catalog catalog name/pattern or NULL
catalogLen length of catalog or SQL_NTS
schema schema name/pattern or NULL
schemaLen length of schema or SQL_NTS
proc procedure name/pattern or NULL
procLen length of proc or SQL_NTS
column column name/pattern or NULL
columnLen length of column or SQL_NTS
Returns:
ODBC error code
Definition at line 5207 of file sqliteodbc.c.

References array_size, mkresultset(), and procColSpec.

SQLRETURN SQL_API SQLProcedures SQLHSTMT  stmt,
SQLCHAR *  catalog,
SQLSMALLINT  catalogLen,
SQLCHAR *  schema,
SQLSMALLINT  schemaLen,
SQLCHAR *  proc,
SQLSMALLINT  procLen
 

Retrieve information about stored procedures.

Parameters:
stmt statement handle
catalog catalog name/pattern or NULL
catalogLen length of catalog or SQL_NTS
schema schema name/pattern or NULL
schemaLen length of schema or SQL_NTS
proc procedure name/pattern or NULL
procLen length of proc or SQL_NTS
Returns:
ODBC error code
Definition at line 5133 of file sqliteodbc.c.

References array_size, mkresultset(), and procSpec.

SQLRETURN SQL_API SQLPutData SQLHSTMT  stmt,
SQLPOINTER  data,
SQLINTEGER  len
 

Put (partial) parameter data into executing statement.

Parameters:
stmt statement handle
data pointer to data
len length of data
Returns:
ODBC error code
Definition at line 2793 of file sqliteodbc.c.

References stmt::bindparms, drvexecute(), freep(), BINDPARM::ind, BINDPARM::len, mapdeftype(), min, BINDPARM::need, nomem(), stmt::nowchar, stmt::nparams, BINDPARM::offs, BINDPARM::param, stmt::query, setstat(), STMT, BINDPARM::stype, BINDPARM::type, and xmalloc.

SQLRETURN SQL_API SQLRowCount SQLHSTMT  stmt,
SQLINTEGER *  nrows
 

Return number of affected rows of HSTMT.

Parameters:
stmt statement handle
nrows output number of rows
Returns:
ODBC error code
Definition at line 10471 of file sqliteodbc.c.

References stmt::nrows, and STMT.

SQLRETURN SQL_API SQLSetConnectAttr SQLHDBC  dbc,
SQLINTEGER  attr,
SQLPOINTER  val,
SQLINTEGER  len
 

Set connect attribute of HDBC.

Parameters:
dbc database connection handle
attr option to be set
val option value
len size of option
Returns:
ODBC error code
Definition at line 7163 of file sqliteodbc.c.

References drvsetconnectattr().

SQLRETURN SQL_API SQLSetConnectOption SQLHDBC  dbc,
SQLUSMALLINT  opt,
SQLUINTEGER  param
 

Set option on HDBC.

Parameters:
dbc database connection handle
opt option to be set
param option value
Returns:
ODBC error code
Definition at line 7350 of file sqliteodbc.c.

References drvsetconnectoption().

SQLRETURN SQL_API SQLSetCursorName SQLHSTMT  stmt,
SQLCHAR *  cursor,
SQLSMALLINT  len
 

Set cursor name on STMT.

Parameters:
stmt statement handle
cursor new cursor name
len length of cursor name or SQL_NTS
Returns:
ODBC error code
Definition at line 8048 of file sqliteodbc.c.

References drvsetcursorname().

SQLRETURN SQL_API SQLSetDescField SQLHDESC  handle,
SQLSMALLINT  recno,
SQLSMALLINT  fieldid,
SQLPOINTER  value,
SQLINTEGER  buflen
 

Function not implemented.

Definition at line 3577 of file sqliteodbc.c.

SQLRETURN SQL_API SQLSetDescRec SQLHDESC  handle,
SQLSMALLINT  recno,
SQLSMALLINT  type,
SQLSMALLINT  subtype,
SQLINTEGER  len,
SQLSMALLINT  prec,
SQLSMALLINT  scale,
SQLPOINTER  data,
SQLINTEGER *  strlen,
SQLINTEGER *  indicator
 

Function not implemented.

Definition at line 3638 of file sqliteodbc.c.

SQLRETURN SQL_API SQLSetEnvAttr SQLHENV  env,
SQLINTEGER  attr,
SQLPOINTER  val,
SQLINTEGER  len
 

Set information in HENV.

Parameters:
env environment handle
attr attribute to be retrieved
val parameter buffer
len length of parameter
Returns:
ODBC error code
Definition at line 5303 of file sqliteodbc.c.

References ENV_MAGIC, ENV::magic, and ENV::ov3.

SQLRETURN SQL_API SQLSetParam SQLHSTMT  stmt,
SQLUSMALLINT  par,
SQLSMALLINT  type,
SQLSMALLINT  sqltype,
SQLUINTEGER  coldef,
SQLSMALLINT  scale,
SQLPOINTER  val,
SQLINTEGER *  nval
 

Set information on parameter.

Parameters:
stmt statement handle
par parameter number, starting at 1
type type of host variable
sqltype 
coldef 
scale 
val pointer to host variable
len output length pointer
Returns:
ODBC error code
Definition at line 3524 of file sqliteodbc.c.

References drvbindparam().

SQLRETURN SQL_API SQLSetPos SQLHSTMT  stmt,
SQLUSMALLINT  row,
SQLUSMALLINT  op,
SQLUSMALLINT  lock
 

Function not implemented.

Definition at line 6032 of file sqliteodbc.c.

References drvunimplstmt().

SQLRETURN SQL_API SQLSetScrollOptions SQLHSTMT  stmt,
SQLUSMALLINT  concur,
SQLINTEGER  rowkeyset,
SQLUSMALLINT  rowset
 

Function not implemented.

Definition at line 6042 of file sqliteodbc.c.

References drvunimplstmt().

SQLRETURN SQL_API SQLSetStmtAttr SQLHSTMT  stmt,
SQLINTEGER  attr,
SQLPOINTER  val,
SQLINTEGER  buflen
 

Set option on HSTMT.

Parameters:
stmt statement handle
attr attribute to be set
val input buffer (attribute value)
buflen length of input buffer
Returns:
ODBC error code
Definition at line 5827 of file sqliteodbc.c.

References drvsetstmtattr().

SQLRETURN SQL_API SQLSetStmtOption SQLHSTMT  stmt,
SQLUSMALLINT  opt,
SQLUINTEGER  param
 

Set option on HSTMT.

Parameters:
stmt statement handle
opt option to be set
param input buffer (option value)
Returns:
ODBC error code
Definition at line 6006 of file sqliteodbc.c.

References drvsetstmtoption().

SQLRETURN SQL_API SQLSpecialColumns SQLHSTMT  stmt,
SQLUSMALLINT  id,
SQLCHAR *  cat,
SQLSMALLINT  catLen,
SQLCHAR *  schema,
SQLSMALLINT  schemaLen,
SQLCHAR *  table,
SQLSMALLINT  tableLen,
SQLUSMALLINT  scope,
SQLUSMALLINT  nullable
 

Retrieve information about indexed columns.

Parameters:
stmt statement handle
id type of information, e.g. best row id
cat catalog name/pattern or NULL
catLen length of catalog name/pattern or SQL_NTS
schema schema name/pattern or NULL
schemaLen length of schema name/pattern or SQL_NTS
table table name/pattern or NULL
tableLen length of table name/pattern or SQL_NTS
scope 
nullable 
Returns:
ODBC error code
Definition at line 4373 of file sqliteodbc.c.

References drvspecialcolumns().

SQLRETURN SQL_API SQLStatistics SQLHSTMT  stmt,
SQLCHAR *  cat,
SQLSMALLINT  catLen,
SQLCHAR *  schema,
SQLSMALLINT  schemaLen,
SQLCHAR *  table,
SQLSMALLINT  tableLen,
SQLUSMALLINT  itype,
SQLUSMALLINT  resv
 

Return statistic information on table indices.

Parameters:
stmt statement handle
cat catalog name/pattern or NULL
catLen length of catalog name/pattern or SQL_NTS
schema schema name/pattern or NULL
schemaLen length of schema name/pattern or SQL_NTS
table table name/pattern or NULL
tableLen length of table name/pattern or SQL_NTS
itype type of index information
resv reserved
Returns:
ODBC error code
Definition at line 9967 of file sqliteodbc.c.

References drvstatistics().

SQLRETURN SQL_API SQLTablePrivileges SQLHSTMT  stmt,
SQLCHAR *  catalog,
SQLSMALLINT  catalogLen,
SQLCHAR *  schema,
SQLSMALLINT  schemaLen,
SQLCHAR *  table,
SQLSMALLINT  tableLen
 

Retrieve privileges on tables and/or views.

Parameters:
stmt statement handle
catalog catalog name/pattern or NULL
catalogLen length of catalog name/pattern or SQL_NTS
schema schema name/pattern or NULL
schemaLen length of schema name/pattern or SQL_NTS
table table name/pattern or NULL
tableLen length of table name/pattern or SQL_NTS
Returns:
ODBC error code
Definition at line 3711 of file sqliteodbc.c.

References array_size, mkresultset(), and tablePrivSpec.

SQLRETURN SQL_API SQLTables SQLHSTMT  stmt,
SQLCHAR *  cat,
SQLSMALLINT  catLen,
SQLCHAR *  schema,
SQLSMALLINT  schemaLen,
SQLCHAR *  table,
SQLSMALLINT  tableLen,
SQLCHAR *  type,
SQLSMALLINT  typeLen
 

Retrieve information on tables and/or views.

Parameters:
stmt statement handle
cat catalog name/pattern or NULL
catLen length of catalog name/pattern or SQL_NTS
schema schema name/pattern or NULL
schemaLen length of schema name/pattern or SQL_NTS
table table name/pattern or NULL
tableLen length of table name/pattern or SQL_NTS
type types of tables string or NULL
typeLen length of types of tables string or SQL_NTS
Returns:
ODBC error code
Definition at line 8985 of file sqliteodbc.c.

References drvtables().

SQLRETURN SQL_API SQLTransact SQLHENV  env,
SQLHDBC  dbc,
UWORD  type
 

Commit or rollback transaction.

Parameters:
env environment handle or NULL
dbc database connection handle or NULL
type SQL_COMMIT or SQL_ROLLBACK
Returns:
ODBC error code
Definition at line 5004 of file sqliteodbc.c.

References drvendtran().

int str2date char *  str,
DATE_STRUCT *  ds
[static]
 

Convert string to ODBC DATE_STRUCT.

Parameters:
str string to be converted
ds output DATE_STRUCT
Returns:
0 on success, -1 on error
Strings of the format 'YYYYMMDD' or 'YYYY-MM-DD' or 'YYYY/MM/DD' are converted to a DATE_STRUCT. Definition at line 1716 of file sqliteodbc.c.

References getmdays(), and ISDIGIT.

Referenced by getrowdata().

int str2time char *  str,
TIME_STRUCT *  ts
[static]
 

Convert string to ODBC TIME_STRUCT.

Parameters:
str string to be converted
ts output TIME_STRUCT
Returns:
0 on success, -1 on error
Strings of the format 'HHMMSS' or 'HH:MM:SS' are converted to a TIME_STRUCT. Definition at line 1796 of file sqliteodbc.c.

References ISDIGIT.

Referenced by getrowdata().

int str2timestamp char *  str,
TIMESTAMP_STRUCT *  tss
[static]
 

Convert string to ODBC TIMESTAMP_STRUCT.

Parameters:
str string to be converted
tss output TIMESTAMP_STRUCT
Returns:
0 on success, -1 on error
Strings of the format 'YYYYMMDDhhmmssff' or 'YYYY-MM-DD hh:mm:ss ff' or 'YYYY/MM/DD hh:mm:ss ff' or 'hh:mm:ss ff YYYY-MM-DD' are converted to a TIMESTAMP_STRUCT. The ISO8601 formats YYYY-MM-DDThh:mm:ss[.f]Z YYYY-MM-DDThh:mm:ss[.f]shh:mm are also supported. In case a time zone field is present, the resulting TIMESTAMP_STRUCT is expressed in UTC. Definition at line 1879 of file sqliteodbc.c.

References getmdays(), and ISDIGIT.

Referenced by getrowdata().

char* strdup_ const char *  str  )  [static]
 

Duplicate string using xmalloc().

Parameters:
str string to be duplicated
Returns:
pointer to new string or NULL
Definition at line 311 of file sqliteodbc.c.

References xmalloc.

SQLRETURN substparam STMT s,
int  pnum,
char **  out,
int *  size
[static]
 

Substitute parameter for statement.

Parameters:
s statement pointer
pnum parameter number
out output buffer or NULL
size size indicator or NULL
Returns:
ODBC error code
If no output buffer is given, the function computes and reports the space needed for the parameter. Otherwise the parameter is converted to its string representation in order to be presented to sqlite_exec_vprintf() et.al. Definition at line 3026 of file sqliteodbc.c.

References stmt::bindparms, BINDPARM::ind, BINDPARM::len, BINDPARM::lenp, ln_sprintfg(), mapdeftype(), BINDPARM::max, stmt::nbindparms, BINDPARM::need, nomem(), stmt::nowchar, stmt::ov3, BINDPARM::param, setstat(), STMT, BINDPARM::stype, BINDPARM::type, and xmalloc.

Referenced by drvexecute().

void time_func sqlite_func *  context,
int  argc,
const char **  argv
[static]
 

SQLite function "current_time_local" etc.

Parameters:
context SQLite function context
argc number arguments
argv argument vector
Definition at line 2553 of file sqliteodbc.c.

Referenced by setsqliteopts().

int TOLOWER int  c  )  [static]
 

Definition at line 195 of file sqliteodbc.c.

References lower_chars, and upper_chars.

Referenced by drvtables(), and mapsqltype().

int typeinfosort const void *  a,
const void *  b
[static]
 

Helper function to sort type information.

Callback for qsort().

Parameters:
a first item to compare
b second item to compare
Returns:
==0, <0, >0 according to data type number
Definition at line 9473 of file sqliteodbc.c.

Referenced by drvgettypeinfo().

void unbindcols STMT s  )  [static]
 

Reset bound columns to unbound state.

Parameters:
s statement pointer
Definition at line 8207 of file sqliteodbc.c.

References stmt::bindcols, stmt::bkmrkcol, BINDCOL::index, BINDCOL::lenp, BINDCOL::max, stmt::nbindcols, BINDCOL::offs, STMT, BINDCOL::type, and BINDCOL::valp.

Referenced by drvfreestmt(), and mkbindcols().

void vm_end STMT s  )  [static]
 

Stop running VM.

Parameters:
s statement pointer
Definition at line 2373 of file sqliteodbc.c.

References stmt::dbc, DBC, STMT, stmt::vm, and dbc::vm_stmt.

Referenced by drvexecute(), drvprepare(), drvsetconnectattr(), drvsetconnectoption(), SQLDisconnect(), and vm_end_if().

void vm_end_if STMT s  )  [static]
 

Conditionally stop running VM.

Parameters:
s statement pointer
Definition at line 2392 of file sqliteodbc.c.

References stmt::dbc, DBC, STMT, vm_end(), and dbc::vm_stmt.

Referenced by drvfreestmt(), and mkresultset().

SQLRETURN vm_start STMT s,
char **  params
[static]
 

Start VM for execution of SELECT statement.

Parameters:
s statement pointer
params string array of statement parameters
Returns:
ODBC error code
Definition at line 2409 of file sqliteodbc.c.

References stmt::dbc, DBC, dbtracerc, nomem(), stmt::ov3, stmt::query, setstat(), dbc::sqlite, STMT, stmt::vm, dbc::vm_rownum, and dbc::vm_stmt.

Referenced by drvexecute().

int vm_step STMT s  )  [static]
 

Do one VM step gathering one result row.

Parameters:
s statement pointer
Returns:
ODBC error code
Definition at line 2238 of file sqliteodbc.c.

References COL::autoinc, stmt::cols, COL::column, COL::db, stmt::dbc, DBC, stmt::dcols, stmt::dyncols, fixupdyncols(), freedyncols(), freeresult(), freerows(), COL::index, COL::label, mkbindcols(), stmt::ncols, nomem(), COL::nosign, stmt::nrows, stmt::ov3, COL::prec, stmt::rows, COL::scale, setstat(), COL::size, dbc::sqlite, STMT, COL::table, COL::type, COL::typename, stmt::vm, dbc::vm_rownum, dbc::vm_stmt, xmalloc, and xstrdup.

Referenced by drvfetchscroll(), and SQLFetch().


Variable Documentation

COL colPrivSpec[] [static]
 

Initial value:

{ { "SYSTEM", "COLPRIV", "TABLE_QUALIFIER", SCOL_VARCHAR, 50 }, { "SYSTEM", "COLPRIV", "TABLE_OWNER", SCOL_VARCHAR, 50 }, { "SYSTEM", "COLPRIV", "TABLE_NAME", SCOL_VARCHAR, 255 }, { "SYSTEM", "COLPRIV", "GRANTOR", SCOL_VARCHAR, 50 }, { "SYSTEM", "COLPRIV", "GRANTEE", SCOL_VARCHAR, 50 }, { "SYSTEM", "COLPRIV", "PRIVILEGE", SCOL_VARCHAR, 50 }, { "SYSTEM", "COLPRIV", "IS_GRANTABLE", SCOL_VARCHAR, 50 } }
Columns for result set of SQLColumnPrivileges().

Definition at line 3749 of file sqliteodbc.c.

Referenced by SQLColumnPrivileges().

COL colSpec[] [static]
 

Initial value:

{ { "SYSTEM", "COLUMN", "TABLE_QUALIFIER", SCOL_VARCHAR, 50 }, { "SYSTEM", "COLUMN", "TABLE_OWNER", SCOL_VARCHAR, 50 }, { "SYSTEM", "COLUMN", "TABLE_NAME", SCOL_VARCHAR, 255 }, { "SYSTEM", "COLUMN", "COLUMN_NAME", SCOL_VARCHAR, 255 }, { "SYSTEM", "COLUMN", "DATA_TYPE", SQL_SMALLINT, 50 }, { "SYSTEM", "COLUMN", "TYPE_NAME", SCOL_VARCHAR, 50 }, { "SYSTEM", "COLUMN", "PRECISION", SQL_INTEGER, 50 }, { "SYSTEM", "COLUMN", "LENGTH", SQL_INTEGER, 50 }, { "SYSTEM", "COLUMN", "RADIX", SQL_SMALLINT, 50 }, { "SYSTEM", "COLUMN", "SCALE", SQL_SMALLINT, 50 }, { "SYSTEM", "COLUMN", "NULLABLE", SQL_SMALLINT, 50 }, { "SYSTEM", "COLUMN", "REMARKS", SCOL_VARCHAR, 50 }, { "SYSTEM", "COLUMN", "COLUMN_DEF", SCOL_VARCHAR, 50 }, { "SYSTEM", "COLUMN", "SQL_DATA_TYPE", SQL_SMALLINT, 50 }, { "SYSTEM", "COLUMN", "SQL_DATETIME_SUB", SQL_SMALLINT, 50 }, { "SYSTEM", "COLUMN", "CHAR_OCTET_LENGTH", SQL_SMALLINT, 50 }, { "SYSTEM", "COLUMN", "ORDINAL_POSITION", SQL_SMALLINT, 50 }, { "SYSTEM", "COLUMN", "IS_NULLABLE", SCOL_VARCHAR, 50 } }
Columns for result set of SQLColumns().

Definition at line 9064 of file sqliteodbc.c.

Referenced by drvcolumns().

const char digit_chars[] = "0123456789" [static]
 

Definition at line 211 of file sqliteodbc.c.

COL fkeySpec[] [static]
 

Initial value:

{ { "SYSTEM", "FOREIGNKEY", "PKTABLE_QUALIFIER", SCOL_VARCHAR, 50 }, { "SYSTEM", "FOREIGNKEY", "PKTABLE_OWNER", SCOL_VARCHAR, 50 }, { "SYSTEM", "FOREIGNKEY", "PKTABLE_NAME", SCOL_VARCHAR, 255 }, { "SYSTEM", "FOREIGNKEY", "PKCOLUMN_NAME", SCOL_VARCHAR, 255 }, { "SYSTEM", "FOREIGNKEY", "FKTABLE_QUALIFIER", SCOL_VARCHAR, 50 }, { "SYSTEM", "FOREIGNKEY", "FKTABLE_OWNER", SCOL_VARCHAR, 50 }, { "SYSTEM", "FOREIGNKEY", "FKTABLE_NAME", SCOL_VARCHAR, 255 }, { "SYSTEM", "FOREIGNKEY", "FKCOLUMN_NAME", SCOL_VARCHAR, 255 }, { "SYSTEM", "FOREIGNKEY", "KEY_SEQ", SQL_SMALLINT, 5 }, { "SYSTEM", "FOREIGNKEY", "UPDATE_RULE", SQL_SMALLINT, 5 }, { "SYSTEM", "FOREIGNKEY", "DELETE_RULE", SQL_SMALLINT, 5 }, { "SYSTEM", "FOREIGNKEY", "FK_NAME", SCOL_VARCHAR, 255 }, { "SYSTEM", "FOREIGNKEY", "PK_NAME", SCOL_VARCHAR, 255 }, { "SYSTEM", "FOREIGNKEY", "DEFERRABILITY", SQL_SMALLINT, 5 } }
Columns for result set of SQLForeignKeys().

Definition at line 4445 of file sqliteodbc.c.

Referenced by drvforeignkeys().

const char id_chars[] [static]
 

Initial value:

"ABCDEFGHIJKLMNOPQRSTUVWXYZ" "abcdefghijklmnopqrstuvwxyz" "_0123456789"
Definition at line 229 of file sqliteodbc.c.

const char lower_chars[] = "abcdefghijklmnopqrstuvwxyz" [static]
 

Definition at line 192 of file sqliteodbc.c.

Referenced by TOLOWER().

COL pkeySpec[] [static]
 

Initial value:

{ { "SYSTEM", "PRIMARYKEY", "TABLE_QUALIFIER", SCOL_VARCHAR, 50 }, { "SYSTEM", "PRIMARYKEY", "TABLE_OWNER", SCOL_VARCHAR, 50 }, { "SYSTEM", "PRIMARYKEY", "TABLE_NAME", SCOL_VARCHAR, 255 }, { "SYSTEM", "PRIMARYKEY", "COLUMN_NAME", SCOL_VARCHAR, 255 }, { "SYSTEM", "PRIMARYKEY", "KEY_SEQ", SQL_SMALLINT, 50 }, { "SYSTEM", "PRIMARYKEY", "PK_NAME", SCOL_VARCHAR, 50 } }
Columns for result set of SQLPrimaryKeys().

Definition at line 3817 of file sqliteodbc.c.

Referenced by drvprimarykeys().

COL procColSpec[] [static]
 

Initial value:

{ { "SYSTEM", "PROCCOL", "PROCEDURE_QUALIFIER", SCOL_VARCHAR, 50 }, { "SYSTEM", "PROCCOL", "PROCEDURE_OWNER", SCOL_VARCHAR, 50 }, { "SYSTEM", "PROCCOL", "PROCEDURE_NAME", SCOL_VARCHAR, 255 }, { "SYSTEM", "PROCCOL", "COLUMN_NAME", SCOL_VARCHAR, 255 }, { "SYSTEM", "PROCCOL", "COLUMN_TYPE", SQL_SMALLINT, 5 }, { "SYSTEM", "PROCCOL", "DATA_TYPE", SQL_SMALLINT, 5 }, { "SYSTEM", "PROCCOL", "TYPE_NAME", SCOL_VARCHAR, 50 }, { "SYSTEM", "PROCCOL", "PRECISION", SQL_INTEGER, 10 }, { "SYSTEM", "PROCCOL", "LENGTH", SQL_INTEGER, 10 }, { "SYSTEM", "PROCCOL", "RADIX", SQL_SMALLINT, 5 }, { "SYSTEM", "PROCCOL", "SCALE", SQL_SMALLINT, 5 }, { "SYSTEM", "PROCCOL", "NULLABLE", SQL_SMALLINT, 5 }, { "SYSTEM", "PROCCOL", "REMARKS", SCOL_VARCHAR, 50 }, { "SYSTEM", "PROCCOL", "COLUMN_DEF", SCOL_VARCHAR, 50 }, { "SYSTEM", "PROCCOL", "SQL_DATA_TYPE", SQL_SMALLINT, 5 }, { "SYSTEM", "PROCCOL", "SQL_DATETIME_SUB", SQL_SMALLINT, 5 }, { "SYSTEM", "PROCCOL", "CHAR_OCTET_LENGTH", SQL_SMALLINT, 5 }, { "SYSTEM", "PROCCOL", "ORDINAL_POSITION", SQL_SMALLINT, 5 }, { "SYSTEM", "PROCCOL", "IS_NULLABLE", SCOL_VARCHAR, 50 } }
Columns for result set of SQLProcedureColumns().

Definition at line 5169 of file sqliteodbc.c.

Referenced by SQLProcedureColumns().

COL procSpec[] [static]
 

Initial value:

{ { "SYSTEM", "PROCEDURE", "PROCEDURE_QUALIFIER", SCOL_VARCHAR, 50 }, { "SYSTEM", "PROCEDURE", "PROCEDURE_OWNER", SCOL_VARCHAR, 50 }, { "SYSTEM", "PROCEDURE", "PROCEDURE_NAME", SCOL_VARCHAR, 255 }, { "SYSTEM", "PROCEDURE", "NUM_INPUT_PARAMS", SQL_SMALLINT, 5 }, { "SYSTEM", "PROCEDURE", "NUM_OUTPUT_PARAMS", SQL_SMALLINT, 5 }, { "SYSTEM", "PROCEDURE", "NUM_RESULT_SETS", SQL_SMALLINT, 5 }, { "SYSTEM", "PROCEDURE", "REMARKS", SCOL_VARCHAR, 255 }, { "SYSTEM", "PROCEDURE", "PROCEDURE_TYPE", SQL_SMALLINT, 5 } }
Columns for result set of SQLProcedures().

Definition at line 5108 of file sqliteodbc.c.

Referenced by SQLProcedures().

COL scolSpec[] [static]
 

Initial value:

{ { "SYSTEM", "COLUMN", "SCOPE", SQL_SMALLINT, 1 }, { "SYSTEM", "COLUMN", "COLUMN_NAME", SCOL_VARCHAR, 255 }, { "SYSTEM", "COLUMN", "DATA_TYPE", SQL_SMALLINT, 50 }, { "SYSTEM", "COLUMN", "TYPE_NAME", SCOL_VARCHAR, 50 }, { "SYSTEM", "COLUMN", "PRECISION", SQL_INTEGER, 50 }, { "SYSTEM", "COLUMN", "LENGTH", SQL_INTEGER, 50 }, { "SYSTEM", "COLUMN", "DECIMAL_DIGITS", SQL_INTEGER, 50 }, { "SYSTEM", "COLUMN", "PSEUDO_COLUMN", SQL_SMALLINT, 1 }, { "SYSTEM", "COLUMN", "NULLABLE", SQL_SMALLINT, 1 } }
Columns for result set of SQLSpecialColumns().

Definition at line 4096 of file sqliteodbc.c.

Referenced by drvspecialcolumns().

const char space_chars[] = " \f\n\r\t\v" [static]
 

Definition at line 220 of file sqliteodbc.c.

COL statSpec[] [static]
 

Initial value:

{ { "SYSTEM", "STATISTICS", "TABLE_QUALIFIER", SCOL_VARCHAR, 50 }, { "SYSTEM", "STATISTICS", "TABLE_OWNER", SCOL_VARCHAR, 50 }, { "SYSTEM", "STATISTICS", "TABLE_NAME", SCOL_VARCHAR, 255 }, { "SYSTEM", "STATISTICS", "NON_UNIQUE", SQL_SMALLINT, 50 }, { "SYSTEM", "STATISTICS", "INDEX_QUALIFIER", SCOL_VARCHAR, 255 }, { "SYSTEM", "STATISTICS", "INDEX_NAME", SCOL_VARCHAR, 255 }, { "SYSTEM", "STATISTICS", "TYPE", SQL_SMALLINT, 50 }, { "SYSTEM", "STATISTICS", "ORDINAL_POSITION", SQL_SMALLINT, 50 }, { "SYSTEM", "STATISTICS", "COLUMN_NAME", SCOL_VARCHAR, 255 }, { "SYSTEM", "STATISTICS", "ASC_OR_DESC", SCOL_CHAR, 1 }, { "SYSTEM", "STATISTICS", "CARDINALITY", SQL_INTEGER, 50 }, { "SYSTEM", "STATISTICS", "PAGES", SQL_INTEGER, 50 }, { "SYSTEM", "STATISTICS", "FILTER_CONDITION", SCOL_VARCHAR, 255 } }
Columns for result set of SQLStatistics().

Definition at line 9721 of file sqliteodbc.c.

Referenced by drvstatistics().

COL tablePrivSpec[] [static]
 

Initial value:

{ { "SYSTEM", "TABLEPRIV", "TABLE_QUALIFIER", SCOL_VARCHAR, 50 }, { "SYSTEM", "TABLEPRIV", "TABLE_OWNER", SCOL_VARCHAR, 50 }, { "SYSTEM", "TABLEPRIV", "TABLE_NAME", SCOL_VARCHAR, 255 }, { "SYSTEM", "TABLEPRIV", "GRANTOR", SCOL_VARCHAR, 50 }, { "SYSTEM", "TABLEPRIV", "GRANTEE", SCOL_VARCHAR, 50 }, { "SYSTEM", "TABLEPRIV", "PRIVILEGE", SCOL_VARCHAR, 50 }, { "SYSTEM", "TABLEPRIV", "IS_GRANTABLE", SCOL_VARCHAR, 50 } }
Columns for result set of SQLTablePrivileges().

Definition at line 3687 of file sqliteodbc.c.

Referenced by SQLTablePrivileges().

COL tableSpec[] [static]
 

Initial value:

{ { "SYSTEM", "COLUMN", "TABLE_QUALIFIER", SCOL_VARCHAR, 50 }, { "SYSTEM", "COLUMN", "TABLE_OWNER", SCOL_VARCHAR, 50 }, { "SYSTEM", "COLUMN", "TABLE_NAME", SCOL_VARCHAR, 255 }, { "SYSTEM", "COLUMN", "TABLE_TYPE", SCOL_VARCHAR, 50 }, { "SYSTEM", "COLUMN", "REMARKS", SCOL_VARCHAR, 50 } }
Columns for result set of SQLTables().

Definition at line 8767 of file sqliteodbc.c.

Referenced by drvtables().

COL typeSpec[] [static]
 

Initial value:

{ { "SYSTEM", "TYPE", "TYPE_NAME", SCOL_VARCHAR, 50 }, { "SYSTEM", "TYPE", "DATA_TYPE", SQL_SMALLINT, 2 }, { "SYSTEM", "TYPE", "PRECISION", SQL_INTEGER, 4 }, { "SYSTEM", "TYPE", "LITERAL_PREFIX", SCOL_VARCHAR, 50 }, { "SYSTEM", "TYPE", "LITERAL_SUFFIX", SCOL_VARCHAR, 50 }, { "SYSTEM", "TYPE", "CREATE_PARAMS", SCOL_VARCHAR, 50 }, { "SYSTEM", "TYPE", "NULLABLE", SQL_SMALLINT, 2 }, { "SYSTEM", "TYPE", "CASE_SENSITIVE", SQL_SMALLINT, 2 }, { "SYSTEM", "TYPE", "SEARCHABLE", SQL_SMALLINT, 2 }, { "SYSTEM", "TYPE", "UNSIGNED_ATTRIBUTE", SQL_SMALLINT, 2 }, { "SYSTEM", "TYPE", "MONEY", SQL_SMALLINT, 2 }, { "SYSTEM", "TYPE", "AUTO_INCREMENT", SQL_SMALLINT, 2 }, { "SYSTEM", "TYPE", "LOCAL_TYPE_NAME", SCOL_VARCHAR, 50 }, { "SYSTEM", "TYPE", "MINIMUM_SCALE", SQL_SMALLINT, 2 }, { "SYSTEM", "TYPE", "MAXIMUM_SCALE", SQL_SMALLINT, 2 } }
Columns for result set of SQLGetTypeInfo().

Definition at line 9336 of file sqliteodbc.c.

Referenced by drvgettypeinfo(), and mktypeinfo().

const char upper_chars[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" [static]
 

Definition at line 191 of file sqliteodbc.c.

Referenced by TOLOWER().


Generated on 9 Oct 2004 by doxygen.
Contact: chw@ch-werner.de