HDK
|
#include <UT_SQL.h>
Public Member Functions | |
UT_SqliteDriver () | |
~UT_SqliteDriver () override | |
UT_NON_COPYABLE (UT_SqliteDriver) | |
void | setDatabaseName (const UT_StringHolder &db_name) override |
void | setConnectOptions (const UT_Options &options) override |
bool | connect (UT_ErrorCode *ec=nullptr) override |
bool | close (UT_ErrorCode *ec=nullptr) override |
NO_DISCARD SYS_FORCE_INLINE bool | isValid () const override |
NO_DISCARD bool | isReadOnly (const char *db="main", UT_ErrorCode *ec=nullptr) const override |
NO_DISCARD void * | nativeAPI () override |
NO_DISCARD void * | nativeAPI () const override |
NO_DISCARD int | dataVersion (UT_ErrorCode *ec=nullptr) const |
NO_DISCARD int | userVersion (UT_ErrorCode *ec=nullptr) const |
void | setUserVersion (int version, UT_ErrorCode *ec=nullptr) const |
NO_DISCARD bool | tableExists (const UT_StringRef &name, UT_ErrorCode *ec=nullptr) const override |
Check if the specified table exists. More... | |
NO_DISCARD bool | indexExists (const UT_StringRef &name, UT_ErrorCode *ec=nullptr) const override |
NO_DISCARD bool | viewExists (const UT_StringRef &name, UT_ErrorCode *ec=nullptr) const override |
NO_DISCARD bool | columnExists (const UT_StringRef &table_name, const UT_StringRef &column_name, UT_ErrorCode *ec=nullptr) const override |
NO_DISCARD UT_StringHolder | errorMessage () const override |
NO_DISCARD int | errorCode () const override |
NO_DISCARD int | extendedErrorCode () const override |
NO_DISCARD UT_StringHolder | getSchema (UT_ErrorCode *ec=nullptr) const override |
void | setBusyTimeout (int timeout_ms) |
bool | copyTo (UT_SqliteDriver &destination, UT_ErrorCode *ec=nullptr) const |
UT_SharedPtr< UT_SqlStatementImpl > | createStatementImpl () override |
UT_SharedPtr< UT_SqlStatementImpl > | createStatementImpl () const override |
UT_SharedPtr< UT_SqlStatementImpl > | cachedStatement (const UT_SqlStatementHandleId &id, const UT_StringRef &sql, UT_ErrorCode *ec=nullptr) const override |
UT_SharedPtr< UT_SqlStatementImpl > | findCachedStatement (const UT_SqlStatementHandleId &id) const override |
bool | startTransaction (UT_ErrorCode *ec=nullptr) override |
bool | endTransaction (bool commit, UT_ErrorCode *ec=nullptr) override |
int | exec (const UT_StringRef &sql, UT_ErrorCode *ec=nullptr) const override |
Returns the number of rows modified, inserted or deleted. More... | |
Public Member Functions inherited from UT_SqlBaseDriver | |
virtual | ~UT_SqlBaseDriver ()=default |
UT_NON_COPYABLE (UT_SqlBaseDriver) | |
virtual void | setHostName (const UT_StringHolder &host) |
virtual void | setPort (int port) |
virtual void | setUserName (const UT_StringHolder &user) |
virtual void | setPassword (const UT_StringHolder &password) |
template<typename... Args> | |
bool | run (UT_ErrorCode *ec, const UT_StringRef &sql, Args &&...args) |
Helper function to run an sql statement with provided typed args. More... | |
Static Public Attributes | |
static constexpr UT_StringLit | theFilenameOpt = "SQLITE_FILENAME" |
static constexpr UT_StringLit | theBusyTimeoutOpt = "SQLITE_BUSY_TIMEOUT" |
Protected Member Functions | |
bool | schemaItemExists (const UT_StringRef &type, const UT_StringRef &name, UT_ErrorCode *ec) const |
Protected Member Functions inherited from UT_SqlBaseDriver | |
UT_SqlBaseDriver ()=default | |
UT_SqliteDriver::UT_SqliteDriver | ( | ) |
|
override |
|
overridevirtual |
Get a sql statement that is retrieved from the cache. If the statement is not already cached then its compiled and then cached if the compiled statement is valid.
Implements UT_SqlBaseDriver.
|
overridevirtual |
Implements UT_SqlBaseDriver.
|
overridevirtual |
Implements UT_SqlBaseDriver.
|
overridevirtual |
Implements UT_SqlBaseDriver.
bool UT_SqliteDriver::copyTo | ( | UT_SqliteDriver & | destination, |
UT_ErrorCode * | ec = nullptr |
||
) | const |
Copy the contents of this database into the provided destination database. Return true on success and false otherwise. On failure, the error code is set in the destination database.
|
overridevirtual |
Implements UT_SqlBaseDriver.
|
overridevirtual |
Implements UT_SqlBaseDriver.
NO_DISCARD int UT_SqliteDriver::dataVersion | ( | UT_ErrorCode * | ec = nullptr | ) | const |
Check the database's "data_version" (see https://www.sqlite.org/pragma.html#pragma_data_version)
|
overridevirtual |
Implements UT_SqlBaseDriver.
|
overridevirtual |
Implements UT_SqlBaseDriver.
|
overridevirtual |
Implements UT_SqlBaseDriver.
|
overridevirtual |
Returns the number of rows modified, inserted or deleted.
Implements UT_SqlBaseDriver.
|
overridevirtual |
Implements UT_SqlBaseDriver.
|
overridevirtual |
Find an sql handle based on its id. The sql statement must have already been added from cachedStatement(). This method is typically used when a statement has already been compiled and added to the cache but needs to be dynamically looked up some time later.
Implements UT_SqlBaseDriver.
|
overridevirtual |
Implements UT_SqlBaseDriver.
|
overridevirtual |
Implements UT_SqlBaseDriver.
|
overridevirtual |
Implements UT_SqlBaseDriver.
|
inlineoverridevirtual |
Implements UT_SqlBaseDriver.
|
inlineoverridevirtual |
Implements UT_SqlBaseDriver.
|
inlineoverridevirtual |
Implements UT_SqlBaseDriver.
|
protected |
This sets a busy handler that sleeps for a specified amount of time when a table is locked. The handler will sleep multiple times until at least milliseconds of sleeping have accumulated. After the timeout the handler returns 0 which causes the step() to return kSQLITE_BUSY.
|
overridevirtual |
Reimplemented from UT_SqlBaseDriver.
|
inlineoverridevirtual |
Reimplemented from UT_SqlBaseDriver.
void UT_SqliteDriver::setUserVersion | ( | int | version, |
UT_ErrorCode * | ec = nullptr |
||
) | const |
|
overridevirtual |
These are primarily used by UT_SqlTransaction (but can be used by any client code) and provide an abstraction that resembles nested transations. This is inspired by (and follows the same behaviour as): https://developer.android.com/reference/android/database/sqlite/SQLiteDatabase#beginTransaction()
Implements UT_SqlBaseDriver.
|
overridevirtual |
Check if the specified table exists.
Implements UT_SqlBaseDriver.
NO_DISCARD int UT_SqliteDriver::userVersion | ( | UT_ErrorCode * | ec = nullptr | ) | const |
Get/set the database's "user_version" (see https://www.sqlite.org/pragma.html#pragma_user_version)
UT_SqliteDriver::UT_NON_COPYABLE | ( | UT_SqliteDriver | ) |
|
overridevirtual |
Implements UT_SqlBaseDriver.
|
static |
|
static |