#include <mysqlconnection.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 | |
| MySqlConnection (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_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 bool | drv_getTablesList (TQStringList &list) |
| virtual bool | drv_containsTable (const TQString &tableName) |
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) |
| 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 | |
| MySqlConnectionInternal * | 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 | MySqlDriver |
| class | MySqlCursor |
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
Should override kexiDB/kexiDB all other members are done by the base class.
Definition at line 40 of file mysqlconnection.h.
Constructor & Destructor Documentation
◆ ~MySqlConnection()
|
virtual |
Definition at line 49 of file mysqlconnection.cpp.
◆ MySqlConnection()
|
protected |
Used by driver
Definition at line 43 of file mysqlconnection.cpp.
Member Function Documentation
◆ 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 162 of file mysqlconnection.cpp.
◆ drv_closeDatabase()
|
protectedvirtual |
For reimplemenation: closes previously opened database using connection.
Implements KexiDB::Connection.
Definition at line 131 of file mysqlconnection.cpp.
◆ drv_connect()
|
protectedvirtual |
For reimplemenation: connects to database. version should be set to real server's version.
- Returns
- true on success.
- Todo:
- this is hardcoded for now; define api for retrieving variables and use this API...
addLimitTo1
Implements KexiDB::Connection.
Definition at line 53 of file mysqlconnection.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 174 of file mysqlconnection.cpp.
◆ drv_createDatabase()
|
protectedvirtual |
For reimplemenation: creates new database using connection
Implements KexiDB::Connection.
Definition at line 114 of file mysqlconnection.cpp.
◆ drv_disconnect()
|
protectedvirtual |
For reimplemenation: disconnects database
- Returns
- true on success.
Implements KexiDB::Connection.
Definition at line 83 of file mysqlconnection.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 137 of file mysqlconnection.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 142 of file mysqlconnection.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 95 of file mysqlconnection.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 181 of file mysqlconnection.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 146 of file mysqlconnection.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.
Implements KexiDB::Connection.
Definition at line 123 of file mysqlconnection.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 87 of file mysqlconnection.cpp.
◆ prepareQuery() [2/2]
|
virtual |
Implements KexiDB::Connection.
Definition at line 91 of file mysqlconnection.cpp.
◆ prepareStatement()
|
virtual |
Prepare a SQL statement and return a PreparedStatement instance.
Implements KexiDB::Connection.
Definition at line 202 of file mysqlconnection.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 169 of file mysqlconnection.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 152 of file mysqlconnection.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 157 of file mysqlconnection.cpp.
Friends And Related Symbol Documentation
◆ MySqlCursor
|
friend |
Definition at line 83 of file mysqlconnection.h.
◆ MySqlDriver
|
friend |
Definition at line 82 of file mysqlconnection.h.
Member Data Documentation
◆ d
|
protected |
Definition at line 80 of file mysqlconnection.h.
The documentation for this class was generated from the following files:

Public Member Functions inherited from