kexi
KexiDB::pqxxSqlConnection Class Reference
#include <pqxxconnection.h>

Detailed Description
Definition at line 48 of file pqxxconnection.h.
Public Member Functions | |
virtual Cursor * | prepareQuery (const QString &statement=QString::null, uint cursor_options=0) |
virtual Cursor * | prepareQuery (QuerySchema &query, uint cursor_options=0) |
virtual PreparedStatement::Ptr | prepareStatement (PreparedStatement::StatementType type, FieldList &fields) |
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 (QStringList &list) |
virtual bool | drv_createDatabase (const QString &dbName=QString::null) |
virtual bool | drv_useDatabase (const QString &dbName=QString::null, bool *cancelled=0, MessageHandler *msgHandler=0) |
virtual bool | drv_closeDatabase () |
virtual bool | drv_dropDatabase (const QString &dbName=QString::null) |
virtual bool | drv_executeSQL (const QString &statement) |
virtual Q_ULLONG | drv_lastInsertRowID () |
virtual bool | drv_getTablesList (QStringList &list) |
virtual bool | drv_containsTable (const QString &tableName) |
virtual TransactionData * | drv_beginTransaction () |
virtual bool | drv_commitTransaction (TransactionData *) |
virtual bool | drv_rollbackTransaction (TransactionData *) |
virtual int | serverResult () |
virtual QString | serverResultName () |
virtual void | drv_clearServerResult () |
virtual QString | serverErrorMsg () |
Protected Attributes | |
pqxxSqlConnectionInternal * | d |
Friends | |
class | pqxxSqlDriver |
class | pqxxSqlCursor |
class | pqxxTransactionData |
Member Function Documentation
Cursor * pqxxSqlConnection::prepareQuery | ( | const QString & | statement = QString::null , |
|
uint | cursor_options = 0 | |||
) | [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().
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.
PreparedStatement::Ptr pqxxSqlConnection::prepareStatement | ( | PreparedStatement::StatementType | type, | |
FieldList & | fields | |||
) | [virtual] |
Prepare a SQL statement and return a PreparedStatement instance.
Implements KexiDB::Connection.
Definition at line 443 of file pqxxconnection.cpp.
bool pqxxSqlConnection::drv_isDatabaseUsed | ( | ) | const [protected, virtual] |
- 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).
Reimplemented from KexiDB::Connection.
Definition at line 315 of file pqxxconnection.cpp.
bool pqxxSqlConnection::drv_connect | ( | KexiDB::ServerVersionInfo & | version | ) | [protected, virtual] |
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.
bool pqxxSqlConnection::drv_disconnect | ( | ) | [protected, virtual] |
For reimplemenation: disconnects database
- Returns:
- true on success.
Implements KexiDB::Connection.
Definition at line 111 of file pqxxconnection.cpp.
bool pqxxSqlConnection::drv_getDatabasesList | ( | QStringList & | list | ) | [protected, virtual] |
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.
bool pqxxSqlConnection::drv_createDatabase | ( | const QString & | dbName = QString::null |
) | [protected, virtual] |
For reimplemenation: creates new database using connection
Implements KexiDB::Connection.
Definition at line 141 of file pqxxconnection.cpp.
bool pqxxSqlConnection::drv_useDatabase | ( | const QString & | dbName = QString::null , |
|
bool * | cancelled = 0 , |
|||
MessageHandler * | msgHandler = 0 | |||
) | [protected, virtual] |
For reimplemenation: opens existing database using connection
- Returns:
- true on success, false on failure and cancelled if user has cancelled this action.
Implements KexiDB::Connection.
Definition at line 153 of file pqxxconnection.cpp.
bool pqxxSqlConnection::drv_closeDatabase | ( | ) | [protected, virtual] |
For reimplemenation: closes previously opened database using connection.
Implements KexiDB::Connection.
Definition at line 228 of file pqxxconnection.cpp.
bool pqxxSqlConnection::drv_dropDatabase | ( | const QString & | dbName = QString::null |
) | [protected, virtual] |
For reimplemenation: drops database from the server using connection. After drop, database shouldn't be accessible anymore.
Implements KexiDB::Connection.
Definition at line 247 of file pqxxconnection.cpp.
bool pqxxSqlConnection::drv_executeSQL | ( | const QString & | statement | ) | [protected, virtual] |
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 260 of file pqxxconnection.cpp.
Q_ULLONG pqxxSqlConnection::drv_lastInsertRowID | ( | ) | [protected, virtual] |
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 326 of file pqxxconnection.cpp.
bool pqxxSqlConnection::drv_getTablesList | ( | QStringList & | list | ) | [protected, virtual] |
- Todo:
- move this somewhere to low level class (MIGRATION?)
Implements KexiDB::Connection.
Definition at line 352 of file pqxxconnection.cpp.
bool pqxxSqlConnection::drv_containsTable | ( | const QString & | tableName | ) | [protected, virtual] |
- Todo:
- move this somewhere to low level class (MIGRATION?)
- Returns:
- false if it does not exist or error occurred. The lookup is case insensitive.
Implements KexiDB::Connection.
Definition at line 345 of file pqxxconnection.cpp.
TransactionData * pqxxSqlConnection::drv_beginTransaction | ( | ) | [protected, virtual] |
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 374 of file pqxxconnection.cpp.
bool pqxxSqlConnection::drv_commitTransaction | ( | TransactionData * | trans | ) | [protected, virtual] |
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 379 of file pqxxconnection.cpp.
bool pqxxSqlConnection::drv_rollbackTransaction | ( | TransactionData * | trans | ) | [protected, virtual] |
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 401 of file pqxxconnection.cpp.
int pqxxSqlConnection::serverResult | ( | ) | [protected, virtual] |
- Returns:
- engine-specific last server-side operation result number. Use this in your application to give users more information on what's up.
- See also:
- serverErrorMsg(), drv_clearServerResult()
Reimplemented from KexiDB::Object.
Definition at line 423 of file pqxxconnection.cpp.
QString pqxxSqlConnection::serverResultName | ( | ) | [protected, virtual] |
- 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.
- See also:
- serverErrorMsg(), drv_clearServerResult()
Reimplemented from KexiDB::Object.
Definition at line 428 of file pqxxconnection.cpp.
void pqxxSqlConnection::drv_clearServerResult | ( | ) | [protected, virtual] |
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 433 of file pqxxconnection.cpp.
QString pqxxSqlConnection::serverErrorMsg | ( | ) | [protected, virtual] |
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 438 of file pqxxconnection.cpp.
Member Data Documentation
pqxxSqlConnectionInternal* KexiDB::pqxxSqlConnection::d [protected] |
for future extensions
Reimplemented from KexiDB::Connection.
Definition at line 90 of file pqxxconnection.h.
The documentation for this class was generated from the following files: