wxsqlite3.cpp File Reference

Implementation of the wxSQLite3 class. More...

`#include "wx/wxprec.h"`
`#include "wx/wx.h"`
`#include "wx/regex.h"`
`#include "wx/thread.h"`
`#include "wx/wxsqlite3.h"`
`#include "wx/wxsqlite3opt.h"`
`#include "sqlite3.h"`
`#include <string.h>`
`#include <assert.h>`

## Classes

class | wxSQLite3DatabaseReference
class | wxSQLite3StatementReference
class | wxSQLite3BlobReference
struct | sqlite3_intarray
| Definition of the sqlite3_intarray object (internal). More...
struct | intarray_vtab
| Definition of intarray table object (internal). More...
struct | intarray_cursor
| Definition of intarray cursor object (internal). More...
struct | sqlite3_chararray
| Definition of the sqlite3_chararray object (internal). More...
struct | chararray_vtab
| Definition of chararray table object (internal). More...
struct | chararray_cursor
| Definition of chararray cursor object (internal). More...

## Macros

#define | SQLITE_HAS_CODEC 1

## Typedefs

typedef int(* | sqlite3_xauth) (void *, int, const char *, const char *, const char *, const char *)
typedef struct intarray_vtab | intarray_vtab
typedef struct intarray_cursor | intarray_cursor
typedef struct chararray_vtab | chararray_vtab
typedef struct chararray_cursor | chararray_cursor

## Functions

wxLongLong | ConvertStringToLongLong (const wxString &str, wxLongLong defValue)
static double | wxSQLite3AtoF (const char *z)
static bool | BackupRestoreCallback (int total, int remaining, wxSQLite3BackupProgress *progressCallback)
static void | intarrayFree (sqlite3_intarray *p)
static int | intarrayDestroy (sqlite3_vtab *p)
static int | intarrayCreate (sqlite3 *db, void *pAux, int, const char *const *, sqlite3_vtab **ppVtab, char **)
static int | intarrayOpen (sqlite3_vtab *, sqlite3_vtab_cursor **ppCursor)
static int | intarrayClose (sqlite3_vtab_cursor *cur)
static int | intarrayColumn (sqlite3_vtab_cursor *cur, sqlite3_context *ctx, int)
static int | intarrayRowid (sqlite3_vtab_cursor *cur, sqlite_int64 *pRowid)
static int | intarrayEof (sqlite3_vtab_cursor *cur)
static int | intarrayNext (sqlite3_vtab_cursor *cur)
static int | intarrayFilter (sqlite3_vtab_cursor *pVtabCursor, int, const char *, int, sqlite3_value **)
static int | intarrayBestIndex (sqlite3_vtab *, sqlite3_index_info *)
static void | chararrayFree (sqlite3_chararray *p)
static int | chararrayDestroy (sqlite3_vtab *p)
static int | chararrayCreate (sqlite3 *db, void *pAux, int, const char *const *, sqlite3_vtab **ppVtab, char **)
static int | chararrayOpen (sqlite3_vtab *, sqlite3_vtab_cursor **ppCursor)
static int | chararrayClose (sqlite3_vtab_cursor *cur)
static int | chararrayColumn (sqlite3_vtab_cursor *cur, sqlite3_context *ctx, int)
static int | chararrayRowid (sqlite3_vtab_cursor *cur, sqlite_int64 *pRowid)
static int | chararrayEof (sqlite3_vtab_cursor *cur)
static int | chararrayNext (sqlite3_vtab_cursor *cur)
static int | chararrayFilter (sqlite3_vtab_cursor *pVtabCursor, int, const char *, int, sqlite3_value **)
static int | chararrayBestIndex (sqlite3_vtab *, sqlite3_index_info *)

## Variables

const wxChar * | wxERRMSG_NODB = wxTRANSLATE("No Database opened")
const wxChar * | wxERRMSG_NOSTMT = wxTRANSLATE("Statement not accessible")
const wxChar * | wxERRMSG_NOMEM = wxTRANSLATE("Out of memory")
const wxChar * | wxERRMSG_DECODE = wxTRANSLATE("Cannot decode binary")
const wxChar * | wxERRMSG_INVALID_INDEX = wxTRANSLATE("Invalid field index")
const wxChar * | wxERRMSG_INVALID_NAME = wxTRANSLATE("Invalid field name")
const wxChar * | wxERRMSG_INVALID_ROW = wxTRANSLATE("Invalid row index")
const wxChar * | wxERRMSG_INVALID_QUERY = wxTRANSLATE("Invalid scalar query")
const wxChar * | wxERRMSG_INVALID_BLOB = wxTRANSLATE("Invalid BLOB handle")
const wxChar * | wxERRMSG_NORESULT = wxTRANSLATE("Null Results pointer")
const wxChar * | wxERRMSG_BIND_STR = wxTRANSLATE("Error binding string param")
const wxChar * | wxERRMSG_BIND_INT = wxTRANSLATE("Error binding int param")
const wxChar * | wxERRMSG_BIND_INT64 = wxTRANSLATE("Error binding int64 param")
const wxChar * | wxERRMSG_BIND_DBL = wxTRANSLATE("Error binding double param")
const wxChar * | wxERRMSG_BIND_BLOB = wxTRANSLATE("Error binding blob param")
const wxChar * | wxERRMSG_BIND_DATETIME = wxTRANSLATE("Error binding date/time param")
const wxChar * | wxERRMSG_BIND_NULL = wxTRANSLATE("Error binding NULL param")
const wxChar * | wxERRMSG_BIND_ZEROBLOB = wxTRANSLATE("Error binding zero blob param")
const wxChar * | wxERRMSG_BIND_CLEAR = wxTRANSLATE("Error clearing bindings")
const wxChar * | wxERRMSG_NOMETADATA = wxTRANSLATE("Meta data support not available")
const wxChar * | wxERRMSG_NOCODEC = wxTRANSLATE("Encryption support not available")
const wxChar * | wxERRMSG_NOLOADEXT = wxTRANSLATE("Loadable extension support not available")
const wxChar * | wxERRMSG_NOINCBLOB = wxTRANSLATE("Incremental BLOB support not available")
const wxChar * | wxERRMSG_NOBLOBREBIND = wxTRANSLATE("Rebind BLOB support not available")
const wxChar * | wxERRMSG_NOSAVEPOINT = wxTRANSLATE("Savepoint support not available")
const wxChar * | wxERRMSG_NOBACKUP = wxTRANSLATE("Backup/restore support not available")
const wxChar * | wxERRMSG_NOWAL = wxTRANSLATE("Write Ahead Log support not available")
const wxChar * | wxERRMSG_NOCOLLECTIONS = wxTRANSLATE("Named collection support not available")
const wxChar * | wxERRMSG_SHARED_CACHE = wxTRANSLATE("Setting SQLite shared cache mode failed")
const wxChar * | wxERRMSG_INITIALIZE = wxTRANSLATE("Initialization of SQLite failed")
const wxChar * | wxERRMSG_SHUTDOWN = wxTRANSLATE("Shutdown of SQLite failed")
const wxChar * | wxERRMSG_TEMPDIR = wxTRANSLATE("Setting temporary directory failed")
const wxChar * | wxERRMSG_SOURCEDB_BUSY = wxTRANSLATE("Source database is busy")
const wxChar * | wxERRMSG_DBOPEN_FAILED = wxTRANSLATE("Database open failed")
const wxChar * | wxERRMSG_DBCLOSE_FAILED = wxTRANSLATE("Database close failed")
const wxChar * | wxERRMSG_DBASSIGN_FAILED = wxTRANSLATE("Database assignment failed")
const wxChar * | wxERRMSG_FINALIZE_FAILED = wxTRANSLATE("Finalize failed")
static const wxChar * | limitCodeString []
static const wxChar * | authCodeString []
static sqlite3_module | intarrayModule
static sqlite3_module | chararrayModule

## Detailed Description

Implementation of the wxSQLite3 class.

## Macro Definition Documentation

## SQLITE_HAS_CODEC

#define SQLITE_HAS_CODEC 1

## Typedef Documentation

## chararray_cursor

typedef struct chararray_cursor chararray_cursor

## chararray_vtab

typedef struct chararray_vtab chararray_vtab

## intarray_cursor

typedef struct intarray_cursor intarray_cursor

## intarray_vtab

typedef struct intarray_vtab intarray_vtab

## sqlite3_xauth

typedef int(* sqlite3_xauth) (void *, int, const char *, const char *, const char *, const char *)

## Function Documentation

## BackupRestoreCallback()

bool BackupRestoreCallback | ( | int | total,
|  | int | remaining,
|  | wxSQLite3BackupProgress * | progressCallback )

static

## chararrayBestIndex()

int chararrayBestIndex | ( | sqlite3_vtab * | ,
|  | sqlite3_index_info * | )

static

## chararrayClose()

int chararrayClose | ( | sqlite3_vtab_cursor * | cur | ) |

static

## chararrayColumn()

int chararrayColumn | ( | sqlite3_vtab_cursor * | cur,
|  | sqlite3_context * | ctx,
|  | int | )

static

## chararrayCreate()

int chararrayCreate | ( | sqlite3 * | db,
|  | void * | pAux,
|  | int | ,
|  | const char *const * | ,
|  | sqlite3_vtab ** | ppVtab,
|  | char ** | )

static

## chararrayDestroy()

int chararrayDestroy | ( | sqlite3_vtab * | p | ) |

static

## chararrayEof()

int chararrayEof | ( | sqlite3_vtab_cursor * | cur | ) |

static

## chararrayFilter()

int chararrayFilter | ( | sqlite3_vtab_cursor * | pVtabCursor,
|  | int | ,
|  | const char * | ,
|  | int | ,
|  | sqlite3_value ** | )

static

## chararrayFree()

void chararrayFree | ( | sqlite3_chararray * | p | ) |

static

## chararrayNext()

int chararrayNext | ( | sqlite3_vtab_cursor * | cur | ) |

static

## chararrayOpen()

int chararrayOpen | ( | sqlite3_vtab * | ,
|  | sqlite3_vtab_cursor ** | ppCursor )

static

## chararrayRowid()

int chararrayRowid | ( | sqlite3_vtab_cursor * | cur,
|  | sqlite_int64 * | pRowid )

static

## ConvertStringToLongLong()

wxLongLong ConvertStringToLongLong | ( | const wxString & | str,
|  | wxLongLong | defValue )

inline

## intarrayBestIndex()

int intarrayBestIndex | ( | sqlite3_vtab * | ,
|  | sqlite3_index_info * | )

static

## intarrayClose()

int intarrayClose | ( | sqlite3_vtab_cursor * | cur | ) |

static

## intarrayColumn()

int intarrayColumn | ( | sqlite3_vtab_cursor * | cur,
|  | sqlite3_context * | ctx,
|  | int | )

static

## intarrayCreate()

int intarrayCreate | ( | sqlite3 * | db,
|  | void * | pAux,
|  | int | ,
|  | const char *const * | ,
|  | sqlite3_vtab ** | ppVtab,
|  | char ** | )

static

## intarrayDestroy()

int intarrayDestroy | ( | sqlite3_vtab * | p | ) |

static

## intarrayEof()

int intarrayEof | ( | sqlite3_vtab_cursor * | cur | ) |

static

## intarrayFilter()

int intarrayFilter | ( | sqlite3_vtab_cursor * | pVtabCursor,
|  | int | ,
|  | const char * | ,
|  | int | ,
|  | sqlite3_value ** | )

static

## intarrayFree()

void intarrayFree | ( | sqlite3_intarray * | p | ) |

static

## intarrayNext()

int intarrayNext | ( | sqlite3_vtab_cursor * | cur | ) |

static

## intarrayOpen()

int intarrayOpen | ( | sqlite3_vtab * | ,
|  | sqlite3_vtab_cursor ** | ppCursor )

static

## intarrayRowid()

int intarrayRowid | ( | sqlite3_vtab_cursor * | cur,
|  | sqlite_int64 * | pRowid )

static

## wxSQLite3AtoF()

double wxSQLite3AtoF | ( | const char * | z | ) |

static

## Variable Documentation

## authCodeString

const wxChar* authCodeString[]

static

Initial value:
=
{ wxT("SQLITE_COPY"), wxT("SQLITE_CREATE_INDEX"), wxT("SQLITE_CREATE_TABLE"),
wxT("SQLITE_CREATE_TEMP_INDEX"), wxT("SQLITE_CREATE_TEMP_TABLE"), wxT("SQLITE_CREATE_TEMP_TRIGGER"),
wxT("SQLITE_CREATE_TEMP_VIEW"), wxT("SQLITE_CREATE_TRIGGER"), wxT("SQLITE_CREATE_VIEW"),
wxT("SQLITE_DELETE"), wxT("SQLITE_DROP_INDEX"), wxT("SQLITE_DROP_TABLE"),
wxT("SQLITE_DROP_TEMP_INDEX"), wxT("SQLITE_DROP_TEMP_TABLE"), wxT("SQLITE_DROP_TEMP_TRIGGER"),
wxT("SQLITE_DROP_TEMP_VIEW"), wxT("SQLITE_DROP_TRIGGER"), wxT("SQLITE_DROP_VIEW"),
wxT("SQLITE_INSERT"), wxT("SQLITE_PRAGMA"), wxT("SQLITE_READ"),
wxT("SQLITE_SELECT"), wxT("SQLITE_TRANSACTION"), wxT("SQLITE_UPDATE"),
wxT("SQLITE_ATTACH"), wxT("SQLITE_DETACH"), wxT("SQLITE_ALTER_TABLE"),
wxT("SQLITE_REINDEX"), wxT("SQLITE_ANALYZE"), wxT("SQLITE_CREATE_VTABLE"),
wxT("SQLITE_DROP_VTABLE"), wxT("SQLITE_FUNCTION"), wxT("SQLITE_SAVEPOINT"),
wxT("SQLITE_RECURSIVE")
}

## chararrayModule

sqlite3_module chararrayModule

static

Initial value:
=
{
0,
chararrayCreate,
chararrayCreate,
chararrayBestIndex,
chararrayDestroy,
chararrayDestroy,
chararrayOpen,
chararrayClose,
chararrayFilter,
chararrayNext,
chararrayEof,
chararrayColumn,
chararrayRowid,
0,
0,
0,
0,
0,
0,
0,
}
chararrayNext
static int chararrayNext(sqlite3_vtab_cursor *cur)
Definition wxsqlite3.cpp:4925
chararrayClose
static int chararrayClose(sqlite3_vtab_cursor *cur)
Definition wxsqlite3.cpp:4890
chararrayOpen
static int chararrayOpen(sqlite3_vtab *, sqlite3_vtab_cursor **ppCursor)
Definition wxsqlite3.cpp:4876
chararrayEof
static int chararrayEof(sqlite3_vtab_cursor *cur)
Definition wxsqlite3.cpp:4917
chararrayRowid
static int chararrayRowid(sqlite3_vtab_cursor *cur, sqlite_int64 *pRowid)
Definition wxsqlite3.cpp:4910
chararrayBestIndex
static int chararrayBestIndex(sqlite3_vtab *, sqlite3_index_info *)
Definition wxsqlite3.cpp:4943
chararrayColumn
static int chararrayColumn(sqlite3_vtab_cursor *cur, sqlite3_context *ctx, int)
Definition wxsqlite3.cpp:4898
chararrayDestroy
static int chararrayDestroy(sqlite3_vtab *p)
Definition wxsqlite3.cpp:4847
chararrayFilter
static int chararrayFilter(sqlite3_vtab_cursor *pVtabCursor, int, const char *, int, sqlite3_value **)
Definition wxsqlite3.cpp:4933
chararrayCreate
static int chararrayCreate(sqlite3 *db, void *pAux, int, const char *const *, sqlite3_vtab **ppVtab, char **)
Definition wxsqlite3.cpp:4855

## intarrayModule

sqlite3_module intarrayModule

static

Initial value:
=
{
0,
intarrayCreate,
intarrayCreate,
intarrayBestIndex,
intarrayDestroy,
intarrayDestroy,
intarrayOpen,
intarrayClose,
intarrayFilter,
intarrayNext,
intarrayEof,
intarrayColumn,
intarrayRowid,
0,
0,
0,
0,
0,
0,
0,
}
intarrayNext
static int intarrayNext(sqlite3_vtab_cursor *cur)
Definition wxsqlite3.cpp:4752
intarrayCreate
static int intarrayCreate(sqlite3 *db, void *pAux, int, const char *const *, sqlite3_vtab **ppVtab, char **)
Definition wxsqlite3.cpp:4682
intarrayBestIndex
static int intarrayBestIndex(sqlite3_vtab *, sqlite3_index_info *)
Definition wxsqlite3.cpp:4770
intarrayDestroy
static int intarrayDestroy(sqlite3_vtab *p)
Definition wxsqlite3.cpp:4674
intarrayOpen
static int intarrayOpen(sqlite3_vtab *, sqlite3_vtab_cursor **ppCursor)
Definition wxsqlite3.cpp:4703
intarrayRowid
static int intarrayRowid(sqlite3_vtab_cursor *cur, sqlite_int64 *pRowid)
Definition wxsqlite3.cpp:4737
intarrayColumn
static int intarrayColumn(sqlite3_vtab_cursor *cur, sqlite3_context *ctx, int)
Definition wxsqlite3.cpp:4725
intarrayEof
static int intarrayEof(sqlite3_vtab_cursor *cur)
Definition wxsqlite3.cpp:4744
intarrayClose
static int intarrayClose(sqlite3_vtab_cursor *cur)
Definition wxsqlite3.cpp:4717
intarrayFilter
static int intarrayFilter(sqlite3_vtab_cursor *pVtabCursor, int, const char *, int, sqlite3_value **)
Definition wxsqlite3.cpp:4760

## limitCodeString

const wxChar* limitCodeString[]

static

Initial value:
=
{ wxT("SQLITE_LIMIT_LENGTH"), wxT("SQLITE_LIMIT_SQL_LENGTH"),
wxT("SQLITE_LIMIT_COLUMN"), wxT("SQLITE_LIMIT_EXPR_DEPTH"),
wxT("SQLITE_LIMIT_COMPOUND_SELECT"), wxT("SQLITE_LIMIT_VDBE_OP"),
wxT("SQLITE_LIMIT_FUNCTION_ARG"), wxT("SQLITE_LIMIT_ATTACHED"),
wxT("SQLITE_LIMIT_LIKE_PATTERN_LENGTH"), wxT("SQLITE_LIMIT_VARIABLE_NUMBER"),
wxT("SQLITE_LIMIT_TRIGGER_DEPTH"), wxT("SQLITE_LIMIT_WORKER_THREADS")
}

## wxERRMSG_BIND_BLOB

const wxChar* wxERRMSG_BIND_BLOB = wxTRANSLATE("Error binding blob param")

## wxERRMSG_BIND_CLEAR

const wxChar* wxERRMSG_BIND_CLEAR = wxTRANSLATE("Error clearing bindings")

## wxERRMSG_BIND_DATETIME

const wxChar* wxERRMSG_BIND_DATETIME = wxTRANSLATE("Error binding date/time param")

## wxERRMSG_BIND_DBL

const wxChar* wxERRMSG_BIND_DBL = wxTRANSLATE("Error binding double param")

## wxERRMSG_BIND_INT

const wxChar* wxERRMSG_BIND_INT = wxTRANSLATE("Error binding int param")

## wxERRMSG_BIND_INT64

const wxChar* wxERRMSG_BIND_INT64 = wxTRANSLATE("Error binding int64 param")

## wxERRMSG_BIND_NULL

const wxChar* wxERRMSG_BIND_NULL = wxTRANSLATE("Error binding NULL param")

## wxERRMSG_BIND_STR

const wxChar* wxERRMSG_BIND_STR = wxTRANSLATE("Error binding string param")

## wxERRMSG_BIND_ZEROBLOB

const wxChar* wxERRMSG_BIND_ZEROBLOB = wxTRANSLATE("Error binding zero blob param")

## wxERRMSG_DBASSIGN_FAILED

const wxChar* wxERRMSG_DBASSIGN_FAILED = wxTRANSLATE("Database assignment failed")

## wxERRMSG_DBCLOSE_FAILED

const wxChar* wxERRMSG_DBCLOSE_FAILED = wxTRANSLATE("Database close failed")

## wxERRMSG_DBOPEN_FAILED

const wxChar* wxERRMSG_DBOPEN_FAILED = wxTRANSLATE("Database open failed")

## wxERRMSG_DECODE

const wxChar* wxERRMSG_DECODE = wxTRANSLATE("Cannot decode binary")

## wxERRMSG_FINALIZE_FAILED

const wxChar* wxERRMSG_FINALIZE_FAILED = wxTRANSLATE("Finalize failed")

## wxERRMSG_INITIALIZE

const wxChar* wxERRMSG_INITIALIZE = wxTRANSLATE("Initialization of SQLite failed")

## wxERRMSG_INVALID_BLOB

const wxChar* wxERRMSG_INVALID_BLOB = wxTRANSLATE("Invalid BLOB handle")

## wxERRMSG_INVALID_INDEX

const wxChar* wxERRMSG_INVALID_INDEX = wxTRANSLATE("Invalid field index")

## wxERRMSG_INVALID_NAME

const wxChar* wxERRMSG_INVALID_NAME = wxTRANSLATE("Invalid field name")

## wxERRMSG_INVALID_QUERY

const wxChar* wxERRMSG_INVALID_QUERY = wxTRANSLATE("Invalid scalar query")

## wxERRMSG_INVALID_ROW

const wxChar* wxERRMSG_INVALID_ROW = wxTRANSLATE("Invalid row index")

## wxERRMSG_NOBACKUP

const wxChar* wxERRMSG_NOBACKUP = wxTRANSLATE("Backup/restore support not available")

## wxERRMSG_NOBLOBREBIND

const wxChar* wxERRMSG_NOBLOBREBIND = wxTRANSLATE("Rebind BLOB support not available")

## wxERRMSG_NOCODEC

const wxChar* wxERRMSG_NOCODEC = wxTRANSLATE("Encryption support not available")

## wxERRMSG_NOCOLLECTIONS

const wxChar* wxERRMSG_NOCOLLECTIONS = wxTRANSLATE("Named collection support not available")

## wxERRMSG_NODB

const wxChar* wxERRMSG_NODB = wxTRANSLATE("No Database opened")

## wxERRMSG_NOINCBLOB

const wxChar* wxERRMSG_NOINCBLOB = wxTRANSLATE("Incremental BLOB support not available")

## wxERRMSG_NOLOADEXT

const wxChar* wxERRMSG_NOLOADEXT = wxTRANSLATE("Loadable extension support not available")

## wxERRMSG_NOMEM

const wxChar* wxERRMSG_NOMEM = wxTRANSLATE("Out of memory")

## wxERRMSG_NOMETADATA

const wxChar* wxERRMSG_NOMETADATA = wxTRANSLATE("Meta data support not available")

## wxERRMSG_NORESULT

const wxChar* wxERRMSG_NORESULT = wxTRANSLATE("Null Results pointer")

## wxERRMSG_NOSAVEPOINT

const wxChar* wxERRMSG_NOSAVEPOINT = wxTRANSLATE("Savepoint support not available")

## wxERRMSG_NOSTMT

const wxChar* wxERRMSG_NOSTMT = wxTRANSLATE("Statement not accessible")

## wxERRMSG_NOWAL

const wxChar* wxERRMSG_NOWAL = wxTRANSLATE("Write Ahead Log support not available")

## wxERRMSG_SHARED_CACHE

const wxChar* wxERRMSG_SHARED_CACHE = wxTRANSLATE("Setting SQLite shared cache mode failed")

## wxERRMSG_SHUTDOWN

const wxChar* wxERRMSG_SHUTDOWN = wxTRANSLATE("Shutdown of SQLite failed")

## wxERRMSG_SOURCEDB_BUSY

const wxChar* wxERRMSG_SOURCEDB_BUSY = wxTRANSLATE("Source database is busy")

## wxERRMSG_TEMPDIR

const wxChar* wxERRMSG_TEMPDIR = wxTRANSLATE("Setting temporary directory failed")