#include <sqliteconnection.h>
Public Member Functions | |
| virtual Cursor * | prepareQuery (const TQString &statement, uint cursor_options=0) |
| virtual Cursor * | prepareQuery (QuerySchema &query, uint cursor_options=0) |
| virtual PreparedStatement::Ptr | prepareStatement (PreparedStatement::StatementType type, FieldList &fields) |
| virtual bool | isReadOnly () const |
Public Member Functions inherited from KexiDB::Connection | |
| virtual | ~Connection () |
| ConnectionData * | data () const |
| Driver * | driver () const |
| bool | connect () |
| bool | isConnected () const |
| bool | isDatabaseUsed () const |
| virtual void | clearError () |
| bool | disconnect () |
| TQStringList | databaseNames (bool also_system_db=false) |
| bool | databaseExists (const TQString &dbName, bool ignoreErrors=true) |
| bool | createDatabase (const TQString &dbName) |
| bool | useDatabase (const TQString &dbName, bool kexiCompatible=true, bool *cancelled=0, MessageHandler *msgHandler=0) |
| bool | closeDatabase () |
| TQString | currentDatabase () const |
| bool | dropDatabase (const TQString &dbName=TQString()) |
| TQStringList | objectNames (int objType=KexiDB::AnyObjectType, bool *ok=0) |
| TQStringList | tableNames (bool also_system_tables=false) |
| KexiDB::ServerVersionInfo * | serverVersion () const |
| KexiDB::DatabaseVersionInfo * | databaseVersion () const |
| DatabaseProperties & | databaseProperties () |
| TQValueList< int > | tableIds () |
| TQValueList< int > | queryIds () |
| TQValueList< int > | objectIds (int objType) |
| Transaction | beginTransaction () |
| bool | commitTransaction (Transaction trans=Transaction::null, bool ignore_inactive=false) |
| bool | rollbackTransaction (Transaction trans=Transaction::null, bool ignore_inactive=false) |
| Transaction & | defaultTransaction () const |
| void | setDefaultTransaction (const Transaction &trans) |
| const TQValueList< Transaction > & | transactions () |
| bool | autoCommit () const |
| bool | setAutoCommit (bool on) |
| Cursor * | prepareQuery (QuerySchema &query, const TQValueList< TQVariant > ¶ms, uint cursor_options=0) |
| Cursor * | prepareQuery (TableSchema &table, uint cursor_options=0) |
| Cursor * | executeQuery (const TQString &statement, uint cursor_options=0) |
| Cursor * | executeQuery (QuerySchema &query, const TQValueList< TQVariant > ¶ms, uint cursor_options=0) |
| Cursor * | executeQuery (QuerySchema &query, uint cursor_options=0) |
| Cursor * | executeQuery (TableSchema &table, uint cursor_options=0) |
| bool | deleteCursor (Cursor *cursor) |
| TableSchema * | tableSchema (int tableId) |
| TableSchema * | tableSchema (const TQString &tableName) |
| QuerySchema * | querySchema (int queryId) |
| QuerySchema * | querySchema (const TQString &queryName) |
| bool | setQuerySchemaObsolete (const TQString &queryName) |
| tristate | querySingleRecord (const TQString &sql, RowData &data, bool addLimitTo1=true) |
| tristate | querySingleRecord (QuerySchema &query, RowData &data, bool addLimitTo1=true) |
| tristate | querySingleString (const TQString &sql, TQString &value, uint column=0, bool addLimitTo1=true) |
| tristate | querySingleNumber (const TQString &sql, int &number, uint column=0, bool addLimitTo1=true) |
| bool | queryStringList (const TQString &sql, TQStringList &list, uint column=0) |
| bool | resultExists (const TQString &sql, bool &success, bool addLimitTo1=true) |
| bool | isEmpty (TableSchema &table, bool &success) |
| int | resultCount (const TQString &sql) |
| bool | insertRecord (TableSchema &tableSchema, TQValueList< TQVariant > &values) |
| bool | insertRecord (FieldList &fields, TQValueList< TQVariant > &values) |
| bool | createTable (TableSchema *tableSchema, bool replaceExisting=false) |
| tristate | dropTable (TableSchema *tableSchema) |
| tristate | dropTable (const TQString &table) |
| tristate | alterTable (TableSchema &tableSchema, TableSchema &newTableSchema) |
| bool | alterTableName (TableSchema &tableSchema, const TQString &newName, bool replace=false) |
| bool | dropQuery (QuerySchema *querySchema) |
| bool | dropQuery (const TQString &query) |
| bool | removeObject (uint objId) |
| Field * | findSystemFieldName (FieldList *fieldlist) |
| virtual TQString | anyAvailableDatabaseName () |
| void | setAvailableDatabaseName (const TQString &dbName) |
| bool | useTemporaryDatabaseIfNeeded (TQString &tmpdbName) |
| TQ_ULLONG | lastInsertedAutoIncValue (const TQString &aiFieldName, const TQString &tableName, TQ_ULLONG *ROWID=0) |
| TQ_ULLONG | lastInsertedAutoIncValue (const TQString &aiFieldName, const TableSchema &table, TQ_ULLONG *ROWID=0) |
| bool | executeSQL (const TQString &statement) |
| TQString | selectStatement (QuerySchema &querySchema, const TQValueList< TQVariant > ¶ms, const SelectStatementOptions &options=SelectStatementOptions()) const |
| TQString | selectStatement (QuerySchema &querySchema, const SelectStatementOptions &options=SelectStatementOptions()) const |
| bool | storeObjectSchemaData (SchemaData &sdata, bool newObject) |
| tristate | loadObjectSchemaData (int objectID, SchemaData &sdata) |
| tristate | loadObjectSchemaData (int objectType, const TQString &objectName, SchemaData &sdata) |
| tristate | loadDataBlock (int objectID, TQString &dataString, const TQString &dataID) |
| bool | storeDataBlock (int objectID, const TQString &dataString, const TQString &dataID=TQString()) |
| bool | removeDataBlock (int objectID, const TQString &dataID=TQString()) |
| void | registerForTableSchemaChanges (TableSchemaChangeListenerInterface &listener, TableSchema &schema) |
| void | unregisterForTableSchemaChanges (TableSchemaChangeListenerInterface &listener, TableSchema &schema) |
| void | unregisterForTablesSchemaChanges (TableSchemaChangeListenerInterface &listener) |
| TQPtrList< Connection::TableSchemaChangeListenerInterface > * | tableSchemaChangeListeners (TableSchema &tableSchema) const |
| tristate | closeAllTableSchemaChangeListeners (TableSchema &tableSchema) |
| void | removeTableSchemaInternal (KexiDB::TableSchema *tableSchema) |
| void | insertInternalTableSchema (TableSchema *tableSchema) |
| virtual bool | drv_createTable (const TableSchema &tableSchema) |
| virtual bool | drv_alterTableName (TableSchema &tableSchema, const TQString &newName) |
| virtual bool | drv_dropTable (const TQString &name) |
| bool | isInternalTableSchema (const TQString &tableName) |
| bool | setupObjectSchemaData (const RowData &data, SchemaData &sdata) |
| KexiDB::Field * | setupField (const RowData &data) |
Public Member Functions inherited from KexiDB::Object | |
| bool | error () const |
| const TQString & | errorMsg () const |
| int | errorNum () const |
| int | previousServerResult () const |
| TQString | previousServerResultName () const |
| void | debugError () |
| TQString | msgTitle () const |
| const TQString | recentSQLString () const |
Protected Member Functions | |
| SQLiteConnection (Driver *driver, ConnectionData &conn_data) | |
| virtual bool | drv_connect (KexiDB::ServerVersionInfo &version) |
| virtual bool | drv_disconnect () |
| virtual bool | drv_getDatabasesList (TQStringList &list) |
| virtual bool | drv_getTablesList (TQStringList &list) |
| virtual bool | drv_containsTable (const TQString &tableName) |
| virtual bool | drv_createDatabase (const TQString &dbName=TQString()) |
| virtual bool | drv_useDatabase (const TQString &dbName=TQString(), bool *cancelled=0, MessageHandler *msgHandler=0) |
| virtual bool | drv_closeDatabase () |
| virtual bool | drv_dropDatabase (const TQString &dbName=TQString()) |
| virtual bool | drv_executeSQL (const TQString &statement) |
| virtual TQ_ULLONG | drv_lastInsertRowID () |
| virtual int | serverResult () |
| virtual TQString | serverResultName () |
| virtual TQString | serverErrorMsg () |
| virtual void | drv_clearServerResult () |
| virtual tristate | drv_changeFieldProperty (TableSchema &table, Field &field, const TQString &propertyName, const TQVariant &value) |
| tristate | changeFieldType (TableSchema &table, Field &field, Field::Type type) |
Protected Member Functions inherited from KexiDB::Connection | |
| Connection (Driver *driver, ConnectionData &conn_data) | |
| void | destroy () |
| tristate | dropTable (KexiDB::TableSchema *tableSchema, bool alsoRemoveSchema) |
| virtual bool | drv_databaseExists (const TQString &dbName, bool ignoreErrors=true) |
| virtual bool | drv_isDatabaseUsed () const |
| TQString | createTableStatement (const TableSchema &tableSchema) const |
| TQString | selectStatement (TableSchema &tableSchema, const SelectStatementOptions &options=SelectStatementOptions()) const |
| virtual bool | drv_createTable (const TQString &tableSchemaName) |
| virtual TransactionData * | drv_beginTransaction () |
| virtual bool | drv_commitTransaction (TransactionData *trans) |
| virtual bool | drv_rollbackTransaction (TransactionData *trans) |
| virtual bool | drv_setAutoCommit (bool on) |
| bool | beginAutoCommitTransaction (TransactionGuard &tg) |
| bool | commitAutoCommitTransaction (const Transaction &trans) |
| bool | rollbackAutoCommitTransaction (const Transaction &trans) |
| bool | checkConnected () |
| bool | checkIsDatabaseUsed () |
| TableSchema * | setupTableSchema (const RowData &data) |
| QuerySchema * | setupQuerySchema (const RowData &data) |
| bool | updateRow (QuerySchema &query, RowData &data, RowEditBuffer &buf, bool useROWID=false) |
| bool | insertRow (QuerySchema &query, RowData &data, RowEditBuffer &buf, bool getROWID=false) |
| bool | deleteRow (QuerySchema &query, RowData &data, bool useROWID=false) |
| bool | deleteAllRows (QuerySchema &query) |
| bool | setupKexiDBSystemSchema () |
| TableSchema * | newKexiDBSystemTableSchema (const TQString &tsname) |
| TQString | escapeIdentifier (const TQString &id, int escaping=Driver::EscapeDriver|Driver::EscapeAsNecessary) const |
| void | removeMe (TableSchema *ts) |
| bool | checkIfColumnExists (Cursor *cursor, uint column) |
| tristate | querySingleRecordInternal (RowData &data, const TQString *sql, QuerySchema *query, bool addLimitTo1=true) |
| void | setReadOnly (bool set) |
| bool | loadExtendedTableSchemaData (TableSchema &tableSchema) |
| bool | storeExtendedTableSchemaData (TableSchema &tableSchema) |
| bool | storeMainFieldSchema (Field *field) |
Protected Member Functions inherited from KexiDB::Object | |
| Object (MessageHandler *handler=0) | |
| virtual void | setError (int code=ERR_OTHER, const TQString &msg=TQString()) |
| virtual void | setError (const TQString &msg) |
| virtual void | setError (const TQString &title, const TQString &msg) |
| void | setError (KexiDB::Object *obj, const TQString &prependMessage=TQString()) |
| virtual void | setError (KexiDB::Object *obj, int code, const TQString &prependMessage=TQString()) |
| virtual int | askQuestion (const TQString &message, KMessageBox::DialogType dlgType, KMessageBox::ButtonCode defaultResult, const KGuiItem &buttonYes=KStdGuiItem::yes(), const KGuiItem &buttonNo=KStdGuiItem::no(), const TQString &dontShowAskAgainName=TQString(), int options=KMessageBox::Notify, MessageHandler *msgHandler=0) |
Protected Attributes | |
| SQLiteConnectionInternal * | d |
Protected Attributes inherited from KexiDB::Connection | |
| TQPtrDict< KexiDB::Cursor > | m_cursors |
Protected Attributes inherited from KexiDB::Object | |
| TQString | m_sql |
| TQString | m_errorSql |
| int | m_serverResult |
| TQString | m_serverResultName |
| TQString | m_serverErrorMsg |
| TQString | m_errMsg |
Friends | |
| class | SQLiteDriver |
| class | SQLiteCursor |
Additional Inherited Members | |
Static Public Member Functions inherited from KexiDB::Connection | |
| static const TQStringList & | kexiDBSystemTableNames () |
Public Attributes inherited from KexiDB::Connection | |
| H_INS_REC_ALL | |
Detailed Description
sqlite-specific connection
Definition at line 37 of file sqlite/sqliteconnection.h.
Constructor & Destructor Documentation
◆ ~SQLiteConnection()
|
virtual |
Definition at line 93 of file sqlite/sqliteconnection.cpp.
◆ SQLiteConnection()
|
protected |
Used by driver
Definition at line 87 of file sqlite/sqliteconnection.cpp.
Member Function Documentation
◆ changeFieldType()
|
protected |
From http://sqlite.org/datatype3.html : Version 3 enhances provides the ability to store integer and real numbers in a more compact format and the capability to store BLOB data.
Each value stored in an SQLite database (or manipulated by the database engine) has one of the following storage classes: NULL. The value is a NULL value. INTEGER. The value is a signed integer, stored in 1, 2, 3, 4, 6, or 8 bytes depending on the magnitude of the value. REAL. The value is a floating point value, stored as an 8-byte IEEE floating point number. TEXT. The value is a text string, stored using the database encoding (UTF-8, UTF-16BE or UTF-16-LE). BLOB. The value is a blob of data, stored exactly as it was input.
Column Affinity In SQLite version 3, the type of a value is associated with the value itself, not with the column or variable in which the value is stored. .The type affinity of a column is the recommended type for data stored in that column.
See alter_table_type_conversions.ods for details.
Definition at line 102 of file sqlite/sqlitealter.cpp.
◆ drv_changeFieldProperty()
|
protectedvirtual |
This is a part of alter table interface implementing lower-level operations used to perform table schema altering. Used by AlterTableHandler.
Changes value of field property.
- Returns
- true on success, false on failure, cancelled if the action has been cancelled.
Note for driver developers: implement this if the driver has to support the altering.
- Todo:
- msg
Reimplemented from KexiDB::Connection.
Definition at line 62 of file sqlite/sqlitealter.cpp.
◆ drv_clearServerResult()
|
protectedvirtual |
Clears number of last server operation's result stored as a single integer. Formally, this integer should be set to value that means "NO ERRORS" or "OK". This method is called by clearError(). For reimplementation. By default does nothing.
- See also
- serverErrorMsg()
Reimplemented from KexiDB::Object.
Definition at line 334 of file sqlite/sqliteconnection.cpp.
◆ drv_closeDatabase()
|
protectedvirtual |
For reimplemenation: closes previously opened database using connection.
Implements KexiDB::Connection.
Definition at line 235 of file sqlite/sqliteconnection.cpp.
◆ drv_connect()
|
protectedvirtual |
For reimplemenation: connects to database. version should be set to real server's version.
- Returns
- true on success.
Implements KexiDB::Connection.
Definition at line 103 of file sqlite/sqliteconnection.cpp.
◆ drv_containsTable()
|
protectedvirtual |
- Todo:
- move this somewhere to low level class (MIGRATION?)
LOW LEVEL METHOD. For reimplemenation: returns true if table with name tableName exists in the database.
- Returns
- false if it does not exist or error occurred. The lookup is case insensitive.
Implements KexiDB::Connection.
Definition at line 129 of file sqlite/sqliteconnection.cpp.
◆ drv_createDatabase()
|
protectedvirtual |
Creates new database using connection. Note: Do not pass dbName arg because for file-based engine (that has one database per connection) it is defined during connection.
Implements KexiDB::Connection.
Definition at line 157 of file sqlite/sqliteconnection.cpp.
◆ drv_disconnect()
|
protectedvirtual |
For reimplemenation: disconnects database
- Returns
- true on success.
Implements KexiDB::Connection.
Definition at line 116 of file sqlite/sqliteconnection.cpp.
◆ drv_dropDatabase()
|
protectedvirtual |
Drops database from the server using connection. After drop, database shouldn't be accessible anymore, so database file is just removed. See note from drv_useDatabase().
Implements KexiDB::Connection.
Definition at line 261 of file sqlite/sqliteconnection.cpp.
◆ drv_executeSQL()
|
protectedvirtual |
Executes query statement, but without returning resulting rows (used mostly for functional queries). Only use this method if you really need.
Implements KexiDB::Connection.
Definition at line 285 of file sqlite/sqliteconnection.cpp.
◆ drv_getDatabasesList()
|
protectedvirtual |
For reimplemenation: loads list of databases' names available for this connection and adds these names to list. If your server is not able to offer such a list, consider reimplementing drv_databaseExists() instead. The method should return true only if there was no error on getting database names list from the server. Default implementation puts empty list into list and returns true.
Reimplemented from KexiDB::Connection.
Definition at line 122 of file sqlite/sqliteconnection.cpp.
◆ drv_getTablesList()
|
protectedvirtual |
- Todo:
- move this somewhere to low level class (MIGRATION?)
LOW LEVEL METHOD. For reimplemenation: loads low-level list of table names available for this connection. The names are in lower case. The method should return true only if there was no error on getting database names list from the server.
Implements KexiDB::Connection.
Definition at line 136 of file sqlite/sqliteconnection.cpp.
◆ drv_lastInsertRowID()
|
protectedvirtual |
Executes query statement and returns resulting rows (used mostly for SELECT query). */ virtual bool drv_executeQuery( const TQString& statement ) = 0;
/*! \return unique identifier of last inserted row.
Typically this is just primary key value.
This identifier could be reused when we want to reference
just inserted row.
Note for driver developers: contact js (at) iidea.pl
if your engine do not offers this information.
Implements KexiDB::Connection.
Definition at line 313 of file sqlite/sqliteconnection.cpp.
◆ drv_useDatabase()
|
protectedvirtual |
Opens existing database using connection. Do not pass dbName arg because for file-based engine (that has one database per connection) it is defined during connection. If you pass it, database file name will be changed.
- Todo:
- add option (command line or in kexirc?)
- Todo:
- add option
Implements KexiDB::Connection.
Definition at line 169 of file sqlite/sqliteconnection.cpp.
◆ isReadOnly()
|
virtual |
Reimplemented to provide real read-only flag of the connection
Reimplemented from KexiDB::Connection.
Definition at line 359 of file sqlite/sqliteconnection.cpp.
◆ prepareQuery() [1/2]
|
virtual |
driver-specific string escaping
Prepares SELECT query described by raw statement.
- Returns
- opened cursor created for results of this query or NULL if there was any error. Cursor can have optionally applied cursor_options (one of more selected from KexiDB::Cursor::Options). Preparation means that returned cursor is created but not opened. Open this when you would like to do it with Cursor::open().
Note for driver developers: you should initialize cursor engine-specific resources and return Cursor subclass' object (passing statement and cursor_options to it's constructor).
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Prepares query described by query schema. params are values of parameters that will be inserted into places marked with [] before execution of the query.
Note for driver developers: you should initialize cursor engine-specific resources and return Cursor subclass' object (passing query and cursor_options to it's constructor). Kexi SQL and driver-specific escaping is performed on table names.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Statement is build from data provided by table schema, it is like "select * from table_name".
Implements KexiDB::Connection.
Definition at line 275 of file sqlite/sqliteconnection.cpp.
◆ prepareQuery() [2/2]
|
virtual |
Implements KexiDB::Connection.
Definition at line 280 of file sqlite/sqliteconnection.cpp.
◆ prepareStatement()
|
virtual |
Prepare a SQL statement and return a PreparedStatement instance.
Implements KexiDB::Connection.
Definition at line 351 of file sqlite/sqliteconnection.cpp.
◆ serverErrorMsg()
|
protectedvirtual |
KexiDB library offers detailed error numbers using errorNum() and detailed error i18n'd messages using errorMsg() - this information is not engine-dependent (almost). Use this in your application to give users more information on what's up.
This method returns (non-i18n'd !) engine-specific error message, if there was any error during last server-side operation, otherwise null string. Reimplement this for your driver
- default implementation just returns null string.
- See also
- serverErrorMsg()
Reimplemented from KexiDB::Object.
Definition at line 346 of file sqlite/sqliteconnection.cpp.
◆ serverResult()
|
protectedvirtual |
- Returns
- engine-specific last server-side operation result number. Use this in your application to give users more information on what's up.
Reimplement this for your driver - default implementation just returns 0. Note that this result value is not the same as the one returned by errorNum() (Object::m_errno member)
- See also
- serverErrorMsg(), drv_clearServerResult()
Reimplemented from KexiDB::Object.
Definition at line 318 of file sqlite/sqliteconnection.cpp.
◆ serverResultName()
|
protectedvirtual |
- Returns
- engine-specific last server-side operation result name, (name for serverResult()). Use this in your application to give users more information on what's up.
Reimplement this for your driver - default implementation just returns null string. Note that this result name is not the same as the error message returned by serverErorMsg() or erorMsg()
- See also
- serverErrorMsg(), drv_clearServerResult()
Reimplemented from KexiDB::Object.
Definition at line 323 of file sqlite/sqliteconnection.cpp.
Friends And Related Symbol Documentation
◆ SQLiteCursor
|
friend |
Definition at line 121 of file sqlite/sqliteconnection.h.
◆ SQLiteDriver
|
friend |
Definition at line 120 of file sqlite/sqliteconnection.h.
Member Data Documentation
◆ d
|
protected |
Definition at line 118 of file sqlite/sqliteconnection.h.
The documentation for this class was generated from the following files:

Public Member Functions inherited from