sqlite3odbc.c File Reference

SQLite3 ODBC Driver main module. More...

#include "sqlite3odbc.h"
#include <sqlucode.h>
#include <odbcinst.h>

Go to the source code of this file.

Data Structures

struct  dstr
 Internal structure representing dynamic strings. More...
 
struct  tblres
 Internal structure for managing driver's sqlite3_get_table() implementation. More...
 

Macros

#define WINTERFACE
 
#define WCHARSUPPORT
 
#define ODBC_INI   ".odbc.ini"
 
#define DRIVER_VER_INFO   "0.0"
 
#define COLATTRIBUTE_LAST_ARG_TYPE   SQLPOINTER
 
#define SETSTMTOPTION_LAST_ARG_TYPE   SQLROWCOUNT
 
#define min(a, b)
 
#define max(a, b)
 
#define PTRDIFF_T   int
 
#define array_size(x)
 
#define stringify1(s)
 
#define stringify(s)
 
#define verinfo(maj, min, lev)
 
#define SCOL_VARCHAR   SQL_WVARCHAR
 
#define SCOL_CHAR   SQL_WCHAR
 
#define ENV_MAGIC   0x53544145
 
#define DBC_MAGIC   0x53544144
 
#define DEAD_MAGIC   0xdeadbeef
 
#define xmalloc(x)
 
#define xrealloc(x, y)
 
#define xfree(x)
 
#define xstrdup(x)
 
#define HDBC_LOCK(hdbc)
 
#define HDBC_UNLOCK(hdbc)
 
#define HSTMT_LOCK(hdbc)
 
#define HSTMT_UNLOCK(hdbc)
 
#define ISDIGIT(c)
 
#define ISSPACE(c)
 
#define drvgetgpps(d)
 
#define drvrelgpps(d)
 
#define strmak(dst, src, max, lenp)
 
#define SET_EXISTS(x)
 
#define CLR_EXISTS(x)
 

Typedefs

typedef struct dstr dstr
 
typedef struct tblres TBLRES
 

Functions

static int TOLOWER (int c)
 
static void dbtraceapi (DBC *d, char *fn, const char *sql)
 Trace function for SQLite API calls.
 
static void freedyncols (STMT *s)
 Free dynamically allocated column descriptions of STMT.
 
static void freeresult (STMT *s, int clrcols)
 Free statement's result.
 
static void freerows (char **rowp)
 Free counted array of char pointers.
 
static void unbindcols (STMT *s)
 Reset bound columns to unbound state.
 
static void s3stmt_drop (STMT *s)
 Drop running sqlite statement in STMT.
 
static SQLRETURN drvexecute (SQLHSTMT stmt, int initial)
 
static SQLRETURN freestmt (HSTMT stmt)
 
static SQLRETURN mkbindcols (STMT *s, int ncols)
 Reallocate space for bound columns.
 
static SQLRETURN setupdyncols (STMT *s, sqlite3_stmt *s3stmt, int *ncolsp)
 
static SQLRETURN setupparbuf (STMT *s, BINDPARM *p)
 Setup parameter buffer for deferred parameter.
 
static SQLRETURN starttran (STMT *s)
 Start transaction when autocommit off.
 
static SQLRETURN setupparam (STMT *s, char *sql, int pnum)
 Setup SQLite3 parameter for statement parameter.
 
static SQLRETURN getrowdata (STMT *s, SQLUSMALLINT col, SQLSMALLINT otype, SQLPOINTER val, SQLINTEGER len, SQLLEN *lenp, int partial)
 Internal function to retrieve row data, used by SQLFetch() and friends and SQLGetData().
 
static char * strdup_ (const char *str)
 Duplicate string using xmalloc().
 
static dstrdsappend (dstr *dsp, const char *str)
 Append string to dynamic string.
 
static dstrdsappendq (dstr *dsp, const char *str)
 Append a string double quoted to dynamic string.
 
static const char * dsval (dstr *dsp)
 Return dynamic string's value.
 
static int dserr (dstr *dsp)
 Check error on dynamic string.
 
static void dsfree (dstr *dsp)
 Free dynamic string.
 
static int uc_strlen (SQLWCHAR *str)
 Return length of UNICODE string.
 
static SQLWCHAR * uc_strncpy (SQLWCHAR *dest, SQLWCHAR *src, int len)
 Copy UNICODE string like strncpy().
 
static void uc_from_utf_buf (unsigned char *str, int len, SQLWCHAR *uc, int ucLen)
 Make UNICODE string from UTF8 string into buffer.
 
static SQLWCHAR * uc_from_utf (unsigned char *str, int len)
 Make UNICODE string from UTF8 string.
 
static char * uc_to_utf (SQLWCHAR *str, int len)
 Make UTF8 string from UNICODE string.
 
static char * uc_to_utf_c (SQLWCHAR *str, int len)
 Make UTF8 string from UNICODE string.
 
static void uc_free (void *str)
 Free converted UTF8 or UNICODE string.
 
static void s3bind (DBC *d, sqlite3_stmt *stmt, int nparams, BINDPARM *p)
 
static int drvgettable_row (TBLRES *t, int ncol, int rc)
 
static int drvgettable (STMT *s, const char *sql, char ***resp, int *nrowp, int *ncolp, char **errp, int nparam, BINDPARM *p)
 
static void setstatd (DBC *d, int naterr, char *msg, char *st,...)
 Set error message and SQL state on DBC.
 
static void setstat (STMT *s, int naterr, char *msg, char *st,...)
 Set error message and SQL state on statement.
 
static SQLRETURN drvunimpldbc (HDBC dbc)
 Report IM001 (not implemented) SQL error code for HDBC.
 
static SQLRETURN drvunimplstmt (HSTMT stmt)
 Report IM001 (not implemented) SQL error code for HSTMT.
 
static void freep (void *x)
 Free memory given pointer to memory pointer.
 
static SQLRETURN nomem (STMT *s)
 Report S1000 (out of memory) SQL error given STMT.
 
static SQLRETURN noconn (STMT *s)
 Report S1000 (not connected) SQL error given STMT.
 
static double ln_strtod (const char *data, char **endp)
 Internal locale neutral strtod function.
 
static char * unquote (char *str)
 Strip quotes from quoted string in-place.
 
static int unescpat (char *str)
 Unescape search pattern for e.g.
 
static int namematch (char *str, char *pat, int esc)
 SQL LIKE string match with optional backslash escape handling.
 
static int busy_handler (void *udata, int count)
 Busy callback for SQLite.
 
static int setsqliteopts (sqlite3 *x, DBC *d)
 Set SQLite options (PRAGMAs) given SQLite handle.
 
static int mapsqltype (const char *typename, int *nosign, int ov3, int nowchar, int dobigint)
 Map SQL field type from string to ODBC integer type code.
 
static void getmd (const char *typename, int sqltype, int *mp, int *dp)
 Get maximum display size and number of digits after decimal point from field type specification.
 
static int mapdeftype (int type, int stype, int nosign, int nowchar)
 Map SQL_C_DEFAULT to proper C type.
 
static int checkddl (char *sql)
 Check if query is a DDL statement.
 
static char * fixupsql (char *sql, int sqlLen, int cte, int *nparam, int *isselect, char **errmsg)
 Fixup query string with optional parameter markers.
 
static void replilike (char *sql)
 Replace ILIKE with LIKE in-place given query string.
 
static int findcol (char **cols, int ncols, char *name)
 Find column given name in string array.
 
static void fixupdyncols (STMT *s, DBC *d)
 Fixup column information for a running statement.
 
static void convJD2YMD (double jd, DATE_STRUCT *ds)
 Convert julian day to year/month/day.
 
static void convJD2HMS (double jd, TIME_STRUCT *ts, int *fp)
 Convert julian day to hour/minute/second.
 
static int getmdays (int year, int month)
 Return number of month days.
 
static int str2date (int jdconv, char *str, DATE_STRUCT *ds)
 Convert string to ODBC DATE_STRUCT.
 
static int str2time (int jdconv, char *str, TIME_STRUCT *ts)
 Convert string to ODBC TIME_STRUCT.
 
static int str2timestamp (int jdconv, char *str, TIMESTAMP_STRUCT *tss)
 Convert string to ODBC TIMESTAMP_STRUCT.
 
static int getbool (char *string)
 Get boolean flag from string.
 
static void blob_import (sqlite3_context *ctx, int nargs, sqlite3_value **args)
 SQLite function to import a BLOB from a file.
 
static void blob_export (sqlite3_context *ctx, int nargs, sqlite3_value **args)
 SQLite function to export a BLOB to a file.
 
static void dbtrace (void *arg, const char *msg, sqlite_uint64 et)
 SQLite trace or profile callback.
 
static void dbtracerc (DBC *d, int rc, char *err)
 Trace function for SQLite return codes.
 
static SQLRETURN dbopen (DBC *d, char *name, int isu, char *dsn, char *sflag, char *spflag, char *ntflag, char *jmode, char *busy)
 Open SQLite database file given file name and flags.
 
static void dbloadext (DBC *d, char *exts)
 Load SQLite extension modules, if any.
 
static void dbattas (DBC *d, char *attas)
 Perform ATTACH commands to same database file.
 
static char * s3stmt_coltype (sqlite3_stmt *s3stmt, int col, DBC *d, int *guessed_types)
 Find out column type.
 
static int s3stmt_step (STMT *s)
 Do one sqlite statement step gathering one result row.
 
static void s3stmt_end (STMT *s)
 Stop running sqlite statement.
 
static void s3stmt_end_if (STMT *s)
 Conditionally stop running sqlite statement.
 
static SQLRETURN s3stmt_start (STMT *s)
 Start sqlite statement for execution of SELECT statement.
 
SQLRETURN SQL_API SQLDataSourcesW (SQLHENV env, SQLUSMALLINT dir, SQLWCHAR *srvname, SQLSMALLINT buflen1, SQLSMALLINT *lenp1, SQLWCHAR *desc, SQLSMALLINT buflen2, SQLSMALLINT *lenp2)
 Function not implemented.
 
SQLRETURN SQL_API SQLDriversW (SQLHENV env, SQLUSMALLINT dir, SQLWCHAR *drvdesc, SQLSMALLINT descmax, SQLSMALLINT *desclenp, SQLWCHAR *drvattr, SQLSMALLINT attrmax, SQLSMALLINT *attrlenp)
 Function not implemented.
 
SQLRETURN SQL_API SQLBrowseConnectW (SQLHDBC dbc, SQLWCHAR *connin, SQLSMALLINT conninLen, SQLWCHAR *connout, SQLSMALLINT connoutMax, SQLSMALLINT *connoutLen)
 Function not implemented.
 
static SQLRETURN drvputdata (SQLHSTMT stmt, SQLPOINTER data, SQLLEN len)
 Internal put (partial) parameter data into executing statement.
 
SQLRETURN SQL_API SQLPutData (SQLHSTMT stmt, SQLPOINTER data, SQLLEN len)
 Put (partial) parameter data into executing statement.
 
static SQLRETURN freeparams (STMT *s)
 Clear out parameter bindings, if any.
 
static SQLRETURN drvbindparam (SQLHSTMT stmt, SQLUSMALLINT pnum, SQLSMALLINT iotype, SQLSMALLINT buftype, SQLSMALLINT ptype, SQLUINTEGER coldef, SQLSMALLINT scale, SQLPOINTER data, SQLINTEGER buflen, SQLLEN *len)
 Internal bind parameter on HSTMT.
 
SQLRETURN SQL_API SQLBindParameter (SQLHSTMT stmt, SQLUSMALLINT pnum, SQLSMALLINT iotype, SQLSMALLINT buftype, SQLSMALLINT ptype, SQLULEN coldef, SQLSMALLINT scale, SQLPOINTER data, SQLLEN buflen, SQLLEN *len)
 Bind parameter on HSTMT.
 
SQLRETURN SQL_API SQLBindParam (SQLHSTMT stmt, SQLUSMALLINT pnum, SQLSMALLINT vtype, SQLSMALLINT ptype, SQLULEN lenprec, SQLSMALLINT scale, SQLPOINTER val, SQLLEN *lenp)
 Bind parameter on HSTMT.
 
SQLRETURN SQL_API SQLNumParams (SQLHSTMT stmt, SQLSMALLINT *nparam)
 Return number of parameters.
 
SQLRETURN SQL_API SQLParamData (SQLHSTMT stmt, SQLPOINTER *pind)
 Retrieve next parameter for sending data to executing query.
 
SQLRETURN SQL_API SQLDescribeParam (SQLHSTMT stmt, SQLUSMALLINT pnum, SQLSMALLINT *dtype, SQLULEN *size, SQLSMALLINT *decdigits, SQLSMALLINT *nullable)
 Return information about parameter.
 
SQLRETURN SQL_API SQLSetParam (SQLHSTMT stmt, SQLUSMALLINT par, SQLSMALLINT type, SQLSMALLINT sqltype, SQLULEN coldef, SQLSMALLINT scale, SQLPOINTER val, SQLLEN *nval)
 Set information on parameter.
 
SQLRETURN SQL_API SQLParamOptions (SQLHSTMT stmt, SQLULEN rows, SQLULEN *rowp)
 Function not implemented.
 
SQLRETURN SQL_API SQLGetDescFieldW (SQLHDESC handle, SQLSMALLINT recno, SQLSMALLINT fieldid, SQLPOINTER value, SQLINTEGER buflen, SQLINTEGER *strlen)
 Function not implemented.
 
SQLRETURN SQL_API SQLSetDescFieldW (SQLHDESC handle, SQLSMALLINT recno, SQLSMALLINT fieldid, SQLPOINTER value, SQLINTEGER buflen)
 Function not implemented.
 
SQLRETURN SQL_API SQLGetDescRecW (SQLHDESC handle, SQLSMALLINT recno, SQLWCHAR *name, SQLSMALLINT buflen, SQLSMALLINT *strlen, SQLSMALLINT *type, SQLSMALLINT *subtype, SQLLEN *len, SQLSMALLINT *prec, SQLSMALLINT *scale, SQLSMALLINT *nullable)
 Function not implemented.
 
SQLRETURN SQL_API SQLSetDescRec (SQLHDESC handle, SQLSMALLINT recno, SQLSMALLINT type, SQLSMALLINT subtype, SQLLEN len, SQLSMALLINT prec, SQLSMALLINT scale, SQLPOINTER data, SQLLEN *strlen, SQLLEN *indicator)
 Function not implemented.
 
static SQLRETURN mkresultset (HSTMT stmt, COL *colspec, int ncols, COL *colspec3, int ncols3, int *nret)
 Setup empty result set from constant column specification.
 
static SQLRETURN drvtableprivileges (SQLHSTMT stmt, SQLCHAR *cat, SQLSMALLINT catLen, SQLCHAR *schema, SQLSMALLINT schemaLen, SQLCHAR *table, SQLSMALLINT tableLen)
 Retrieve privileges on tables and/or views.
 
SQLRETURN SQL_API SQLTablePrivilegesW (SQLHSTMT stmt, SQLWCHAR *catalog, SQLSMALLINT catalogLen, SQLWCHAR *schema, SQLSMALLINT schemaLen, SQLWCHAR *table, SQLSMALLINT tableLen)
 Retrieve privileges on tables and/or views (UNICODE version).
 
SQLRETURN SQL_API SQLColumnPrivilegesW (SQLHSTMT stmt, SQLWCHAR *catalog, SQLSMALLINT catalogLen, SQLWCHAR *schema, SQLSMALLINT schemaLen, SQLWCHAR *table, SQLSMALLINT tableLen, SQLWCHAR *column, SQLSMALLINT columnLen)
 Retrieve privileges on columns (UNICODE version).
 
static 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 SQLPrimaryKeysW (SQLHSTMT stmt, SQLWCHAR *cat, SQLSMALLINT catLen, SQLWCHAR *schema, SQLSMALLINT schemaLen, SQLWCHAR *table, SQLSMALLINT tableLen)
 Retrieve information about indexed columns (UNICODE version).
 
static 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 SQLSpecialColumnsW (SQLHSTMT stmt, SQLUSMALLINT id, SQLWCHAR *cat, SQLSMALLINT catLen, SQLWCHAR *schema, SQLSMALLINT schemaLen, SQLWCHAR *table, SQLSMALLINT tableLen, SQLUSMALLINT scope, SQLUSMALLINT nullable)
 Retrieve information about indexed columns (UNICODE version).
 
static 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 SQLForeignKeysW (SQLHSTMT stmt, SQLWCHAR *PKcatalog, SQLSMALLINT PKcatalogLen, SQLWCHAR *PKschema, SQLSMALLINT PKschemaLen, SQLWCHAR *PKtable, SQLSMALLINT PKtableLen, SQLWCHAR *FKcatalog, SQLSMALLINT FKcatalogLen, SQLWCHAR *FKschema, SQLSMALLINT FKschemaLen, SQLWCHAR *FKtable, SQLSMALLINT FKtableLen)
 Retrieve information about primary/foreign keys (UNICODE version).
 
static SQLRETURN endtran (DBC *d, SQLSMALLINT comptype, int force)
 Internal commit or rollback transaction.
 
static 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, SQLUSMALLINT type)
 Commit or rollback transaction.
 
SQLRETURN SQL_API SQLCopyDesc (SQLHDESC source, SQLHDESC target)
 Function not implemented.
 
SQLRETURN SQL_API SQLNativeSqlW (SQLHSTMT stmt, SQLWCHAR *sqlin, SQLINTEGER sqlinLen, SQLWCHAR *sql, SQLINTEGER sqlMax, SQLINTEGER *sqlLen)
 Translate SQL string (UNICODE version).
 
SQLRETURN SQL_API SQLProceduresW (SQLHSTMT stmt, SQLWCHAR *catalog, SQLSMALLINT catalogLen, SQLWCHAR *schema, SQLSMALLINT schemaLen, SQLWCHAR *proc, SQLSMALLINT procLen)
 Retrieve information about stored procedures (UNICODE version).
 
SQLRETURN SQL_API SQLProcedureColumnsW (SQLHSTMT stmt, SQLWCHAR *catalog, SQLSMALLINT catalogLen, SQLWCHAR *schema, SQLSMALLINT schemaLen, SQLWCHAR *proc, SQLSMALLINT procLen, SQLWCHAR *column, SQLSMALLINT columnLen)
 Retrieve information about columns in result set of stored procedures (UNICODE version).
 
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.
 
static 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 SQLGetDiagRecW (SQLSMALLINT htype, SQLHANDLE handle, SQLSMALLINT recno, SQLWCHAR *sqlstate, SQLINTEGER *nativeerr, SQLWCHAR *msg, SQLSMALLINT buflen, SQLSMALLINT *msglen)
 Get error message given handle (HENV, HDBC, or HSTMT) (UNICODE version).
 
static SQLRETURN drvgetdiagfield (SQLSMALLINT htype, SQLHANDLE handle, SQLSMALLINT recno, SQLSMALLINT id, SQLPOINTER info, SQLSMALLINT buflen, SQLSMALLINT *stringlen)
 Get error record given handle (HDBC or HSTMT).
 
SQLRETURN SQL_API SQLGetDiagFieldW (SQLSMALLINT htype, SQLHANDLE handle, SQLSMALLINT recno, SQLSMALLINT id, SQLPOINTER info, SQLSMALLINT buflen, SQLSMALLINT *stringlen)
 Get error record given handle (HDBC or HSTMT).
 
static SQLRETURN drvgetstmtattr (SQLHSTMT stmt, SQLINTEGER attr, SQLPOINTER val, SQLINTEGER bufmax, SQLINTEGER *buflen)
 Internal get option of HSTMT.
 
SQLRETURN SQL_API SQLGetStmtAttrW (SQLHSTMT stmt, SQLINTEGER attr, SQLPOINTER val, SQLINTEGER bufmax, SQLINTEGER *buflen)
 Get option of HSTMT (UNICODE version).
 
static SQLRETURN drvsetstmtattr (SQLHSTMT stmt, SQLINTEGER attr, SQLPOINTER val, SQLINTEGER buflen)
 Internal set option on HSTMT.
 
SQLRETURN SQL_API SQLSetStmtAttrW (SQLHSTMT stmt, SQLINTEGER attr, SQLPOINTER val, SQLINTEGER buflen)
 Set option on HSTMT (UNICODE version).
 
static 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 SQL_API SQLGetStmtOptionW (SQLHSTMT stmt, SQLUSMALLINT opt, SQLPOINTER param)
 Get option of HSTMT (UNICODE version).
 
static SQLRETURN drvsetstmtoption (SQLHSTMT stmt, SQLUSMALLINT opt, SQLUINTEGER param)
 Internal set option on HSTMT.
 
SQLRETURN SQL_API SQLSetStmtOption (SQLHSTMT stmt, SQLUSMALLINT opt, SETSTMTOPTION_LAST_ARG_TYPE param)
 Set option on HSTMT.
 
SQLRETURN SQL_API SQLSetStmtOptionW (SQLHSTMT stmt, SQLUSMALLINT opt, SETSTMTOPTION_LAST_ARG_TYPE param)
 Set option on HSTMT (UNICODE version).
 
static SQLRETURN chkunbound (STMT *s)
 Check for unbound result columns.
 
static SQLRETURN setposbind (STMT *s, sqlite3_stmt *stmt, int i, int si, int rsi)
 Internal handler to setup parameters for positional updates from bound user buffers.
 
static SQLRETURN setposibind (STMT *s, sqlite3_stmt *stmt, int i, int si, int rsi)
 Internal handler to setup parameters for positional updates from driver side result set.
 
static SQLRETURN setposrefr (STMT *s, int rsi)
 Internal handler to refresh user buffers from driver side result set.
 
static SQLRETURN drvsetpos (SQLHSTMT stmt, SQLSETPOSIROW row, SQLUSMALLINT op, SQLUSMALLINT lock)
 Internal set position on result in HSTMT.
 
SQLRETURN SQL_API SQLSetPos (SQLHSTMT stmt, SQLSETPOSIROW row, SQLUSMALLINT op, SQLUSMALLINT lock)
 Set position on result in HSTMT.
 
static SQLRETURN drvbulkoperations (SQLHSTMT stmt, SQLSMALLINT op)
 Internal perform bulk operation on HSTMT.
 
SQLRETURN SQL_API SQLBulkOperations (SQLHSTMT stmt, SQLSMALLINT oper)
 Perform bulk operation on HSTMT.
 
SQLRETURN SQL_API SQLSetScrollOptions (SQLHSTMT stmt, SQLUSMALLINT concur, SQLLEN rowkeyset, SQLUSMALLINT rowset)
 Function not implemented.
 
static SQLRETURN drvgetinfo (SQLHDBC dbc, SQLUSMALLINT type, SQLPOINTER val, SQLSMALLINT valMax, SQLSMALLINT *valLen)
 Internal return information about what this ODBC driver supports.
 
SQLRETURN SQL_API SQLGetInfoW (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.
 
static SQLRETURN drvallocenv (SQLHENV *env)
 Internal allocate HENV.
 
SQLRETURN SQL_API SQLAllocEnv (SQLHENV *env)
 Allocate HENV.
 
static SQLRETURN drvfreeenv (SQLHENV env)
 Internal free HENV.
 
SQLRETURN SQL_API SQLFreeEnv (SQLHENV env)
 Free HENV.
 
static SQLRETURN drvallocconnect (SQLHENV env, SQLHDBC *dbc)
 Internal allocate HDBC.
 
SQLRETURN SQL_API SQLAllocConnect (SQLHENV env, SQLHDBC *dbc)
 Allocate HDBC.
 
static SQLRETURN drvfreeconnect (SQLHDBC dbc)
 Internal free connection (HDBC).
 
SQLRETURN SQL_API SQLFreeConnect (SQLHDBC dbc)
 Free connection (HDBC).
 
static SQLRETURN drvgetconnectattr (SQLHDBC dbc, SQLINTEGER attr, SQLPOINTER val, SQLINTEGER bufmax, SQLINTEGER *buflen)
 Internal get connect attribute of HDBC.
 
SQLRETURN SQL_API SQLGetConnectAttrW (SQLHDBC dbc, SQLINTEGER attr, SQLPOINTER val, SQLINTEGER bufmax, SQLINTEGER *buflen)
 Get connect attribute of HDBC (UNICODE version).
 
static SQLRETURN drvsetconnectattr (SQLHDBC dbc, SQLINTEGER attr, SQLPOINTER val, SQLINTEGER len)
 Internal set connect attribute of HDBC.
 
SQLRETURN SQL_API SQLSetConnectAttrW (SQLHDBC dbc, SQLINTEGER attr, SQLPOINTER val, SQLINTEGER len)
 Set connect attribute of HDBC (UNICODE version).
 
static SQLRETURN drvgetconnectoption (SQLHDBC dbc, SQLUSMALLINT opt, SQLPOINTER param)
 Internal get connect option of HDBC.
 
SQLRETURN SQL_API SQLGetConnectOptionW (SQLHDBC dbc, SQLUSMALLINT opt, SQLPOINTER param)
 Get connect option of HDBC (UNICODE version).
 
static SQLRETURN drvsetconnectoption (SQLHDBC dbc, SQLUSMALLINT opt, SQLUINTEGER param)
 Internal set option on HDBC.
 
SQLRETURN SQL_API SQLSetConnectOptionW (SQLHDBC dbc, SQLUSMALLINT opt, SQLULEN param)
 Set option on HDBC (UNICODE version).
 
static int getdsnattr (char *dsn, char *attr, char *out, int outLen)
 Handling of SQLConnect() connection attributes for standalone operation without driver manager.
 
static SQLRETURN drvconnect (SQLHDBC dbc, SQLCHAR *dsn, SQLSMALLINT dsnLen, char *pwd, int pwdLen, int isu)
 Internal connect to SQLite database.
 
SQLRETURN SQL_API SQLConnectW (SQLHDBC dbc, SQLWCHAR *dsn, SQLSMALLINT dsnLen, SQLWCHAR *uid, SQLSMALLINT uidLen, SQLWCHAR *pwd, SQLSMALLINT pwdLen)
 Connect to SQLite database.
 
static SQLRETURN drvdisconnect (SQLHDBC dbc)
 Internal disconnect given HDBC.
 
SQLRETURN SQL_API SQLDisconnect (SQLHDBC dbc)
 Disconnect given HDBC.
 
static 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.
 
static SQLRETURN freestmt (SQLHSTMT stmt)
 Internal free function for HSTMT.
 
static 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.
 
static 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.
 
static SQLRETURN drvgetcursorname (SQLHSTMT stmt, SQLCHAR *cursor, SQLSMALLINT buflen, SQLSMALLINT *lenp)
 Internal function to get cursor name of STMT.
 
SQLRETURN SQL_API SQLGetCursorNameW (SQLHSTMT stmt, SQLWCHAR *cursor, SQLSMALLINT buflen, SQLSMALLINT *lenp)
 Get cursor name of STMT (UNICODE version).
 
static SQLRETURN drvsetcursorname (SQLHSTMT stmt, SQLCHAR *cursor, SQLSMALLINT len)
 Internal function to set cursor name on STMT.
 
SQLRETURN SQL_API SQLSetCursorNameW (SQLHSTMT stmt, SQLWCHAR *cursor, SQLSMALLINT len)
 Set cursor name on STMT (UNICODE version).
 
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.
 
static SQLRETURN drvbindcol (SQLHSTMT stmt, SQLUSMALLINT col, SQLSMALLINT type, SQLPOINTER val, SQLLEN max, SQLLEN *lenp)
 Internal bind C variable to column of result set.
 
SQLRETURN SQL_API SQLBindCol (SQLHSTMT stmt, SQLUSMALLINT col, SQLSMALLINT type, SQLPOINTER val, SQLLEN max, SQLLEN *lenp)
 Bind C variable to column of result set.
 
static 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 SQLTablesW (SQLHSTMT stmt, SQLWCHAR *cat, SQLSMALLINT catLen, SQLWCHAR *schema, SQLSMALLINT schemaLen, SQLWCHAR *table, SQLSMALLINT tableLen, SQLWCHAR *type, SQLSMALLINT typeLen)
 Retrieve information on tables and/or views.
 
static 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 SQLColumnsW (SQLHSTMT stmt, SQLWCHAR *cat, SQLSMALLINT catLen, SQLWCHAR *schema, SQLSMALLINT schemaLen, SQLWCHAR *table, SQLSMALLINT tableLen, SQLWCHAR *col, SQLSMALLINT colLen)
 Retrieve column information on table (UNICODE version).
 
static void mktypeinfo (STMT *s, int row, int asize, char *typename, int type, int tind)
 Internal function to build up data type information as row in result set.
 
static int typeinfosort (const void *a, const void *b)
 Helper function to sort type information.
 
static SQLRETURN drvgettypeinfo (SQLHSTMT stmt, SQLSMALLINT sqltype)
 Internal return data type information.
 
SQLRETURN SQL_API SQLGetTypeInfoW (SQLHSTMT stmt, SQLSMALLINT sqltype)
 Return data type information (UNICODE version).
 
static 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 SQLStatisticsW (SQLHSTMT stmt, SQLWCHAR *cat, SQLSMALLINT catLen, SQLWCHAR *schema, SQLSMALLINT schemaLen, SQLWCHAR *table, SQLSMALLINT tableLen, SQLUSMALLINT itype, SQLUSMALLINT resv)
 Return statistic information on table indices (UNICODE version).
 
SQLRETURN SQL_API SQLGetData (SQLHSTMT stmt, SQLUSMALLINT col, SQLSMALLINT type, SQLPOINTER val, SQLLEN len, SQLLEN *lenp)
 Retrieve row data after fetch.
 
static SQLRETURN dofetchbind (STMT *s, int rsi)
 Internal: fetch and bind from statement's current row.
 
static SQLRETURN drvfetchscroll (SQLHSTMT stmt, SQLSMALLINT orient, SQLINTEGER offset)
 Internal fetch function for SQLFetchScroll() and SQLExtendedFetch().
 
SQLRETURN SQL_API SQLFetch (SQLHSTMT stmt)
 Fetch next result row.
 
SQLRETURN SQL_API SQLFetchScroll (SQLHSTMT stmt, SQLSMALLINT orient, SQLLEN offset)
 Fetch result row with scrolling.
 
SQLRETURN SQL_API SQLExtendedFetch (SQLHSTMT stmt, SQLUSMALLINT orient, SQLROWOFFSET offset, SQLROWSETSIZE *rowcount, SQLUSMALLINT *rowstatus)
 Fetch result row with scrolling and row status.
 
SQLRETURN SQL_API SQLRowCount (SQLHSTMT stmt, SQLLEN *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.
 
static SQLRETURN drvdescribecol (SQLHSTMT stmt, SQLUSMALLINT col, SQLCHAR *name, SQLSMALLINT nameMax, SQLSMALLINT *nameLen, SQLSMALLINT *type, SQLULEN *size, SQLSMALLINT *digits, SQLSMALLINT *nullable)
 Internal describe column information.
 
SQLRETURN SQL_API SQLDescribeColW (SQLHSTMT stmt, SQLUSMALLINT col, SQLWCHAR *name, SQLSMALLINT nameMax, SQLSMALLINT *nameLen, SQLSMALLINT *type, SQLULEN *size, SQLSMALLINT *digits, SQLSMALLINT *nullable)
 Describe column information (UNICODE version).
 
static SQLRETURN drvcolattributes (SQLHSTMT stmt, SQLUSMALLINT col, SQLUSMALLINT id, SQLPOINTER val, SQLSMALLINT valMax, SQLSMALLINT *valLen, SQLLEN *val2)
 Internal retrieve column attributes.
 

Variables

static const char * xdigits = "0123456789ABCDEFabcdef"
 
static const char upper_chars [] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
 
static const char lower_chars [] = "abcdefghijklmnopqrstuvwxyz"
 
static const char digit_chars [] = "0123456789"
 
static const char space_chars [] = " \f\n\r\t\v"
 
static COL tablePrivSpec2 []
 Columns for result set of SQLTablePrivileges().
 
static COL tablePrivSpec3 []
 
static COL colPrivSpec2 []
 Columns for result set of SQLColumnPrivileges().
 
static COL colPrivSpec3 []
 
static COL pkeySpec2 []
 Columns for result set of SQLPrimaryKeys().
 
static COL pkeySpec3 []
 
static COL scolSpec2 []
 Columns for result set of SQLSpecialColumns().
 
static COL scolSpec3 []
 
static COL fkeySpec2 []
 Columns for result set of SQLForeignKeys().
 
static COL fkeySpec3 []
 
static COL procSpec2 []
 Columns for result set of SQLProcedures().
 
static COL procSpec3 []
 
static COL procColSpec2 []
 Columns for result set of SQLProcedureColumns().
 
static COL procColSpec3 []
 
static COL tableSpec2 []
 Columns for result set of SQLTables().
 
static COL tableSpec3 []
 
static COL colSpec2 []
 Columns for result set of SQLColumns().
 
static COL colSpec3 []
 
static COL typeSpec2 []
 Columns for result set of SQLGetTypeInfo().
 
static COL typeSpec3 []
 
static COL statSpec2 []
 Columns for result set of SQLStatistics().
 
static COL statSpec3 []
 

Detailed Description

SQLite3 ODBC Driver main module.

Id
sqlite3odbc.c,v 1.183 2023/10/23 13:33:58 chw Exp chw

Copyright (c) 2004-2023 Christian Werner chw@c.nosp@m.h-we.nosp@m.rner..nosp@m.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 sqlite3odbc.c.

Macro Definition Documentation

◆ array_size

◆ CLR_EXISTS

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

◆ COLATTRIBUTE_LAST_ARG_TYPE

#define COLATTRIBUTE_LAST_ARG_TYPE   SQLPOINTER

Definition at line 216 of file sqlite3odbc.c.

◆ DBC_MAGIC

#define DBC_MAGIC   0x53544144

◆ DEAD_MAGIC

#define DEAD_MAGIC   0xdeadbeef

Definition at line 264 of file sqlite3odbc.c.

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

◆ DRIVER_VER_INFO

#define DRIVER_VER_INFO   "0.0"

Definition at line 209 of file sqlite3odbc.c.

Referenced by drvgetinfo().

◆ drvgetgpps

#define drvgetgpps ( d)

Definition at line 1291 of file sqlite3odbc.c.

Referenced by drvallocconnect().

◆ drvrelgpps

#define drvrelgpps ( d)

Definition at line 1292 of file sqlite3odbc.c.

Referenced by drvfreeconnect().

◆ ENV_MAGIC

#define ENV_MAGIC   0x53544145

◆ HDBC_LOCK

◆ HDBC_UNLOCK

◆ HSTMT_LOCK

◆ HSTMT_UNLOCK

◆ ISDIGIT

#define ISDIGIT ( c)
Value:
((c) && strchr(digit_chars, (c)) != NULL)
static const char digit_chars[]

Definition at line 568 of file sqlite3odbc.c.

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

◆ ISSPACE

#define ISSPACE ( c)
Value:
((c) && strchr(space_chars, (c)) != NULL)
static const char space_chars[]

Definition at line 577 of file sqlite3odbc.c.

Referenced by checkddl(), drvcolattributes(), drvgettable(), fixupsql(), and replilike().

◆ max

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

Definition at line 227 of file sqlite3odbc.c.

Referenced by drvbindcol(), drvbindparam(), dsappend(), dsappendq(), setsqliteopts(), and SQLBindCol().

◆ min

◆ ODBC_INI

#define ODBC_INI   ".odbc.ini"

Definition at line 205 of file sqlite3odbc.c.

Referenced by drvconnect(), and drvdriverconnect().

◆ PTRDIFF_T

#define PTRDIFF_T   int

◆ SCOL_CHAR

#define SCOL_CHAR   SQL_WCHAR

Definition at line 256 of file sqlite3odbc.c.

◆ SCOL_VARCHAR

#define SCOL_VARCHAR   SQL_WVARCHAR

Definition at line 255 of file sqlite3odbc.c.

◆ SET_EXISTS

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

Referenced by SQLGetFunctions().

◆ SETSTMTOPTION_LAST_ARG_TYPE

#define SETSTMTOPTION_LAST_ARG_TYPE   SQLROWCOUNT

Definition at line 221 of file sqlite3odbc.c.

◆ stringify

#define stringify ( s)
Value:
#define stringify1(s)

Definition at line 236 of file sqlite3odbc.c.

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

◆ stringify1

#define stringify1 ( s)
Value:
#s

Definition at line 235 of file sqlite3odbc.c.

◆ strmak

#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; \
}
#define min(a, b)
#define max(a, b)

Definition at line 11144 of file sqlite3odbc.c.

Referenced by drvgetinfo().

◆ verinfo

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

Definition at line 238 of file sqlite3odbc.c.

Referenced by drvallocconnect().

◆ WCHARSUPPORT

#define WCHARSUPPORT

Definition at line 185 of file sqlite3odbc.c.

Referenced by drvputdata().

◆ WINTERFACE

#define WINTERFACE

Definition at line 184 of file sqlite3odbc.c.

◆ xfree

#define xfree ( x)
Value:
sqlite3_free(x)

Definition at line 405 of file sqlite3odbc.c.

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

◆ xmalloc

◆ xrealloc

#define xrealloc ( x,
y )
Value:
sqlite3_realloc(x, y)

Definition at line 404 of file sqlite3odbc.c.

Referenced by drvbindparam(), drvgettable_row(), dsappend(), dsappendq(), and mkbindcols().

◆ xstrdup

#define xstrdup ( x)
Value:
static char * strdup_(const char *str)
Duplicate string using xmalloc().

Definition at line 406 of file sqlite3odbc.c.

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

Typedef Documentation

◆ dstr

typedef struct dstr dstr

◆ TBLRES

typedef struct tblres TBLRES

Function Documentation

◆ blob_export()

static void blob_export ( sqlite3_context * ctx,
int nargs,
sqlite3_value ** args )
static

SQLite function to export a BLOB to a file.

Parameters
ctxfunction context
nargsnumber arguments
argsarguments

Definition at line 3824 of file sqlite3odbc.c.

References uc_free().

Referenced by dbopen().

◆ blob_import()

static void blob_import ( sqlite3_context * ctx,
int nargs,
sqlite3_value ** args )
static

SQLite function to import a BLOB from a file.

Parameters
ctxfunction context
nargsnumber arguments
argsarguments

Definition at line 3754 of file sqlite3odbc.c.

References uc_free().

Referenced by dbopen().

◆ busy_handler()

static int busy_handler ( void * udata,
int count )
static

Busy callback for SQLite.

Parameters
udatauser data, pointer to DBC
countcount of subsequenct calls
Returns
true or false

Definition at line 2021 of file sqlite3odbc.c.

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

Referenced by endtran(), setsqliteopts(), and starttran().

◆ checkddl()

static int checkddl ( char * sql)
static

Check if query is a DDL statement.

Parameters
sqlquery string
Returns
true or false

Definition at line 2474 of file sqlite3odbc.c.

References array_size, and ISSPACE.

Referenced by fixupsql().

◆ chkunbound()

static SQLRETURN chkunbound ( STMT * s)
static

Check for unbound result columns.

Parameters
sstatement handle
Returns
ODBC error code

Definition at line 9855 of file sqlite3odbc.c.

References stmt::bindcols, stmt::nbindcols, stmt::ncols, stmt::ov3, setstat(), BINDCOL::type, and BINDCOL::valp.

Referenced by drvbulkoperations(), and drvsetpos().

◆ convJD2HMS()

static void convJD2HMS ( double jd,
TIME_STRUCT * ts,
int * fp )
static

Convert julian day to hour/minute/second.

Parameters
jdjulian day as stored in database
tsoutput TIME_STRUCT
fpoptional fractional part output

Definition at line 3107 of file sqlite3odbc.c.

Referenced by str2time(), and str2timestamp().

◆ convJD2YMD()

static void convJD2YMD ( double jd,
DATE_STRUCT * ds )
static

Convert julian day to year/month/day.

Parameters
jdjulian day as stored in database
dsoutput DATE_STRUCT

Definition at line 3079 of file sqlite3odbc.c.

Referenced by str2date(), and str2timestamp().

◆ dbattas()

static void dbattas ( DBC * d,
char * attas )
static

Perform ATTACH commands to same database file.

Parameters
dDBC pointer
attasstring, comma separated names

Definition at line 4263 of file sqlite3odbc.c.

References dbc::dbname, and dbc::sqlite.

Referenced by drvconnect(), and drvdriverconnect().

◆ dbloadext()

static void dbloadext ( DBC * d,
char * exts )
static

Load SQLite extension modules, if any.

Parameters
dDBC pointer
extsstring, comma separated extension names

Definition at line 4185 of file sqlite3odbc.c.

References dbc::sqlite.

Referenced by drvconnect(), and drvdriverconnect().

◆ dbopen()

static SQLRETURN dbopen ( DBC * d,
char * name,
int isu,
char * dsn,
char * sflag,
char * spflag,
char * ntflag,
char * jmode,
char * busy )
static

Open SQLite database file given file name and flags.

Parameters
dDBC pointer
namefile name
isutrue/false: file name is UTF8 encoded
dsndata source name
sflagSTEPAPI flag
spflagSyncPragma string
ntflagNoTransaction string
jmodeJournalMode string
busybusy/lock timeout
Returns
ODBC error code

Definition at line 3971 of file sqlite3odbc.c.

References blob_export(), blob_import(), dbc::curtype, dbc::dbname, dbtrace(), dbc::dsn, freep(), getbool(), dbc::nocreat, dbc::ov3, dbc::pwd, dbc::pwdLen, setsqliteopts(), setstatd(), dbc::sqlite, dbc::step_enable, dbc::timeout, dbc::trace, dbc::trans_disable, uc_free(), and xstrdup.

Referenced by drvconnect(), and drvdriverconnect().

◆ dbtrace()

static void dbtrace ( void * arg,
const char * msg,
sqlite_uint64 et )
static

SQLite trace or profile callback.

Parameters
argDBC pointer
msglog message, SQL text
etelapsed time

Definition at line 3889 of file sqlite3odbc.c.

References dbc::trace.

Referenced by dbopen().

◆ dbtraceapi()

static void dbtraceapi ( DBC * d,
char * fn,
const char * sql )
static

Trace function for SQLite API calls.

Parameters
dpointer to database connection handle
fnSQLite function name
sqlSQL string

Definition at line 3927 of file sqlite3odbc.c.

References dbc::trace.

Referenced by drvbulkoperations(), drvcolumns(), drvforeignkeys(), drvgettable(), drvprimarykeys(), drvsetpos(), drvspecialcolumns(), drvstatistics(), drvtableprivileges(), drvtables(), fixupdyncols(), s3stmt_drop(), s3stmt_end(), s3stmt_start(), and s3stmt_step().

◆ dbtracerc()

static void dbtracerc ( DBC * d,
int rc,
char * err )
static

Trace function for SQLite return codes.

Parameters
dpointer to database connection handle
rcSQLite return code
errerror string or NULL

Definition at line 3947 of file sqlite3odbc.c.

References dbc::trace.

Referenced by drvbulkoperations(), drvsetpos(), endtran(), s3stmt_start(), and starttran().

◆ dofetchbind()

static SQLRETURN dofetchbind ( STMT * s,
int rsi )
static

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

Parameters
sstatement pointer
rsirowset index
Returns
ODBC error code

Definition at line 16623 of file sqlite3odbc.c.

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

Referenced by drvfetchscroll().

◆ drvallocconnect()

static SQLRETURN drvallocconnect ( SQLHENV env,
SQLHDBC * dbc )
static

Internal allocate HDBC.

Parameters
envenvironment handle
dbcpointer to database connection handle
Returns
ODBC error code

Definition at line 12033 of file sqlite3odbc.c.

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

Referenced by SQLAllocConnect(), and SQLAllocHandle().

◆ drvallocenv()

static SQLRETURN drvallocenv ( SQLHENV * env)
static

Internal allocate HENV.

Parameters
envpointer to environment handle
Returns
ODBC error code

Definition at line 11938 of file sqlite3odbc.c.

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

Referenced by SQLAllocEnv(), and SQLAllocHandle().

◆ drvallocstmt()

static SQLRETURN drvallocstmt ( SQLHDBC dbc,
SQLHSTMT * stmt )
static

◆ drvbindcol()

static SQLRETURN drvbindcol ( SQLHSTMT stmt,
SQLUSMALLINT col,
SQLSMALLINT type,
SQLPOINTER val,
SQLLEN max,
SQLLEN * lenp )
static

Internal bind C variable to column of result set.

Parameters
stmtstatement handle
colcolumn number, starting at 1
typeoutput type
valoutput buffer
maxlength of output buffer
lenpoutput length pointer
Returns
ODBC error code

Definition at line 14596 of file sqlite3odbc.c.

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

Referenced by SQLBindCol().

◆ drvbindparam()

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

Internal bind parameter on HSTMT.

Parameters
stmtstatement handle
pnumparameter number, starting at 1
iotypeinput/output type of parameter
buftypetype of host variable
ptype
coldef
scale
datapointer to host variable
buflenlength of host variable
lenoutput length pointer
Returns
ODBC error code

Definition at line 5506 of file sqlite3odbc.c.

References stmt::bindparms, BINDPARM::bound, BINDPARM::coldef, freep(), BINDPARM::inc, BINDPARM::len, BINDPARM::lenp, BINDPARM::lenp0, BINDPARM::max, max, stmt::nbindparms, BINDPARM::need, nomem(), BINDPARM::offs, stmt::ov3, BINDPARM::param, BINDPARM::param0, BINDPARM::parbuf, BINDPARM::scale, setstat(), BINDPARM::stype, BINDPARM::type, xmalloc, and xrealloc.

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

◆ drvbulkoperations()

static SQLRETURN drvbulkoperations ( SQLHSTMT stmt,
SQLSMALLINT op )
static

◆ drvcolattributes()

static SQLRETURN drvcolattributes ( SQLHSTMT stmt,
SQLUSMALLINT col,
SQLUSMALLINT id,
SQLPOINTER val,
SQLSMALLINT valMax,
SQLSMALLINT * valLen,
SQLLEN * val2 )
static

Internal retrieve column attributes.

Parameters
stmtstatement handle
colcolumn number, starting at 1
idattribute id
valoutput buffer
valMaxlength of output buffer
valLenoutput length
val2integer output buffer
Returns
ODBC error code

Retrieve column attributes (UNICODE version).

Parameters
stmtstatement handle
colcolumn number, starting at 1
idattribute id
valoutput buffer
valMaxlength of output buffer
valLenoutput length
val2integer output buffer
Returns
ODBC error code

Internal retrieve column attributes.

Parameters
stmtstatement handle
colcolumn number, starting at 1
idattribute id
valoutput buffer
valMaxlength of output buffer
valLenoutput length
val2integer output buffer
Returns
ODBC error code

Retrieve column attributes (UNICODE version).

Parameters
stmtstatement handle
colcolumn number, starting at 1
idattribute id
valoutput buffer
valMaxlength of output buffer
valLenoutput length
val2integer output buffer
Returns
ODBC error code

Internal return last HDBC or HSTMT error message.

Parameters
envenvironment handle or NULL
dbcdatabase connection handle or NULL
stmtstatement handle or NULL
sqlStateoutput buffer for SQL state
nativeErroutput buffer for native error code
errmsgoutput buffer for error message
errmaxlength of output buffer for error message
errlenoutput length of error message
Returns
ODBC error code

Return last HDBC or HSTMT error message (UNICODE version).

Parameters
envenvironment handle or NULL
dbcdatabase connection handle or NULL
stmtstatement handle or NULL
sqlStateoutput buffer for SQL state
nativeErroutput buffer for native error code
errmsgoutput buffer for error message
errmaxlength of output buffer for error message
errlenoutput length of error message
Returns
ODBC error code

Return information for more result sets.

Parameters
stmtstatement handle
Returns
ODBC error code

Internal function to setup column name/type information

Parameters
sstatement poiner
s3stmtSQLite3 statement pointer
ncolsppointer to preinitialized number of columns
Returns
ODBC error code

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

Parameters
stmtstatement handle
queryquery string
queryLenlength of query string or SQL_NTS
Returns
ODBC error code

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

Parameters
stmtstatement handle
initialfalse when called from SQLPutData()
Returns
ODBC error code

Prepare HSTMT (UNICODE version).

Parameters
stmtstatement handle
queryquery string
queryLenlength of query string or SQL_NTS
Returns
ODBC error code

Execute query.

Parameters
stmtstatement handle
Returns
ODBC error code

Execute query directly (UNICODE version).

Parameters
stmtstatement handle
queryquery string
queryLenlength of query string or SQL_NTS
Returns
ODBC error code

Connect using a driver connection string (UNICODE version).

Parameters
dbcdatabase connection handle
hwndparent window handle
connIndriver connect input string
connInLenlength of driver connect input string or SQL_NTS
connOutdriver connect output string
connOutMaxlength of driver connect output string
connOutLenoutput length of driver connect output string
drvcomplcompletion type
Returns
ODBC error code

Definition at line 17336 of file sqlite3odbc.c.

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

◆ drvcolumns()

static 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
stmtstatement handle
catcatalog name/pattern or NULL
catLenlength of catalog name/pattern or SQL_NTS
schemaschema name/pattern or NULL
schemaLenlength of schema name/pattern or SQL_NTS
tabletable name/pattern or NULL
tableLenlength of table name/pattern or SQL_NTS
colcolumn name/pattern or NULL
colLenlength of column name/pattern or SQL_NTS
Returns
ODBC error code

Definition at line 15199 of file sqlite3odbc.c.

References array_size, colSpec2, colSpec3, stmt::dbc, dbtraceapi(), stmt::dobigint, freerows(), getmd(), mapsqltype(), min, mkresultset(), namematch(), nomem(), stmt::nowchar, stmt::nrows, stmt::ov3, PTRDIFF_T, stmt::rowfree, stmt::rows, setstat(), dbc::sqlite, starttran(), stringify, unescpat(), unquote(), xmalloc, and xstrdup.

Referenced by SQLColumnsW().

◆ drvconnect()

static SQLRETURN drvconnect ( SQLHDBC dbc,
SQLCHAR * dsn,
SQLSMALLINT dsnLen,
char * pwd,
int pwdLen,
int isu )
static

Internal connect to SQLite database.

Parameters
dbcdatabase connection handle
dsnDSN string
dsnLenlength of DSN string or SQL_NTS
pwdpassword or NULL
pwdLenlength of password or SQL_NTS
isutrue/false: file name is UTF8 encoded
Returns
ODBC error code

Definition at line 12793 of file sqlite3odbc.c.

References dbattas(), DBC_MAGIC, dbloadext(), dbopen(), dbc::dobigint, dbc::fksupport, getbool(), getdsnattr(), dbc::ilike, dbc::jdconv, dbc::longnames, dbc::magic, min, dbc::nocreat, dbc::nowchar, ODBC_INI, dbc::oemcp, dbc::ov3, dbc::pwd, dbc::pwdLen, setstatd(), dbc::shortnames, dbc::sqlite, dbc::trace, and uc_free().

Referenced by SQLConnectW().

◆ drvdescribecol()

static SQLRETURN drvdescribecol ( SQLHSTMT stmt,
SQLUSMALLINT col,
SQLCHAR * name,
SQLSMALLINT nameMax,
SQLSMALLINT * nameLen,
SQLSMALLINT * type,
SQLULEN * size,
SQLSMALLINT * digits,
SQLSMALLINT * nullable )
static

Internal describe column information.

Parameters
stmtstatement handle
colcolumn number, starting at 1
namebuffer for column name
nameMaxlength of name buffer
nameLenoutput length of column name
typeoutput SQL type
sizeoutput column size
digitsoutput number of digits
nullableoutput NULL allowed indicator
Returns
ODBC error code

Definition at line 17110 of file sqlite3odbc.c.

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

Referenced by SQLDescribeColW().

◆ drvdisconnect()

static SQLRETURN drvdisconnect ( SQLHDBC dbc)
static

Internal disconnect given HDBC.

Parameters
dbcdatabase connection handle
Returns
ODBC error code

Definition at line 13056 of file sqlite3odbc.c.

References dbc::cur_s3stmt, DBC_MAGIC, dbc::dbname, dbc::dsn, freep(), dbc::intrans, dbc::magic, s3stmt_end(), setstatd(), dbc::sqlite, and dbc::trace.

Referenced by SQLDisconnect().

◆ drvdriverconnect()

static 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
dbcdatabase connection handle
hwnddummy window handle or NULL
connIndriver connect input string
connInLenlength of driver connect input string or SQL_NTS
connOutdriver connect output string
connOutMaxlength of driver connect output string
connOutLenoutput length of driver connect output string
drvcomplcompletion type
Returns
ODBC error code

Definition at line 13126 of file sqlite3odbc.c.

References dbattas(), dbloadext(), dbopen(), dbc::dobigint, dbc::fksupport, getbool(), getdsnattr(), dbc::ilike, dbc::jdconv, dbc::longnames, min, dbc::nocreat, dbc::nowchar, ODBC_INI, dbc::oemcp, dbc::ov3, dbc::pwd, dbc::pwdLen, setstatd(), dbc::shortnames, dbc::sqlite, and dbc::trace.

◆ drvendtran()

static SQLRETURN drvendtran ( SQLSMALLINT type,
SQLHANDLE handle,
SQLSMALLINT comptype )
static

Internal commit or rollback transaction.

Parameters
typetype of handle
handleHDBC, HENV, or HSTMT handle
comptypeSQL_COMMIT or SQL_ROLLBACK
Returns
ODBC error code

Definition at line 8238 of file sqlite3odbc.c.

References endtran(), ENV_MAGIC, HDBC_LOCK, HDBC_UNLOCK, ENV::magic, and dbc::next.

Referenced by SQLEndTran(), and SQLTransact().

◆ drvexecute()

static SQLRETURN drvexecute ( SQLHSTMT stmt,
int initial )
static

Referenced by SQLParamData().

◆ drvfetchscroll()

static SQLRETURN drvfetchscroll ( SQLHSTMT stmt,
SQLSMALLINT orient,
SQLINTEGER offset )
static

◆ drvforeignkeys()

static 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
stmtstatement handle
PKcatalogprimary key catalog name/pattern or NULL
PKcatalogLenlength of PKcatalog or SQL_NTS
PKschemaprimary key schema name/pattern or NULL
PKschemaLenlength of PKschema or SQL_NTS
PKtableprimary key table name/pattern or NULL
PKtableLenlength of PKtable or SQL_NTS
FKcatalogforeign key catalog name/pattern or NULL
FKcatalogLenlength of FKcatalog or SQL_NTS
FKschemaforeign key schema name/pattern or NULL
FKschemaLenlength of FKschema or SQL_NTS
FKtableforeign key table name/pattern or NULL
FKtableLenlength of FKtable or SQL_NTS
Returns
ODBC error code

Definition at line 7550 of file sqlite3odbc.c.

References array_size, stmt::dbc, dbtraceapi(), findcol(), fkeySpec2, fkeySpec3, freerows(), min, mkresultset(), stmt::ncols, nomem(), stmt::nrows, stmt::ov3, PTRDIFF_T, stmt::rowfree, stmt::rows, setstat(), dbc::sqlite, starttran(), stringify, unquote(), xmalloc, and xstrdup.

Referenced by SQLForeignKeysW().

◆ drvfreeconnect()

static SQLRETURN drvfreeconnect ( SQLHDBC dbc)
static

Internal free connection (HDBC).

Parameters
dbcdatabase connection handle
Returns
ODBC error code

Definition at line 12112 of file sqlite3odbc.c.

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

Referenced by SQLFreeConnect(), and SQLFreeHandle().

◆ drvfreeenv()

static SQLRETURN drvfreeenv ( SQLHENV env)
static

Internal free HENV.

Parameters
envenvironment handle
Returns
ODBC error code

Definition at line 11984 of file sqlite3odbc.c.

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

Referenced by SQLFreeEnv(), and SQLFreeHandle().

◆ drvfreestmt()

static SQLRETURN drvfreestmt ( SQLHSTMT stmt,
SQLUSMALLINT opt )
static

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

Parameters
stmtstatement handle
optSQL_RESET_PARAMS, SQL_UNBIND, SQL_CLOSE, or SQL_DROP
Returns
ODBC error code

Definition at line 13525 of file sqlite3odbc.c.

References stmt::dbc, freeparams(), freeresult(), freestmt(), HDBC_UNLOCK, HSTMT_LOCK, stmt::ov3, s3stmt_end_if(), setstat(), and unbindcols().

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

◆ drvgetconnectattr()

static SQLRETURN drvgetconnectattr ( SQLHDBC dbc,
SQLINTEGER attr,
SQLPOINTER val,
SQLINTEGER bufmax,
SQLINTEGER * buflen )
static

Internal get connect attribute of HDBC.

Parameters
dbcdatabase connection handle
attroption to be retrieved
valoutput buffer
bufmaxsize of output buffer
buflenoutput length
Returns
ODBC error code

Definition at line 12206 of file sqlite3odbc.c.

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

Referenced by SQLGetConnectAttrW().

◆ drvgetconnectoption()

static SQLRETURN drvgetconnectoption ( SQLHDBC dbc,
SQLUSMALLINT opt,
SQLPOINTER param )
static

Internal get connect option of HDBC.

Parameters
dbcdatabase connection handle
optoption to be retrieved
paramoutput buffer
Returns
ODBC error code

Definition at line 12529 of file sqlite3odbc.c.

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

Referenced by SQLGetConnectOptionW().

◆ drvgetcursorname()

static SQLRETURN drvgetcursorname ( SQLHSTMT stmt,
SQLCHAR * cursor,
SQLSMALLINT buflen,
SQLSMALLINT * lenp )
static

Internal function to get cursor name of STMT.

Parameters
stmtstatement handle
cursoroutput buffer
buflenlength of output buffer
lenpoutput length
Returns
ODBC error code

Definition at line 13613 of file sqlite3odbc.c.

References stmt::cursorname, and min.

Referenced by SQLGetCursorNameW().

◆ drvgetdiagfield()

static SQLRETURN drvgetdiagfield ( SQLSMALLINT htype,
SQLHANDLE handle,
SQLSMALLINT recno,
SQLSMALLINT id,
SQLPOINTER info,
SQLSMALLINT buflen,
SQLSMALLINT * stringlen )
static

Get error record given handle (HDBC or HSTMT).

Parameters
htypehandle type
handleHDBC or HSTMT
recnodiag record number for which info to be retrieved
iddiag id for which info to be retrieved
infooutput buffer for error message
buflenlength of output buffer
stringlenoutput length
Returns
ODBC error code

Definition at line 8967 of file sqlite3odbc.c.

References stmt::dbc, dbc::dsn, HDBC_LOCK, HDBC_UNLOCK, HSTMT_LOCK, HSTMT_UNLOCK, stmt::isselect, dbc::logmsg, stmt::logmsg, dbc::naterr, stmt::naterr, stmt::nrows, dbc::sqlstate, stmt::sqlstate, and SQLULEN.

Referenced by SQLGetDiagFieldW().

◆ drvgetdiagrec()

static 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
htypehandle type
handleHENV, HDBC, or HSTMT
recno
sqlstateoutput buffer for SQL state
nativeerroutput buffer of native error code
msgoutput buffer for error message
buflenlength of output buffer
msglenoutput length
Returns
ODBC error code

Definition at line 8758 of file sqlite3odbc.c.

References HDBC_LOCK, HDBC_UNLOCK, HSTMT_LOCK, HSTMT_UNLOCK, dbc::logmsg, stmt::logmsg, dbc::naterr, stmt::naterr, dbc::sqlstate, and stmt::sqlstate.

Referenced by SQLGetDiagRecW().

◆ drvgetinfo()

static SQLRETURN drvgetinfo ( SQLHDBC dbc,
SQLUSMALLINT type,
SQLPOINTER val,
SQLSMALLINT valMax,
SQLSMALLINT * valLen )
static

Internal return information about what this ODBC driver supports.

Parameters
dbcdatabase connection handle
typetype of information to be retrieved
valoutput buffer
valMaxlength of output buffer
valLenoutput length
Returns
ODBC error code

Definition at line 11162 of file sqlite3odbc.c.

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

Referenced by SQLGetInfoW().

◆ drvgetstmtattr()

static SQLRETURN drvgetstmtattr ( SQLHSTMT stmt,
SQLINTEGER attr,
SQLPOINTER val,
SQLINTEGER bufmax,
SQLINTEGER * buflen )
static

Internal get option of HSTMT.

Parameters
stmtstatement handle
attrattribute to be retrieved
valoutput buffer
bufmaxlength of output buffer
buflenoutput length
Returns
ODBC error code

Definition at line 9242 of file sqlite3odbc.c.

References stmt::bind_offs, stmt::bind_type, stmt::bkmrk, stmt::bkmrkptr, stmt::curtype, DEAD_MAGIC, drvunimplstmt(), stmt::max_rows, stmt::paramset_size, stmt::parm_bind_offs, stmt::parm_bind_type, stmt::parm_oper, stmt::parm_proc, stmt::parm_status, stmt::retr_data, stmt::row_count, stmt::row_status, stmt::rowp, stmt::rowset_size, stmt::s3stmt, stmt::s3stmt_rownum, and SQLULEN.

Referenced by SQLGetStmtAttrW().

◆ drvgetstmtoption()

static SQLRETURN drvgetstmtoption ( SQLHSTMT stmt,
SQLUSMALLINT opt,
SQLPOINTER param )
static

Internal get option of HSTMT.

Parameters
stmtstatement handle
optoption to be retrieved
paramoutput buffer
Returns
ODBC error code

Definition at line 9645 of file sqlite3odbc.c.

References stmt::curtype, drvunimplstmt(), stmt::max_rows, stmt::retr_data, stmt::rowp, stmt::rowset_size, stmt::s3stmt, and stmt::s3stmt_rownum.

Referenced by SQLGetStmtOption(), and SQLGetStmtOptionW().

◆ drvgettable()

static int drvgettable ( STMT * s,
const char * sql,
char *** resp,
int * nrowp,
int * ncolp,
char ** errp,
int nparam,
BINDPARM * p )
static

◆ drvgettable_row()

static int drvgettable_row ( TBLRES * t,
int ncol,
int rc )
static

◆ drvgettypeinfo()

static SQLRETURN drvgettypeinfo ( SQLHSTMT stmt,
SQLSMALLINT sqltype )
static

Internal return data type information.

Parameters
stmtstatement handle
sqltypewhich type to retrieve
Returns
ODBC error code

Definition at line 15879 of file sqlite3odbc.c.

References array_size, mkresultset(), mktypeinfo(), nomem(), stmt::nrows, stmt::ov3, stmt::rowfree, stmt::rows, typeinfosort(), typeSpec2, typeSpec3, and xmalloc.

Referenced by SQLGetTypeInfoW().

◆ drvprimarykeys()

static SQLRETURN drvprimarykeys ( SQLHSTMT stmt,
SQLCHAR * cat,
SQLSMALLINT catLen,
SQLCHAR * schema,
SQLSMALLINT schemaLen,
SQLCHAR * table,
SQLSMALLINT tableLen )
static

Internal retrieve information about indexed columns.

Parameters
stmtstatement handle
catcatalog name/pattern or NULL
catLenlength of catalog name/pattern or SQL_NTS
schemaschema name/pattern or NULL
schemaLenlength of schema name/pattern or SQL_NTS
tabletable name/pattern or NULL
tableLenlength of table name/pattern or SQL_NTS
Returns
ODBC error code

Definition at line 6684 of file sqlite3odbc.c.

References array_size, stmt::dbc, dbtraceapi(), findcol(), freerows(), min, mkresultset(), stmt::ncols, nomem(), stmt::nrows, stmt::ov3, pkeySpec2, pkeySpec3, PTRDIFF_T, stmt::rowfree, stmt::rows, setstat(), dbc::sqlite, starttran(), unescpat(), xmalloc, and xstrdup.

Referenced by SQLPrimaryKeysW().

◆ drvputdata()

static SQLRETURN drvputdata ( SQLHSTMT stmt,
SQLPOINTER data,
SQLLEN len )
static

Internal put (partial) parameter data into executing statement.

Parameters
stmtstatement handle
datapointer to data
lenlength of data
Returns
ODBC error code

Definition at line 4908 of file sqlite3odbc.c.

References stmt::bindparms, BINDPARM::coldef, freep(), BINDPARM::len, mapdeftype(), min, BINDPARM::need, nomem(), stmt::nowchar, stmt::nparams, stmt::oemcp, BINDPARM::offs, BINDPARM::param, BINDPARM::parbuf, stmt::pdcount, stmt::query, setstat(), BINDPARM::stype, BINDPARM::type, uc_free(), uc_to_utf(), WCHARSUPPORT, and xmalloc.

Referenced by SQLPutData().

◆ drvsetconnectattr()

static SQLRETURN drvsetconnectattr ( SQLHDBC dbc,
SQLINTEGER attr,
SQLPOINTER val,
SQLINTEGER len )
static

Internal set connect attribute of HDBC.

Parameters
dbcdatabase connection handle
attroption to be set
valoption value
lensize of option
Returns
ODBC error code

Definition at line 12442 of file sqlite3odbc.c.

References dbc::autocommit, dbc::cur_s3stmt, endtran(), dbc::intrans, s3stmt_end(), and setstatd().

Referenced by SQLSetConnectAttrW().

◆ drvsetconnectoption()

static SQLRETURN drvsetconnectoption ( SQLHDBC dbc,
SQLUSMALLINT opt,
SQLUINTEGER param )
static

Internal set option on HDBC.

Parameters
dbcdatabase connection handle
optoption to be set
paramoption value
Returns
ODBC error code

Definition at line 12671 of file sqlite3odbc.c.

References dbc::autocommit, dbc::cur_s3stmt, endtran(), dbc::intrans, s3stmt_end(), and setstatd().

Referenced by SQLSetConnectOptionW().

◆ drvsetcursorname()

static SQLRETURN drvsetcursorname ( SQLHSTMT stmt,
SQLCHAR * cursor,
SQLSMALLINT len )
static

Internal function to set cursor name on STMT.

Parameters
stmtstatement handle
cursornew cursor name
lenlength of cursor name or SQL_NTS
Returns
ODBC error code

Definition at line 13750 of file sqlite3odbc.c.

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

Referenced by SQLSetCursorNameW().

◆ drvsetpos()

static SQLRETURN drvsetpos ( SQLHSTMT stmt,
SQLSETPOSIROW row,
SQLUSMALLINT op,
SQLUSMALLINT lock )
static

Internal set position on result in HSTMT.

Parameters
stmtstatement handle
rowrow to be positioned
opoperation code
locklocking type
Returns
ODBC error code

Definition at line 10329 of file sqlite3odbc.c.

References stmt::bindcols, chkunbound(), COL::column, stmt::curtype, COL::db, stmt::dbc, dbtraceapi(), dbtracerc(), drvsetpos(), drvunimplstmt(), dsappend(), dsappendq(), dserr(), dsfree(), dsval(), stmt::dyncols, stmt::has_pk, COL::ispk, stmt::isselect, stmt::ncols, nomem(), stmt::nrows, stmt::one_tbl, stmt::ov3, stmt::row_status, stmt::row_status0, stmt::rowp, stmt::rows, stmt::rowset_size, setposbind(), setposibind(), setposrefr(), setstat(), dbc::sqlite, and COL::table.

Referenced by drvsetpos(), and SQLSetPos().

◆ drvsetstmtattr()

static SQLRETURN drvsetstmtattr ( SQLHSTMT stmt,
SQLINTEGER attr,
SQLPOINTER val,
SQLINTEGER buflen )
static

Internal set option on HSTMT.

Parameters
stmtstatement handle
attrattribute to be set
valinput buffer (attribute value)
buflenlength of input buffer
Returns
ODBC error code

Definition at line 9437 of file sqlite3odbc.c.

References stmt::bind_offs, stmt::bind_type, stmt::bkmrk, stmt::bkmrkptr, stmt::curtype, drvunimplstmt(), freep(), stmt::max_rows, nomem(), stmt::ov3, stmt::paramset_count, stmt::paramset_size, stmt::parm_bind_offs, stmt::parm_bind_type, stmt::parm_oper, stmt::parm_proc, stmt::parm_status, stmt::retr_data, stmt::row_count, stmt::row_status, stmt::row_status0, stmt::row_status1, stmt::rowset_size, setstat(), SQLULEN, and xmalloc.

Referenced by SQLSetStmtAttrW().

◆ drvsetstmtoption()

static SQLRETURN drvsetstmtoption ( SQLHSTMT stmt,
SQLUSMALLINT opt,
SQLUINTEGER param )
static

Internal set option on HSTMT.

Parameters
stmtstatement handle
optoption to be set
paraminput buffer (option value)
Returns
ODBC error code

Definition at line 9737 of file sqlite3odbc.c.

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

Referenced by SQLSetStmtOption(), and SQLSetStmtOptionW().

◆ drvspecialcolumns()

static 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
stmtstatement handle
idtype of information, e.g. best row id
catcatalog name/pattern or NULL
catLenlength of catalog name/pattern or SQL_NTS
schemaschema name/pattern or NULL
schemaLenlength of schema name/pattern or SQL_NTS
tabletable name/pattern or NULL
tableLenlength of table name/pattern or SQL_NTS
scope
nullable
Returns
ODBC error code

Definition at line 7097 of file sqlite3odbc.c.

References array_size, stmt::dbc, dbtraceapi(), stmt::dobigint, findcol(), freep(), freerows(), getmd(), mapsqltype(), min, mkresultset(), stmt::ncols, nomem(), stmt::nowchar, stmt::nrows, stmt::ov3, PTRDIFF_T, stmt::rowfree, stmt::rows, scolSpec2, scolSpec3, setstat(), dbc::sqlite, starttran(), stringify, unescpat(), xmalloc, and xstrdup.

Referenced by SQLSpecialColumnsW().

◆ drvstatistics()

static 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
stmtstatement handle
catcatalog name/pattern or NULL
catLenlength of catalog name/pattern or SQL_NTS
schemaschema name/pattern or NULL
schemaLenlength of schema name/pattern or SQL_NTS
tabletable name/pattern or NULL
tableLenlength of table name/pattern or SQL_NTS
itypetype of index information
resvreserved
Returns
ODBC error code

Definition at line 16160 of file sqlite3odbc.c.

References array_size, stmt::dbc, dbtraceapi(), findcol(), freerows(), min, mkresultset(), stmt::ncols, nomem(), stmt::nrows, stmt::ov3, PTRDIFF_T, stmt::rowfree, stmt::rows, setstat(), dbc::sqlite, starttran(), statSpec2, statSpec3, stringify, unescpat(), xmalloc, and xstrdup.

Referenced by SQLStatisticsW().

◆ drvtableprivileges()

static SQLRETURN drvtableprivileges ( SQLHSTMT stmt,
SQLCHAR * cat,
SQLSMALLINT catLen,
SQLCHAR * schema,
SQLSMALLINT schemaLen,
SQLCHAR * table,
SQLSMALLINT tableLen )
static

Retrieve privileges on tables and/or views.

Parameters
stmtstatement handle
catcatalog name/pattern or NULL
catLenlength of catalog name/pattern or SQL_NTS
schemaschema name/pattern or NULL
schemaLenlength of schema name/pattern or SQL_NTS
tabletable name/pattern or NULL
tableLenlength of table name/pattern or SQL_NTS
Returns
ODBC error code

Definition at line 6096 of file sqlite3odbc.c.

References array_size, stmt::dbc, dbtraceapi(), freeresult(), min, mkresultset(), stmt::ncols, nomem(), stmt::nrows, stmt::rowfree, stmt::rowp, stmt::rowprs, stmt::rows, dbc::sqlite, starttran(), tablePrivSpec2, tablePrivSpec3, and unescpat().

Referenced by SQLTablePrivilegesW().

◆ drvtables()

static 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
stmtstatement handle
catcatalog name/pattern or NULL
catLenlength of catalog name/pattern or SQL_NTS
schemaschema name/pattern or NULL
schemaLenlength of schema name/pattern or SQL_NTS
tabletable name/pattern or NULL
tableLenlength of table name/pattern or SQL_NTS
typetypes of tables string or NULL
typeLenlength of types of tables string or SQL_NTS
Returns
ODBC error code

Definition at line 14797 of file sqlite3odbc.c.

References array_size, stmt::dbc, dbtraceapi(), freeresult(), min, mkresultset(), stmt::ncols, nomem(), stmt::nrows, stmt::rowfree, stmt::rowp, stmt::rowprs, stmt::rows, dbc::sqlite, starttran(), tableSpec2, tableSpec3, TOLOWER(), unescpat(), and xmalloc.

Referenced by SQLTablesW().

◆ drvunimpldbc()

static SQLRETURN drvunimpldbc ( HDBC dbc)
static

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

Parameters
dbcdatabase connection handle
Returns
ODBC error code

Definition at line 1763 of file sqlite3odbc.c.

References setstatd().

Referenced by SQLBrowseConnectW().

◆ drvunimplstmt()

static SQLRETURN drvunimplstmt ( HSTMT stmt)
static

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

Parameters
stmtstatement handle
Returns
ODBC error code

Definition at line 1782 of file sqlite3odbc.c.

References setstat().

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

◆ dsappend()

static dstr * dsappend ( dstr * dsp,
const char * str )
static

Append string to dynamic string.

Parameters
dspdstr pointer
strstring to append
Returns
dsp result dstr pointer or NULL.

Definition at line 638 of file sqlite3odbc.c.

References dstr::buffer, dstr::len, dstr::max, max, dstr::oom, xmalloc, and xrealloc.

Referenced by drvbulkoperations(), and drvsetpos().

◆ dsappendq()

static dstr * dsappendq ( dstr * dsp,
const char * str )
static

Append a string double quoted to dynamic string.

Parameters
dspdstr pointer
strstring to append
Returns
dsp result dstr pointer or NULL.

Definition at line 690 of file sqlite3odbc.c.

References dstr::buffer, dstr::len, dstr::max, max, dstr::oom, xmalloc, and xrealloc.

Referenced by drvbulkoperations(), and drvsetpos().

◆ dserr()

static int dserr ( dstr * dsp)
static

Check error on dynamic string.

Parameters
dspdstr pointer
Returns
true when error pending

Definition at line 773 of file sqlite3odbc.c.

References dstr::oom.

Referenced by drvbulkoperations(), and drvsetpos().

◆ dsfree()

static void dsfree ( dstr * dsp)
static

Free dynamic string.

Parameters
dspdstr pointer

Definition at line 784 of file sqlite3odbc.c.

References xfree.

Referenced by drvbulkoperations(), and drvsetpos().

◆ dsval()

static const char * dsval ( dstr * dsp)
static

Return dynamic string's value.

Parameters
dspdstr pointer
Returns
string value

Definition at line 758 of file sqlite3odbc.c.

References dstr::buffer.

Referenced by drvbulkoperations(), and drvsetpos().

◆ endtran()

static SQLRETURN endtran ( DBC * d,
SQLSMALLINT comptype,
int force )
static

Internal commit or rollback transaction.

Parameters
ddatabase connection pointer
comptypetype of transaction's end, SQL_COMMIT or SQL_ROLLBACK
forceforce action regardless of DBC's autocommit state
Returns
ODBC error code

Definition at line 8179 of file sqlite3odbc.c.

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

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

◆ findcol()

static int findcol ( char ** cols,
int ncols,
char * name )
static

Find column given name in string array.

Parameters
colsstring array
ncolsnumber of strings
namecolumn name
Returns
>= 0 on success, -1 on error

Definition at line 2828 of file sqlite3odbc.c.

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

◆ fixupdyncols()

static void fixupdyncols ( STMT * s,
DBC * d )
static

Fixup column information for a running statement.

Parameters
sstatement to get fresh column information
dDBC pointer

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 2859 of file sqlite3odbc.c.

References array_size, COL::autoinc, COL::column, dbtraceapi(), stmt::dcols, stmt::dobigint, stmt::dyncols, findcol(), freep(), getmd(), stmt::has_pk, stmt::has_rowid, COL::ispk, COL::isrowid, COL::label, stmt::longnames, mapsqltype(), COL::nosign, COL::notnull, stmt::nowchar, stmt::one_tbl, stmt::ov3, COL::prec, COL::size, dbc::sqlite, COL::table, COL::type, COL::typename, xmalloc, and xstrdup.

Referenced by s3stmt_step().

◆ fixupsql()

static char * fixupsql ( char * sql,
int sqlLen,
int cte,
int * nparam,
int * isselect,
char ** errmsg )
static

Fixup query string with optional parameter markers.

Parameters
sqloriginal query string
sqlLenlength of query string or SQL_NTS
ctewhen true, WITH is treated as SELECT
nparamoutput number of parameters
isselectoutput indicator for SELECT (1) or DDL statement (2)
errmsgoutput error message
Returns
newly allocated string containing query string for SQLite or NULL

Definition at line 2527 of file sqlite3odbc.c.

References checkddl(), fixupsql(), freep(), ISSPACE, and xmalloc.

Referenced by fixupsql().

◆ freedyncols()

static void freedyncols ( STMT * s)
static

Free dynamically allocated column descriptions of STMT.

Parameters
sstatement pointer

Definition at line 13924 of file sqlite3odbc.c.

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

Referenced by freeresult(), and s3stmt_step().

◆ freep()

static void freep ( void * x)
static

Free memory given pointer to memory pointer.

Parameters
xpointer to pointer to memory to be free'd

Definition at line 1800 of file sqlite3odbc.c.

References xfree.

Referenced by dbopen(), drvbindparam(), drvdisconnect(), drvputdata(), drvsetstmtattr(), drvsetstmtoption(), drvspecialcolumns(), fixupdyncols(), fixupsql(), freedyncols(), freeparams(), freeresult(), freerows(), freestmt(), getrowdata(), and setupparam().

◆ freeparams()

static SQLRETURN freeparams ( STMT * s)
static

Clear out parameter bindings, if any.

Parameters
sstatement pointer

Definition at line 5143 of file sqlite3odbc.c.

References stmt::bindparms, freep(), stmt::nbindparms, and BINDPARM::parbuf.

Referenced by drvfreestmt(), and freestmt().

◆ freeresult()

static void freeresult ( STMT * s,
int clrcols )
static

Free statement's result.

Parameters
sstatement pointer
clrcolsflag 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 13953 of file sqlite3odbc.c.

References stmt::bincache, stmt::bincell, stmt::bindcols, stmt::binlen, stmt::cols, freedyncols(), freep(), stmt::has_pk, stmt::has_rowid, stmt::nbindcols, stmt::ncols, stmt::nowchar, stmt::nrows, stmt::one_tbl, stmt::rowfree, and stmt::rows.

Referenced by drvfreestmt(), drvtableprivileges(), drvtables(), freestmt(), mkresultset(), and s3stmt_step().

◆ freerows()

static void freerows ( char ** rowp)
static

Free counted array of char pointers.

Parameters
rowppointer 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 2153 of file sqlite3odbc.c.

References freep(), and PTRDIFF_T.

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

◆ freestmt() [1/2]

static SQLRETURN freestmt ( HSTMT stmt)
static

Referenced by drvfreeconnect(), and drvfreestmt().

◆ freestmt() [2/2]

static SQLRETURN freestmt ( SQLHSTMT stmt)
static

Internal free function for HSTMT.

Parameters
stmtstatement handle
Returns
ODBC error code

Definition at line 13386 of file sqlite3odbc.c.

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

◆ getbool()

static int getbool ( char * string)
static

Get boolean flag from string.

Parameters
stringstring to be inspected
Returns
true or false

Definition at line 3738 of file sqlite3odbc.c.

Referenced by dbopen(), drvconnect(), drvdriverconnect(), and getrowdata().

◆ getdsnattr()

static int getdsnattr ( char * dsn,
char * attr,
char * out,
int outLen )
static

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

Parameters
dsnDSN/driver connection string
attrattribute string to be retrieved
outoutput buffer
outLenlength of output buffer
Returns
true or false

Definition at line 12750 of file sqlite3odbc.c.

References min.

Referenced by drvconnect(), and drvdriverconnect().

◆ getmd()

static void getmd ( const char * typename,
int sqltype,
int * mp,
int * dp )
static

Get maximum display size and number of digits after decimal point from field type specification.

Parameters
typenamefield type specification
sqltypetarget SQL data type
mppointer to maximum display size or NULL
dppointer to number of digits after decimal point or NULL

Definition at line 2303 of file sqlite3odbc.c.

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

◆ getmdays()

static int getmdays ( int year,
int month )
static

Return number of month days.

Parameters
year
month1..12
Returns
number of month days or 0

Definition at line 3136 of file sqlite3odbc.c.

Referenced by str2date(), and str2timestamp().

◆ getrowdata()

static SQLRETURN getrowdata ( STMT * s,
SQLUSMALLINT col,
SQLSMALLINT otype,
SQLPOINTER val,
SQLINTEGER len,
SQLLEN * lenp,
int partial )
static

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

Parameters
sstatement pointer
colcolumn number, 0 based
otypeoutput data type
valoutput buffer
lenlength of output buffer
lenpoutput length
partialflag for partial data retrieval
Returns
ODBC error code

Definition at line 14056 of file sqlite3odbc.c.

References stmt::bincache, stmt::bincell, stmt::bindcols, stmt::binlen, stmt::cols, freep(), getbool(), stmt::jdconv, BINDCOL::lenp, ln_strtod(), mapdeftype(), min, stmt::ncols, nomem(), COL::nosign, stmt::nowchar, stmt::nrows, stmt::oemcp, BINDCOL::offs, stmt::ov3, COL::prec, stmt::retr_data, stmt::rowp, stmt::rows, setstat(), SQLLEN, str2date(), str2time(), str2timestamp(), COL::type, uc_free(), uc_from_utf(), uc_strlen(), uc_strncpy(), xdigits, and xmalloc.

Referenced by dofetchbind(), setposrefr(), and SQLGetData().

◆ ln_strtod()

static double ln_strtod ( const char * data,
char ** endp )
static

Internal locale neutral strtod function.

Parameters
datapointer to string
endppointer for ending character
Returns
double value

Definition at line 1844 of file sqlite3odbc.c.

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

◆ mapdeftype()

static int mapdeftype ( int type,
int stype,
int nosign,
int nowchar )
static

Map SQL_C_DEFAULT to proper C type.

Parameters
typeinput C type
stypeinput SQL type
nosign0=signed, 0>unsigned, 0<undefined
nowcharwhen compiled with WINTERFACE don't use WCHAR
Returns
C type

Definition at line 2388 of file sqlite3odbc.c.

Referenced by drvbindcol(), drvputdata(), getrowdata(), setupparam(), and SQLParamData().

◆ mapsqltype()

static int mapsqltype ( const char * typename,
int * nosign,
int ov3,
int nowchar,
int dobigint )
static

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

Parameters
typenamefield type string
nosignpointer to indicator for unsigned field or NULL
ov3boolean, true for SQL_OV_ODBC3
nowcharboolean, for WINTERFACE don't use WCHAR
dobigintboolean, force SQL_BIGINT on INTEGER columns
Returns
SQL data type

Definition at line 2179 of file sqlite3odbc.c.

References TOLOWER(), xfree, and xmalloc.

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

◆ mkbindcols()

static SQLRETURN mkbindcols ( STMT * s,
int ncols )
static

Reallocate space for bound columns.

Parameters
sstatement pointer
ncolsnumber of columns
Returns
ODBC error code

Definition at line 14009 of file sqlite3odbc.c.

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

Referenced by drvbindcol(), mkresultset(), and s3stmt_step().

◆ mkresultset()

static SQLRETURN mkresultset ( HSTMT stmt,
COL * colspec,
int ncols,
COL * colspec3,
int ncols3,
int * nret )
static

Setup empty result set from constant column specification.

Parameters
stmtstatement handle
colspeccolumn specification array (default, ODBC2)
ncolsnumber of columns (default, ODBC2)
colspec3column specification array (ODBC3)
ncols3number of columns (ODBC3)
nretreturns number of columns
Returns
ODBC error code

Definition at line 6021 of file sqlite3odbc.c.

References stmt::cols, stmt::dbc, freeresult(), stmt::isselect, mkbindcols(), stmt::ncols, noconn(), stmt::nowchar, stmt::nrows, stmt::ov3, stmt::rowp, stmt::rowprs, s3stmt_end_if(), and dbc::sqlite.

Referenced by drvcolumns(), drvforeignkeys(), drvgettypeinfo(), drvprimarykeys(), drvspecialcolumns(), drvstatistics(), drvtableprivileges(), drvtables(), SQLColumnPrivilegesW(), SQLProcedureColumnsW(), and SQLProceduresW().

◆ mktypeinfo()

static void mktypeinfo ( STMT * s,
int row,
int asize,
char * typename,
int type,
int tind )
static

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

Parameters
sstatement pointer
rowrow number
asizenumber of items in a row
typenamename of type
typeinteger SQL type
tindtype index

Definition at line 15718 of file sqlite3odbc.c.

References stmt::rows, and stringify.

Referenced by drvgettypeinfo().

◆ namematch()

static int namematch ( char * str,
char * pat,
int esc )
static

SQL LIKE string match with optional backslash escape handling.

Parameters
strstring
patpattern
escwhen true, treat literally "\\" as "", "\%" as "%", "\_" as "_"
Returns
true when pattern matched

Definition at line 1948 of file sqlite3odbc.c.

References namematch(), and TOLOWER().

Referenced by drvcolumns(), and namematch().

◆ noconn()

static SQLRETURN noconn ( STMT * s)
static

Report S1000 (not connected) SQL error given STMT.

Parameters
sstatement pointer
Returns
ODBC error code

Definition at line 1828 of file sqlite3odbc.c.

References stmt::ov3, and setstat().

Referenced by mkresultset().

◆ nomem()

◆ replilike()

static void replilike ( char * sql)
static

Replace ILIKE with LIKE in-place given query string.

Parameters
sqloriginal query string

Definition at line 2766 of file sqlite3odbc.c.

References ISSPACE.

◆ s3bind()

static void s3bind ( DBC * d,
sqlite3_stmt * stmt,
int nparams,
BINDPARM * p )
static

◆ s3stmt_coltype()

static char * s3stmt_coltype ( sqlite3_stmt * s3stmt,
int col,
DBC * d,
int * guessed_types )
static

Find out column type.

Parameters
s3stmtSQLite statement pointer
colcolumn number
dDBC pointer (for tracing only)
guessed_typesflag array
Returns
type name as string

Definition at line 4304 of file sqlite3odbc.c.

References dbc::trace.

Referenced by s3stmt_step().

◆ s3stmt_drop()

static void s3stmt_drop ( STMT * s)
static

Drop running sqlite statement in STMT.

Parameters
sstatement pointer

Definition at line 4715 of file sqlite3odbc.c.

References stmt::dbc, dbtraceapi(), stmt::s3stmt, and stmt::s3stmt_rownum.

Referenced by freestmt().

◆ s3stmt_end()

static void s3stmt_end ( STMT * s)
static

Stop running sqlite statement.

Parameters
sstatement pointer

Definition at line 4669 of file sqlite3odbc.c.

References dbc::busyint, dbc::cur_s3stmt, stmt::dbc, dbtraceapi(), stmt::s3stmt, stmt::s3stmt_noreset, and stmt::s3stmt_rownum.

Referenced by drvdisconnect(), drvsetconnectattr(), drvsetconnectoption(), and s3stmt_end_if().

◆ s3stmt_end_if()

static void s3stmt_end_if ( STMT * s)
static

Conditionally stop running sqlite statement.

Parameters
sstatement pointer

Definition at line 4697 of file sqlite3odbc.c.

References dbc::busyint, dbc::cur_s3stmt, stmt::dbc, and s3stmt_end().

Referenced by drvfreestmt(), and mkresultset().

◆ s3stmt_start()

static SQLRETURN s3stmt_start ( STMT * s)
static

Start sqlite statement for execution of SELECT statement.

Parameters
sstatement pointer
Returns
ODBC error code

Definition at line 4736 of file sqlite3odbc.c.

References stmt::bindparms, dbc::cur_s3stmt, stmt::dbc, dbtraceapi(), dbtracerc(), stmt::nparams, stmt::ov3, stmt::query, s3bind(), stmt::s3stmt, dbc::s3stmt_needmeta, stmt::s3stmt_noreset, stmt::s3stmt_rownum, setstat(), and dbc::sqlite.

◆ s3stmt_step()

◆ setposbind()

static SQLRETURN setposbind ( STMT * s,
sqlite3_stmt * stmt,
int i,
int si,
int rsi )
static

Internal handler to setup parameters for positional updates from bound user buffers.

Parameters
sstatement handle
stmtSQLite3 statement pointer
iresult set column index
siSQLite3 parameter index
rsiresult set row index
Returns
ODBC error code

Definition at line 9886 of file sqlite3odbc.c.

References stmt::bind_offs, stmt::bind_type, stmt::bindcols, stmt::cols, stmt::dbc, stmt::jdconv, BINDCOL::lenp, BINDCOL::max, nomem(), stmt::oemcp, stmt::ov3, COL::prec, setstat(), SQLLEN, dbc::trace, BINDCOL::type, uc_free(), uc_to_utf(), and BINDCOL::valp.

Referenced by drvbulkoperations(), and drvsetpos().

◆ setposibind()

static SQLRETURN setposibind ( STMT * s,
sqlite3_stmt * stmt,
int i,
int si,
int rsi )
static

Internal handler to setup parameters for positional updates from driver side result set.

Parameters
sstatement handle
stmtSQLite3 statement pointer
iresult set column index
siSQLite3 parameter index
rsiresult set row index
Returns
ODBC error code

Definition at line 10226 of file sqlite3odbc.c.

References stmt::dbc, stmt::ncols, stmt::ov3, stmt::rowprs, stmt::rows, setstat(), and dbc::trace.

Referenced by drvsetpos().

◆ setposrefr()

static SQLRETURN setposrefr ( STMT * s,
int rsi )
static

Internal handler to refresh user buffers from driver side result set.

Parameters
sstatement handle
rsiresult set row index
Returns
ODBC error code

Definition at line 10263 of file sqlite3odbc.c.

References stmt::bind_offs, stmt::bind_type, stmt::bindcols, getrowdata(), BINDCOL::lenp, BINDCOL::max, stmt::ncols, BINDCOL::offs, stmt::row_status0, stmt::rowp, stmt::rowprs, SQLLEN, BINDCOL::type, and BINDCOL::valp.

Referenced by drvsetpos().

◆ setsqliteopts()

static int setsqliteopts ( sqlite3 * x,
DBC * d )
static

Set SQLite options (PRAGMAs) given SQLite handle.

Parameters
xSQLite database handle
dDBC pointer
Returns
SQLite error code

SQLite < 3.3.x and not shortnames DSN option: "full_column_names" is always turned on and "short_column_names" is always turned off, to get the table names in column labels.

Definition at line 2096 of file sqlite3odbc.c.

References busy_handler(), dbc::fksupport, dbc::longnames, max, and dbc::shortnames.

Referenced by dbopen().

◆ setstat()

static void setstat ( STMT * s,
int naterr,
char * msg,
char * st,
... )
static

◆ setstatd()

static void setstatd ( DBC * d,
int naterr,
char * msg,
char * st,
... )
static

Set error message and SQL state on DBC.

Parameters
ddatabase connection pointer
naterrnative error code
msgerror message
stSQL state

Definition at line 1690 of file sqlite3odbc.c.

References dbc::logmsg, dbc::naterr, and dbc::sqlstate.

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

◆ setupdyncols()

static SQLRETURN setupdyncols ( STMT * s,
sqlite3_stmt * s3stmt,
int * ncolsp )
static

Referenced by drvgettable_row().

◆ setupparam()

static SQLRETURN setupparam ( STMT * s,
char * sql,
int pnum )
static

Setup SQLite3 parameter for statement parameter.

Parameters
sstatement pointer
sqlsql string
pnumparameter number
Returns
ODBC error code

The parameter is converted within BINDPARM in order to be presented to sqlite3_bind_*() functions.

Definition at line 5168 of file sqlite3odbc.c.

References stmt::bindparms, BINDPARM::coldef, freep(), stmt::jdconv, BINDPARM::len, BINDPARM::lenp, mapdeftype(), BINDPARM::max, stmt::nbindparms, BINDPARM::need, nomem(), stmt::nowchar, stmt::oemcp, stmt::ov3, BINDPARM::param, BINDPARM::parbuf, BINDPARM::s3dval, BINDPARM::s3ival, BINDPARM::s3lival, BINDPARM::s3size, BINDPARM::s3type, BINDPARM::s3val, setstat(), setupparbuf(), BINDPARM::strbuf, BINDPARM::stype, BINDPARM::type, uc_strlen(), uc_to_utf(), and xmalloc.

◆ setupparbuf()

static SQLRETURN setupparbuf ( STMT * s,
BINDPARM * p )
static

Setup parameter buffer for deferred parameter.

Parameters
spointer to STMT
ppointer to BINDPARM
Returns
ODBC error code (success indicated by SQL_NEED_DATA)

Definition at line 5723 of file sqlite3odbc.c.

References BINDPARM::len, BINDPARM::lenp, BINDPARM::max, nomem(), BINDPARM::param, BINDPARM::parbuf, setstat(), and xmalloc.

Referenced by setupparam(), and SQLParamData().

◆ SQLAllocConnect()

SQLRETURN SQL_API SQLAllocConnect ( SQLHENV env,
SQLHDBC * dbc )

Allocate HDBC.

Parameters
envenvironment handle
dbcpointer to database connection handle
Returns
ODBC error code

Definition at line 12100 of file sqlite3odbc.c.

References drvallocconnect().

◆ SQLAllocEnv()

SQLRETURN SQL_API SQLAllocEnv ( SQLHENV * env)

Allocate HENV.

Parameters
envpointer to environment handle
Returns
ODBC error code

Definition at line 11972 of file sqlite3odbc.c.

References drvallocenv().

◆ SQLAllocHandle()

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

Allocate a HENV, HDBC, or HSTMT handle.

Parameters
typehandle type
inputinput handle (HENV, HDBC)
outputpointer to output handle (HENV, HDBC, HSTMT)
Returns
ODBC error code

Definition at line 13871 of file sqlite3odbc.c.

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

◆ SQLAllocStmt()

SQLRETURN SQL_API SQLAllocStmt ( SQLHDBC dbc,
SQLHSTMT * stmt )

Allocate HSTMT given HDBC.

Parameters
dbcdatabase connection handle
stmtpointer to statement handle
Returns
ODBC error code

Definition at line 13507 of file sqlite3odbc.c.

References drvallocstmt(), HDBC_LOCK, and HDBC_UNLOCK.

◆ SQLBindCol()

SQLRETURN SQL_API SQLBindCol ( SQLHSTMT stmt,
SQLUSMALLINT col,
SQLSMALLINT type,
SQLPOINTER val,
SQLLEN max,
SQLLEN * lenp )

Bind C variable to column of result set.

Parameters
stmtstatement handle
colcolumn number, starting at 1
typeoutput type
valoutput buffer
maxlength of output buffer
lenpoutput length pointer
Returns
ODBC error code

Definition at line 14751 of file sqlite3odbc.c.

References drvbindcol(), HSTMT_LOCK, HSTMT_UNLOCK, and max.

◆ SQLBindParam()

SQLRETURN SQL_API SQLBindParam ( SQLHSTMT stmt,
SQLUSMALLINT pnum,
SQLSMALLINT vtype,
SQLSMALLINT ptype,
SQLULEN lenprec,
SQLSMALLINT scale,
SQLPOINTER val,
SQLLEN * lenp )

Bind parameter on HSTMT.

Parameters
stmtstatement handle
pnumparameter number, starting at 1
vtypeinput/output type of parameter
ptype
lenprec
scale
valpointer to host variable
lenpoutput length pointer
Returns
ODBC error code

Definition at line 5674 of file sqlite3odbc.c.

References drvbindparam(), HSTMT_LOCK, and HSTMT_UNLOCK.

◆ SQLBindParameter()

SQLRETURN SQL_API SQLBindParameter ( SQLHSTMT stmt,
SQLUSMALLINT pnum,
SQLSMALLINT iotype,
SQLSMALLINT buftype,
SQLSMALLINT ptype,
SQLULEN coldef,
SQLSMALLINT scale,
SQLPOINTER data,
SQLLEN buflen,
SQLLEN * len )

Bind parameter on HSTMT.

Parameters
stmtstatement handle
pnumparameter number, starting at 1
iotypeinput/output type of parameter
buftypetype of host variable
ptype
coldef
scale
datapointer to host variable
buflenlength of host variable
lenoutput length pointer
Returns
ODBC error code

Definition at line 5645 of file sqlite3odbc.c.

References drvbindparam(), HSTMT_LOCK, and HSTMT_UNLOCK.

◆ SQLBrowseConnectW()

SQLRETURN SQL_API SQLBrowseConnectW ( SQLHDBC dbc,
SQLWCHAR * connin,
SQLSMALLINT conninLen,
SQLWCHAR * connout,
SQLSMALLINT connoutMax,
SQLSMALLINT * connoutLen )

Function not implemented.

Definition at line 4886 of file sqlite3odbc.c.

References drvunimpldbc(), HDBC_LOCK, and HDBC_UNLOCK.

◆ SQLBulkOperations()

SQLRETURN SQL_API SQLBulkOperations ( SQLHSTMT stmt,
SQLSMALLINT oper )

Perform bulk operation on HSTMT.

Parameters
stmtstatement handle
operoperation to be performed
Returns
ODBC error code

Definition at line 11117 of file sqlite3odbc.c.

References drvbulkoperations(), HSTMT_LOCK, and HSTMT_UNLOCK.

◆ SQLCancel()

SQLRETURN SQL_API SQLCancel ( SQLHSTMT stmt)

Cancel HSTMT closing cursor.

Parameters
stmtstatement handle
Returns
ODBC error code

Definition at line 13581 of file sqlite3odbc.c.

References dbc::busyint, DBC_MAGIC, drvfreestmt(), dbc::magic, and dbc::sqlite.

◆ SQLCloseCursor()

SQLRETURN SQL_API SQLCloseCursor ( SQLHSTMT stmt)

Close open cursor.

Parameters
stmtstatement handle
Returns
ODBC error code

Definition at line 13857 of file sqlite3odbc.c.

References drvfreestmt().

◆ SQLColumnPrivilegesW()

SQLRETURN SQL_API SQLColumnPrivilegesW ( SQLHSTMT stmt,
SQLWCHAR * catalog,
SQLSMALLINT catalogLen,
SQLWCHAR * schema,
SQLSMALLINT schemaLen,
SQLWCHAR * table,
SQLSMALLINT tableLen,
SQLWCHAR * column,
SQLSMALLINT columnLen )

Retrieve privileges on columns (UNICODE version).

Parameters
stmtstatement handle
catalogcatalog name/pattern or NULL
catalogLenlength of catalog name/pattern or SQL_NTS
schemaschema name/pattern or NULL
schemaLenlength of schema name/pattern or SQL_NTS
tabletable name/pattern or NULL
tableLenlength of table name/pattern or SQL_NTS
columncolumn name or NULL
columnLenlength of column name or SQL_NTS
Returns
ODBC error code

Definition at line 6632 of file sqlite3odbc.c.

References array_size, colPrivSpec2, colPrivSpec3, HSTMT_LOCK, HSTMT_UNLOCK, and mkresultset().

◆ SQLColumnsW()

SQLRETURN SQL_API SQLColumnsW ( SQLHSTMT stmt,
SQLWCHAR * cat,
SQLSMALLINT catLen,
SQLWCHAR * schema,
SQLSMALLINT schemaLen,
SQLWCHAR * table,
SQLSMALLINT tableLen,
SQLWCHAR * col,
SQLSMALLINT colLen )

Retrieve column information on table (UNICODE version).

Parameters
stmtstatement handle
catcatalog name/pattern or NULL
catLenlength of catalog name/pattern or SQL_NTS
schemaschema name/pattern or NULL
schemaLenlength of schema name/pattern or SQL_NTS
tabletable name/pattern or NULL
tableLenlength of table name/pattern or SQL_NTS
colcolumn name/pattern or NULL
colLenlength of column name/pattern or SQL_NTS
Returns
ODBC error code

Definition at line 15612 of file sqlite3odbc.c.

References drvcolumns(), HSTMT_LOCK, HSTMT_UNLOCK, nomem(), uc_free(), and uc_to_utf_c().

◆ SQLConnectW()

SQLRETURN SQL_API SQLConnectW ( SQLHDBC dbc,
SQLWCHAR * dsn,
SQLSMALLINT dsnLen,
SQLWCHAR * uid,
SQLSMALLINT uidLen,
SQLWCHAR * pwd,
SQLSMALLINT pwdLen )

Connect to SQLite database.

Parameters
dbcdatabase connection handle
dsnDSN string
dsnLenlength of DSN string or SQL_NTS
uiduser id string or NULL
uidLenlength of user id string or SQL_NTS
pwdpassword string or NULL
pwdLenlength of password string or SQL_NTS
Returns
ODBC error code

Definition at line 13011 of file sqlite3odbc.c.

References drvconnect(), HDBC_LOCK, HDBC_UNLOCK, dbc::ov3, setstatd(), uc_free(), and uc_to_utf_c().

◆ SQLCopyDesc()

SQLRETURN SQL_API SQLCopyDesc ( SQLHDESC source,
SQLHDESC target )

Function not implemented.

Definition at line 8322 of file sqlite3odbc.c.

◆ SQLDataSourcesW()

SQLRETURN SQL_API SQLDataSourcesW ( SQLHENV env,
SQLUSMALLINT dir,
SQLWCHAR * srvname,
SQLSMALLINT buflen1,
SQLSMALLINT * lenp1,
SQLWCHAR * desc,
SQLSMALLINT buflen2,
SQLSMALLINT * lenp2 )

Function not implemented.

Definition at line 4816 of file sqlite3odbc.c.

◆ SQLDescribeColW()

SQLRETURN SQL_API SQLDescribeColW ( SQLHSTMT stmt,
SQLUSMALLINT col,
SQLWCHAR * name,
SQLSMALLINT nameMax,
SQLSMALLINT * nameLen,
SQLSMALLINT * type,
SQLULEN * size,
SQLSMALLINT * digits,
SQLSMALLINT * nullable )

Describe column information (UNICODE version).

Parameters
stmtstatement handle
colcolumn number, starting at 1
namebuffer for column name
nameMaxlength of name buffer
nameLenoutput length of column name
typeoutput SQL type
sizeoutput column size
digitsoutput number of digits
nullableoutput NULL allowed indicator
Returns
ODBC error code

Definition at line 17272 of file sqlite3odbc.c.

References stmt::cols, COL::column, drvdescribecol(), HSTMT_LOCK, HSTMT_UNLOCK, min, uc_free(), uc_from_utf(), uc_strlen(), and uc_strncpy().

◆ SQLDescribeParam()

SQLRETURN SQL_API SQLDescribeParam ( SQLHSTMT stmt,
SQLUSMALLINT pnum,
SQLSMALLINT * dtype,
SQLULEN * size,
SQLSMALLINT * decdigits,
SQLSMALLINT * nullable )

Return information about parameter.

Parameters
stmtstatement handle
pnumparameter number, starting at 1
dtypeoutput type indicator
sizeoutput size indicator
decdigitsoutput number of digits
nullableoutput NULL allowed indicator
Returns
ODBC error code

Definition at line 5811 of file sqlite3odbc.c.

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

◆ SQLDisconnect()

SQLRETURN SQL_API SQLDisconnect ( SQLHDBC dbc)

Disconnect given HDBC.

Parameters
dbcdatabase connection handle
Returns
ODBC error code

Definition at line 13100 of file sqlite3odbc.c.

References drvdisconnect(), HDBC_LOCK, and HDBC_UNLOCK.

◆ SQLDriversW()

SQLRETURN SQL_API SQLDriversW ( SQLHENV env,
SQLUSMALLINT dir,
SQLWCHAR * drvdesc,
SQLSMALLINT descmax,
SQLSMALLINT * desclenp,
SQLWCHAR * drvattr,
SQLSMALLINT attrmax,
SQLSMALLINT * attrlenp )

Function not implemented.

Definition at line 4850 of file sqlite3odbc.c.

◆ SQLEndTran()

SQLRETURN SQL_API SQLEndTran ( SQLSMALLINT type,
SQLHANDLE handle,
SQLSMALLINT comptype )

Commit or rollback transaction.

Parameters
typetype of handle
handleHDBC, HENV, or HSTMT handle
comptypeSQL_COMMIT or SQL_ROLLBACK
Returns
ODBC error code

Definition at line 8295 of file sqlite3odbc.c.

References drvendtran().

◆ SQLExtendedFetch()

SQLRETURN SQL_API SQLExtendedFetch ( SQLHSTMT stmt,
SQLUSMALLINT orient,
SQLROWOFFSET offset,
SQLROWSETSIZE * rowcount,
SQLUSMALLINT * rowstatus )

Fetch result row with scrolling and row status.

Parameters
stmtstatement handle
orientfetch direction
offsetoffset for fetch direction
rowcountoutput number of fetched rows
rowstatusarray for row stati
Returns
ODBC error code

Definition at line 17015 of file sqlite3odbc.c.

References stmt::bkmrkptr, drvfetchscroll(), HSTMT_LOCK, HSTMT_UNLOCK, stmt::row_count0, stmt::row_status, stmt::row_status0, and stmt::rowset_size.

◆ SQLFetch()

SQLRETURN SQL_API SQLFetch ( SQLHSTMT stmt)

Fetch next result row.

Parameters
stmtstatement handle
Returns
ODBC error code

Definition at line 16975 of file sqlite3odbc.c.

References drvfetchscroll(), HSTMT_LOCK, and HSTMT_UNLOCK.

◆ SQLFetchScroll()

SQLRETURN SQL_API SQLFetchScroll ( SQLHSTMT stmt,
SQLSMALLINT orient,
SQLLEN offset )

Fetch result row with scrolling.

Parameters
stmtstatement handle
orientfetch direction
offsetoffset for fetch direction
Returns
ODBC error code

Definition at line 16994 of file sqlite3odbc.c.

References drvfetchscroll(), HSTMT_LOCK, and HSTMT_UNLOCK.

◆ SQLForeignKeysW()

SQLRETURN SQL_API SQLForeignKeysW ( SQLHSTMT stmt,
SQLWCHAR * PKcatalog,
SQLSMALLINT PKcatalogLen,
SQLWCHAR * PKschema,
SQLSMALLINT PKschemaLen,
SQLWCHAR * PKtable,
SQLSMALLINT PKtableLen,
SQLWCHAR * FKcatalog,
SQLSMALLINT FKcatalogLen,
SQLWCHAR * FKschema,
SQLSMALLINT FKschemaLen,
SQLWCHAR * FKtable,
SQLSMALLINT FKtableLen )

Retrieve information about primary/foreign keys (UNICODE version).

Parameters
stmtstatement handle
PKcatalogprimary key catalog name/pattern or NULL
PKcatalogLenlength of PKcatalog or SQL_NTS
PKschemaprimary key schema name/pattern or NULL
PKschemaLenlength of PKschema or SQL_NTS
PKtableprimary key table name/pattern or NULL
PKtableLenlength of PKtable or SQL_NTS
FKcatalogforeign key catalog name/pattern or NULL
FKcatalogLenlength of FKcatalog or SQL_NTS
FKschemaforeign key schema name/pattern or NULL
FKschemaLenlength of FKschema or SQL_NTS
FKtableforeign key table name/pattern or NULL
FKtableLenlength of FKtable or SQL_NTS
Returns
ODBC error code

Definition at line 8058 of file sqlite3odbc.c.

References drvforeignkeys(), HSTMT_LOCK, HSTMT_UNLOCK, nomem(), uc_free(), and uc_to_utf_c().

◆ SQLFreeConnect()

SQLRETURN SQL_API SQLFreeConnect ( SQLHDBC dbc)

Free connection (HDBC).

Parameters
dbcdatabase connection handle
Returns
ODBC error code

Definition at line 12190 of file sqlite3odbc.c.

References drvfreeconnect().

◆ SQLFreeEnv()

SQLRETURN SQL_API SQLFreeEnv ( SQLHENV env)

Free HENV.

Parameters
envenvironment handle
Returns
ODBC error code

Definition at line 12020 of file sqlite3odbc.c.

References drvfreeenv().

◆ SQLFreeHandle()

SQLRETURN SQL_API SQLFreeHandle ( SQLSMALLINT type,
SQLHANDLE h )

Free a HENV, HDBC, or HSTMT handle.

Parameters
typehandle type
hhandle (HENV, HDBC, or HSTMT)
Returns
ODBC error code

Definition at line 13905 of file sqlite3odbc.c.

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

◆ SQLFreeStmt()

SQLRETURN SQL_API SQLFreeStmt ( SQLHSTMT stmt,
SQLUSMALLINT opt )

Free HSTMT.

Parameters
stmtstatement handle
optSQL_RESET_PARAMS, SQL_UNBIND, SQL_CLOSE, or SQL_DROP
Returns
ODBC error code

Definition at line 13569 of file sqlite3odbc.c.

References drvfreestmt().

◆ SQLGetConnectAttrW()

SQLRETURN SQL_API SQLGetConnectAttrW ( SQLHDBC dbc,
SQLINTEGER attr,
SQLPOINTER val,
SQLINTEGER bufmax,
SQLINTEGER * buflen )

Get connect attribute of HDBC (UNICODE version).

Parameters
dbcdatabase connection handle
attroption to be retrieved
valoutput buffer
bufmaxsize of output buffer
buflenoutput length
Returns
ODBC error code

Definition at line 12378 of file sqlite3odbc.c.

References drvgetconnectattr(), HDBC_LOCK, HDBC_UNLOCK, min, uc_free(), uc_from_utf(), uc_strlen(), and uc_strncpy().

◆ SQLGetConnectOptionW()

SQLRETURN SQL_API SQLGetConnectOptionW ( SQLHDBC dbc,
SQLUSMALLINT opt,
SQLPOINTER param )

Get connect option of HDBC (UNICODE version).

Parameters
dbcdatabase connection handle
optoption to be retrieved
paramoutput buffer
Returns
ODBC error code

Definition at line 12640 of file sqlite3odbc.c.

References drvgetconnectoption(), HDBC_LOCK, and HDBC_UNLOCK.

◆ SQLGetCursorNameW()

SQLRETURN SQL_API SQLGetCursorNameW ( SQLHSTMT stmt,
SQLWCHAR * cursor,
SQLSMALLINT buflen,
SQLSMALLINT * lenp )

Get cursor name of STMT (UNICODE version).

Parameters
stmtstatement handle
cursoroutput buffer
buflenlength of output buffer
lenpoutput length
Returns
ODBC error code

Definition at line 13706 of file sqlite3odbc.c.

References drvgetcursorname(), HSTMT_LOCK, HSTMT_UNLOCK, min, nomem(), uc_free(), uc_from_utf(), uc_strlen(), and uc_strncpy().

◆ SQLGetData()

SQLRETURN SQL_API SQLGetData ( SQLHSTMT stmt,
SQLUSMALLINT col,
SQLSMALLINT type,
SQLPOINTER val,
SQLLEN len,
SQLLEN * lenp )

Retrieve row data after fetch.

Parameters
stmtstatement handle
colcolumn number, starting at 1
typeoutput type
valoutput buffer
lenlength of output buffer
lenpoutput length
Returns
ODBC error code

Definition at line 16564 of file sqlite3odbc.c.

References stmt::bkmrk, getrowdata(), stmt::has_rowid, HSTMT_LOCK, HSTMT_UNLOCK, stmt::ncols, stmt::ov3, stmt::rowp, stmt::rows, and setstat().

◆ SQLGetDescFieldW()

SQLRETURN SQL_API SQLGetDescFieldW ( SQLHDESC handle,
SQLSMALLINT recno,
SQLSMALLINT fieldid,
SQLPOINTER value,
SQLINTEGER buflen,
SQLINTEGER * strlen )

Function not implemented.

Definition at line 5925 of file sqlite3odbc.c.

◆ SQLGetDescRecW()

SQLRETURN SQL_API SQLGetDescRecW ( SQLHDESC handle,
SQLSMALLINT recno,
SQLWCHAR * name,
SQLSMALLINT buflen,
SQLSMALLINT * strlen,
SQLSMALLINT * type,
SQLSMALLINT * subtype,
SQLLEN * len,
SQLSMALLINT * prec,
SQLSMALLINT * scale,
SQLSMALLINT * nullable )

Function not implemented.

Definition at line 5984 of file sqlite3odbc.c.

◆ SQLGetDiagFieldW()

SQLRETURN SQL_API SQLGetDiagFieldW ( SQLSMALLINT htype,
SQLHANDLE handle,
SQLSMALLINT recno,
SQLSMALLINT id,
SQLPOINTER info,
SQLSMALLINT buflen,
SQLSMALLINT * stringlen )

Get error record given handle (HDBC or HSTMT).

Parameters
htypehandle type
handleHDBC or HSTMT
recnodiag record number for which info to be retrieved
iddiag id for which info to be retrieved
infooutput buffer for error message
buflenlength of output buffer
stringlenoutput length
Returns
ODBC error code

Definition at line 9166 of file sqlite3odbc.c.

References drvgetdiagfield(), min, uc_free(), uc_from_utf(), uc_strlen(), and uc_strncpy().

◆ SQLGetDiagRecW()

SQLRETURN SQL_API SQLGetDiagRecW ( SQLSMALLINT htype,
SQLHANDLE handle,
SQLSMALLINT recno,
SQLWCHAR * sqlstate,
SQLINTEGER * nativeerr,
SQLWCHAR * msg,
SQLSMALLINT buflen,
SQLSMALLINT * msglen )

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

Parameters
htypehandle type
handleHENV, HDBC, or HSTMT
recno
sqlstateoutput buffer for SQL state
nativeerroutput buffer of native error code
msgoutput buffer for error message
buflenlength of output buffer
msglenoutput length
Returns
ODBC error code

Definition at line 8889 of file sqlite3odbc.c.

References drvgetdiagrec(), min, uc_free(), uc_from_utf(), uc_from_utf_buf(), uc_strlen(), and uc_strncpy().

◆ SQLGetEnvAttr()

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

Get information of HENV.

Parameters
envenvironment handle
attrattribute to be retrieved
valoutput buffer
lenlength of output buffer
lenpoutput length
Returns
ODBC error code

Definition at line 8623 of file sqlite3odbc.c.

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

◆ SQLGetFunctions()

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

Return information about supported ODBC API functions.

Parameters
dbcdatabase connection handle
funcfunction code to be retrieved
flagsoutput indicator
Returns
ODBC error code

Definition at line 11789 of file sqlite3odbc.c.

References array_size, and SET_EXISTS.

◆ SQLGetInfoW()

SQLRETURN SQL_API SQLGetInfoW ( SQLHDBC dbc,
SQLUSMALLINT type,
SQLPOINTER val,
SQLSMALLINT valMax,
SQLSMALLINT * valLen )

Return information about what this ODBC driver supports.

Parameters
dbcdatabase connection handle
typetype of information to be retrieved
valoutput buffer
valMaxlength of output buffer
valLenoutput length
Returns
ODBC error code

Definition at line 11686 of file sqlite3odbc.c.

References drvgetinfo(), HDBC_LOCK, HDBC_UNLOCK, min, uc_free(), uc_from_utf(), uc_strlen(), and uc_strncpy().

◆ SQLGetStmtAttrW()

SQLRETURN SQL_API SQLGetStmtAttrW ( SQLHSTMT stmt,
SQLINTEGER attr,
SQLPOINTER val,
SQLINTEGER bufmax,
SQLINTEGER * buflen )

Get option of HSTMT (UNICODE version).

Parameters
stmtstatement handle
attrattribute to be retrieved
valoutput buffer
bufmaxlength of output buffer
buflenoutput length
Returns
ODBC error code

Definition at line 9415 of file sqlite3odbc.c.

References drvgetstmtattr(), HSTMT_LOCK, and HSTMT_UNLOCK.

◆ SQLGetStmtOption()

SQLRETURN SQL_API SQLGetStmtOption ( SQLHSTMT stmt,
SQLUSMALLINT opt,
SQLPOINTER param )

Get option of HSTMT.

Parameters
stmtstatement handle
optoption to be retrieved
paramoutput buffer
Returns
ODBC error code

Definition at line 9697 of file sqlite3odbc.c.

References drvgetstmtoption(), HSTMT_LOCK, and HSTMT_UNLOCK.

◆ SQLGetStmtOptionW()

SQLRETURN SQL_API SQLGetStmtOptionW ( SQLHSTMT stmt,
SQLUSMALLINT opt,
SQLPOINTER param )

Get option of HSTMT (UNICODE version).

Parameters
stmtstatement handle
optoption to be retrieved
paramoutput buffer
Returns
ODBC error code

Definition at line 9717 of file sqlite3odbc.c.

References drvgetstmtoption(), HSTMT_LOCK, and HSTMT_UNLOCK.

◆ SQLGetTypeInfoW()

SQLRETURN SQL_API SQLGetTypeInfoW ( SQLHSTMT stmt,
SQLSMALLINT sqltype )

Return data type information (UNICODE version).

Parameters
stmtstatement handle
sqltypewhich type to retrieve
Returns
ODBC error code

Definition at line 16098 of file sqlite3odbc.c.

References drvgettypeinfo(), HSTMT_LOCK, and HSTMT_UNLOCK.

◆ SQLNativeSqlW()

SQLRETURN SQL_API SQLNativeSqlW ( SQLHSTMT stmt,
SQLWCHAR * sqlin,
SQLINTEGER sqlinLen,
SQLWCHAR * sql,
SQLINTEGER sqlMax,
SQLINTEGER * sqlLen )

Translate SQL string (UNICODE version).

Parameters
stmtstatement handle
sqlininput string
sqlinLenlength of input string
sqloutput string
sqlMaxmax space in output string
sqlLenvalue return for length of output string
Returns
ODBC error code

Definition at line 8384 of file sqlite3odbc.c.

References HSTMT_LOCK, HSTMT_UNLOCK, min, setstat(), uc_strlen(), and uc_strncpy().

◆ SQLNumParams()

SQLRETURN SQL_API SQLNumParams ( SQLHSTMT stmt,
SQLSMALLINT * nparam )

Return number of parameters.

Parameters
stmtstatement handle
nparamoutput parameter count
Returns
ODBC error code

Definition at line 5697 of file sqlite3odbc.c.

References HSTMT_LOCK, HSTMT_UNLOCK, and stmt::nparams.

◆ SQLNumResultCols()

SQLRETURN SQL_API SQLNumResultCols ( SQLHSTMT stmt,
SQLSMALLINT * ncols )

Return number of columns of result set given HSTMT.

Parameters
stmtstatement handle
ncolsoutput number of columns
Returns
ODBC error code

Definition at line 17079 of file sqlite3odbc.c.

References HSTMT_LOCK, HSTMT_UNLOCK, and stmt::ncols.

◆ SQLParamData()

SQLRETURN SQL_API SQLParamData ( SQLHSTMT stmt,
SQLPOINTER * pind )

Retrieve next parameter for sending data to executing query.

Parameters
stmtstatement handle
pindpointer to output parameter indicator
Returns
ODBC error code

Definition at line 5757 of file sqlite3odbc.c.

References stmt::bindparms, drvexecute(), HSTMT_LOCK, HSTMT_UNLOCK, mapdeftype(), BINDPARM::need, stmt::nowchar, stmt::nparams, BINDPARM::param0, stmt::pdcount, setupparbuf(), BINDPARM::stype, and BINDPARM::type.

◆ SQLParamOptions()

SQLRETURN SQL_API SQLParamOptions ( SQLHSTMT stmt,
SQLULEN rows,
SQLULEN * rowp )

Function not implemented.

Definition at line 5895 of file sqlite3odbc.c.

References drvunimplstmt(), HSTMT_LOCK, and HSTMT_UNLOCK.

◆ SQLPrimaryKeysW()

SQLRETURN SQL_API SQLPrimaryKeysW ( SQLHSTMT stmt,
SQLWCHAR * cat,
SQLSMALLINT catLen,
SQLWCHAR * schema,
SQLSMALLINT schemaLen,
SQLWCHAR * table,
SQLSMALLINT tableLen )

Retrieve information about indexed columns (UNICODE version).

Parameters
stmtstatement handle
catcatalog name/pattern or NULL
catLenlength of catalog name/pattern or SQL_NTS
schemaschema name/pattern or NULL
schemaLenlength of schema name/pattern or SQL_NTS
tabletable name/pattern or NULL
tableLenlength of table name/pattern or SQL_NTS
Returns
ODBC error code

Definition at line 7012 of file sqlite3odbc.c.

References drvprimarykeys(), HSTMT_LOCK, HSTMT_UNLOCK, nomem(), uc_free(), and uc_to_utf_c().

◆ SQLProcedureColumnsW()

SQLRETURN SQL_API SQLProcedureColumnsW ( SQLHSTMT stmt,
SQLWCHAR * catalog,
SQLSMALLINT catalogLen,
SQLWCHAR * schema,
SQLSMALLINT schemaLen,
SQLWCHAR * proc,
SQLSMALLINT procLen,
SQLWCHAR * column,
SQLSMALLINT columnLen )

Retrieve information about columns in result set of stored procedures (UNICODE version).

Parameters
stmtstatement handle
catalogcatalog name/pattern or NULL
catalogLenlength of catalog or SQL_NTS
schemaschema name/pattern or NULL
schemaLenlength of schema or SQL_NTS
procprocedure name/pattern or NULL
procLenlength of proc or SQL_NTS
columncolumn name/pattern or NULL
columnLenlength of column or SQL_NTS
Returns
ODBC error code

Definition at line 8596 of file sqlite3odbc.c.

References array_size, HSTMT_LOCK, HSTMT_UNLOCK, mkresultset(), procColSpec2, and procColSpec3.

◆ SQLProceduresW()

SQLRETURN SQL_API SQLProceduresW ( SQLHSTMT stmt,
SQLWCHAR * catalog,
SQLSMALLINT catalogLen,
SQLWCHAR * schema,
SQLSMALLINT schemaLen,
SQLWCHAR * proc,
SQLSMALLINT procLen )

Retrieve information about stored procedures (UNICODE version).

Parameters
stmtstatement handle
catalogcatalog name/pattern or NULL
catalogLenlength of catalog or SQL_NTS
schemaschema name/pattern or NULL
schemaLenlength of schema or SQL_NTS
procprocedure name/pattern or NULL
procLenlength of proc or SQL_NTS
Returns
ODBC error code

Definition at line 8484 of file sqlite3odbc.c.

References array_size, HSTMT_LOCK, HSTMT_UNLOCK, mkresultset(), procSpec2, and procSpec3.

◆ SQLPutData()

SQLRETURN SQL_API SQLPutData ( SQLHSTMT stmt,
SQLPOINTER data,
SQLLEN len )

Put (partial) parameter data into executing statement.

Parameters
stmtstatement handle
datapointer to data
lenlength of data
Returns
ODBC error code

Definition at line 5127 of file sqlite3odbc.c.

References drvputdata(), HSTMT_LOCK, and HSTMT_UNLOCK.

◆ SQLRowCount()

SQLRETURN SQL_API SQLRowCount ( SQLHSTMT stmt,
SQLLEN * nrows )

Return number of affected rows of HSTMT.

Parameters
stmtstatement handle
nrowsoutput number of rows
Returns
ODBC error code

Definition at line 17055 of file sqlite3odbc.c.

References HSTMT_LOCK, HSTMT_UNLOCK, stmt::isselect, and stmt::nrows.

◆ SQLSetConnectAttrW()

SQLRETURN SQL_API SQLSetConnectAttrW ( SQLHDBC dbc,
SQLINTEGER attr,
SQLPOINTER val,
SQLINTEGER len )

Set connect attribute of HDBC (UNICODE version).

Parameters
dbcdatabase connection handle
attroption to be set
valoption value
lensize of option
Returns
ODBC error code

Definition at line 12508 of file sqlite3odbc.c.

References drvsetconnectattr(), HDBC_LOCK, and HDBC_UNLOCK.

◆ SQLSetConnectOptionW()

SQLRETURN SQL_API SQLSetConnectOptionW ( SQLHDBC dbc,
SQLUSMALLINT opt,
SQLULEN param )

Set option on HDBC (UNICODE version).

Parameters
dbcdatabase connection handle
optoption to be set
paramoption value
Returns
ODBC error code

Definition at line 12726 of file sqlite3odbc.c.

References drvsetconnectoption(), HDBC_LOCK, and HDBC_UNLOCK.

◆ SQLSetCursorNameW()

SQLRETURN SQL_API SQLSetCursorNameW ( SQLHSTMT stmt,
SQLWCHAR * cursor,
SQLSMALLINT len )

Set cursor name on STMT (UNICODE version).

Parameters
stmtstatement handle
cursornew cursor name
lenlength of cursor name or SQL_NTS
Returns
ODBC error code

Definition at line 13829 of file sqlite3odbc.c.

References drvsetcursorname(), HSTMT_LOCK, HSTMT_UNLOCK, nomem(), uc_free(), and uc_to_utf_c().

◆ SQLSetDescFieldW()

SQLRETURN SQL_API SQLSetDescFieldW ( SQLHDESC handle,
SQLSMALLINT recno,
SQLSMALLINT fieldid,
SQLPOINTER value,
SQLINTEGER buflen )

Function not implemented.

Definition at line 5953 of file sqlite3odbc.c.

◆ SQLSetDescRec()

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

Function not implemented.

Definition at line 6000 of file sqlite3odbc.c.

◆ SQLSetEnvAttr()

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

Set information in HENV.

Parameters
envenvironment handle
attrattribute to be retrieved
valparameter buffer
lenlength of parameter
Returns
ODBC error code

Definition at line 8692 of file sqlite3odbc.c.

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

◆ SQLSetParam()

SQLRETURN SQL_API SQLSetParam ( SQLHSTMT stmt,
SQLUSMALLINT par,
SQLSMALLINT type,
SQLSMALLINT sqltype,
SQLULEN coldef,
SQLSMALLINT scale,
SQLPOINTER val,
SQLLEN * nval )

Set information on parameter.

Parameters
stmtstatement handle
parparameter number, starting at 1
typetype of host variable
sqltype
coldef
scale
valpointer to host variable
nvaloutput length pointer
Returns
ODBC error code

Definition at line 5876 of file sqlite3odbc.c.

References drvbindparam(), HSTMT_LOCK, and HSTMT_UNLOCK.

◆ SQLSetPos()

SQLRETURN SQL_API SQLSetPos ( SQLHSTMT stmt,
SQLSETPOSIROW row,
SQLUSMALLINT op,
SQLUSMALLINT lock )

Set position on result in HSTMT.

Parameters
stmtstatement handle
rowrow to be positioned
opoperation code
locklocking type
Returns
ODBC error code

Definition at line 10674 of file sqlite3odbc.c.

References drvsetpos(), HSTMT_LOCK, and HSTMT_UNLOCK.

◆ SQLSetScrollOptions()

SQLRETURN SQL_API SQLSetScrollOptions ( SQLHSTMT stmt,
SQLUSMALLINT concur,
SQLLEN rowkeyset,
SQLUSMALLINT rowset )

Function not implemented.

Definition at line 11133 of file sqlite3odbc.c.

References drvunimplstmt(), HSTMT_LOCK, and HSTMT_UNLOCK.

◆ SQLSetStmtAttrW()

SQLRETURN SQL_API SQLSetStmtAttrW ( SQLHSTMT stmt,
SQLINTEGER attr,
SQLPOINTER val,
SQLINTEGER buflen )

Set option on HSTMT (UNICODE version).

Parameters
stmtstatement handle
attrattribute to be set
valinput buffer (attribute value)
buflenlength of input buffer
Returns
ODBC error code

Definition at line 9624 of file sqlite3odbc.c.

References drvsetstmtattr(), HSTMT_LOCK, and HSTMT_UNLOCK.

◆ SQLSetStmtOption()

SQLRETURN SQL_API SQLSetStmtOption ( SQLHSTMT stmt,
SQLUSMALLINT opt,
SETSTMTOPTION_LAST_ARG_TYPE param )

Set option on HSTMT.

Parameters
stmtstatement handle
optoption to be set
paraminput buffer (option value)
Returns
ODBC error code

Definition at line 9815 of file sqlite3odbc.c.

References drvsetstmtoption(), HSTMT_LOCK, and HSTMT_UNLOCK.

◆ SQLSetStmtOptionW()

SQLRETURN SQL_API SQLSetStmtOptionW ( SQLHSTMT stmt,
SQLUSMALLINT opt,
SETSTMTOPTION_LAST_ARG_TYPE param )

Set option on HSTMT (UNICODE version).

Parameters
stmtstatement handle
optoption to be set
paraminput buffer (option value)
Returns
ODBC error code

Definition at line 9836 of file sqlite3odbc.c.

References drvsetstmtoption(), HSTMT_LOCK, and HSTMT_UNLOCK.

◆ SQLSpecialColumnsW()

SQLRETURN SQL_API SQLSpecialColumnsW ( SQLHSTMT stmt,
SQLUSMALLINT id,
SQLWCHAR * cat,
SQLSMALLINT catLen,
SQLWCHAR * schema,
SQLSMALLINT schemaLen,
SQLWCHAR * table,
SQLSMALLINT tableLen,
SQLUSMALLINT scope,
SQLUSMALLINT nullable )

Retrieve information about indexed columns (UNICODE version).

Parameters
stmtstatement handle
idtype of information, e.g. best row id
catcatalog name/pattern or NULL
catLenlength of catalog name/pattern or SQL_NTS
schemaschema name/pattern or NULL
schemaLenlength of schema name/pattern or SQL_NTS
tabletable name/pattern or NULL
tableLenlength of table name/pattern or SQL_NTS
scope
nullable
Returns
ODBC error code

Definition at line 7450 of file sqlite3odbc.c.

References drvspecialcolumns(), HSTMT_LOCK, HSTMT_UNLOCK, nomem(), uc_free(), and uc_to_utf_c().

◆ SQLStatisticsW()

SQLRETURN SQL_API SQLStatisticsW ( SQLHSTMT stmt,
SQLWCHAR * cat,
SQLSMALLINT catLen,
SQLWCHAR * schema,
SQLSMALLINT schemaLen,
SQLWCHAR * table,
SQLSMALLINT tableLen,
SQLUSMALLINT itype,
SQLUSMALLINT resv )

Return statistic information on table indices (UNICODE version).

Parameters
stmtstatement handle
catcatalog name/pattern or NULL
catLenlength of catalog name/pattern or SQL_NTS
schemaschema name/pattern or NULL
schemaLenlength of schema name/pattern or SQL_NTS
tabletable name/pattern or NULL
tableLenlength of table name/pattern or SQL_NTS
itypetype of index information
resvreserved
Returns
ODBC error code

Definition at line 16511 of file sqlite3odbc.c.

References drvstatistics(), HSTMT_LOCK, HSTMT_UNLOCK, nomem(), uc_free(), and uc_to_utf_c().

◆ SQLTablePrivilegesW()

SQLRETURN SQL_API SQLTablePrivilegesW ( SQLHSTMT stmt,
SQLWCHAR * catalog,
SQLSMALLINT catalogLen,
SQLWCHAR * schema,
SQLSMALLINT schemaLen,
SQLWCHAR * table,
SQLSMALLINT tableLen )

Retrieve privileges on tables and/or views (UNICODE version).

Parameters
stmtstatement handle
catalogcatalog name/pattern or NULL
catalogLenlength of catalog name/pattern or SQL_NTS
schemaschema name/pattern or NULL
schemaLenlength of schema name/pattern or SQL_NTS
tabletable name/pattern or NULL
tableLenlength of table name/pattern or SQL_NTS
Returns
ODBC error code

Definition at line 6516 of file sqlite3odbc.c.

References drvtableprivileges(), HSTMT_LOCK, HSTMT_UNLOCK, nomem(), uc_free(), and uc_to_utf_c().

◆ SQLTablesW()

SQLRETURN SQL_API SQLTablesW ( SQLHSTMT stmt,
SQLWCHAR * cat,
SQLSMALLINT catLen,
SQLWCHAR * schema,
SQLSMALLINT schemaLen,
SQLWCHAR * table,
SQLSMALLINT tableLen,
SQLWCHAR * type,
SQLSMALLINT typeLen )

Retrieve information on tables and/or views.

Parameters
stmtstatement handle
catcatalog name/pattern or NULL
catLenlength of catalog name/pattern or SQL_NTS
schemaschema name/pattern or NULL
schemaLenlength of schema name/pattern or SQL_NTS
tabletable name/pattern or NULL
tableLenlength of table name/pattern or SQL_NTS
typetypes of tables string or NULL
typeLenlength of types of tables string or SQL_NTS
Returns
ODBC error code

Definition at line 15088 of file sqlite3odbc.c.

References drvtables(), HSTMT_LOCK, HSTMT_UNLOCK, nomem(), uc_free(), and uc_to_utf_c().

◆ SQLTransact()

SQLRETURN SQL_API SQLTransact ( SQLHENV env,
SQLHDBC dbc,
SQLUSMALLINT type )

Commit or rollback transaction.

Parameters
envenvironment handle or NULL
dbcdatabase connection handle or NULL
typeSQL_COMMIT or SQL_ROLLBACK
Returns
ODBC error code

Definition at line 8309 of file sqlite3odbc.c.

References drvendtran().

◆ starttran()

static SQLRETURN starttran ( STMT * s)
static

Start transaction when autocommit off.

Parameters
sstatement pointer
Returns
ODBC error code

Definition at line 8136 of file sqlite3odbc.c.

References dbc::autocommit, busy_handler(), stmt::dbc, dbtracerc(), dbc::intrans, stmt::ov3, setstat(), dbc::sqlite, and dbc::trans_disable.

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

◆ str2date()

static int str2date ( int jdconv,
char * str,
DATE_STRUCT * ds )
static

Convert string to ODBC DATE_STRUCT.

Parameters
jdconvwhen true, allow julian day format
strstring to be converted
dsoutput DATE_STRUCT
Returns
0 on success, -1 on error

Strings of the format 'YYYYMMDD' or 'YYYY-MM-DD' or 'YYYY/MM/DD' or 'MM/DD/YYYY' are converted to a DATE_STRUCT.

If the string looks like a floating point number, SQLite3's julian day format is assumed.

Definition at line 3170 of file sqlite3odbc.c.

References convJD2YMD(), getmdays(), ISDIGIT, and ln_strtod().

Referenced by getrowdata().

◆ str2time()

static int str2time ( int jdconv,
char * str,
TIME_STRUCT * ts )
static

Convert string to ODBC TIME_STRUCT.

Parameters
jdconvwhen true, allow julian day format
strstring to be converted
tsoutput TIME_STRUCT
Returns
0 on success, -1 on error

Strings of the format 'HHMMSS' or 'HH:MM:SS' are converted to a TIME_STRUCT.

If the string looks like a floating point number, SQLite3's julian day format is assumed.

Definition at line 3285 of file sqlite3odbc.c.

References convJD2HMS(), ISDIGIT, and ln_strtod().

Referenced by getrowdata().

◆ str2timestamp()

static int str2timestamp ( int jdconv,
char * str,
TIMESTAMP_STRUCT * tss )
static

Convert string to ODBC TIMESTAMP_STRUCT.

Parameters
jdconvwhen true, allow julian day format
strstring to be converted
tssoutput 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.

If the string looks like a floating point number, SQLite3's julian day format is assumed.

Definition at line 3406 of file sqlite3odbc.c.

References convJD2HMS(), convJD2YMD(), getmdays(), ISDIGIT, and ln_strtod().

Referenced by getrowdata().

◆ strdup_()

static char * strdup_ ( const char * str)
static

Duplicate string using xmalloc().

Parameters
strstring to be duplicated
Returns
pointer to new string or NULL

Definition at line 616 of file sqlite3odbc.c.

References xmalloc.

◆ TOLOWER()

static int TOLOWER ( int c)
static

Definition at line 550 of file sqlite3odbc.c.

References lower_chars, and upper_chars.

Referenced by drvtables(), mapsqltype(), and namematch().

◆ typeinfosort()

static int typeinfosort ( const void * a,
const void * b )
static

Helper function to sort type information.

Callback for qsort().

Parameters
afirst item to compare
bsecond item to compare
Returns
==0, <0, >0 according to data type number

Definition at line 15860 of file sqlite3odbc.c.

Referenced by drvgettypeinfo().

◆ uc_free()

◆ uc_from_utf()

static SQLWCHAR * uc_from_utf ( unsigned char * str,
int len )
static

Make UNICODE string from UTF8 string.

Parameters
strUTF8 string to be converted
lenlength of UTF8 string
Returns
alloc'ed UNICODE string to be free'd by uc_free()

Definition at line 932 of file sqlite3odbc.c.

References uc_from_utf_buf(), and xmalloc.

Referenced by getrowdata(), SQLDescribeColW(), SQLGetConnectAttrW(), SQLGetCursorNameW(), SQLGetDiagFieldW(), SQLGetDiagRecW(), and SQLGetInfoW().

◆ uc_from_utf_buf()

static void uc_from_utf_buf ( unsigned char * str,
int len,
SQLWCHAR * uc,
int ucLen )
static

Make UNICODE string from UTF8 string into buffer.

Parameters
strUTF8 string to be converted
lenlength in characters of str or -1
ucdestination area to receive UNICODE string
ucLenbyte length of destination area

Definition at line 848 of file sqlite3odbc.c.

Referenced by SQLGetDiagRecW(), and uc_from_utf().

◆ uc_strlen()

static int uc_strlen ( SQLWCHAR * str)
static

Return length of UNICODE string.

Parameters
strUNICODE string
Returns
length of string in characters

Definition at line 800 of file sqlite3odbc.c.

Referenced by getrowdata(), setupparam(), SQLDescribeColW(), SQLGetConnectAttrW(), SQLGetCursorNameW(), SQLGetDiagFieldW(), SQLGetDiagRecW(), SQLGetInfoW(), SQLNativeSqlW(), and uc_to_utf().

◆ uc_strncpy()

static SQLWCHAR * uc_strncpy ( SQLWCHAR * dest,
SQLWCHAR * src,
int len )
static

Copy UNICODE string like strncpy().

Parameters
destdestination area
srcsource area
lenlength of source area in characters
Returns
pointer to destination area

Definition at line 822 of file sqlite3odbc.c.

Referenced by getrowdata(), SQLDescribeColW(), SQLGetConnectAttrW(), SQLGetCursorNameW(), SQLGetDiagFieldW(), SQLGetDiagRecW(), SQLGetInfoW(), and SQLNativeSqlW().

◆ uc_to_utf()

static char * uc_to_utf ( SQLWCHAR * str,
int len )
static

Make UTF8 string from UNICODE string.

Parameters
strUNICODE string to be converted
lenlength of UNICODE string in bytes
Returns
alloc'ed UTF8 string to be free'd by uc_free()

Definition at line 958 of file sqlite3odbc.c.

References uc_strlen(), and xmalloc.

Referenced by drvputdata(), setposbind(), setupparam(), and uc_to_utf_c().

◆ uc_to_utf_c()

static char * uc_to_utf_c ( SQLWCHAR * str,
int len )
static

Make UTF8 string from UNICODE string.

Parameters
strUNICODE string to be converted
lenlength of UNICODE string in characters
Returns
alloc'ed UTF8 string to be free'd by uc_free()

Definition at line 1028 of file sqlite3odbc.c.

References uc_to_utf().

Referenced by SQLColumnsW(), SQLConnectW(), SQLForeignKeysW(), SQLPrimaryKeysW(), SQLSetCursorNameW(), SQLSpecialColumnsW(), SQLStatisticsW(), SQLTablePrivilegesW(), and SQLTablesW().

◆ unbindcols()

static void unbindcols ( STMT * s)
static

Reset bound columns to unbound state.

Parameters
sstatement pointer

Definition at line 13987 of file sqlite3odbc.c.

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

Referenced by drvfreestmt(), and mkbindcols().

◆ unescpat()

static int unescpat ( char * str)
static

Unescape search pattern for e.g.

table name in catalog functions. Replacements in string are done in-place.

Parameters
strstring
Returns
number of pattern characters in string or 0

Definition at line 1910 of file sqlite3odbc.c.

Referenced by drvcolumns(), drvprimarykeys(), drvspecialcolumns(), drvstatistics(), drvtableprivileges(), and drvtables().

◆ unquote()

static char * unquote ( char * str)
static

Strip quotes from quoted string in-place.

Parameters
strstring

Definition at line 1883 of file sqlite3odbc.c.

Referenced by drvcolumns(), and drvforeignkeys().

Variable Documentation

◆ colPrivSpec2

COL colPrivSpec2[]
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", "COLUMN_NAME", SCOL_VARCHAR, 255 },
{ "SYSTEM", "COLPRIV", "GRANTOR", SCOL_VARCHAR, 50 },
{ "SYSTEM", "COLPRIV", "GRANTEE", SCOL_VARCHAR, 50 },
{ "SYSTEM", "COLPRIV", "PRIVILEGE", SCOL_VARCHAR, 50 }
}
#define SCOL_VARCHAR

Columns for result set of SQLColumnPrivileges().

Definition at line 6563 of file sqlite3odbc.c.

Referenced by SQLColumnPrivilegesW().

◆ colPrivSpec3

COL colPrivSpec3[]
static
Initial value:
= {
{ "SYSTEM", "COLPRIV", "TABLE_CAT", SCOL_VARCHAR, 50 },
{ "SYSTEM", "COLPRIV", "TABLE_SCHEM", SCOL_VARCHAR, 50 },
{ "SYSTEM", "COLPRIV", "TABLE_NAME", SCOL_VARCHAR, 255 },
{ "SYSTEM", "COLPRIV", "COLUMN_NAME", SCOL_VARCHAR, 255 },
{ "SYSTEM", "COLPRIV", "GRANTOR", SCOL_VARCHAR, 50 },
{ "SYSTEM", "COLPRIV", "GRANTEE", SCOL_VARCHAR, 50 },
{ "SYSTEM", "COLPRIV", "PRIVILEGE", SCOL_VARCHAR, 50 }
}

Definition at line 6573 of file sqlite3odbc.c.

Referenced by SQLColumnPrivilegesW().

◆ colSpec2

COL colSpec2[]
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", "SCALE", SQL_SMALLINT, 50 },
{ "SYSTEM", "COLUMN", "RADIX", 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 15142 of file sqlite3odbc.c.

Referenced by drvcolumns().

◆ colSpec3

COL colSpec3[]
static
Initial value:
= {
{ "SYSTEM", "COLUMN", "TABLE_CAT", SCOL_VARCHAR, 50 },
{ "SYSTEM", "COLUMN", "TABLE_SCHEM", 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", "COLUMN_SIZE", SQL_INTEGER, 50 },
{ "SYSTEM", "COLUMN", "BUFFER_LENGTH", SQL_INTEGER, 50 },
{ "SYSTEM", "COLUMN", "DECIMAL_DIGITS", SQL_SMALLINT, 50 },
{ "SYSTEM", "COLUMN", "NUM_PREC_RADIX", 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 }
}

Definition at line 15163 of file sqlite3odbc.c.

Referenced by drvcolumns().

◆ digit_chars

const char digit_chars[] = "0123456789"
static

Definition at line 566 of file sqlite3odbc.c.

◆ fkeySpec2

COL fkeySpec2[]
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 7497 of file sqlite3odbc.c.

Referenced by drvforeignkeys().

◆ fkeySpec3

COL fkeySpec3[]
static
Initial value:
= {
{ "SYSTEM", "FOREIGNKEY", "PKTABLE_CAT", SCOL_VARCHAR, 50 },
{ "SYSTEM", "FOREIGNKEY", "PKTABLE_SCHEM", SCOL_VARCHAR, 50 },
{ "SYSTEM", "FOREIGNKEY", "PKTABLE_NAME", SCOL_VARCHAR, 255 },
{ "SYSTEM", "FOREIGNKEY", "PKCOLUMN_NAME", SCOL_VARCHAR, 255 },
{ "SYSTEM", "FOREIGNKEY", "FKTABLE_CAT", SCOL_VARCHAR, 50 },
{ "SYSTEM", "FOREIGNKEY", "FKTABLE_SCHEM", 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 }
}

Definition at line 7514 of file sqlite3odbc.c.

Referenced by drvforeignkeys().

◆ lower_chars

const char lower_chars[] = "abcdefghijklmnopqrstuvwxyz"
static

Definition at line 547 of file sqlite3odbc.c.

Referenced by TOLOWER().

◆ pkeySpec2

COL pkeySpec2[]
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 6653 of file sqlite3odbc.c.

Referenced by drvprimarykeys().

◆ pkeySpec3

COL pkeySpec3[]
static
Initial value:
= {
{ "SYSTEM", "PRIMARYKEY", "TABLE_CAT", SCOL_VARCHAR, 50 },
{ "SYSTEM", "PRIMARYKEY", "TABLE_SCHEM", 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 }
}

Definition at line 6662 of file sqlite3odbc.c.

Referenced by drvprimarykeys().

◆ procColSpec2

COL procColSpec2[]
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", "SCALE", SQL_SMALLINT, 5 },
{ "SYSTEM", "PROCCOL", "RADIX", 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 8503 of file sqlite3odbc.c.

Referenced by SQLProcedureColumnsW().

◆ procColSpec3

COL procColSpec3[]
static
Initial value:
= {
{ "SYSTEM", "PROCCOL", "PROCEDURE_CAT", SCOL_VARCHAR, 50 },
{ "SYSTEM", "PROCCOL", "PROCEDURE_SCHEM", 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", "COLUMN_SIZE", SQL_INTEGER, 10 },
{ "SYSTEM", "PROCCOL", "BUFFER_LENGTH", SQL_INTEGER, 10 },
{ "SYSTEM", "PROCCOL", "DECIMAL_DIGITS", SQL_SMALLINT, 5 },
{ "SYSTEM", "PROCCOL", "NUM_PREC_RADIX", 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 }
}

Definition at line 8525 of file sqlite3odbc.c.

Referenced by SQLProcedureColumnsW().

◆ procSpec2

COL procSpec2[]
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 8419 of file sqlite3odbc.c.

Referenced by SQLProceduresW().

◆ procSpec3

COL procSpec3[]
static
Initial value:
= {
{ "SYSTEM", "PROCEDURE", "PROCEDURE_CAT", SCOL_VARCHAR, 50 },
{ "SYSTEM", "PROCEDURE", "PROCEDURE_SCHEM", 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 }
}

Definition at line 8430 of file sqlite3odbc.c.

Referenced by SQLProceduresW().

◆ scolSpec2

COL scolSpec2[]
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 7057 of file sqlite3odbc.c.

Referenced by drvspecialcolumns().

◆ scolSpec3

COL scolSpec3[]
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", "COLUMN_SIZE", SQL_INTEGER, 50 },
{ "SYSTEM", "COLUMN", "BUFFER_LENGTH", SQL_INTEGER, 50 },
{ "SYSTEM", "COLUMN", "DECIMAL_DIGITS", SQL_INTEGER, 50 },
{ "SYSTEM", "COLUMN", "PSEUDO_COLUMN", SQL_SMALLINT, 1 },
{ "SYSTEM", "COLUMN", "NULLABLE", SQL_SMALLINT, 1 }
}

Definition at line 7069 of file sqlite3odbc.c.

Referenced by drvspecialcolumns().

◆ space_chars

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

Definition at line 575 of file sqlite3odbc.c.

◆ statSpec2

COL statSpec2[]
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", "SEQ_IN_INDEX", SQL_SMALLINT, 50 },
{ "SYSTEM", "STATISTICS", "COLUMN_NAME", SCOL_VARCHAR, 255 },
{ "SYSTEM", "STATISTICS", "COLLATION", SCOL_CHAR, 1 },
{ "SYSTEM", "STATISTICS", "CARDINALITY", SQL_INTEGER, 50 },
{ "SYSTEM", "STATISTICS", "PAGES", SQL_INTEGER, 50 },
{ "SYSTEM", "STATISTICS", "FILTER_CONDITION", SCOL_VARCHAR, 255 }
}
#define SCOL_CHAR

Columns for result set of SQLStatistics().

Definition at line 16113 of file sqlite3odbc.c.

Referenced by drvstatistics().

◆ statSpec3

COL statSpec3[]
static
Initial value:
= {
{ "SYSTEM", "STATISTICS", "TABLE_CAT", SCOL_VARCHAR, 50 },
{ "SYSTEM", "STATISTICS", "TABLE_SCHEM", 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 }
}

Definition at line 16129 of file sqlite3odbc.c.

Referenced by drvstatistics().

◆ tablePrivSpec2

COL tablePrivSpec2[]
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 6063 of file sqlite3odbc.c.

Referenced by drvtableprivileges().

◆ tablePrivSpec3

COL tablePrivSpec3[]
static
Initial value:
= {
{ "SYSTEM", "TABLEPRIV", "TABLE_CAT", SCOL_VARCHAR, 50 },
{ "SYSTEM", "TABLEPRIV", "TABLE_SCHEM", 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 }
}

Definition at line 6073 of file sqlite3odbc.c.

Referenced by drvtableprivileges().

◆ tableSpec2

COL tableSpec2[]
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 14766 of file sqlite3odbc.c.

Referenced by drvtables().

◆ tableSpec3

COL tableSpec3[]
static
Initial value:
= {
{ "SYSTEM", "COLUMN", "TABLE_CAT", SCOL_VARCHAR, 50 },
{ "SYSTEM", "COLUMN", "TABLE_SCHEM", SCOL_VARCHAR, 50 },
{ "SYSTEM", "COLUMN", "TABLE_NAME", SCOL_VARCHAR, 255 },
{ "SYSTEM", "COLUMN", "TABLE_TYPE", SCOL_VARCHAR, 50 },
{ "SYSTEM", "COLUMN", "REMARKS", SCOL_VARCHAR, 50 }
}

Definition at line 14774 of file sqlite3odbc.c.

Referenced by drvtables().

◆ typeSpec2

COL typeSpec2[]
static
Initial value:
= {
{ "SYSTEM", "TYPE", "TYPE_NAME", SCOL_VARCHAR, 50 },
{ "SYSTEM", "TYPE", "DATA_TYPE", SQL_SMALLINT, 2 },
{ "SYSTEM", "TYPE", "PRECISION", SQL_INTEGER, 9 },
{ "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 15667 of file sqlite3odbc.c.

Referenced by drvgettypeinfo().

◆ typeSpec3

COL typeSpec3[]
static
Initial value:
= {
{ "SYSTEM", "TYPE", "TYPE_NAME", SCOL_VARCHAR, 50 },
{ "SYSTEM", "TYPE", "DATA_TYPE", SQL_SMALLINT, 2 },
{ "SYSTEM", "TYPE", "COLUMN_SIZE", SQL_INTEGER, 9 },
{ "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", "FIXED_PREC_SCALE", SQL_SMALLINT, 2 },
{ "SYSTEM", "TYPE", "AUTO_UNIQUE_VALUE", 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 },
{ "SYSTEM", "TYPE", "SQL_DATA_TYPE", SQL_SMALLINT, 2 },
{ "SYSTEM", "TYPE", "SQL_DATETIME_SUB", SQL_SMALLINT, 2 },
{ "SYSTEM", "TYPE", "NUM_PREC_RADIX", SQL_INTEGER, 4 },
{ "SYSTEM", "TYPE", "INTERVAL_PRECISION", SQL_SMALLINT, 2 }
}

Definition at line 15685 of file sqlite3odbc.c.

Referenced by drvgettypeinfo().

◆ upper_chars

const char upper_chars[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
static

Definition at line 546 of file sqlite3odbc.c.

Referenced by TOLOWER().

◆ xdigits

const char* xdigits = "0123456789ABCDEFabcdef"
static

Generated on Sun Nov 26 2023 by doxygen.
Contact: chw@ch-werner.de