#include <driver.h>
|
| enum | Features {
NoFeatures = 0
, SingleTransactions = 1
, MultipleTransactions = 2
, NestedTransactions = 4
,
CursorForward = 8
, CursorBackward = (CursorForward+16)
, CompactingDatabaseSupported = 32
, IgnoreTransactions = 1024
} |
| |
| enum | CreateConnectionOptions { ReadOnlyConnection = 1
} |
| |
| enum | EscapeType { EscapeDriver = 0x01
, EscapeKexi = 0x02
} |
| |
| enum | EscapePolicy { EscapeAsNecessary = 0x04
, EscapeAlways = 0x08
} |
| |
| typedef TQMap< TQString, Info > | InfoMap |
| |
|
| | Driver (TQObject *parent, const char *name, const TQStringList &args=TQStringList()) |
| |
| virtual Connection * | drv_createConnection (ConnectionData &conn_data)=0 |
| |
| virtual TQString | drv_escapeIdentifier (const TQString &str) const =0 |
| |
| virtual TQCString | drv_escapeIdentifier (const TQCString &str) const =0 |
| |
| virtual bool | drv_isSystemFieldName (const TQString &n) const =0 |
| |
| virtual AdminTools * | drv_createAdminTools () const |
| |
| Connection * | removeConnection (Connection *conn) |
| |
| void | initSQLKeywords (int hashSize=17) |
| |
| | 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) |
| |
| virtual void | drv_clearServerResult () |
| |
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:
KEXIDB_DRIVER_INFO( CLASS_NAME, INTERNAL_NAME );
where:
- 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 TDETrader to find the module's entry point. For example, this line declares kexidb_mysqldriver.so module's entry point:
- See also
- SQLiteDriver MySqlDriver, pqxxSqlDriver
Definition at line 66 of file driver.h.
◆ InfoMap
| typedef TQMap<TQString,Info> KexiDB::Driver::InfoMap |
◆ CreateConnectionOptions
◆ EscapePolicy
| enum KexiDB::Driver::EscapePolicy |
◆ EscapeType
| enum KexiDB::Driver::EscapeType |
◆ Features
Features supported by driver (sum of few Features enum items).
| Enumerator |
|---|
| SingleTransactions | single trasactions are only supported
|
| MultipleTransactions | multiple concurrent trasactions are supported (this implies !SingleTransactions)
|
| NestedTransactions | nested trasactions are supported (this should imply !SingleTransactions and MultipleTransactions)
|
| CursorForward | forward moving is supported for cursors (if not available, no cursors available at all)
|
| CursorBackward | backward moving is supported for cursors (this implies CursorForward)
|
| CompactingDatabaseSupported | compacting database supported (aka VACUUM)
|
| IgnoreTransactions | If set, actions related to transactions will be silently bypassed with success. Set this if your driver does not support transactions at all Currently, this is only way to get it working with KexiDB. Keep in mind that this hack do not provide data integrity! This flag is currently used for MySQL driver.
|
Definition at line 87 of file driver.h.
◆ Driver()
| KexiDB::Driver::Driver |
( |
TQObject * |
parent, |
|
|
const char * |
name, |
|
|
const TQStringList & |
args = TQStringList() |
|
) |
| |
|
protected |
Used by DriverManager. Note for driver developers: Reimplement this. In your reimplementation you should initialize:
- d->typeNames - to types accepted by your engine
- d->isFileDriver - to true or false depending if your driver is file-based
- d->features - to combination of selected values from Features enum
You may also want to change options in DriverBehaviour *beh member. See drivers/mySQL/mysqldriver.cpp for usage example.
◆ adminTools()
- Returns
- admin tools object providing a number of database administration tools for the driver. Tools availablility varies from driver to driver. You can check it using features().
Definition at line 158 of file driver.cpp.
◆ connectionsList()
| const TQPtrList< Connection > Driver::connectionsList |
( |
| ) |
const |
- Returns
- List of created connections.
Definition at line 125 of file driver.cpp.
◆ createConnection()
Creates connection using conn_data as parameters. - Returns
- 0 and sets error message on error. driverName member of conn_data will be updated with this driver name. options can be a combination of CreateConnectionOptions enum values.
Definition at line 178 of file driver.cpp.
◆ dateTimeToSQL()
| virtual TQString KexiDB::Driver::dateTimeToSQL |
( |
const TQDateTime & |
v | ) |
const |
|
inlinevirtual |
◆ defaultFileBasedDriverMimeType()
| TQString Driver::defaultFileBasedDriverMimeType |
( |
| ) |
|
|
static |
- Returns
- default file-based driver mime type (typically something like "application/x-kexiproject-sqlite")
Definition at line 137 of file driver.cpp.
◆ defaultFileBasedDriverName()
| TQString Driver::defaultFileBasedDriverName |
( |
| ) |
|
|
static |
- Returns
- default file-based driver name (currently, "sqlite3").
Definition at line 140 of file driver.cpp.
◆ defaultSQLTypeName()
| TQString Driver::defaultSQLTypeName |
( |
int |
id_t | ) |
|
|
static |
◆ drv_createAdminTools()
| AdminTools * Driver::drv_createAdminTools |
( |
| ) |
const |
|
protectedvirtual |
◆ drv_createConnection()
◆ drv_escapeIdentifier() [1/2]
| virtual TQCString KexiDB::Driver::drv_escapeIdentifier |
( |
const TQCString & |
str | ) |
const |
|
protectedpure virtual |
◆ drv_escapeIdentifier() [2/2]
| virtual TQString KexiDB::Driver::drv_escapeIdentifier |
( |
const TQString & |
str | ) |
const |
|
protectedpure virtual |
◆ drv_isSystemFieldName()
| virtual bool KexiDB::Driver::drv_isSystemFieldName |
( |
const TQString & |
n | ) |
const |
|
protectedpure virtual |
- Returns
- true if n is a system field's name, build-in system field that cannot be used or created by a user, and in most cases user even shouldn't see this. The list is specific for a given driver implementation. For implementation.
Implemented in KexiDB::MySqlDriver, KexiDB::pqxxSqlDriver, and KexiDB::SQLiteDriver.
◆ escapeBLOB()
| virtual TQString KexiDB::Driver::escapeBLOB |
( |
const TQByteArray & |
array | ) |
const |
|
pure virtual |
◆ escapeIdentifier() [1/2]
| TQCString Driver::escapeIdentifier |
( |
const TQCString & |
str, |
|
|
int |
options = EscapeDriver|EscapeAsNecessary |
|
) |
| const |
◆ escapeIdentifier() [2/2]
| TQString Driver::escapeIdentifier |
( |
const TQString & |
str, |
|
|
int |
options = EscapeDriver|EscapeAsNecessary |
|
) |
| const |
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.
◆ escapeString() [1/2]
| virtual TQCString KexiDB::Driver::escapeString |
( |
const TQCString & |
str | ) |
const |
|
pure virtual |
◆ escapeString() [2/2]
| virtual TQString KexiDB::Driver::escapeString |
( |
const TQString & |
str | ) |
const |
|
pure virtual |
◆ features()
| int Driver::features |
( |
| ) |
const |
◆ fileDBDriverMimeType()
| TQString Driver::fileDBDriverMimeType |
( |
| ) |
const |
- Returns
- a name equal to the service name (X-Kexi-DriverName) stored in given service .desktop file. */ TQString driverName() { return m_driverName; }
/*! \return a name of MIME type of files handled by this driver
if it is a file-based database's driver
(equal X-Kexi-FileDBDriverMime service property)
otherwise returns null string. \sa isFileDriver()
Definition at line 134 of file driver.cpp.
◆ initSQLKeywords()
| void Driver::initSQLKeywords |
( |
int |
hashSize = 17 | ) |
|
|
protected |
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. - See also
- DriverPrivate::SQL_KEYWORDS.
Definition at line 360 of file driver.cpp.
◆ isFileDriver()
| bool Driver::isFileDriver |
( |
| ) |
const |
- Returns
- true if this driver is file-based
Definition at line 149 of file driver.cpp.
◆ isKexiDBSystemObjectName()
| bool Driver::isKexiDBSystemObjectName |
( |
const TQString & |
n | ) |
|
|
static |
- Returns
- true if n is a kexibd-related 'system' object's name, i.e. when n starts with "kexi__" prefix.
Definition at line 235 of file driver.cpp.
◆ isSystemDatabaseName()
| virtual bool KexiDB::Driver::isSystemDatabaseName |
( |
const TQString & |
n | ) |
const |
|
pure virtual |
◆ isSystemFieldName()
| bool Driver::isSystemFieldName |
( |
const TQString & |
n | ) |
const |
- Returns
- true if n is a system field's name, build-in system field that cannot be used or created by a user, and in most cases user even shouldn't see this. The list is specific for a given driver implementation.
- See also
- isSystemObjectName().
Definition at line 243 of file driver.cpp.
◆ isSystemObjectName()
| bool Driver::isSystemObjectName |
( |
const TQString & |
n | ) |
const |
|
virtual |
◆ isValid()
| virtual bool KexiDB::Driver::isValid |
( |
| ) |
|
|
virtual |
- Returns
- true if this driver's implementation is valid. Just few constriants are checked to ensure that driver developer didn't forget about something. This method is called automatically on createConnection(), and proper error message is set properly on any error.
◆ propertyCaption()
| TQString Driver::propertyCaption |
( |
const TQCString & |
propName | ) |
const |
- Returns
- translated property caption for propeName. If there's no such property defined for driver, empty string value is returned.
Definition at line 304 of file driver.cpp.
◆ propertyNames()
| TQValueList< TQCString > Driver::propertyNames |
( |
| ) |
const |
- Returns
- a list of property names available for this driver.
Definition at line 309 of file driver.cpp.
◆ propertyValue()
| TQVariant Driver::propertyValue |
( |
const TQCString & |
propName | ) |
const |
- Returns
- property value for propeName available for this driver. If there's no such property defined for driver, Null TQVariant value is returned.
Definition at line 299 of file driver.cpp.
◆ removeConnection()
- Returns
- connection conn , do not deletes it nor affect. Returns 0 if conn is not owned by this driver. After this, you are owner of conn object, so you should eventually delete it. Better use Connection destructor.
Definition at line 200 of file driver.cpp.
◆ service()
| const KService * Driver::service |
( |
| ) |
const |
◆ sqlTypeName()
| TQString Driver::sqlTypeName |
( |
int |
id_t, |
|
|
int |
p = 0 |
|
) |
| const |
|
virtual |
◆ transactionsSupported()
| bool Driver::transactionsSupported |
( |
| ) |
const |
- Returns
- true if transaction are supported (single or multiple).
Definition at line 155 of file driver.cpp.
◆ valueToSQL() [1/3]
| TQString KexiDB::Driver::valueToSQL |
( |
const Field * |
field, |
|
|
const TQVariant & |
v |
|
) |
| const |
|
inline |
Like above method, for field.
Definition at line 232 of file driver.h.
◆ valueToSQL() [2/3]
| TQString KexiDB::Driver::valueToSQL |
( |
const TQString & |
ftype, |
|
|
const TQVariant & |
v |
|
) |
| const |
|
inline |
Like above but with the fildtype as string.
Definition at line 227 of file driver.h.
◆ valueToSQL() [3/3]
| TQString Driver::valueToSQL |
( |
uint |
ftype, |
|
|
const TQVariant & |
v |
|
) |
| const |
|
virtual |
Escapes and converts value v (for type ftype) to string representation required by SQL commands. Reimplement this if you need other behaviour (eg. for 'date' type handling) This implementation return date, datetime and time values in ISO format, what seems to be accepted by SQL servers. - See also
- TQt::DateFormat
Reimplemented in KexiDB::pqxxSqlDriver.
Definition at line 250 of file driver.cpp.
◆ version()
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.
◆ Connection
◆ Cursor
◆ DriverManagerInternal
| friend class DriverManagerInternal |
|
friend |
◆ beh
| DriverBehaviour* KexiDB::Driver::beh |
|
protected |
| DriverPrivate* KexiDB::Driver::d |
|
protected |
The documentation for this class was generated from the following files:
|