#include <Pt/Db/IConnection.h>
Database connection backend. More...
Inherited by IStmtCacheConnection.
Public Member Functions | |
| void | setActive (Pt::System::EventLoop *loop) |
| Attaches loop for asynchronous operations, or 0 to detach. | |
| bool | ping () |
| Returns true if the backend still answers. | |
| void | beginPing () |
| Starts an asynchronous ping. | |
| bool | endPing () |
| Completes an asynchronous ping. | |
| Pt::Signal & | pingFinished () |
| Signal emitted when an asynchronous ping completes. | |
| long long | lastInsertId (const std::string &name) |
| Returns the last generated row id. | |
| bool | isIdle () const |
| Returns true if no asynchronous operation is pending. | |
| bool | hasTransaction () const |
| Returns true if a transaction is active. | |
| void | open (const std::string &connStr) |
| Opens the database with connStr. | |
| void | close () |
| Closes the database and cancels any pending operation. | |
| void | beginClose () |
| Starts an asynchronous close. | |
| void | endClose () |
| Completes an asynchronous close. | |
| Pt::Signal & | closeFinished () |
| Signal emitted when an asynchronous close completes. | |
| bool | isOpen () const |
| Returns true if the database is open. | |
| void | beginOpen (const std::string &connStr) |
| Starts an asynchronous open with connStr. | |
| void | endOpen () |
| Completes an asynchronous open. | |
| Pt::Signal & | openFinished () |
| Signal emitted when an asynchronous open completes. | |
| void | startTransaction (const char *sql=nullptr) |
| Begins a transaction with optional sql. | |
| void | commitTransaction (const char *sql=nullptr) |
| Commits the active transaction with optional sql. | |
| void | rollbackTransaction (const char *sql=nullptr) |
| Rolls back the active transaction with optional sql. | |
| void | beginStartTransaction (Transaction &txn, const char *sql) |
| Starts an asynchronous begin-transaction. | |
| void | endStartTransaction () |
| Completes an asynchronous begin-transaction. | |
| void | beginCommitTransaction (Transaction &txn, const char *sql) |
| Starts an asynchronous commit. | |
| void | endCommitTransaction () |
| Completes an asynchronous commit. | |
| void | beginRollbackTransaction (Transaction &txn, const char *sql) |
| Starts an asynchronous rollback. | |
| void | endRollbackTransaction () |
| Completes an asynchronous rollback. | |
| size_type | execute (const std::string &query) |
| Executes query and returns the number of rows changed. | |
| void | beginExecute (const std::string &sql) |
| Starts asynchronous execution of sql. | |
| size_type | endExecute () |
| Completes asynchronous execution. | |
| Pt::Signal & | executeFinished () |
| Signal emitted when asynchronous execution completes. | |
| size_type | execute (IStatement &stmt) |
| Executes stmt and returns the number of rows changed. | |
| void | beginExecute (IStatement &stmt) |
| Starts asynchronous execution of stmt. | |
| size_type | endExecute (IStatement &stmt) |
| Completes asynchronous execution of stmt. | |
| Statement | prepare (const std::string &query) |
| Compiles query into a prepared statement. | |
| virtual Statement | prepareCached (const std::string &query)=0 |
| Compiles query and caches the prepared statement. | |
| virtual void | clearStatementCache ()=0 |
| Clears the prepared-statement cache. | |
| virtual void | beginPrepareCached (const std::string &query)=0 |
| Starts asynchronous prepare with cache lookup. | |
| virtual Statement | endPrepareCached ()=0 |
| Completes asynchronous prepareCached. | |
| Pt::Signal & | prepareCachedFinished () |
| Signal emitted when asynchronous prepareCached completes. | |
| void | beginPrepare (const std::string &query) |
| Starts asynchronous compile of query. | |
| Statement | endPrepare () |
| Completes asynchronous compile. | |
| Pt::Signal & | prepareFinished () |
| Signal emitted when asynchronous prepare completes. | |
| Result | select (const std::string &query) |
| Executes query and returns a buffered result. | |
| void | beginSelect (const std::string &sql) |
| Starts an asynchronous select of sql. | |
| Result | endSelect () |
| Completes an asynchronous select. | |
| Pt::Signal & | selectFinished () |
| Signal emitted when an asynchronous select completes. | |
| Result | select (IStatement &stmt) |
| Executes stmt and returns a buffered result. | |
| Row | selectRow (IStatement &stmt) |
| Executes stmt and returns the first row. | |
| Value | selectValue (IStatement &stmt) |
| Executes stmt and returns the first column of the first row. | |
| void | beginSelect (IStatement &stmt) |
| Starts an asynchronous select of stmt. | |
| Result | endSelect (IStatement &stmt) |
| Completes an asynchronous select of stmt. | |
| Cursor | getCursor (IStatement &stmt, size_type batchSize) |
| Opens a batch cursor on stmt. | |
| Result | fetchBatch (ICursor &cursor, size_type batchSize) |
| Fetches the next batch from cursor. | |
| void | beginBatchFetch (ICursor &cursor, size_type batchSize) |
| Starts an asynchronous batch fetch from cursor. | |
| Result | endBatchFetch (ICursor &cursor) |
| Completes an asynchronous batch fetch from cursor. | |
| void | cancelCursor (ICursor &cursor) |
| Cancels a pending fetch on cursor. | |
| void | cancelStatement (IStatement &stmt) |
| Cancels a pending operation on stmt. | |
Public non-virtual methods own open state and the pending operation, and call the protected onXxx() hooks a backend overrides.
| bool endPing | ( | ) |
| long long lastInsertId | ( | const std::string & | name | ) |
Pass a sequence name on backends that use named sequences, or an empty string otherwise.