KDbDriverBehavior
#include <KDbDriverBehavior.h>
Public Member Functions | |
KDbDriverBehavior (KDbDriver *driver) | |
Detailed Description
Detailed definition of driver's default behavior.
This class is mostly interesting for KDb driver developers. Defaults can be changed by KDbDriver subclass in constructors.
Definition at line 32 of file KDbDriverBehavior.h.
Member Data Documentation
◆ _1ST_ROW_READ_AHEAD_REQUIRED_TO_KNOW_IF_THE_RESULT_IS_EMPTY
bool KDbDriverBehavior::_1ST_ROW_READ_AHEAD_REQUIRED_TO_KNOW_IF_THE_RESULT_IS_EMPTY |
True if before we know whether the fetched result of executed query is empty or not, we need to fetch first record. Particularly, it's true for SQLite. The flag is used in KDbCursor::open(). By default this flag is false.
Definition at line 188 of file KDbDriverBehavior.h.
◆ ALWAYS_AVAILABLE_DATABASE_NAME
QString KDbDriverBehavior::ALWAYS_AVAILABLE_DATABASE_NAME |
Name of any (e.g. first found) database for this connection that typically always exists. This can be not set if we want to do some magic checking what database name is availabe by reimplementing KDbConnection::anyAvailableDatabaseName(). Example: for PostgreSQL this is "template1".
- See also
- KDbConnection::SetAvailableDatabaseName()
Definition at line 118 of file KDbDriverBehavior.h.
◆ AUTO_INCREMENT_FIELD_OPTION
QString KDbDriverBehavior::AUTO_INCREMENT_FIELD_OPTION |
"AUTO_INCREMENT" by default, used as add-in word to field definition May be also used as full definition if SPECIAL_AUTO_INCREMENT_DEF is true.
Definition at line 63 of file KDbDriverBehavior.h.
◆ AUTO_INCREMENT_PK_FIELD_OPTION
QString KDbDriverBehavior::AUTO_INCREMENT_PK_FIELD_OPTION |
"AUTO_INCREMENT PRIMARY KEY" by default, used as add-in word to field definition May be also used as full definition if SPECIAL_AUTO_INCREMENT_DEF is true.
Definition at line 67 of file KDbDriverBehavior.h.
◆ AUTO_INCREMENT_REQUIRES_PK
bool KDbDriverBehavior::AUTO_INCREMENT_REQUIRES_PK |
True if autoincrement requires field to be declared as primary key. This is true for SQLite. False by default.
Definition at line 81 of file KDbDriverBehavior.h.
◆ AUTO_INCREMENT_TYPE
QString KDbDriverBehavior::AUTO_INCREMENT_TYPE |
"" by default, used as type string for autoinc.
field definition pgsql defines it as "SERIAL", sqlite defines it as "INTEGER"
Definition at line 71 of file KDbDriverBehavior.h.
◆ BOOLEAN_FALSE_LITERAL
QString KDbDriverBehavior::BOOLEAN_FALSE_LITERAL |
Literal for boolean false. "0" by default which is typically expected by backends even while the standard says "TRUE": https://troels.arvin.dk/db/rdbms/#data_types-boolean
Definition at line 204 of file KDbDriverBehavior.h.
◆ BOOLEAN_TRUE_LITERAL
QString KDbDriverBehavior::BOOLEAN_TRUE_LITERAL |
Literal for boolean true. "1" by default which is typically expected by backends even while the standard says "TRUE": https://troels.arvin.dk/db/rdbms/#data_types-boolean
Definition at line 198 of file KDbDriverBehavior.h.
◆ CLOSING_QUOTATION_MARK_BEGIN_FOR_IDENTIFIER
char KDbDriverBehavior::CLOSING_QUOTATION_MARK_BEGIN_FOR_IDENTIFIER |
Opening quotation mark used for escaping identifier (see KDbDriver::escapeIdentifier()). Default value is '"'. Change it for your driver.
Definition at line 128 of file KDbDriverBehavior.h.
◆ CONNECTION_REQUIRED_TO_CHECK_DB_EXISTENCE
bool KDbDriverBehavior::CONNECTION_REQUIRED_TO_CHECK_DB_EXISTENCE |
True if connection should be established (KDbConnection::connect()) in order to check database existence (KDbConnection::databaseExists()). This is true for most engines, but not for SQLite (and probably most file-based databases) where existence of database is checked at filesystem level. By default this flag is true.
Definition at line 147 of file KDbDriverBehavior.h.
◆ CONNECTION_REQUIRED_TO_CREATE_DB
bool KDbDriverBehavior::CONNECTION_REQUIRED_TO_CREATE_DB |
True if connection should be established (KDbConnection::connect()) in order to create new database (KDbConnection::createDatabase()). This is true for most engines, but not for SQLite (and probably most file-based databases) where opening physical connection for nonexisting file creates new file. By default this flag is true.
Definition at line 156 of file KDbDriverBehavior.h.
◆ CONNECTION_REQUIRED_TO_DROP_DB
bool KDbDriverBehavior::CONNECTION_REQUIRED_TO_DROP_DB |
True if connection should be established (KDbConnection::connect()) in order to drop database (KDbConnection::dropDatabase()). This is true for most engines, but not for SQLite (and probably most file-based databases) where dropping database is performed at filesystem level. By default this flag is true.
Definition at line 164 of file KDbDriverBehavior.h.
◆ features
int KDbDriverBehavior::features |
Features (like transactions, etc.) supported by this driver (sum of selected Features enum items). This member should be filled in driver implementation's constructor (by default m_features==NoFeatures).
Definition at line 43 of file KDbDriverBehavior.h.
◆ GET_TABLE_NAMES_SQL
KDbEscapedString KDbDriverBehavior::GET_TABLE_NAMES_SQL |
SQL statement used to obtain list of physical table names.
Used by default implementation of KDbConnection::drv_getTableNames(). Empty by default. If empty, default implementation of KDbConnection::drv_getTableNames() fails.
- Since
- 3.2
Definition at line 229 of file KDbDriverBehavior.h.
◆ IS_DB_OPEN_AFTER_CREATE
bool KDbDriverBehavior::IS_DB_OPEN_AFTER_CREATE |
Set to true
in a subclass if after successful drv_createDatabase() the database is in opened state (as after useDatabase()). false
for most engines.
Definition at line 183 of file KDbDriverBehavior.h.
◆ LIKE_OPERATOR
QString KDbDriverBehavior::LIKE_OPERATOR |
"LIKE" by default, used to construct native expressions "x LIKE y" and "x NOT LIKE y". LIKE is case-insensitive for MySQL, SQLite, and often on Sybase/MSSQL while for PostgreSQL it's case-sensitive. So for PostgreSQL LIKE_OPERATOR == "ILIKE".
Definition at line 216 of file KDbDriverBehavior.h.
◆ OPENING_QUOTATION_MARK_BEGIN_FOR_IDENTIFIER
char KDbDriverBehavior::OPENING_QUOTATION_MARK_BEGIN_FOR_IDENTIFIER |
Opening quotation mark used for escaping identifier (see KDbDriver::escapeIdentifier()). Default value is '"'. Change it for your driver.
Definition at line 123 of file KDbDriverBehavior.h.
◆ properties
KDbUtils::PropertySet KDbDriverBehavior::properties |
Driver properties (indexed by name), useful for presenting properties to the user. Contains i18n-ed captions. In driver implementations available properties can be initialized, for example:
You do not need to set captions of properties predefined by the KDbDriver superclass, they will be reused. Predefined properties are set in KDbDriver.
Definition at line 56 of file KDbDriverBehavior.h.
◆ RANDOM_FUNCTION
QString KDbDriverBehavior::RANDOM_FUNCTION |
"RANDOM()" function name, used in Driver::randomFunctionToString() to construct native expressions.
Definition at line 220 of file KDbDriverBehavior.h.
◆ ROW_ID_FIELD_NAME
QString KDbDriverBehavior::ROW_ID_FIELD_NAME |
Name of a field (or built-in function) with autoincremented unique value, typically returned by KDbSqlResult::lastInsertRecordId().
Examples:
- PostgreSQL and SQLite engines use 'OID' field
- MySQL uses LAST_INSERT_ID() built-in function
Definition at line 90 of file KDbDriverBehavior.h.
◆ ROW_ID_FIELD_RETURNS_LAST_AUTOINCREMENTED_VALUE
bool KDbDriverBehavior::ROW_ID_FIELD_RETURNS_LAST_AUTOINCREMENTED_VALUE |
True if the value (fetched from field or function, defined by ROW_ID_FIELD_NAME member) is EXACTLY the value of autoincremented field, not an implicit (internal) row number. Default value is false.
Examples:
- PostgreSQL and SQLite engines have this flag set to false ('OID' field has it's own implicit value)
- MySQL engine has this flag set to true (LAST_INSERT_ID() returns real value of last autoincremented field).
Notes: If it's false, we have a convenient way for identifying row even when there's no primary key defined. So, as '_ROWID' column in MySQL is really just a synonym for the primary key, this engine needs to have primary keys always defined if we want to use interactive editing features like row updating and deleting.
Definition at line 108 of file KDbDriverBehavior.h.
◆ SELECT_1_SUBQUERY_SUPPORTED
bool KDbDriverBehavior::SELECT_1_SUBQUERY_SUPPORTED |
True if "SELECT 1 from (subquery)" is supported. False by default. Used in KDbConnection::resultExists() for optimization. It's set to true for SQLite driver.
Definition at line 192 of file KDbDriverBehavior.h.
◆ SPECIAL_AUTO_INCREMENT_DEF
bool KDbDriverBehavior::SPECIAL_AUTO_INCREMENT_DEF |
True if autoincrement field has special definition e.g. like "INTEGER PRIMARY KEY" for SQLite. Special definition string should be stored in AUTO_INCREMENT_FIELD_OPTION. False by default.
Definition at line 77 of file KDbDriverBehavior.h.
◆ TEXT_TYPE_MAX_LENGTH
int KDbDriverBehavior::TEXT_TYPE_MAX_LENGTH |
Specifies maximum length for Text type. If 0, there is are limits and length argument is not needed, e.g. VARCHAR works for the driver this is the case for SQLite and PostgreSQL. If greater than 0, this value should be used to express maximum value, e.g. VARCHAR(...). This is the case for MySQL. The default is 0.
Definition at line 211 of file KDbDriverBehavior.h.
◆ typeNames
real type names for this engine
Definition at line 46 of file KDbDriverBehavior.h.
◆ UNSIGNED_TYPE_KEYWORD
QString KDbDriverBehavior::UNSIGNED_TYPE_KEYWORD |
"UNSIGNED" by default
Definition at line 59 of file KDbDriverBehavior.h.
◆ USE_TEMPORARY_DATABASE_FOR_CONNECTION_IF_NEEDED
bool KDbDriverBehavior::USE_TEMPORARY_DATABASE_FOR_CONNECTION_IF_NEEDED |
Because some engines need to have opened any database before executing administrative sql statements like "create database" or "drop database", using appropriate, existing temporary database for this connection. This is the case for PostgreSQL. For file-based db drivers this flag is ignored. By default this flag is false.
Note: This method has nothing to do with creating or using temporary databases in such meaning that these database are not persistent.
Definition at line 178 of file KDbDriverBehavior.h.
◆ USING_DATABASE_REQUIRED_TO_CONNECT
bool KDbDriverBehavior::USING_DATABASE_REQUIRED_TO_CONNECT |
True if using database is required to perform real connection. This is true for may engines, e.g. for PostgreSQL, where connection strings should contain a database name. If the flag is false, then developer has to call KDbConnection::useDatabase() after creating the KDbConnection object. This flag can be also used for file-based db drivers, e.g. SQLite sets it to true. MySQL sets it to false. By default this flag is true.
Definition at line 139 of file KDbDriverBehavior.h.
The documentation for this class was generated from the following file:
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:38:31 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.