KDb
Typedefs | |
typedef QList< const KDbExpressionData * > | ExpressionCallStack |
Enumerations | |
enum class | BLOBEscapingType { XHex = 1 , ZeroXHex , Hex , Octal , ByteaHex } |
enum | ExpressionClass { UnknownExpression , UnaryExpression , ArithmeticExpression , LogicalExpression , RelationalExpression , SpecialBinaryExpression , ConstExpression , VariableExpression , FunctionExpression , AggregationExpression , FieldListExpression , TableListExpression , ArgumentListExpression , QueryParameterExpression , LastExpressionClass = QueryParameterExpression } |
enum | IdentifierEscapingType { DriverEscaping , KDbEscaping } |
enum | ObjectType { UnknownObjectType = -1 , AnyObjectType = 0 , TableObjectType = 1 , QueryObjectType = 2 , LastObjectType = 2 , KDbSystemTableObjectType = 128 , IndexObjectType = 256 } |
enum | Signedness { Signed = 0 , Unsigned = 1 } |
enum | SplitToTableAndFieldPartsOptions { FailIfNoTableOrFieldName = 0 , SetFieldNameIfNoTableName = 1 } |
Functions | |
KDB_EXPORT QVariant | cstringToVariant (const char *data, KDbField::Type type, bool *ok, int length=-1, KDb::Signedness signedness=KDb::Signed) |
KDB_EXPORT KDbEscapedString | dateTimeToIsoString (const QVariant &v) |
KDB_DEPRECATED_EXPORT KDbEscapedString | dateTimeToSql (const QDateTime &v) |
KDB_EXPORT KDbEscapedString | dateTimeToSql (const QVariant &v) |
KDB_EXPORT KDbEscapedString | dateToIsoString (const QVariant &v) |
KDB_EXPORT KDbEscapedString | dateToSql (const QVariant &v) |
KDB_EXPORT KDbField::Type | defaultFieldTypeForGroup (KDbField::TypeGroup typeGroup) |
KDB_EXPORT QString | defaultFileBasedDriverId () |
KDB_EXPORT QString | defaultFileBasedDriverMimeType () |
bool | deleteAllRecords (KDbConnection *conn, const KDbTableSchema &table) |
KDB_EXPORT bool | deleteAllRecords (KDbConnection *conn, const QString &tableName) |
bool | deleteRecords (KDbConnection *conn, const KDbTableSchema &table, const QString &keyname, const QString &keyval) |
bool | deleteRecords (KDbConnection *conn, const KDbTableSchema &table, const QString &keyname, int keyval) |
bool | deleteRecords (KDbConnection *conn, const KDbTableSchema &table, const QString &keyname, KDbField::Type keytype, const QVariant &keyval) |
bool | deleteRecords (KDbConnection *conn, const QString &tableName, const QString &keyname, const QString &keyval) |
bool | deleteRecords (KDbConnection *conn, const QString &tableName, const QString &keyname, int keyval) |
KDB_EXPORT bool | deleteRecords (KDbConnection *conn, const QString &tableName, const QString &keyname, KDbField::Type keytype, const QVariant &keyval) |
KDB_EXPORT bool | deleteRecords (KDbConnection *conn, const QString &tableName, const QString &keyname1, KDbField::Type keytype1, const QVariant &keyval1, const QString &keyname2, KDbField::Type keytype2, const QVariant &keyval2) |
KDB_EXPORT bool | deleteRecords (KDbConnection *conn, const QString &tableName, const QString &keyname1, KDbField::Type keytype1, const QVariant &keyval1, const QString &keyname2, KDbField::Type keytype2, const QVariant &keyval2, const QString &keyname3, KDbField::Type keytype3, const QVariant &keyval3) |
KDB_EXPORT QList< int > | deserializeIntList (const QString &data, bool *ok) |
KDB_EXPORT QStringList | deserializeList (const QString &data) |
KDB_EXPORT QVariant | emptyValueForFieldType (KDbField::Type type) |
KDB_EXPORT QString | escapeBLOB (const QByteArray &array, BLOBEscapingType type) |
KDB_EXPORT QByteArray | escapeIdentifier (const KDbDriver *driver, const QByteArray &str) |
KDB_EXPORT QString | escapeIdentifier (const KDbDriver *driver, const QString &string) |
KDB_EXPORT QByteArray | escapeIdentifier (const QByteArray &string) |
KDB_EXPORT QString | escapeIdentifier (const QString &string) |
KDB_EXPORT QByteArray | escapeIdentifierAndAddQuotes (const QByteArray &string) |
KDB_EXPORT QString | escapeIdentifierAndAddQuotes (const QString &string) |
KDB_EXPORT QString | escapeString (const QString &string) |
KDB_EXPORT KDbEscapedString | escapeString (KDbConnection *conn, const QString &string) |
KDB_EXPORT KDbEscapedString | escapeString (KDbDriver *drv, const QString &string) |
KDB_EXPORT QStringList | fieldTypeNamesForGroup (KDbField::TypeGroup typeGroup) |
KDB_EXPORT const QList< KDbField::Type > | fieldTypesForGroup (KDbField::TypeGroup typeGroup) |
KDB_EXPORT QStringList | fieldTypeStringsForGroup (KDbField::TypeGroup typeGroup) |
KDB_EXPORT void | getFieldProperties (const KDbField &field, QMap< QByteArray, QVariant > *values) |
KDB_EXPORT void | getHTMLErrorMesage (const KDbResultable &resultable, KDbResultInfo *info) |
KDB_EXPORT void | getHTMLErrorMesage (const KDbResultable &resultable, QString *msg) |
KDB_EXPORT void | getHTMLErrorMesage (const KDbResultable &resultable, QString *msg, QString *details) |
KDB_EXPORT void | getLimitsForFieldType (KDbField::Type type, qlonglong *minValue, qlonglong *maxValue, KDb::Signedness signedness=KDb::Signed) |
KDB_EXPORT void | getProperties (const KDbLookupFieldSchema *lookup, QMap< QByteArray, QVariant > *values) |
KDB_EXPORT QString | identifierExpectedMessage (const QString &valueName, const QVariant &v) |
KDB_EXPORT tristate | idForObjectName (KDbConnection *conn, int *id, const QString &objName, int objType) |
template<typename T > | |
T | iif (bool ok, const T &value) |
template<typename T > | |
T | iifNotEmpty (const QByteArray &string, const T &stringIfEmpty) |
template<typename T > | |
T | iifNotEmpty (const T &string, const QByteArray &stringIfEmpty) |
template<typename T > | |
T | iifNotEmpty (const T &string, const T &stringIfEmpty) |
KDB_EXPORT bool | importSqliteFile (const QString &inputFileName, const QString &outputFileName) |
KDB_EXPORT KDbField::Type | intToFieldType (int type) |
KDB_EXPORT KDbField::TypeGroup | intToFieldTypeGroup (int typeGroup) |
KDB_EXPORT bool | isBuiltinTableFieldProperty (const QByteArray &propertyName) |
KDB_EXPORT bool | isDefaultValueAllowed (const KDbField &field) |
KDB_EXPORT bool | isEmptyValue (KDbField::Type type, const QVariant &value) |
KDB_EXPORT bool | isExtendedTableFieldProperty (const QByteArray &propertyName) |
KDB_EXPORT bool | isIdentifier (const QByteArray &s) |
KDB_EXPORT bool | isIdentifier (const QString &s) |
KDB_EXPORT bool | isKDbSqlKeyword (const QByteArray &word) |
KDB_EXPORT bool | isLookupFieldSchemaProperty (const QByteArray &propertyName) |
KDB_EXPORT quint64 | lastInsertedAutoIncValue (KDbConnection *conn, const quint64 recordId, const QString &autoIncrementFieldName, const QString &tableName) |
quint64 | lastInsertedAutoIncValue (QSharedPointer< KDbSqlResult > result, const QString &autoIncrementFieldName, const KDbTableSchema &table, quint64 *recordId=nullptr) |
KDB_EXPORT quint64 | lastInsertedAutoIncValue (QSharedPointer< KDbSqlResult > result, const QString &autoIncrementFieldName, const QString &tableName, quint64 *recordId=nullptr) |
KDB_EXPORT QStringList | libraryPaths () |
KDB_EXPORT int | loadIntPropertyValueFromDom (const QDomNode &node, bool *ok) |
KDB_EXPORT QVariant | loadPropertyValueFromDom (const QDomNode &node, bool *ok) |
KDB_EXPORT QString | loadStringPropertyValueFromDom (const QDomNode &node, bool *ok) |
KDB_EXPORT KDbField::Type | maximumForIntegerFieldTypes (KDbField::Type t1, KDbField::Type t2) |
KDB_EXPORT QVariant | notEmptyValueForFieldType (KDbField::Type type) |
KDB_EXPORT QString | numberToLocaleString (double value, int decimalPlaces) |
KDB_EXPORT QString | numberToLocaleString (double value, int decimalPlaces, const QLocale &locale) |
KDB_EXPORT QString | numberToString (double value, int decimalPlaces) |
KDB_EXPORT QByteArray | pgsqlByteaToByteArray (const char *data, int length=-1) |
KDB_EXPORT QDomElement | saveBooleanElementToDom (QDomDocument *doc, QDomElement *parentEl, const QString &elementName, bool value) |
KDB_EXPORT QDomElement | saveNumberElementToDom (QDomDocument *doc, QDomElement *parentEl, const QString &elementName, int value) |
KDB_EXPORT QString | serializeList (const QStringList &list) |
KDB_EXPORT bool | setFieldProperties (KDbField *field, const QMap< QByteArray, QVariant > &values) |
KDB_EXPORT bool | setFieldProperty (KDbField *field, const QByteArray &propertyName, const QVariant &value) |
KDB_EXPORT tristate | showConnectionTestDialog (QWidget *parent, const KDbConnectionData &data, KDbMessageHandler *msgHandler) |
KDB_EXPORT QString | simplifiedFieldTypeName (KDbField::Type type) |
KDB_EXPORT bool | splitToTableAndFieldParts (const QString &string, QString *tableName, QString *fieldName, SplitToTableAndFieldPartsOptions option=FailIfNoTableOrFieldName) |
KDB_EXPORT QString | sqlite3ProgramPath () |
KDB_EXPORT KDbEscapedString | sqlWhere (KDbDriver *drv, KDbField::Type t, const QString &fieldName, const QVariant &value) |
KDB_EXPORT QList< int > | stringListToIntList (const QStringList &list, bool *ok=nullptr) |
KDB_EXPORT QString | stringToIdentifier (const QString &s) |
KDB_EXPORT QVariant | stringToVariant (const QString &s, QVariant::Type type, bool *ok) |
KDB_EXPORT bool | supportsVisibleDecimalPlacesProperty (KDbField::Type type) |
KDB_EXPORT QString | temporaryTableName (KDbConnection *conn, const QString &baseName) |
KDB_EXPORT KDbEscapedString | timeToIsoString (const QVariant &v) |
KDB_EXPORT KDbEscapedString | timeToSql (const QVariant &v) |
KDB_EXPORT QString | unescapeString (const QString &string, char quote, int *errorPosition=nullptr) |
KDbEscapedString | valueToSql (const KDbDriver *driver, KDbField::Type ftype, const QVariant &v) |
KDB_EXPORT KDbEscapedString | valueToSql (KDbField::Type ftype, const QVariant &v) |
KDB_EXPORT QString | variantToString (const QVariant &v) |
KDB_EXPORT KDbVersionInfo | version () |
KDB_EXPORT QByteArray | xHexToByteArray (const char *data, int length=-1, bool *ok=nullptr) |
KDB_EXPORT QByteArray | zeroXHexToByteArray (const char *data, int length=-1, bool *ok=nullptr) |
Detailed Description
A database connectivity and creation framework.
KDb is consisted of a general-purpose C++ Qt library and set of plugins delivering support for various database vendors.
Framework
KDbDriverManager KDbDriverMetaData KDbDriver
Database access
Database structure
- Schema
Data representation
Tools
- KDbObject
- KDbEscapedString
- KDbMessageHandler
- KDbProperties
- KDbAdmin
- KDbAlter
- KDbValidator
- KDbUtils
Drivers
Drivers are loaded as plugins on demand by KDbDriverManager. The IDs, descriptions and other details about drivers are given in their metadata by KDbDriverManager::driverMetaData(). The metadata is accessible without actually loading any driver.
KDb supports two families of databases, file and network-based while providing a single uniform API.
Each database driver implements of three main classes KDbDriver, KDbConnection, KDbCursor. The driver classes handle database-related specifics such as data types, naming and hide them behind a general purpose API. The connection classes act as a proxy between the KDb API and the native database. The cursor classes implement cursor functionality specific to the native database at record level.
Typedef Documentation
◆ ExpressionCallStack
typedef QList<const KDbExpressionData*> KDb::ExpressionCallStack |
Definition at line 41 of file KDbExpressionData.h.
Enumeration Type Documentation
◆ BLOBEscapingType
|
strong |
Escaping types for BLOBS. Used in escapeBLOB().
Enumerator | |
---|---|
XHex | Escaping like X'1FAD', used by sqlite (hex numbers) |
ZeroXHex | Escaping like 0x1FAD, used by mysql (hex numbers) |
Hex | Escaping like 1FAD without quotes or prefixes. |
Octal | Escaping like 'zk\000$x', used by PostgreSQL. (only non-printable characters are escaped using octal numbers); see https://www.postgresql.org/docs/9.5/interactive/datatype-binary.html |
ByteaHex | "bytea hex" escaping, e.g. E'\xDEADBEEF'::bytea used by PostgreSQL (only non-printable characters are escaped using octal numbers); see https://www.postgresql.org/docs/9.5/interactive/datatype-binary.html |
◆ ExpressionClass
enum KDb::ExpressionClass |
Classes of expressions.
Enumerator | |
---|---|
LastExpressionClass | This line should be at the end of the list. |
Definition at line 44 of file KDbExpressionData.h.
◆ IdentifierEscapingType
Escaping type for identifiers.
Enumerator | |
---|---|
DriverEscaping | Identifiers are escaped by driver. |
KDbEscaping | Identifiers are escaped using KDb's generic convention. |
Definition at line 144 of file KDbGlobal.h.
◆ ObjectType
enum KDb::ObjectType |
Object types set like table or query.
Enumerator | |
---|---|
UnknownObjectType | helper |
AnyObjectType | helper |
KDbSystemTableObjectType | helper, not used in storage (allows to select KDb system tables may be or'd with TableObjectType) |
IndexObjectType | special |
Definition at line 130 of file KDbGlobal.h.
◆ Signedness
enum KDb::Signedness |
A property of numeric values.
Enumerator | |
---|---|
Signed | Values can be both positive and negative. |
Unsigned | Values can be both non-negative. |
Definition at line 150 of file KDbGlobal.h.
◆ SplitToTableAndFieldPartsOptions
Used in splitToTableAndFieldParts().
Enumerator | |
---|---|
FailIfNoTableOrFieldName | default value for splitToTableAndFieldParts() |
SetFieldNameIfNoTableName |
Function Documentation
◆ cstringToVariant()
KDB_EXPORT QVariant KDb::cstringToVariant | ( | const char * | data, |
KDbField::Type | type, | ||
bool * | ok, | ||
int | length = -1, | ||
KDb::Signedness | signedness = KDb::Signed ) |
- Returns
- QVariant value converted from a data string
Conversion is based on the information about type type. type has to be an element from KDbField::Type, not greater than KDbField::LastType. For unsupported type this function fails. length value controls number of characters used in the conversion. It is optional value for all cases but for the BLOB type because for it data is not null-terminated so the length cannot be measured. The value of signedness controls the conversion in case of integer types; numbers can be limited to unsigned or not. If ok is not 0 *ok is set to false on failure and to true on success. On failure a null QVariant is returned. The function fails if data is 0. For rules of conversion to the boolean type see the documentation of QVariant::toBool(), QVariant::toDate() for date type, QVariant::toDateTime() for date+time type, QVariant::toTime() for time type.
◆ dateTimeToIsoString()
KDB_EXPORT KDbEscapedString KDb::dateTimeToIsoString | ( | const QVariant & | v | ) |
Converts date/time value to its string representation in ISO 8601 DateTime format - with "T" delimiter.
The string is enclosed with single quotes "'". It is compatible with SQLite format for the date/time type. It is used as default implementation for drivers in KDbDriver::dateTimeToSql().
If the v value is convertible to KDbDateTime then KDbDateTime::toString() is used to obtain the result. Otherwise the value is converted to QDateTime and QDateTime::toString() is used as well as QTime::toString() to obtain the result. If the time's milliseconds value is zero, it is not included.
"<INVALID_DATETIME>" string is returned for invalid (also null) time values.
For specification of the ISO format see https://www.w3.org/TR/NOTE-datetime.
Example value: "'1994-11-05T13:15:30'", not "'1994-11-05 13:15:30'".
- Since
- 3.2.0
◆ dateTimeToSql() [1/2]
KDB_DEPRECATED_EXPORT KDbEscapedString KDb::dateTimeToSql | ( | const QDateTime & | v | ) |
Converts date/time value to its string representation in ISO 8601 DateTime format - with "T" delimiter.
- Note
- This method is deprecated since 3.1.1, use KDb::dateTimeToIsoString() which has identical effect. The ISO format is no longer used for creating KDBSQL statements. Prior to this version it was used to generate date/time constants in KDb::valueToSql(KDbField::Type ftype, const QVariant& v) for KDbField::DateTime type. KDb::dateTimeToIsoString() is still used as default implementation for drivers in KDbDriver::dateTimeToSql().
KDb 3.1.0 improved type safety for KDBSQL so Text type are no longer compatible with Date/Time types. By implementing wish https://bugs.kde.org/393094 format of date/time constants for KDBSQL has been strictly defined in a backend-independent way. See https://community.kde.org/Kexi/Plugins/Queries/SQL_Constants for details.
◆ dateTimeToSql() [2/2]
KDB_EXPORT KDbEscapedString KDb::dateTimeToSql | ( | const QVariant & | v | ) |
Converts date/time value to its string representation required by KDBSQL commands.
The value can be of type QDateTime or KDbDateTime. If the value is not one of these types or is invalid QDateTime or is a null KDbDateTime then "<INVALID_DATETIME>" is returned. If the value is of type KDbDateTime that is not null then even if some components of the date/time are invalid, properly formatted string is returned. If the time's milliseconds value is zero, it is not included.
See https://community.kde.org/Kexi/Plugins/Queries/SQL_Constants for details.
Example values: "#1994-11-05 13:15#", "#1994-11-05 13:9:30#", "#1994-9-05 13:15:30.921#".
- Since
- 3.2.0
◆ dateToIsoString()
KDB_EXPORT KDbEscapedString KDb::dateToIsoString | ( | const QVariant & | v | ) |
Converts date value to its string representation in ISO 8601 DateTime format.
The string is enclosed with single quotes "'". It is compatible with SQLite format for the date type. It is used as default implementation for drivers in KDbDriver::dateToSql().
If the v value is convertible to KDbDate then KDbDate::toString() is used to obtain the result. Otherwise the value is converted to QDate and QDate::toString(Qt::ISODate) is used to obtain the result.
"<INVALID_DATE>" string is returned for invalid (also null) date values.
For specification of the ISO format see https://www.w3.org/TR/NOTE-datetime.
Example value: "'1994-11-05'".
- Since
- 3.2.0
◆ dateToSql()
KDB_EXPORT KDbEscapedString KDb::dateToSql | ( | const QVariant & | v | ) |
Converts date value to its string representation required by KDBSQL commands.
The value can be of type QDate or KDbDate. If the value is not one of these types or is invalid QDate or is a null KDbDate then "<INVALID_DATE>" is returned. If the value is of type KDbDate that is not null then even if some components of the date are invalid, properly formatted string is returned.
Example values: "#1994-11-05", "#1994-9-05#".
See https://community.kde.org/Kexi/Plugins/Queries/SQL_Constants for details.
- Since
- 3.2.0
◆ defaultFieldTypeForGroup()
KDbField::Type KDb::defaultFieldTypeForGroup | ( | KDbField::TypeGroup | typeGroup | ) |
- Returns
- default field type for field type group typeGroup, for example, KDbField::Integer for KDbField::IntegerGroup. It is used e.g. in KexiAlterTableDialog, to properly fill 'type' property when user selects type group for a field.
◆ defaultFileBasedDriverId()
KDB_EXPORT QString KDb::defaultFileBasedDriverId | ( | ) |
- Returns
- default file-based driver ID (currently, "org.kde.kdb.sqlite").
◆ defaultFileBasedDriverMimeType()
KDB_EXPORT QString KDb::defaultFileBasedDriverMimeType | ( | ) |
- Returns
- default file-based driver MIME type (typically something like "application/x-kexiproject-sqlite")
◆ deleteAllRecords() [1/2]
|
inline |
◆ deleteAllRecords() [2/2]
bool KDb::deleteAllRecords | ( | KDbConnection * | conn, |
const QString & | tableName ) |
◆ deleteRecords() [1/8]
|
inline |
◆ deleteRecords() [2/8]
|
inline |
◆ deleteRecords() [3/8]
|
inline |
◆ deleteRecords() [4/8]
|
inline |
◆ deleteRecords() [5/8]
|
inline |
◆ deleteRecords() [6/8]
bool KDb::deleteRecords | ( | KDbConnection * | conn, |
const QString & | tableName, | ||
const QString & | keyname, | ||
KDbField::Type | keytype, | ||
const QVariant & | keyval ) |
◆ deleteRecords() [7/8]
bool KDb::deleteRecords | ( | KDbConnection * | conn, |
const QString & | tableName, | ||
const QString & | keyname1, | ||
KDbField::Type | keytype1, | ||
const QVariant & | keyval1, | ||
const QString & | keyname2, | ||
KDbField::Type | keytype2, | ||
const QVariant & | keyval2 ) |
◆ deleteRecords() [8/8]
bool KDb::deleteRecords | ( | KDbConnection * | conn, |
const QString & | tableName, | ||
const QString & | keyname1, | ||
KDbField::Type | keytype1, | ||
const QVariant & | keyval1, | ||
const QString & | keyname2, | ||
KDbField::Type | keytype2, | ||
const QVariant & | keyval2, | ||
const QString & | keyname3, | ||
KDbField::Type | keytype3, | ||
const QVariant & | keyval3 ) |
◆ deserializeIntList()
- Returns
- int list converted from data which was built using serializeList(). Separators are ',' characters, escaping is assumed as "\\,". If ok is not 0, *ok is set to result of the conversion.
- See also
- KDb::stringListToIntList()
◆ deserializeList()
KDB_EXPORT QStringList KDb::deserializeList | ( | const QString & | data | ) |
- Returns
- string list converted from data which was built using serializeList(). Separators are ',' characters, escaping is assumed as "\\,".
◆ emptyValueForFieldType()
QVariant KDb::emptyValueForFieldType | ( | KDbField::Type | type | ) |
Used in KDb::emptyValueForFieldType()
- Returns
- equivalent of empty (default) value that can be set for a database field of type type
In particular returns:
- empty string for text types,
- 0 for integer and floating-point types,
- false for boolean types,
- a null byte array for BLOB type,
- current date, time, date+time is returned (measured at client side) for date, time and date/time types respectively,
- a null QVariant for unsupported values such as KDbField::InvalidType.
◆ escapeBLOB()
KDB_EXPORT QString KDb::escapeBLOB | ( | const QByteArray & | array, |
BLOBEscapingType | type ) |
- Returns
- a string containing escaped, printable representation of array. Escaping is controlled by type. For empty array, QString() is returned, so if you want to use this function in an SQL statement, empty arrays should be detected and "NULL" string should be put instead. This is helper, used in KDbDriver::escapeBLOB() and KDb::variantToString().
◆ escapeIdentifier() [1/4]
KDB_EXPORT QByteArray KDb::escapeIdentifier | ( | const KDbDriver * | driver, |
const QByteArray & | str ) |
Definition at line 417 of file KDbDriver.cpp.
◆ escapeIdentifier() [2/4]
- Returns
- string string with applied driver-specific identifier escaping if driver is not KDbSQL general identifier escaping when driver is 0.
This escaping can be used for field, table, database names, etc.
- See also
- KDb::escapeIdentifier
Definition at line 410 of file KDbDriver.cpp.
◆ escapeIdentifier() [3/4]
QByteArray KDb::escapeIdentifier | ( | const QByteArray & | string | ) |
◆ escapeIdentifier() [4/4]
- Returns
- string string with applied KDBSQL identifier escaping
This escaping can be used for field, table, database names, etc. Use it for user-visible backend-independent statements.
◆ escapeIdentifierAndAddQuotes() [1/2]
QByteArray KDb::escapeIdentifierAndAddQuotes | ( | const QByteArray & | string | ) |
◆ escapeIdentifierAndAddQuotes() [2/2]
- Returns
- string string with applied KDBSQL identifier escaping and enclosed in " quotes
This escaping can be used for field, table, database names, etc. Use it for user-visible backend-independent statements.
- See also
- KDb::escapeIdentifier
◆ escapeString() [1/3]
- Returns
- escaped string string for the KDBSQL dialect, i.e. doubles single quotes ("'") and inserts the string into single quotes. Quotes "'" are prepended and appended. Also escapes \n, \r, \t, \\, \0. Use it for user-visible backend-independent statements.
- See also
- unescapeString()
◆ escapeString() [2/3]
KDbEscapedString KDb::escapeString | ( | KDbConnection * | conn, |
const QString & | string ) |
Returns escaped string string.
If conn is present, its driver is used to perform escaping, otherwise escapeString() is used so the KDBSQL dialect-escaping is performed.
- Since
- 3.1.0
◆ escapeString() [3/3]
KDbEscapedString KDb::escapeString | ( | KDbDriver * | drv, |
const QString & | string ) |
Returns escaped string string.
If drv driver is present, it is used to perform escaping, otherwise escapeString() is used so the KDBSQL dialect-escaping is performed.
- Since
- 3.1.0
◆ fieldTypeNamesForGroup()
QStringList KDb::fieldTypeNamesForGroup | ( | KDbField::TypeGroup | typeGroup | ) |
◆ fieldTypesForGroup()
const QList< KDbField::Type > KDb::fieldTypesForGroup | ( | KDbField::TypeGroup | typeGroup | ) |
◆ fieldTypeStringsForGroup()
QStringList KDb::fieldTypeStringsForGroup | ( | KDbField::TypeGroup | typeGroup | ) |
◆ getFieldProperties()
void KDb::getFieldProperties | ( | const KDbField & | field, |
QMap< QByteArray, QVariant > * | values ) |
Gets property values for field. Properties from extended schema are included. values is cleared before filling. The same number of properties in the same order is returned. This function is used e.g. for altering table design. Nothing is performed if values is nullptr
.
- Todo
- IMPORTANT: values->insert("defaultWidth", field.defaultWidth());
◆ getHTMLErrorMesage() [1/3]
void KDb::getHTMLErrorMesage | ( | const KDbResultable & | resultable, |
KDbResultInfo * | info ) |
◆ getHTMLErrorMesage() [2/3]
void KDb::getHTMLErrorMesage | ( | const KDbResultable & | resultable, |
QString * | msg ) |
◆ getHTMLErrorMesage() [3/3]
void KDb::getHTMLErrorMesage | ( | const KDbResultable & | resultable, |
QString * | msg, | ||
QString * | details ) |
Sets HTML-formatted error message with extra details obtained from result object.
Sets string pointed by msg to an error message retrieved from resultable, and string pointed by details to details of this error (server message and result number). Does nothing if there is no error (resultable.result().isError() == false) or if msg or details is nullptr
. In this case strings pointer by msg and details strings are not changed. If the string pointed by msg is not empty, it is not modified and message obtained from resultable is appended to the string pointed by details instead.
◆ getLimitsForFieldType()
KDB_EXPORT void KDb::getLimitsForFieldType | ( | KDbField::Type | type, |
qlonglong * | minValue, | ||
qlonglong * | maxValue, | ||
KDb::Signedness | signedness = KDb::Signed ) |
Provides limits for values of type type.
The result is put into integers pointed by minValue and maxValue. The limits are machine-independent,. what is useful for format and protocol compatibility. Supported types are Byte, ShortInteger, Integer and BigInteger. The value of signedness controls the values; they can be limited to unsigned or not. Results for BigInteger or non-integer types are the same as for Integer due to limitation of int type. Signed integers are assumed. minValue and maxValue must not be 0.
◆ getProperties()
void KDb::getProperties | ( | const KDbLookupFieldSchema * | lookup, |
QMap< QByteArray, QVariant > * | values ) |
◆ identifierExpectedMessage()
- Returns
- useful message "Value of "valueName" field must be an identifier.
"v" is not a valid identifier.". It is also used by KDbIdentifierValidator.
◆ idForObjectName()
tristate KDb::idForObjectName | ( | KDbConnection * | conn, |
int * | id, | ||
const QString & | objName, | ||
int | objType ) |
Finds an identifier for object objName of type objType.
On success true is returned and *id is set to the value of the identifier. On failure or if conn is nullptr
, false
is returned. If there is no object with specified name and type, cancelled
value is returned.
◆ iif()
T KDb::iif | ( | bool | ok, |
const T & | value ) |
◆ iifNotEmpty() [1/3]
T KDb::iifNotEmpty | ( | const QByteArray & | string, |
const T & | stringIfEmpty ) |
◆ iifNotEmpty() [2/3]
T KDb::iifNotEmpty | ( | const T & | string, |
const QByteArray & | stringIfEmpty ) |
◆ iifNotEmpty() [3/3]
T KDb::iifNotEmpty | ( | const T & | string, |
const T & | stringIfEmpty ) |
- Returns
- string if it is not empty, else returns stringIfEmpty.
This function is an optimization in cases when string is a result of expensive functioncall because any evaluation will be performed once, not twice. Another advantage is simpified code through the functional approach. The function expects bool isEmpty() method to be present in type T, so T can typically be QString or QByteArray.
◆ importSqliteFile()
KDB_EXPORT bool KDb::importSqliteFile | ( | const QString & | inputFileName, |
const QString & | outputFileName ) |
Imports file in SQL format from inputFileName into outputFileName. Works for any SQLite 3 dump file. Requires access to executing the "sqlite3" command. File named outputFileName will be silently overwritten with a new SQLite 3 database file.
- Returns
- true on success.
◆ intToFieldType()
KDbField::Type KDb::intToFieldType | ( | int | type | ) |
- Returns
- type of field for integer value type. If type cannot be casted to KDbField::Type or is not normal type, i.e. type > KDbField::LastType (e.g. KDbField::Null), KDbField::InvalidType is returned. This can be used when type information is deserialized from a string or QVariant.
◆ intToFieldTypeGroup()
KDbField::TypeGroup KDb::intToFieldTypeGroup | ( | int | typeGroup | ) |
- Returns
- type group of field for integer value typeGroup. If typeGroup cannot be casted to KDbField::TypeGroup, KDbField::InvalidGroup is returned. This can be used when type information is deserialized from a string or QVariant.
- See also
- KDbField::typeGroupsCount()
◆ isBuiltinTableFieldProperty()
bool KDb::isBuiltinTableFieldProperty | ( | const QByteArray & | propertyName | ) |
for KDb::isBuiltinTableFieldProperty()
- Returns
- true if propertyName is a builtin field property.
◆ isDefaultValueAllowed()
KDB_EXPORT bool KDb::isDefaultValueAllowed | ( | const KDbField & | field | ) |
- Returns
- true if setting default value for field field is allowed. Fields with unique (and thus primary key) flags set do not accept default values.
◆ isEmptyValue()
bool KDb::isEmptyValue | ( | KDbField::Type | type, |
const QVariant & | value ) |
- Returns
- true if value value represents an empty (but not null) value.
- Case 1: If field type type is of any text type (KDbField::isTextType(type) == true) then the function returns true if value casted to a QString value is empty and not null.
- Case 2: If field type type is KDbField::BLOB then the function returns if value casted to a QByteArray value is empty and not null.
- Case 3: If field type type is of any other type then the function returns true if value.isNull().
- See also
- KDbField::hasEmptyProperty()
◆ isExtendedTableFieldProperty()
bool KDb::isExtendedTableFieldProperty | ( | const QByteArray & | propertyName | ) |
◆ isIdentifier()
KDB_EXPORT bool KDb::isIdentifier | ( | const QString & | s | ) |
- Returns
true
if s is a valid identifier, i.e. starts with a letter or '' character and contains only letters, numbers and '' character.
- Since
- 3.1
◆ isKDbSqlKeyword()
KDB_EXPORT bool KDb::isKDbSqlKeyword | ( | const QByteArray & | word | ) |
- Returns
- true if the word is an reserved KDBSQL keyword See generated/sqlkeywords.cpp.
- Todo
- add function returning list of keywords.
◆ isLookupFieldSchemaProperty()
bool KDb::isLookupFieldSchemaProperty | ( | const QByteArray & | propertyName | ) |
for isLookupFieldSchemaProperty()
- Returns
- true if propertyName is belongs to lookup field's schema.
◆ lastInsertedAutoIncValue() [1/3]
KDB_EXPORT quint64 KDb::lastInsertedAutoIncValue | ( | KDbConnection * | conn, |
const quint64 | recordId, | ||
const QString & | autoIncrementFieldName, | ||
const QString & | tableName ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Accepts recordId that can be obtained from KDbPreparedStatement::lastInsertRecordId() or KDbSqlResult::lastInsertRecordId().
◆ lastInsertedAutoIncValue() [2/3]
|
inline |
◆ lastInsertedAutoIncValue() [3/3]
KDB_EXPORT quint64 KDb::lastInsertedAutoIncValue | ( | QSharedPointer< KDbSqlResult > | result, |
const QString & | autoIncrementFieldName, | ||
const QString & | tableName, | ||
quint64 * | recordId = nullptr ) |
Returns value of last inserted record for an autoincrement field.
This method internally fetches values of the last inserted record for which result was returned and returns selected field's value. The field belong to tableName table. The field must be of integer type, there must be a record inserted using query for which the result is returned. std::numeric_limits<quint64>::max() is returned on error or if result is null. The last inserted record is identified by a magical record identifier, usually called ROWID (PostgreSQL has it as well as SQLite; see KDbDriverBehavior::ROW_ID_FIELD_RETURNS_LAST_AUTOINCREMENTED_VALUE). ROWID's value will be assigned back to recordId if this pointer is not nullptr
.
◆ libraryPaths()
KDB_EXPORT QStringList KDb::libraryPaths | ( | ) |
- Returns
- a list of paths that KDb will search when dynamically loading libraries (plugins) This is basicaly list of directories returned QCoreApplication::libraryPaths() that have readable subdirectory "kdb".
- See also
- QCoreApplication::libraryPaths()
◆ loadIntPropertyValueFromDom()
int KDb::loadIntPropertyValueFromDom | ( | const QDomNode & | node, |
bool * | ok ) |
Convenience version of loadPropertyValueFromDom().
- Returns
- int value.
◆ loadPropertyValueFromDom()
- Returns
- property value loaded from a DOM node, written in a QtDesigner-like notation: <number>int</number> or <bool>bool</bool>, etc. Supported types are "string", "cstring", "bool", "number". For invalid values null QVariant is returned. Validity of the returned value can be checked using the ok parameter and QVariant::type().
◆ loadStringPropertyValueFromDom()
Convenience version of loadPropertyValueFromDom().
- Returns
- QString value.
◆ maximumForIntegerFieldTypes()
KDB_EXPORT KDbField::Type KDb::maximumForIntegerFieldTypes | ( | KDbField::Type | t1, |
KDbField::Type | t2 ) |
- Returns
- type that's maximum of two integer types t1 and t2, e.g. Integer for (Byte, Integer). If one of the types is not of the integer group, KDbField::InvalidType is returned. Returned type may not fit to the result of evaluated expression that involves the arguments. For example, 100 is within Byte type, maximumForIntegerFieldTypes(Byte, Byte) is Byte but result of 100 * 100 exceeds the range of Byte.
◆ notEmptyValueForFieldType()
QVariant KDb::notEmptyValueForFieldType | ( | KDbField::Type | type | ) |
Used in KDb::notEmptyValueForFieldType()
- Returns
- a value that can be set for a database field of type type having "notEmpty" property set.
It works in a similar way as QVariant KDb::emptyValueForFieldType(KDbField::Type type) with the following differences:
- " " string (a single space) is returned for Text and LongText types
- a byte array with saved "filenew" PNG image (icon) for BLOB type Returns null QVariant for unsupported values like KDbField::InvalidType.
◆ numberToLocaleString() [1/2]
QString KDb::numberToLocaleString | ( | double | value, |
int | decimalPlaces ) |
Returns number converted to string using default locale.
This method is similar to KDb::numberToString() but the string is formatted using QLocale::toString().
◆ numberToLocaleString() [2/2]
◆ numberToString()
QString KDb::numberToString | ( | double | value, |
int | decimalPlaces ) |
- Returns
- string constructed by converting value. If decimalPlaces is < 0, all meaningful fractional digits are returned (up to 10). If automatically is 0, just integer part is returned. If automatically is > 0, fractional part should take exactly N digits: if the fractional part is shorter than N, additional zeros are appended. Examples: numberToString(12.345, 6) == "12.345000" numberToString(12.345, 0) == "12" numberToString(12.345, -1) == "12.345" numberToString(12.0, -1) == "12" numberToString(0.0, -1) == "0"
- Note
- No rounding is performed
- No thousands group separator is used. Decimal symbol is '.'.
◆ pgsqlByteaToByteArray()
KDB_EXPORT QByteArray KDb::pgsqlByteaToByteArray | ( | const char * | data, |
int | length = -1 ) |
- Returns
- byte array converted from data of length length. If length is negative, the data is assumed to point to a null-terminated string and its length is determined dynamically. data is escaped in format used by PostgreSQL's bytea datatype described at https://www.postgresql.org/docs/8.1/interactive/datatype-binary.html This function is used by PostgreSQL KDb and migration drivers.
◆ saveBooleanElementToDom()
QDomElement KDb::saveBooleanElementToDom | ( | QDomDocument * | doc, |
QDomElement * | parentEl, | ||
const QString & | elementName, | ||
bool | value ) |
Creates a new DOM element named elementName with boolean value value in doc document within parent element parentEl. This method is like saveNumberElementToDom() but creates "bool" tags. True/false values will be saved as "true"/"false" strings. Example: saveBooleanElementToDom(doc, parentEl, "visible", true) creates:
- Returns
- the reference to element created with tag elementName. Null element is returned if doc or parentEl is
nullptr
or if elementName is empty.
◆ saveNumberElementToDom()
QDomElement KDb::saveNumberElementToDom | ( | QDomDocument * | doc, |
QDomElement * | parentEl, | ||
const QString & | elementName, | ||
int | value ) |
Creates a new DOM element named elementName with numeric value value in doc document within parent element parentEl. The value will be enclosed in "number" element and "elementName" element. Example: saveNumberElementToDom(doc, parentEl, "height", 15) creates:
- Returns
- the reference to element created with tag elementName. Null element is returned if doc or parentEl is
nullptr
or if elementName is empty.
◆ serializeList()
KDB_EXPORT QString KDb::serializeList | ( | const QStringList & | list | ) |
- Returns
- string converted from list list. Separators are ',' characters, "," and "\\" are escaped.
- See also
- KDb::deserializeList()
◆ setFieldProperties()
bool KDb::setFieldProperties | ( | KDbField * | field, |
const QMap< QByteArray, QVariant > & | values ) |
Sets property values for field.
- Returns
- true if all the values are valid and allowed. On failure contents of field is undefined. Properties from extended schema are also supported. This function is used e.g. by KDbAlterTableHandler when property information comes in form of text. If field is
nullptr
nothing is performed andfalse
is returned.
- Todo
- IMPORTANT: defaultWidth
◆ setFieldProperty()
bool KDb::setFieldProperty | ( | KDbField * | field, |
const QByteArray & | propertyName, | ||
const QVariant & | value ) |
Sets value of a single property for field.
- Returns
- true if the property has been found and the value is valid for this property. On failure contents of field is not modified. Properties from extended schema are also supported as well as custom properties (using KDbField::setCustomProperty()).
This function is used e.g. by KDbAlterTableHandler when property information comes in form of text. If field is nullptr
nothing is performed and false
is returned.
- Todo
- IMPORTANT: defaultWidth
◆ showConnectionTestDialog()
tristate KDb::showConnectionTestDialog | ( | QWidget * | parent, |
const KDbConnectionData & | data, | ||
KDbMessageHandler * | msgHandler ) |
Shows connection test dialog.
Shows connection test dialog with a progress bar indicating connection testing (within a separate thread). data is used to perform a (temporary) test connection. msgHandler can be used for error handling. parent is used as dialog's parent widget.
The dialog is modal so the call is blocking.
On successful connecting, a successfull message of type KDbMessageHandler::Information is passed to msgHandler. After testing, temporary connection is closed.
- Returns
true
for successfull connecting,for
failed connecting andcancelled
if the test has been cancelled.
◆ simplifiedFieldTypeName()
KDB_EXPORT QString KDb::simplifiedFieldTypeName | ( | KDbField::Type | type | ) |
- Returns
- a slightly simplified field type name type type. For KDbField::BLOB type it returns a translated "Image" string or other, depending on the mime type. For numbers (either floating-point or integer) it returns a translated "Number" string. For other types KDbField::typeGroupName() is returned.
- Todo
- support names of other BLOB subtypes
◆ splitToTableAndFieldParts()
bool KDb::splitToTableAndFieldParts | ( | const QString & | string, |
QString * | tableName, | ||
QString * | fieldName, | ||
SplitToTableAndFieldPartsOptions | option = FailIfNoTableOrFieldName ) |
Splits string like "table.field" into "table" and "field" parts. On success, a table name is passed to tableName and a field name is passed to fieldName. The function fails if either:
- string is empty, or
- string does not contain '.' character and option is FailIfNoTableOrFieldName (the default), or
- '.' character is the first of last character of string (in this case table name or field name could become empty what is not allowed).
- tableName or fieldName is
nullptr
If option is SetFieldNameIfNoTableName and string does not contain '.', string is passed to fieldName and tableName is set to QString() without failure.
If function fails, tableName and fieldName remain unchanged.
- Returns
- true on success.
◆ sqlite3ProgramPath()
KDB_EXPORT QString KDb::sqlite3ProgramPath | ( | ) |
- Returns
- absolute path to "sqlite3" program. Empty string is returned if the program was not found.
◆ sqlWhere()
KDbEscapedString KDb::sqlWhere | ( | KDbDriver * | drv, |
KDbField::Type | t, | ||
const QString & | fieldName, | ||
const QVariant & | value ) |
◆ stringListToIntList()
KDB_EXPORT QList< int > KDb::stringListToIntList | ( | const QStringList & | list, |
bool * | ok = nullptr ) |
- Returns
- int list converted from string list. If ok is not 0, *ok is set to result of the conversion.
◆ stringToIdentifier()
- Returns
- valid identifier based on s. Non-alphanumeric characters (or spaces) are replaced with ''. If a number is at the beginning, '' is added at start. Empty strings are not changed. Case remains unchanged.
◆ stringToVariant()
KDB_EXPORT QVariant KDb::stringToVariant | ( | const QString & | s, |
QVariant::Type | type, | ||
bool * | ok ) |
- Returns
- variant value of type type for a string s that was previously serialized using variantToString( const QVariant& v ) function. ok is set to the result of the operation. With exception for types mentioned in documentation of variantToString(), QVariant::convert() is used for conversion.
◆ supportsVisibleDecimalPlacesProperty()
bool KDb::supportsVisibleDecimalPlacesProperty | ( | KDbField::Type | type | ) |
◆ temporaryTableName()
KDB_EXPORT QString KDb::temporaryTableName | ( | KDbConnection * | conn, |
const QString & | baseName ) |
- Returns
- new temporary name suitable for creating new table. The name has mask tmp__{baseName}{rand} where baseName is passed as argument and {rand} is a 10 digits long hexadecimal number. baseName can be empty. It is adviced to use the returned name as quickly as possible for creating new physical table. It is not 100% guaranteed that table with this name will not exist at an attempt of creation but it is very unlikely. The function checks for existence of a table with temporary name for connection conn. Empty string is returned if conn is
nullptr
or is not open or if checking for existence of table with temporary name failed.
◆ timeToIsoString()
KDB_EXPORT KDbEscapedString KDb::timeToIsoString | ( | const QVariant & | v | ) |
Converts time value to its string representation in ISO 8601 Time format.
The string is enclosed with single quotes "'". It is compatible with SQLite format for the time type. It is used as default implementation for drivers in KDbDriver::timeToSql().
If the v value is convertible to KDbTime then KDbTime::toString() is used to obtain the result. Otherwise the value is converted to QTime and QTime::toString() is used to obtain the result. If the time's milliseconds value is zero, it is not included.
"<INVALID_TIME>" string is returned for invalid (also null) time values.
For specification of the ISO format see https://www.w3.org/TR/NOTE-datetime.
Example values: "'13:15:30.123'", "'13:15:30'".
- Since
- 3.2.0
◆ timeToSql()
KDB_EXPORT KDbEscapedString KDb::timeToSql | ( | const QVariant & | v | ) |
Converts time value to its string representation required by KDBSQL commands.
The value can be of type QTime or KDbTime. If the value is not one of these types or is invalid QTime or is a null KDbTime then "<INVALID_TIME>" is returned. If the value is of type KDbTime that is not null then even if some components of the time are invalid, properly formatted string is returned. If the time's milliseconds value is zero, it is not included.
See https://community.kde.org/Kexi/Plugins/Queries/SQL_Constants for details.
Example values: "#13:15#", "#13:9:30#", "#13:15:30.921#, "#7:20 AM#".
- Since
- 3.2.0
◆ unescapeString()
KDB_EXPORT QString KDb::unescapeString | ( | const QString & | string, |
char | quote, | ||
int * | errorPosition = nullptr ) |
Unescapes characters in string string for the KDBSQL dialect.
The operation depends on quote character, which can be be ' or ". @a string is assumed to be properly constructed. This is assured by the lexer's grammar. Used by lexer to recognize the CHARACTER_STRING_LITERAL token. @return unescaped string and sets value pointed by @a errorPosition (if any) to -1 on success; and to index of problematic character on failure. The function fails when unsupported @a quote character is passed or for unsupported sequences. Example sequences for ' character quote: - \' -> ' (escaping) - \" -> " (escaping)
- '' -> ' (repeated quote escapes too)
- "" -> "" (repeated but this is not the quote)
- ' -> (disallowed, escaping needed)
- " -> " Example sequences for " character quote: - \' -> ' (escaping) - \" -> " (escaping)
- " -> " (disallowed, escaping needed)
- "" -> " (repeated quote escapes too)
- '' -> '' (repeated but this is not the quote)
- ' -> '
Following sequences are always unescaped (selection based on a mix of MySQL and C/JavaScript):
- \0 -> NULL (QChar())
- \b -> backspace 0x8
- \f -> form feed 0xc
- \n -> new line 0xa
- \r -> carriage return 0xd
- \t -> horizontal tab 0x9
- \v -> vertical tab 0xb
- \\ -> backslash
- \? -> ? (useful when '?' placeholders are used)
- \% -> (useful when '%' wildcards are used e.g. for the LIKE operator)
- _ -> (useful when '_' pattern is used e.g. for the LIKE operator)
- \xhh -> a character for which hh (exactly 2 digits) is interpreted as an hexadecimal
number, 00 <= hh <= FF. Widely supported by programming languages.
Can be also 00 <= hh <= ff.
Example: \xA9 translates to "©".
- \uxxxx -> 16-bit unicode character, exactly 4 digits, each x is a hexadecimal digit,
case insensitive; known from JavaScript, Java, C/C++. 0000 <= xxxxxx <= FFFF
Example: \u2665 translates to "♥".
- \u{xxxxxx} -> 24-bit unicode "code point" character, each x is a hexadecimal digit,
case insensitive; known from JavaScript (ECMAScript 6). 0 <= xxxxxx <= 10FFFF
Example: \u{1D306} translates to "𝌆"
@note Characters without special meaning can be escaped, but then the "" character is skipped, e.g. "\a" == "a".
- Note
- Trailing "\" character in string is ignored.
- \nnn octal notation is not supported, it may be confusing and conflicting when combined with other characters (\0012 is not the same as \012). The industry is moving away from it and EcmaScript 5 deprecates it.
- https://dev.mysql.com/doc/refman/5.7/en/string-literals.html
- https://en.wikipedia.org/wiki/Escape_sequences_in_C#Table_of_escape_sequences
- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Grammar_and_types#Using_special_characters_in_strings
- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#String_literals
◆ valueToSql() [1/2]
|
inline |
Definition at line 444 of file KDbDriver.h.
◆ valueToSql() [2/2]
KDB_EXPORT KDbEscapedString KDb::valueToSql | ( | KDbField::Type | ftype, |
const QVariant & | v ) |
Escapes and converts value v (for type ftype) to string representation required by KDBSQL commands. For Date/Time type KDb::dateTimeToSql() is used. For BLOB type KDb::escapeBlob() with BLOBEscapingType::ZeroXHex conversion type is used.
◆ variantToString()
- Returns
- string value serialized from a variant value v. This functions works like QVariant::toString() except the case when v is of type:
- QByteArray - in this case KDb::escapeBLOB(v.toByteArray(), KDb::BLOBEscapeHex) is used.
- QStringList - in this case KDb::serializeList(v.toStringList()) is used.
This function is needed for handling values of random type, for example "defaultValue" property of table fields can contain value of any type. Note: the returned string is an unescaped string.
◆ version()
KDbVersionInfo KDb::version | ( | ) |
- Returns
- runtime information about version of the KDb library.
◆ xHexToByteArray()
KDB_EXPORT QByteArray KDb::xHexToByteArray | ( | const char * | data, |
int | length = -1, | ||
bool * | ok = nullptr ) |
- Returns
- byte array converted from data of length length. If length is negative, the data is assumed to point to a null-terminated string and its length is determined dynamically. data is escaped in format X'*', where * is one or more hexadecimal digits. Both A-F and a-f letters are supported. Even and odd number of digits are supported. If ok is not 0, *ok is set to result of the conversion. See BLOBEscapingType::XHex.
◆ zeroXHexToByteArray()
KDB_EXPORT QByteArray KDb::zeroXHexToByteArray | ( | const char * | data, |
int | length = -1, | ||
bool * | ok = nullptr ) |
- Returns
- byte array converted from data of length length. If length is negative, the data is assumed to point to a null-terminated string and its length is determined dynamically. data is escaped in format 0x*, where * is one or more hexadecimal digits. Both A-F and a-f letters are supported. Even and odd number of digits are supported. If ok is not 0, *ok is set to result of the conversion. See BLOBEscapingType::ZeroXHex.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 27 2024 11:47:15 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.