kexi
KexiDB::Connection Class Reference
#include <connection.h>
Inheritance diagram for KexiDB::Connection:

Detailed Description
Provides database connection, allowing queries and data modification.This class represents a database connection established within a data source. It supports data queries and modification by creating client-side database cursors. Database transactions are supported.
Definition at line 59 of file connection.h.
Public Member Functions | |
virtual | ~Connection () |
ConnectionData * | data () const |
Driver * | driver () const |
bool | connect () |
bool | isConnected () const |
bool | isDatabaseUsed () const |
virtual bool | isReadOnly () const |
virtual void | clearError () |
bool | disconnect () |
QStringList | databaseNames (bool also_system_db=false) |
bool | databaseExists (const QString &dbName, bool ignoreErrors=true) |
bool | createDatabase (const QString &dbName) |
bool | useDatabase (const QString &dbName, bool kexiCompatible=true, bool *cancelled=0, MessageHandler *msgHandler=0) |
bool | closeDatabase () |
QString | currentDatabase () |
bool | dropDatabase (const QString &dbName=QString::null) |
QStringList | objectNames (int objType=KexiDB::AnyObjectType, bool *ok=0) |
QStringList | tableNames (bool also_system_tables=false) |
int | versionMajor () const |
int | versionMinor () const |
DatabaseProperties & | databaseProperties () |
QValueList< int > | tableIds () |
QValueList< int > | queryIds () |
QValueList< 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 QValueList< Transaction > & | transactions () |
bool | autoCommit () const |
bool | setAutoCommit (bool on) |
virtual Cursor * | prepareQuery (const QString &statement, uint cursor_options=0)=0 |
virtual Cursor * | prepareQuery (QuerySchema &query, uint cursor_options=0)=0 |
Cursor * | prepareQuery (TableSchema &table, uint cursor_options=0) |
Cursor * | executeQuery (const QString &statement, 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 QString &tableName) |
QuerySchema * | querySchema (int queryId) |
QuerySchema * | querySchema (const QString &queryName) |
bool | setQuerySchemaObsolete (const QString &queryName) |
tristate | querySingleRecord (const QString &sql, RowData &data) |
tristate | querySingleRecord (QuerySchema &query, RowData &data) |
tristate | querySingleString (const QString &sql, QString &value, uint column=0) |
tristate | querySingleNumber (const QString &sql, int &number, uint column=0) |
bool | queryStringList (const QString &sql, QStringList &list, uint column=0) |
bool | resultExists (const QString &sql, bool &success) |
bool | isEmpty (TableSchema &table, bool &success) |
int | resultCount (const QString &sql) |
bool | insertRecord (TableSchema &tableSchema, QValueList< QVariant > &values) |
bool | insertRecord (FieldList &fields, QValueList< QVariant > &values) |
bool | createTable (TableSchema *tableSchema, bool replaceExisting=false) |
tristate | dropTable (TableSchema *tableSchema) |
tristate | dropTable (const QString &table) |
tristate | alterTable (TableSchema &tableSchema, TableSchema &newTableSchema) |
bool | alterTableName (TableSchema &tableSchema, const QString &newName, bool replace=false) |
bool | dropQuery (QuerySchema *querySchema) |
bool | dropQuery (const QString &query) |
bool | removeObject (uint objId) |
Field * | findSystemFieldName (FieldList *fieldlist) |
virtual QString | anyAvailableDatabaseName () |
void | setAvailableDatabaseName (const QString &dbName) |
bool | useTemporaryDatabaseIfNeeded (QString &tmpdbName) |
Q_ULLONG | lastInsertedAutoIncValue (const QString &aiFieldName, const QString &tableName, Q_ULLONG *ROWID=0) |
Q_ULLONG | lastInsertedAutoIncValue (const QString &aiFieldName, const TableSchema &table, Q_ULLONG *ROWID=0) |
bool | executeSQL (const QString &statement) |
QString | selectStatement (QuerySchema &querySchema, int idEscaping=Driver::EscapeDriver|Driver::EscapeAsNecessary) const |
bool | storeObjectSchemaData (SchemaData &sdata, bool newObject) |
tristate | loadObjectSchemaData (int objectID, SchemaData &sdata) |
tristate | loadObjectSchemaData (int objectType, const QString &objectName, SchemaData &sdata) |
bool | loadDataBlock (int objectID, QString &dataString, const QString &dataID) |
bool | storeDataBlock (int objectID, const QString &dataString, const QString &dataID=QString::null) |
bool | removeDataBlock (int objectID, const QString &dataID=QString::null) |
void | registerForTableSchemaChanges (TableSchemaChangeListenerInterface &listener, TableSchema &schema) |
void | unregisterForTableSchemaChanges (TableSchemaChangeListenerInterface &listener, TableSchema &schema) |
void | unregisterForTablesSchemaChanges (TableSchemaChangeListenerInterface &listener) |
QPtrList< Connection::TableSchemaChangeListenerInterface > * | tableSchemaChangeListeners (TableSchema &tableSchema) const |
tristate | closeAllTableSchemaChangeListeners (TableSchema &tableSchema) |
void | removeTableSchemaInternal (KexiDB::TableSchema *tableSchema) |
void | insertInternalTableSchema (TableSchema *tableSchema) |
virtual bool | drv_containsTable (const QString &tableName)=0 |
virtual bool | drv_createTable (const TableSchema &tableSchema) |
virtual PreparedStatement::Ptr | prepareStatement (PreparedStatement::StatementType type, FieldList &fields)=0 |
bool | isInternalTableSchema (const QString &tableName) |
Static Public Member Functions | |
static const QStringList & | kexiDBSystemTableNames () |
Public Attributes | |
H_INS_REC_ALL | |
Protected Member Functions | |
Connection (Driver *driver, ConnectionData &conn_data) | |
void | destroy () |
tristate | dropTable (KexiDB::TableSchema *tableSchema, bool alsoRemoveSchema) |
virtual bool | drv_connect ()=0 |
virtual bool | drv_disconnect ()=0 |
virtual bool | drv_executeSQL (const QString &statement)=0 |
virtual bool | drv_getDatabasesList (QStringList &list) |
virtual bool | drv_getTablesList (QStringList &list)=0 |
virtual bool | drv_databaseExists (const QString &dbName, bool ignoreErrors=true) |
virtual bool | drv_createDatabase (const QString &dbName=QString::null)=0 |
virtual bool | drv_useDatabase (const QString &dbName=QString::null, bool *cancelled=0, MessageHandler *msgHandler=0)=0 |
virtual bool | drv_closeDatabase ()=0 |
virtual bool | drv_isDatabaseUsed () const |
virtual bool | drv_dropDatabase (const QString &dbName=QString::null)=0 |
QString | createTableStatement (const TableSchema &tableSchema) const |
QString | selectStatement (TableSchema &tableSchema) const |
QString | selectStatement (QuerySchema &querySchema, bool alsoRetrieveROWID, int idEscaping=Driver::EscapeDriver|Driver::EscapeAsNecessary) const |
virtual bool | drv_createTable (const QString &tableSchemaName) |
virtual Q_ULLONG | drv_lastInsertRowID ()=0 |
virtual TransactionData * | drv_beginTransaction () |
virtual bool | drv_commitTransaction (TransactionData *trans) |
virtual bool | drv_rollbackTransaction (TransactionData *trans) |
virtual bool | drv_setAutoCommit (bool on) |
virtual bool | drv_dropTable (const QString &name) |
virtual bool | drv_alterTableName (TableSchema &tableSchema, const QString &newName, bool replace=false) |
bool | beginAutoCommitTransaction (TransactionGuard &tg) |
bool | commitAutoCommitTransaction (const Transaction &trans) |
bool | rollbackAutoCommitTransaction (const Transaction &trans) |
bool | checkConnected () |
bool | checkIsDatabaseUsed () |
bool | setupObjectSchemaData (const RowData &data, SchemaData &sdata) |
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 QString &tsname) |
QString | escapeIdentifier (const QString &id, int drvEscaping=Driver::EscapeDriver|Driver::EscapeAsNecessary) const |
void | removeMe (TableSchema *ts) |
bool | checkIfColumnExists (Cursor *cursor, uint column) |
tristate | querySingleRecordInternal (RowData &data, const QString *sql, QuerySchema *query) |
void | setReadOnly (bool set) |
Protected Attributes | |
QGuardedPtr< ConnectionData > | m_data |
QString | m_name |
QString | m_usedDatabase |
QIntDict< TableSchema > | m_tables |
QDict< TableSchema > | m_tables_byname |
QIntDict< QuerySchema > | m_queries |
QDict< QuerySchema > | m_queries_byname |
QPtrDict< TableSchema > | m_kexiDBSystemTables |
QPtrDict< KexiDB::Cursor > | m_cursors |
ConnectionPrivate * | d |
Friends | |
class | KexiDB::Driver |
class | KexiDB::Cursor |
class | KexiDB::TableSchema |
class | KexiDB::DatabaseProperties |
class | ConnectionPrivate |
Classes | |
class | TableSchemaChangeListenerInterface |
Constructor & Destructor Documentation
|
Opened connection is automatically disconnected and removed from driver's connections list. Note for driver developers: you should call destroy() from you Connection's subclass destructor. Definition at line 188 of file connection.cpp. |
|
Used by Driver Definition at line 154 of file connection.cpp. |
Member Function Documentation
|
Definition at line 1471 of file connection.cpp. |
|
Alters table's described tableSchema name to newName. If replace is true, destination table is replaced, if present. If replace is false (the default) and destination table is present -- false is returned and ERR_OBJECT_EXISTS error is set. tableSchema is updated on success.
Definition at line 1497 of file connection.cpp. |
|
Note for driver developers: return here a name of database which you are sure is existing. Default implementation returns:
See decription of DriverBehaviour::ALWAYS_AVAILABLE_DATABASE_NAME member. You may want to reimplement this method only when you need to depend on this connection specifics (e.g. you need to check something remotely). Definition at line 2562 of file connection.cpp. |
|
For drivers that do not support transactions (see Driver::features()) this method shouldn't be called because it does nothing ans always returns false. No internal KexiDB object should changes this option, although auto commit's behaviour depends on database engine's specifics. Engines that support only single transaction per connection (see Driver::SingleTransactions), use this single connection for autocommiting, so if there is already transaction started by the KexiDB user program (with beginTransaction()), this transaction is commited before any sql functional statement execution. In this situation default transaction is also affected (see defaultTransaction()). Only for drivers that support nested transactions (Driver::NestedTransactions), autocommiting works independently from previously started transaction, For other drivers set this option off if you need use transaction for grouping more statements together. NOTE: nested transactions are not yet implemented in KexiDB API. Definition at line 1865 of file connection.cpp. |
|
Internal, for handling autocommited transactions: begins transaction if one is supported.
Definition at line 1662 of file connection.cpp. |
|
Creates new transaction handle and starts a new transaction.
Definition at line 1723 of file connection.cpp. |
|
Helper: checks if connection is established; if not: error message is set up and false returned Definition at line 254 of file connection.cpp. |
|
Helper: checks both if connection is established and database any is used; if not: error message is set up and false returned Definition at line 264 of file connection.cpp. |
|
Reimplemented from Object: also clears sql string.
Reimplemented from KexiDB::Object. Definition at line 228 of file connection.cpp. |
|
Closes currently used database for this connection. Any active transactions (if supported) are rolled back, so commit these before closing, if you'd like to save your changes. Definition at line 582 of file connection.cpp. |
|
Internal, for handling autocommited transactions: Commits transaction prevoiusly started with beginAutoCommitTransaction().
Definition at line 1695 of file connection.cpp. |
|
Commits transaction trans. If there is not trans argument passed, and there is default transaction (obtained from defaultTransaction()) defined, this one will be commited. If default is not present, false is returned (when ignore_inactive is false, the default), or true is returned (when ignore_inactive is true). On successfull commit, trans object will be destroyed. If this was default transaction, there is no default transaction for now. Definition at line 1761 of file connection.cpp. |
|
Connects to driver with given parameters.
Definition at line 207 of file connection.cpp. |
|
Creates new database with name dbName, using this connection. If database with dbName already exists, or other error occured, false is returned. For file-based drivers, dbName should be equal to the database filename (the same as specified for ConnectionData). See doc/dev/kexidb_issues.txt document, chapter "Table schema, query schema, etc. storage" for database schema documentation (detailed description of kexi__* 'system' tables).
Definition at line 395 of file connection.cpp. |
|
Creates a table according to the given schema. Creates table defined by tableSchema. Schema information is also added into kexi system tables, for later reuse.
Note that on error:
Definition at line 1209 of file connection.cpp. |
|
Definition at line 819 of file connection.cpp. |
|
Get the name of the current database.
Definition at line 154 of file connection.h. |
|
Definition at line 72 of file connection.h. |
|
Definition at line 333 of file connection.cpp. |
|
Definition at line 274 of file connection.cpp. |
|
Definition at line 785 of file connection.cpp. |
|
Definition at line 1841 of file connection.cpp. |
|
Deletes cursor cursor previously created by functions like executeQuery() for this connection. There is an attempt to close the cursor with Cursor::close() if it was opened. Anyway, at last cursor is deleted.
Definition at line 1954 of file connection.cpp. |
|
Definition at line 2809 of file connection.cpp. |
|
Method to be called form Connection's subclass destructor.
Definition at line 181 of file connection.cpp. |
|
Disconnects from driver with given parameters. The database (if used) is closed, and any active transactions (if supported) are rolled back, so commit these before disconnecting, if you'd like to save your changes. Definition at line 234 of file connection.cpp. |
|
Definition at line 75 of file connection.h. |
|
Drops database with name dbName. if dbName is not specified, currently used database name is used (it is closed before dropping). Definition at line 649 of file connection.cpp. |
|
It is a convenience function, does exactly the same as bool dropQuery( KexiDB::QuerySchema* querySchema ) Definition at line 1635 of file connection.cpp. |
|
Drops a query defined by querySchema. If true is returned, schema information querySchema is destoyed (because it's owned), so don't keep this anymore! Definition at line 1601 of file connection.cpp. |
|
Definition at line 1405 of file connection.cpp. |
|
It is a convenience function, does exactly the same as bool dropTable( KexiDB::TableSchema* tableSchema ) Definition at line 1459 of file connection.cpp. |
|
Drops a table corresponding to the name in the given schema. Drops a table defined by tableSchema (both table object as well as physically). If true is returned, schema information tableSchema is destoyed (because it's owned), so don't keep this anymore! No error is raised if the table does not exist physically
Definition at line 1400 of file connection.cpp. |
|
Alters table's described tableSchema name to newName. Default implementation is ineffective:
Definition at line 1524 of file connection.cpp. |
|
Note for driver developers: begins new transaction and returns handle to it. Default implementation just executes "BEGIN" sql statement and returns just empty data (TransactionData object). Drivers that do not support transactions (see Driver::features()) do never call this method. Reimplement this method if you need to do something more (e.g. if you driver will support multiple transactions per connection). Make subclass of TransactionData (declared in transaction.h) and return object of this subclass. You should return NULL if any error occured. Do not check anything in connection (isConnected(), etc.) - all is already done. Reimplemented in KexiDB::pqxxSqlConnection. Definition at line 1880 of file connection.cpp. |
|
For reimplemenation: closes previously opened database using connection. Implemented in KexiDB::MySqlConnection, KexiDB::pqxxSqlConnection, and KexiDB::SQLiteConnection. |
|
Note for driver developers: begins new transaction and returns handle to it. Default implementation just executes "COMMIT" sql statement and returns true on success.
Reimplemented in KexiDB::pqxxSqlConnection. Definition at line 1888 of file connection.cpp. |
|
For reimplemenation: connects to database
Implemented in KexiDB::MySqlConnection, KexiDB::pqxxSqlConnection, and KexiDB::SQLiteConnection. |
|
LOW LEVEL METHOD. For reimplemenation: returns true if table with name tableName exists in the database.
Implemented in KexiDB::MySqlConnection, KexiDB::pqxxSqlConnection, and KexiDB::SQLiteConnection. |
|
For reimplemenation: creates new database using connection Implemented in KexiDB::MySqlConnection, KexiDB::pqxxSqlConnection, and KexiDB::SQLiteConnection. |
|
Creates table named by tableSchemaName. Schema object must be on schema tables' list before calling this method (otherwise false if returned). Just uses drv_createTable( const KexiDB::TableSchema& tableSchema ). Used internally, e.g. in createDatabase().
Definition at line 1654 of file connection.cpp. |
|
Creates table using tableSchema information.
Definition at line 1647 of file connection.cpp. |
|
For optional reimplemenation: asks server if database dbName exists. This method is used internally in databaseExists(). The default implementation calls databaseNames and checks if that list contains dbName. If you need to ask the server specifically if a database exists, eg. if you can't retrieve a list of all available database names, please reimplement this method and do all needed checks. See databaseExists() description for details about ignoreErrors argument. You should use this appropriately in your implementation. Note: This method should also work if there is already database used (with useDatabase()); in this situation no changes should be made in current database selection. Definition at line 317 of file connection.cpp. |
|
For reimplemenation: disconnects database
Implemented in KexiDB::MySqlConnection, KexiDB::pqxxSqlConnection, and KexiDB::SQLiteConnection. |
|
For reimplemenation: drops database from the server using connection. After drop, database shouldn't be accessible anymore. Implemented in KexiDB::MySqlConnection, KexiDB::pqxxSqlConnection, and KexiDB::SQLiteConnection. |
|
Physically drops table named with name. Default impelmentation executes "DROP TABLE.." command, so you rarely want to change this. Definition at line 1387 of file connection.cpp. |
|
Executes query statement, but without returning resulting rows (used mostly for functional queries). Only use this method if you really need. Implemented in KexiDB::MySqlConnection, KexiDB::pqxxSqlConnection, and KexiDB::SQLiteConnection. |
|
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 in KexiDB::MySqlConnection, KexiDB::pqxxSqlConnection, and KexiDB::SQLiteConnection. Definition at line 311 of file connection.cpp. |
|
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. Implemented in KexiDB::MySqlConnection, KexiDB::pqxxSqlConnection, and KexiDB::SQLiteConnection. |
|
Reimplemented in KexiDB::pqxxSqlConnection. Definition at line 840 of file connection.h. |
|
Implemented in KexiDB::MySqlConnection, KexiDB::pqxxSqlConnection, and KexiDB::SQLiteConnection. |
|
Note for driver developers: begins new transaction and returns handle to it. Default implementation just executes "ROLLBACK" sql statement and returns true on success.
Reimplemented in KexiDB::pqxxSqlConnection. Definition at line 1893 of file connection.cpp. |
|
Changes autocommiting option for established connection.
Default implementation does nothing with connection, just returns true.
Definition at line 1898 of file connection.cpp. |
|
For reimplemenation: opens existing database using connection
Implemented in KexiDB::MySqlConnection, KexiDB::pqxxSqlConnection, and KexiDB::SQLiteConnection. |
|
Identifier escaping function in the associated Driver. Calls the identifier escaping function in the associated Driver to escape table and column names. This should be used when explicitly constructing SQL strings (e.g. "FROM " + escapeIdentifier(tablename)). It should not be used for other functions (e.g. don't do useDatabase(escapeIdentifier(database))), because the identifier will be escaped when the called function generates, for example, "USE " + escapeIdentifier(database). For efficiency, kexi__* system tables and columns therein are not escaped
Definition at line 1054 of file connection.h. |
|
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". Definition at line 1903 of file connection.cpp. |
|
Executes query statement, but without returning resulting rows (used mostly for functional queries). Only use this method if you really need. Definition at line 1001 of file connection.cpp. |
|
Definition at line 1157 of file connection.cpp. |
|
Definition at line 2666 of file connection.cpp. |
|
Definition at line 249 of file connection.cpp. |
|
Definition at line 223 of file connection.cpp. |
|
Definition at line 2210 of file connection.cpp. |
|
Reimplemented in KexiDB::SQLiteConnection. Definition at line 2968 of file connection.cpp. |
|
Definition at line 759 of file connection.cpp. |
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Definition at line 1168 of file connection.cpp. |
|
Loads (potentially large) data block (e.g. xml form's representation), referenced by objectID and puts it to dataString. The can be block indexed with optional dataID.
Definition at line 2332 of file connection.cpp. |
|
Finds object schema data for object of type objectType and name objectName. If the object is found, resulted schema is stored in sdata and true is returned, otherwise false is returned. Definition at line 2008 of file connection.cpp. |
|
Added for convenience.
Definition at line 1998 of file connection.cpp. |
|
used internally by setupKexiDBSystemSchema(): Allocates single table KexiDB system object named tsname and adds this to list of such objects (for later removal on closeDatabase()). Definition at line 2450 of file connection.cpp. |
|
Definition at line 795 of file connection.cpp. |
|
Definition at line 707 of file connection.cpp. |
|
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". Implemented in KexiDB::MySqlConnection, KexiDB::pqxxSqlConnection, and KexiDB::SQLiteConnection. |
|
Definition at line 790 of file connection.cpp. |
|
Definition at line 2408 of file connection.cpp. |
|
Definition at line 2424 of file connection.cpp. |
|
Convenience function: executes sql query and stores first record's field's (number column) value inside number.
Definition at line 2135 of file connection.cpp. |
|
Like tristate querySingleRecord(const QString& sql, RowData &data) but uses QuerySchema object. Definition at line 2099 of file connection.cpp. |
|
Executes sql query and stores first record's data inside data. This is convenient method when we need only first record from query result, or when we know that query result has only one record. Adds a LIMIT clause to the query, sql should not include one already.
Definition at line 2094 of file connection.cpp. |
|
Definition at line 2072 of file connection.cpp. |
|
Executes sql query and stores first record's field's (number column) string value inside value. For efficiency it's recommended that a query defined by sql should have just one field (SELECT one_field FROM ....). Adds a LIMIT clause to the query, so sql should not include one already.
Definition at line 2113 of file connection.cpp. |
|
Executes sql query and stores first record's first field's string value inside list. The list is initially cleared. For efficiency it's recommended that a query defined by sql should have just one field (SELECT one_field FROM ....).
Definition at line 2146 of file connection.cpp. |
|
Register listener for receiving (listening) informations about changes in TableSchema object. Changes could be: altering and removing. Definition at line 2898 of file connection.cpp. |
|
Removes (potentially large) string data (e.g. xml form's representation), referenced by objectID, and pointed by optional dataID.
Definition at line 2364 of file connection.cpp. |
|
Called by TableSchema -- signals destruction to Connection object To avoid having deleted table object on its list. Definition at line 2553 of file connection.cpp. |
|
Removes information about object with objId from internal "kexi__object" and "kexi__objectdata" tables.
Definition at line 1375 of file connection.cpp. |
|
Definition at line 2215 of file connection.cpp. |
|
Definition at line 2177 of file connection.cpp. |
|
Internal, for handling autocommited transactions: Rollbacks transaction prevoiusly started with beginAutoCommitTransaction().
Definition at line 1708 of file connection.cpp. |
|
Rollbacks transaction trans. If there is not trans argument passed, and there is default transaction (obtained from defaultTransaction()) defined, this one will be rolled back. If default is not present, false is returned (when ignore_inactive is false, the default), or true is returned (when ignore_inactive is true). or any error occured, false is returned. On successfull rollback, trans object will be destroyed. If this was default transaction, there is no default transaction for now. Definition at line 1797 of file connection.cpp. |
|
Like selectStatement( QuerySchema& querySchema, int idEscaping = Driver::EscapeDriver|DriverEscapeAsNecessary ) const but also retrieves ROWID information, if alsoRetrieveROWID is true. Used by cursors. Definition at line 1013 of file connection.cpp. |
|
Definition at line 1152 of file connection.cpp. |
|
Definition at line 646 of file connection.h. |
|
Changes auto commit option. This does not affect currently started transactions. This option can be changed even when connection is not established.
Definition at line 1870 of file connection.cpp. |
|
Sets dbName as name of a database that can be accessible. This is option that e.g. application that make use of KexiDB library can set to tune connection's behaviour when it needs to temporary connect to any database in the server to do some work. You can pass empty dbName - then anyAvailableDatabaseName() will try return DriverBehaviour::ALWAYS_AVAILABLE_DATABASE_NAME (the default) value instead of the one previously set with setAvailableDatabaseName().
Definition at line 2570 of file connection.cpp. |
|
Sets default transaction that will be used as context for operations on data in opened database for this connection. Definition at line 1846 of file connection.cpp. |
|
Sets queryName query obsolete by moving it out of the query sets, so it will not be accessible by querySchema( const QString& queryName ). The existing query object is not destroyed, to avoid problems when it's referenced. In this case, a new query schema will be retrieved directly from the backend. For now it's used in KexiQueryDesignerGuiEditor::storeLayout(). This solves the problem when user has changed a query schema but already form still uses previously instantiated query schema.
Definition at line 2439 of file connection.cpp. |
|
Creates kexi__* tables. Allocates all needed table KexiDB system objects for kexi__* KexiDB liblary's system tables schema. These objects are used internally in this connection and are added to list of tables (by name, not by id because these have no ids). Definition at line 2473 of file connection.cpp. |
|
Setups schema data for object that owns sdata (e.g. table, query) using cursor opened on 'kexi__objects' table, pointing to a record corresponding to given object. Definition at line 1967 of file connection.cpp. |
|
Definition at line 2375 of file connection.cpp. |
|
Definition at line 2223 of file connection.cpp. |
|
Stores (potentially large) data block dataString (e.g. xml form's representation), referenced by objectID. Block will be stored in "kexi__objectdata" table and an optional dataID identifier. If there is already such record in the table, it's simply overwritten.
Definition at line 2342 of file connection.cpp. |
|
Stores object's schema data (id, name, caption, help text) described by sdata on the backend. If newObject is true, new entry is created, and (when sdata.id() was <=0), new, unique object identifier is obtained and assigned to sdata (see SchemaData::id()). If newObject is false, it's expected that entry on the backend already exists, so it's updated (changes to identifier are not allowed).
Definition at line 2018 of file connection.cpp. |
|
|
|
Definition at line 748 of file connection.cpp. |
|
Definition at line 2301 of file connection.cpp. |
|
Definition at line 2317 of file connection.cpp. |
|
Definition at line 1860 of file connection.cpp. |
|
Definition at line 2575 of file connection.cpp. |
|
Opens an existing database specified by dbName. If kexiCompatible is true (the default) initial checks will be performed to recognize database Kexi-specific format. Set kexiCompatible to false if you're using native database (one that have no Kexi System tables). For file-based drivers, dbName should be equal to filename (the same as specified for ConnectionData).
Definition at line 497 of file connection.cpp. |
|
Because some engines need to have opened any database before executing administrative sql statements like "create database" or "drop database", this method is used to use appropriate, existing database for this connection. For file-based db drivers this always return true and does not set tmpdbName to any value. For other db drivers: this sets tmpdbName to db name computed using anyAvailableDatabaseName(), and if the name computed is empty, false is returned; if it is not empty, useDatabase() is called. False is returned also when useDatabase() fails. You can call this method from your application's level if you really want to perform tasks that require any used database. In such a case don't forget to closeDatabase() if returned tmpdbName is not empty. Note: This method has nothing to do with creating or using temporary databases in such meaning that these database are not persistent Definition at line 625 of file connection.cpp. |
|
Version information for this connection. Only valid when database is used. It's usually compared to drivers' and KexiDB library version. Definition at line 775 of file connection.cpp. |
Friends And Related Function Documentation
|
for setError()
Definition at line 1094 of file connection.h. |
|
for removeMe()
Definition at line 1093 of file connection.h. |
Member Data Documentation
|
for future extensions
Reimplemented from KexiDB::Object. Reimplemented in KexiDB::MySqlConnection, KexiDB::pqxxSqlConnection, and KexiDB::SQLiteConnection. Definition at line 1097 of file connection.h. |
|
cursors created for this connection
Definition at line 1089 of file connection.h. |
|
used just for removing system TableSchema objects on db close.
Definition at line 1086 of file connection.h. |
|
Table schemas retrieved on demand with tableSchema().
Definition at line 1080 of file connection.h. |
|
database name that is opened now
Definition at line 1077 of file connection.h. |
The documentation for this class was generated from the following files: