KexiDB::Driver Class Reference
#include <driver.h>
Inheritance diagram for KexiDB::Driver:

Detailed Description
Generic database abstraction.This class is a prototype of the database driver for implementations. Driver allows new connections to be created, and groups these as a parent. Before destruction, all connections are destructed.
Notes:
- driver must be provided within KDE module file named with "kexidb_" prefix
- following line should be placed in driver's implementation: where:
KEXIDB_DRIVER_INFO( CLASS_NAME, INTERNAL_NAME );
- CLASS_NAME is actual driver's class name, e.g. MySqlDriver
- INTERNAL_NAME is driver name's most significant part (without quotation marks), e.g. mysql Above information uses K_EXPORT_COMPONENT_FACTORY macro for KTrader to find the module's entry point. For example, this line declares kexidb_mysqldriver.so module's entry point:
KEXIDB_DRIVER_INFO( MySqlDriver, mysql );
- See also:
- SQLiteDriver MySqlDriver, pqxxSqlDriver
Definition at line 66 of file driver.h.
Public Types | |
| typedef QMap< QString, Info > | InfoMap |
| enum | Features { NoFeatures = 0, SingleTransactions = 1, MultipleTransactions = 2, NestedTransactions = 4, CursorForward = 8, CursorBackward = (CursorForward+16), CompactingDatabaseSupported = 32, IgnoreTransactions = 1024 } |
| enum | CreateConnectionOptions { ReadOnlyConnection = 1 } |
| Options used for createConnection(). More... | |
| enum | EscapeType { EscapeDriver = 0x01, EscapeKexi = 0x02 } |
| enum | EscapePolicy { EscapeAsNecessary = 0x04, EscapeAlways = 0x08 } |
Public Member Functions | |
| virtual | ~Driver () |
| Connection * | createConnection (ConnectionData &conn_data, int options=0) |
| const QPtrList< Connection > | connectionsList () const |
| QString | fileDBDriverMimeType () const |
| const KService * | service () const |
| bool | isFileDriver () const |
| virtual bool | isSystemObjectName (const QString &n) const |
| virtual bool | isSystemDatabaseName (const QString &n) const =0 |
| bool | isSystemFieldName (const QString &n) const |
| int | features () const |
| bool | transactionsSupported () const |
| AdminTools & | adminTools () const |
| virtual QString | sqlTypeName (int id_t, int p=0) const |
| virtual bool | isValid () |
| virtual DatabaseVersionInfo | version () const =0 |
| virtual QString | valueToSQL (uint ftype, const QVariant &v) const |
| QString | valueToSQL (const QString &ftype, const QVariant &v) const |
| Like above but with the fildtype as string. | |
| QString | valueToSQL (const Field *field, const QVariant &v) const |
| Like above method, for field. | |
| virtual QString | dateTimeToSQL (const QDateTime &v) const |
| virtual QString | escapeString (const QString &str) const =0 |
| virtual QCString | escapeString (const QCString &str) const =0 |
| virtual QString | escapeBLOB (const QByteArray &array) const =0 |
| QString | escapeIdentifier (const QString &str, int options=EscapeDriver|EscapeAsNecessary) const |
| Driver-specific identifier escaping (e.g. for a table name, db name, etc.). | |
| QCString | escapeIdentifier (const QCString &str, int options=EscapeDriver|EscapeAsNecessary) const |
| QVariant | propertyValue (const QCString &propName) const |
| QString | propertyCaption (const QCString &propName) const |
| QValueList< QCString > | propertyNames () const |
Static Public Member Functions | |
| static QString | defaultFileBasedDriverMimeType () |
| static QString | defaultFileBasedDriverName () |
| static bool | isKexiDBSystemObjectName (const QString &n) |
| static QString | defaultSQLTypeName (int id_t) |
Protected Member Functions | |
| Driver (QObject *parent, const char *name, const QStringList &args=QStringList()) | |
| virtual Connection * | drv_createConnection (ConnectionData &conn_data)=0 |
| virtual QString | drv_escapeIdentifier (const QString &str) const =0 |
| virtual QCString | drv_escapeIdentifier (const QCString &str) const =0 |
| virtual bool | drv_isSystemFieldName (const QString &n) const =0 |
| virtual AdminTools * | drv_createAdminTools () const |
| Connection * | removeConnection (Connection *conn) |
| void | initSQLKeywords (int hashSize=17) |
Protected Attributes | |
| DriverBehaviour * | beh |
| DriverPrivate * | d |
| for future extensions | |
Friends | |
| class | Connection |
| class | Cursor |
| class | DriverManagerInternal |
Classes | |
| class | Info |
Member Typedef Documentation
|
|
|
Member Enumeration Documentation
|
|
Options used for createConnection().
|
|
|
|
|
|
|
|
|
Features supported by driver (sum of few Features enum items).
|
Constructor & Destructor Documentation
|
|
Definition at line 87 of file driver.cpp. |
|
||||||||||||||||
|
Used by DriverManager. Note for driver developers: Reimplement this. In your reimplementation you should initialize:
You may also want to change options in DriverBehaviour *beh member. See drivers/mySQL/mysqldriver.cpp for usage example. Definition at line 72 of file driver.cpp. |
Member Function Documentation
|
|
Definition at line 158 of file driver.cpp. References KexiDB::DriverPrivate::adminTools, d, and drv_createAdminTools(). Referenced by KexiMainWindowImpl::slotToolsCompactDatabase(). |
|
|
Definition at line 125 of file driver.cpp. References KexiDB::DriverPrivate::connections, and d. |
|
||||||||||||
|
Creates connection using conn_data as parameters.
Definition at line 178 of file driver.cpp. References KexiDB::Object::clearError(), KexiDB::DriverPrivate::connections, d, drv_createConnection(), ERR_MISSING_DB_LOCATION, KexiDB::DriverPrivate::isFileDriver, isValid(), ReadOnlyConnection, KexiDB::Object::setError(), and KexiDB::Connection::setReadOnly(). Referenced by KexiMigration::KexiMigrate::checkIfDestinationDatabaseOverwritingNeedsAccepting(), KexiProject::createConnection(), KexiProjectSet::KexiProjectSet(), and SimpleCommandLineApp::openDatabase(). |
|
|
not compatible with all drivers - reimplement (was compatible with SQLite: http://www.sqlite.org/cvstrac/wiki?p=DateAndTimeFunctions) Now it's ISO 8601 DateTime format - with "T" delimiter: http://www.w3.org/TR/NOTE-datetime (e.g. "1994-11-05T13:15:30" not "1994-11-05 13:15:30")
Definition at line 236 of file driver.h. Referenced by valueToSQL(). |
|
|
Definition at line 137 of file driver.cpp. Referenced by defaultFileBasedDriverName(), KexiConnSelectorWidget::KexiConnSelectorWidget(), KexiNewProjectWizard::KexiNewProjectWizard(), KexiPrjTypeSelector::KexiPrjTypeSelector(), and KexiProjectSelectorWidget::KexiProjectSelectorWidget(). |
|
|
Definition at line 140 of file driver.cpp. References defaultFileBasedDriverMimeType(), and KexiDB::DriverManager::lookupByMime(). Referenced by KexiMainWindowImpl::createBlankProjectData(), KexiStartupHandler::init(), and SimpleCommandLineApp::SimpleCommandLineApp(). |
|
|
|
Reimplemented in KexiDB::SQLiteDriver. Definition at line 165 of file driver.cpp. Referenced by adminTools(). |
|
|
For reimplemenation: creates and returns connection object with additional structures specific for a given driver. Connection object should inherit Connection and have a destructor that descructs all allocated driver-dependent connection structures. Implemented in KexiDB::MySqlDriver, KexiDB::pqxxSqlDriver, and KexiDB::SQLiteDriver. Referenced by createConnection(). |
|
|
This is overloaded version of drv_escapeIdentifier( const QString& str ) to be implemented in the same way. Implemented in KexiDB::MySqlDriver, KexiDB::pqxxSqlDriver, and KexiDB::SQLiteDriver. |
|
|
Driver-specific SQL string escaping. This method is used by escapeIdentifier(). Implement escaping for any character like " or ' as your database engine requires. Do not append or prepend any quotation marks characters - it is automatically done by escapeIdentifier() using DriverBehaviour::QUOTATION_MARKS_FOR_IDENTIFIER. Implemented in KexiDB::MySqlDriver, KexiDB::pqxxSqlDriver, and KexiDB::SQLiteDriver. Referenced by escapeIdentifier(). |
|
|
Implemented in KexiDB::MySqlDriver, KexiDB::pqxxSqlDriver, and KexiDB::SQLiteDriver. Referenced by isSystemFieldName(). |
|
|
Driver-specific SQL BLOB value escaping. Implement escaping for any character like " or ' and \0 as your database engine requires. Prepend and append quotation marks. Implemented in KexiDB::MySqlDriver, KexiDB::pqxxSqlDriver, and KexiDB::SQLiteDriver. Referenced by valueToSQL(). |
|
||||||||||||
|
Definition at line 322 of file driver.cpp. References beh, d, KexiDB::DriverPrivate::driverSQLDict, drv_escapeIdentifier(), EscapeAlways, EscapeDriver, EscapeKexi, KexiDB::DriverPrivate::kexiSQLDict, and KexiDB::DriverBehaviour::QUOTATION_MARKS_FOR_IDENTIFIER. |
|
||||||||||||
|
Driver-specific identifier escaping (e.g. for a table name, db name, etc.). Escape database identifier (str) in order that keywords can be used as table names, column names, etc. options is the union of the EscapeType and EscapePolicy types. If no escaping options are given, defaults to driver escaping as necessary. Definition at line 316 of file driver.cpp. Referenced by KexiDB::QuerySchema::sqlColumnsList(), and KexiDB::FieldList::sqlFieldsList(). |
|
|
This is overloaded version of escapeString( const QString& str ) to be implemented in the same way. Implemented in KexiDB::MySqlDriver, KexiDB::pqxxSqlDriver, and KexiDB::SQLiteDriver. |
|
|
Driver-specific SQL string escaping. Implement escaping for any character like " or ' as your database engine requires. Prepend and append quotation marks. Implemented in KexiDB::MySqlDriver, KexiDB::pqxxSqlDriver, and KexiDB::SQLiteDriver. Referenced by KexiDB::Connection::alterTableName(), and valueToSQL(). |
|
|
Definition at line 152 of file driver.cpp. References d, and KexiDB::DriverPrivate::features. Referenced by KexiMainWindowImpl::slotToolsCompactDatabase(). |
|
|
Definition at line 134 of file driver.cpp. References d, and KexiDB::DriverPrivate::fileDBDriverMimeType. |
|
|
Used to initialise the dictionary of driver-specific keywords. Should be called by the Driver's constructor. hashSize is the number of buckets to use in the dictionary.
Definition at line 360 of file driver.cpp. References beh, d, KexiDB::DriverPrivate::driverSQLDict, KexiDB::DriverPrivate::initDriverKeywords(), and KexiDB::DriverBehaviour::SQL_KEYWORDS. Referenced by KexiDB::SQLiteDriver::SQLiteDriver(). |
|
|
Definition at line 149 of file driver.cpp. References d, and KexiDB::DriverPrivate::isFileDriver. Referenced by KexiMigration::KexiMigrate::checkIfDestinationDatabaseOverwritingNeedsAccepting(), KexiDB::Connection::connect(), KexiDB::Connection::createDatabase(), KexiDB::Connection::databaseExists(), KexiDB::Connection::dropDatabase(), SimpleCommandLineApp::openDatabase(), and KexiDB::Connection::useTemporaryDatabaseIfNeeded(). |
|
|
Definition at line 235 of file driver.cpp. References KexiDB::Connection::kexiDBSystemTableNames(). Referenced by KexiDB::ObjectNameValidator::internalCheck(), and isSystemObjectName(). |
|
|
Implemented in KexiDB::MySqlDriver, KexiDB::pqxxSqlDriver, and KexiDB::SQLiteDriver. Referenced by KexiDB::Connection::createDatabase(), KexiDB::Connection::databaseNames(), and KexiDB::Connection::dropDatabase(). |
|
|
Definition at line 243 of file driver.cpp. References beh, drv_isSystemFieldName(), and KexiDB::DriverBehaviour::ROW_ID_FIELD_NAME. Referenced by KexiDB::Connection::findSystemFieldName(). |
|
|
Reimplemented in KexiDB::pqxxSqlDriver, and KexiDB::SQLiteDriver. Definition at line 230 of file driver.cpp. References isKexiDBSystemObjectName(). Referenced by KexiDB::Connection::createTable(), KexiDB::Connection::dropTable(), KexiDB::MySqlDriver::isSystemDatabaseName(), KexiDB::SQLiteDriver::isSystemObjectName(), KexiDB::pqxxSqlDriver::isSystemObjectName(), and KexiMigration::KexiMigrate::performImport(). |
|
|
Definition at line 101 of file driver.cpp. Referenced by createConnection(), and KexiDB::DriverManagerInternal::driver(). |
|
|
Definition at line 304 of file driver.cpp. References d, and KexiDB::DriverPrivate::propertyCaptions. |
|
|
Definition at line 309 of file driver.cpp. References d, and KexiDB::DriverPrivate::properties. |
|
|
Definition at line 299 of file driver.cpp. References d, and KexiDB::DriverPrivate::properties. |
|
|
Definition at line 200 of file driver.cpp. References KexiDB::Object::clearError(), KexiDB::DriverPrivate::connections, and d. |
|
|
Info about the driver as a service. Definition at line 146 of file driver.cpp. References d, and KexiDB::DriverPrivate::service. |
|
||||||||||||
|
SQL-implementation-dependent name of given type Reimplemented in KexiDB::pqxxSqlDriver. Definition at line 170 of file driver.cpp. References d, KexiDB::Field::InvalidType, KexiDB::Field::LastType, and KexiDB::DriverPrivate::typeNames. Referenced by KexiDB::Connection::createTableStatement(). |
|
|
Definition at line 155 of file driver.cpp. References d, KexiDB::DriverPrivate::features, MultipleTransactions, and SingleTransactions. Referenced by KexiDB::Connection::closeDatabase(), KexiDB::Connection::commitAutoCommitTransaction(), KexiDB::Connection::commitTransaction(), KexiDB::Connection::createDatabase(), KexiDB::Connection::rollbackAutoCommitTransaction(), KexiDB::Connection::rollbackTransaction(), and KexiDB::Connection::setDefaultTransaction(). |
|
||||||||||||
|
Like above method, for field.
Definition at line 231 of file driver.h. References KexiDB::Field::InvalidType, and KexiDB::Field::type(). |
|
||||||||||||
|
Like above but with the fildtype as string.
Definition at line 226 of file driver.h. References KexiDB::Field::typeForString(). |
|
||||||||||||
|
|
Driver's static version information (major part), it is automatically defined in implementation by KEXIDB_DRIVER macro (see driver_p.h) It's usually compared to drivers' and KexiDB library version. |
Friends And Related Function Documentation
|
|
|
|
|
|
|
|
|
Member Data Documentation
|
|
The documentation for this class was generated from the following files:
