#include <pqxxconnection.h>
Public Member Functions | |
| virtual Cursor * | prepareQuery (const TQString &statement=TQString(), uint cursor_options=0) |
| virtual Cursor * | prepareQuery (QuerySchema &query, uint cursor_options=0) |
| virtual PreparedStatement::Ptr | prepareStatement (PreparedStatement::StatementType type, FieldList &fields) |
| Public Member Functions inherited from KexiDB::Connection | |
| 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 () |
| 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 | |
| pqxxSqlConnection (Driver *driver, ConnectionData &conn_data) | |
| virtual bool | drv_isDatabaseUsed () const |
| virtual bool | drv_connect (KexiDB::ServerVersionInfo &version) |
| virtual bool | drv_disconnect () |
| virtual bool | drv_getDatabasesList (TQStringList &list) |
| 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 bool | drv_getTablesList (TQStringList &list) |
| virtual bool | drv_containsTable (const TQString &tableName) |
| virtual TransactionData * | drv_beginTransaction () |
| virtual bool | drv_commitTransaction (TransactionData *) |
| virtual bool | drv_rollbackTransaction (TransactionData *) |
| virtual int | serverResult () |
| virtual TQString | serverResultName () |
| virtual void | drv_clearServerResult () |
| virtual TQString | serverErrorMsg () |
| 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) |
| TQString | createTableStatement (const TableSchema &tableSchema) const |
| TQString | selectStatement (TableSchema &tableSchema, const SelectStatementOptions &options=SelectStatementOptions()) const |
| virtual bool | drv_createTable (const TQString &tableSchemaName) |
| 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) |
| virtual tristate | drv_changeFieldProperty (TableSchema &table, Field &field, const TQString &propertyName, const TQVariant &value) |
| 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 | |
| pqxxSqlConnectionInternal * | 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 | pqxxSqlDriver |
| class | pqxxSqlCursor |
| class | pqxxTransactionData |
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
Definition at line 48 of file pqxxconnection.h.
Constructor & Destructor Documentation
◆ ~pqxxSqlConnection()
|
virtual |
Definition at line 64 of file pqxxconnection.cpp.
◆ pqxxSqlConnection()
|
protected |
Definition at line 55 of file pqxxconnection.cpp.
Member Function Documentation
◆ drv_beginTransaction()
|
protectedvirtual |
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 occurred. Do not check anything in connection (isConnected(), etc.) - all is already done.
Reimplemented from KexiDB::Connection.
Definition at line 388 of file pqxxconnection.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 447 of file pqxxconnection.cpp.
◆ drv_closeDatabase()
|
protectedvirtual |
For reimplemenation: closes previously opened database using connection.
Implements KexiDB::Connection.
Definition at line 227 of file pqxxconnection.cpp.
◆ drv_commitTransaction()
|
protectedvirtual |
Note for driver developers: begins new transaction and returns handle to it. Default implementation just executes "COMMIT" sql statement and returns true on success.
- See also
- drv_beginTransaction()
Reimplemented from KexiDB::Connection.
Definition at line 393 of file pqxxconnection.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 97 of file pqxxconnection.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 359 of file pqxxconnection.cpp.
◆ drv_createDatabase()
|
protectedvirtual |
For reimplemenation: creates new database using connection
Implements KexiDB::Connection.
Definition at line 141 of file pqxxconnection.cpp.
◆ drv_disconnect()
|
protectedvirtual |
For reimplemenation: disconnects database
- Returns
- true on success.
Implements KexiDB::Connection.
Definition at line 111 of file pqxxconnection.cpp.
◆ drv_dropDatabase()
|
protectedvirtual |
For reimplemenation: drops database from the server using connection. After drop, database shouldn't be accessible anymore.
Implements KexiDB::Connection.
Definition at line 246 of file pqxxconnection.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 259 of file pqxxconnection.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 119 of file pqxxconnection.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 366 of file pqxxconnection.cpp.
◆ drv_isDatabaseUsed()
|
protectedvirtual |
- Returns
- true if internal driver's structure is still in opened/connected state and database is used. Note for driver developers: Put here every test that you can do using your internal engine's database API, eg (a bit schematic): my_connection_struct->isConnected()==true. Do not check things like Connection::isDatabaseUsed() here or other things that "KexiDB already knows" at its level. If you cannot test anything, just leave default implementation (that returns true).
Result of this method is used as an addtional chance to check for isDatabaseUsed(). Do not call this method from your driver's code, it should be used at KexiDB level only.
Reimplemented from KexiDB::Connection.
Definition at line 331 of file pqxxconnection.cpp.
◆ drv_lastInsertRowID()
|
protectedvirtual |
Executes query statement and returns resulting rows (used mostly for SELECT query).
- Returns
- 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 342 of file pqxxconnection.cpp.
◆ drv_rollbackTransaction()
|
protectedvirtual |
Note for driver developers: begins new transaction and returns handle to it. Default implementation just executes "ROLLBACK" sql statement and returns true on success.
- See also
- drv_beginTransaction()
Reimplemented from KexiDB::Connection.
Definition at line 415 of file pqxxconnection.cpp.
◆ drv_useDatabase()
|
protectedvirtual |
For reimplemenation: opens existing database using connection
- Returns
- true on success, false on failure and cancelled if user has cancelled this action.
- Todo
- set version using the connection pointer when we drop libpqxx for libpq
Implements KexiDB::Connection.
Definition at line 153 of file pqxxconnection.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 73 of file pqxxconnection.cpp.
◆ prepareQuery() [2/2]
|
virtual |
Implements KexiDB::Connection.
Definition at line 81 of file pqxxconnection.cpp.
◆ prepareStatement()
|
virtual |
Prepare a SQL statement and return a PreparedStatement instance.
Implements KexiDB::Connection.
Definition at line 457 of file pqxxconnection.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 452 of file pqxxconnection.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 437 of file pqxxconnection.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 442 of file pqxxconnection.cpp.
Friends And Related Symbol Documentation
◆ pqxxSqlCursor
|
friend |
Definition at line 102 of file pqxxconnection.h.
◆ pqxxSqlDriver
|
friend |
Definition at line 101 of file pqxxconnection.h.
◆ pqxxTransactionData
|
friend |
Definition at line 103 of file pqxxconnection.h.
Member Data Documentation
◆ d
|
protected |
Definition at line 91 of file pqxxconnection.h.
The documentation for this class was generated from the following files:
