kexi

KexiDB Namespace Reference


Detailed Description

High-level database connectivity library with database backend drivers.

Author:
Jaroslaw Staniek <js@iidea.pl>

Framework

DriverManager

Database access

Database structure

  • Schema
    • tableschema
    • queryschema
    • indexschema

Stored in the database.

Data representation

Drivers

Drivers are loaded using DriverManager::driver(const QString& name). The names of drivers are given in their drivers .desktop file in the X-Kexi-DriverName field.

KexiDB supports two kinds of databases: file-based and network-based databases. The type of a driver is available from several places. The X-Kexi-DriverType field in the driver's .desktop file, is read by the DriverManager and available by calling DriverManager::driverInfo(const QString &name) and using the Driver::Info::fileBased member from the result. Given a reference to a Driver, its type can also be found directly using Driver::isFileDriver() const.

Each database backend driver consists of three main classes: a driver, a connection and a cursor class, e.g SQLiteDriver, SQLiteConnection, SQLiteCursor.

The driver classes subclass the Driver class. They set Driver::m_typeNames, which maps KexiDB's Field::Type on to the types supported by the database. They also provide functions for escaping strings and checking table names. These may be used, for example, on a database backend that uses the database name as a filename. In this case, it should be ensured that all the characters in the database name are valid characters in a filename.

The connection classes subclass the Connection class, and include most of the calls to the native database API.

The cursor classes subclass Cursor, and implement cursor functionality specific to the database backend.


Classes

class  AdminTools
 An interface containing a set of tools for database administration. More...
class  AlterTableHandler
 A tool for handling altering database table schema. More...
class  Connection
 Provides database connection, allowing queries and data modification. More...
class  ConnectionDataBase
class  ConnectionData
 Database specific connection data, e.g. host, port. More...
class  Cursor
 Provides database cursor functionality. More...
class  ObjectNameValidator
class  DatabaseProperties
 A set of storable database properties. More...
class  Driver
 Generic database abstraction. More...
class  DriverManager
 Database driver management, e.g. finding and loading drivers. More...
class  MySqlConnection
class  MySqlCursor
class  MySqlDriver
 MySQL database driver. More...
class  MySqlPreparedStatement
class  pqxxTransactionData
class  pqxxSqlConnection
 
Author:
Adam Pigg
More...
class  pqxxSqlCursor
class  pqxxSqlDriver
 PostgreSQL database driver. More...
class  pqxxPreparedStatement
 
Author:
Adam Pigg <adam@piggz.co.uk>
More...
class  SQLiteConnection
 sqlite-specific connection More...
class  SQLiteCursor
class  SQLiteDriver
 SQLite database driver. More...
class  SQLitePreparedStatement
class  ResultInfo
class  BaseExpr
 A base class for all expressions. More...
class  NArgExpr
 A base class N-argument operation. More...
class  UnaryExpr
 An unary argument operation: + - NOT (or !) ~ "IS NULL" "IS NOT NULL". More...
class  BinaryExpr
class  ConstExpr
class  QueryParameterExpr
 Query parameter used to getting user input of constant values. More...
class  VariableExpr
 Variables like fieldname or tablename.fieldname. More...
class  FunctionExpr
 
  • aggregation functions like SUM, COUNT, MAX, .
More...
class  Field
 Meta-data for a field. More...
class  FieldList
class  FieldValidator
 A validator for KexiDB data types. More...
class  DatabaseVersionInfo
 Contains database version information about a Kexi-compatible database. The version is stored as internal database properties. More...
class  ServerVersionInfo
 Contains version information about a database backend. More...
class  IndexSchema
 Provides information about database index that can be created for a database table. More...
class  LookupFieldSchema
 Provides information about lookup field's setup. More...
class  MessageTitle
class  MessageHandler
class  Object
class  ParserError
 Provides detailed i18n'ed error description about the Parser . More...
class  Parser
 Parser for SQL statements. More...
class  PreparedStatement
 Prepared database command for optimizing sequences of multiple database actions. More...
class  QueryColumnInfo
 Helper class that assigns additional information for the column in a query. More...
class  OrderByColumn
 KexiDB::OrderByColumn provides information about a single query column used for sorting. More...
class  OrderByColumnList
 KexiDB::OrderByColumnList provides list of sorted columns for a query schema. More...
class  QuerySchema
 KexiDB::QuerySchema provides information about database query. More...
class  QueryAsterisk
 KexiDB::QueryAsterisk class encapsulates information about single asterisk in query definition. More...
class  QuerySchemaParameter
 A single parameter of a query schema. More...
class  QuerySchemaParameterValueListIterator
 An iteratof for a list of values of query schema parameters providing Allows to iterate over parameters and return QVariant value or well-formatted string. More...
class  Record
class  Relationship
class  RowEditBuffer
 provides data for single edited database row KexiDB::RowEditBuffer provides data for single edited row, needed to perform update at the database backend. Its advantage over pasing e.g. KexiDB::FieldList object is that EditBuffer contains only changed values. More...
class  SchemaData
class  SimpleCommandLineApp
 A skeleton for creating a simple command line database application. More...
class  TableSchema
class  InternalTableSchema
class  TransactionData
class  Transaction
 This class encapsulates transaction handle. More...
class  TransactionGuard
 Helper class for using inside methods for given connection. More...
class  TableOrQuerySchema

Typedefs

typedef QValueVector< QVariant > RowData
typedef QValueList< QuerySchemaParameterQuerySchemaParameterList
typedef QValueList< OrderByColumnOrderByColumnListBase
typedef QValueList< QuerySchemaParameterQuerySchemaParameterList
typedef QValueList< QuerySchemaParameter
>::Iterator 
QuerySchemaParameterListIterator
typedef QValueList< QuerySchemaParameter
>::ConstIterator 
QuerySchemaParameterListConstIterator
typedef QValueList< uint > TypeGroupList

Enumerations

enum  ObjectTypes {
  UnknownObjectType = -1, AnyObjectType = 0, TableObjectType = 1, QueryObjectType = 2,
  LastObjectType = 2, KexiDBSystemTableObjectType = 128, IndexObjectType = 256
}
enum  SplitToTableAndFieldPartsOptions { FailIfNoTableOrFieldName = 0, SetFieldNameIfNoTableName = 1 }
enum  BLOBEscapingType { BLOBEscapeXHex = 1, BLOBEscape0xHex, BLOBEscapeHex, BLOBEscapeOctal }

Functions

QVariant pgsqlCStrToVariant (const pqxx::result::field &r)
KEXI_DB_EXPORT QString exprClassName (int c)
DatabaseVersionInfo version ()
void debug (const QuerySchemaParameterList &list)
const TypeGroupList typesForGroup (KexiDB::Field::TypeGroup typeGroup)
QStringList typeNamesForGroup (KexiDB::Field::TypeGroup typeGroup)
QStringList typeStringsForGroup (KexiDB::Field::TypeGroup typeGroup)
KexiDB::Field::Type defaultTypeForGroup (KexiDB::Field::TypeGroup typeGroup)
void getHTMLErrorMesage (Object *obj, QString &msg, QString &details)
void getHTMLErrorMesage (Object *obj, QString &msg)
void getHTMLErrorMesage (Object *obj, ResultInfo *result)
int idForObjectName (Connection &conn, const QString &objName, int objType)
void connectionTestDialog (QWidget *parent, const KexiDB::ConnectionData &data, KexiDB::MessageHandler &msgHandler)
int rowCount (Connection &conn, const QString &sql)
int rowCount (const TableSchema &tableSchema)
int rowCount (QuerySchema &querySchema)
int rowCount (TableOrQuerySchema &tableOrQuery)
int fieldCount (KexiDB::TableOrQuerySchema &tableOrQuery)
QMap< QString, QString > toMap (const ConnectionData &data)
void fromMap (const QMap< QString, QString > &map, ConnectionData &data)
bool splitToTableAndFieldParts (const QString &string, QString &tableName, QString &fieldName, SplitToTableAndFieldPartsOptions option)
bool supportsVisibleDecimalPlacesProperty (Field::Type type)
QString formatNumberForVisibleDecimalPlaces (double value, int decimalPlaces)
KexiDB::Field::Type intToFieldType (int type)
bool isBuiltinTableFieldProperty (const QCString &propertyName)
bool setFieldProperties (Field &field, const QMap< QCString, QVariant > &values)
bool isExtendedTableFieldProperty (const QCString &propertyName)
bool setFieldProperty (Field &field, const QCString &propertyName, const QVariant &value)
int loadIntPropertyValueFromDom (const QDomNode &node, bool *ok)
QString loadStringPropertyValueFromDom (const QDomNode &node, bool *ok)
QVariant loadPropertyValueFromDom (const QDomNode &node)
QDomElement saveNumberElementToDom (QDomDocument &doc, QDomElement &parentEl, const QString &elementName, int value)
QDomElement saveBooleanElementToDom (QDomDocument &doc, QDomElement &parentEl, const QString &elementName, bool value)
QVariant emptyValueForType (KexiDB::Field::Type type)
QVariant notEmptyValueForType (KexiDB::Field::Type type)
QString escapeBLOB (const QByteArray &array, BLOBEscapingType type)
QByteArray pgsqlByteaToByteArray (const char *data, int length)
QString variantToString (const QVariant &v)
QVariant stringToVariant (const QString &s, QVariant::Type type, bool &ok)
bool isDefaultValueAllowed (KexiDB::Field *field)
void getLimitsForType (Field::Type type, int &minValue, int &maxValue)
void debugRowData (const RowData &rowData)
Field::Type maximumForIntegerTypes (Field::Type t1, Field::Type t2)
KEXI_DB_EXPORT bool deleteRow (Connection &conn, TableSchema *table, const QString &keyname, const QString &keyval)
KEXI_DB_EXPORT bool deleteRow (Connection &conn, const QString &tableName, const QString &keyname, const QString &keyval)
KEXI_DB_EXPORT bool deleteRow (Connection &conn, TableSchema *table, const QString &keyname, int keyval)
KEXI_DB_EXPORT bool deleteRow (Connection &conn, const QString &tableName, const QString &keyname, int keyval)
KEXI_DB_EXPORT bool deleteRow (Connection &conn, const QString &tableName, const QString &keyname1, Field::Type keytype1, const QVariant &keyval1, const QString &keyname2, Field::Type keytype2, const QVariant &keyval2)
KEXI_DB_EXPORT bool replaceRow (Connection &conn, TableSchema *table, const QString &keyname, const QString &keyval, const QString &valname, QVariant val, int ftype)
bool isEmptyValue (Field *f, const QVariant &v)
KEXI_DB_EXPORT QString sqlWhere (Driver *drv, Field::Type t, const QString fieldName, const QVariant value)
QVariant cstringToVariant (const char *data, KexiDB::Field *f, int length=-1)

Variables

static bool _dummy

Typedef Documentation

A base for KexiDB::OrderByColumnList.

Definition at line 155 of file queryschema.h.

typedef QValueVector<QVariant> KexiDB::RowData

structure for storing single record with type information

Definition at line 47 of file connection.h.


Enumeration Type Documentation

Escaping types used in escapeBLOB().

Enumerator:
BLOBEscapeXHex  escaping like X'1FAD', used by sqlite (hex numbers)
BLOBEscape0xHex  escaping like 0x1FAD, used by mysql (hex numbers)
BLOBEscapeHex  escaping like 1FAD without quotes or prefixes
BLOBEscapeOctal  escaping like 'zk\000$x', used by pgsql (only non-printable characters are escaped using octal numbers) See http://www.postgresql.org/docs/8.1/interactive/datatype-binary.html

Definition at line 382 of file kexidb/utils.h.

Object types set like table or query.

Enumerator:
UnknownObjectType  helper
AnyObjectType  helper
KexiDBSystemTableObjectType  helper, not used in storage (allows to select kexidb system tables may be or'd with TableObjectType)
IndexObjectType  special

Definition at line 147 of file global.h.

Used in splitToTableAndFieldParts().

Enumerator:
FailIfNoTableOrFieldName  default value for splitToTableAndFieldParts()
SetFieldNameIfNoTableName  see splitToTableAndFieldParts()

Definition at line 265 of file kexidb/utils.h.


Function Documentation

KEXI_DB_EXPORT void KexiDB::connectionTestDialog ( QWidget *  parent,
const ConnectionData data,
MessageHandler msgHandler 
)

shows connection test dialog with a progress bar indicating connection testing (within a second thread). data is used to perform a (temporary) test connection. msgHandler is used to display errors. On successful connecting, a message is displayed. After testing, temporary connection is closed.

Definition at line 486 of file kexidb/utils.cpp.

QVariant KexiDB::cstringToVariant ( const char *  data,
KexiDB::Field f,
int  length = -1 
) [inline]

Returns:
QVariant value converted from null-terminated data string. In case of BLOB type, data is not nul lterminated, so passing length is needed.

Todo:
date/time?

Definition at line 440 of file kexidb/utils.h.

KEXI_DB_EXPORT void KexiDB::debug ( const QuerySchemaParameterList list  ) 

Shows debug information for list.

Definition at line 42 of file queryschemaparameter.cpp.

KEXI_DB_EXPORT void KexiDB::debugRowData ( const RowData &  rowData  ) 

Shows debug information about rowData row data.

Definition at line 1229 of file kexidb/utils.cpp.

KEXI_DB_EXPORT Field::Type KexiDB::defaultTypeForGroup ( Field::TypeGroup  typeGroup  ) 

Returns:
default field type for type group typeGroup, for example, Field::Integer for Field::IntegerGroup. It is used e.g. in KexiAlterTableDialog, to properly fill 'type' property when user selects type group for a field.

Definition at line 105 of file kexidb/utils.cpp.

KEXI_DB_EXPORT bool KexiDB::deleteRow ( Connection &  conn,
const QString &  tableName,
const QString &  keyname1,
Field::Type  keytype1,
const QVariant &  keyval1,
const QString &  keyname2,
Field::Type  keytype2,
const QVariant &  keyval2 
) [inline]

Delete row with two generic criterias.

Definition at line 66 of file kexidb/utils.h.

KEXI_DB_EXPORT bool KexiDB::deleteRow ( Connection &  conn,
TableSchema *  table,
const QString &  keyname,
const QString &  keyval 
) [inline]

for convenience

Definition at line 37 of file kexidb/utils.h.

KEXI_DB_EXPORT QVariant KexiDB::emptyValueForType ( Field::Type  type  ) 

Returns:
an empty value that can be set for a database field of type type having "null" property set. Empty string is returned for text type, 0 for integer or floating-point types, false for boolean type, empty null byte array for BLOB type. For date, time and date/time types current date, time, date+time is returned, respectively. Returns null QVariant for unsupported values like KexiDB::Field::InvalidType. This function is efficient (uses a cache) and is heavily used by the AlterTableHandler for filling new columns.

Definition at line 976 of file kexidb/utils.cpp.

KEXI_DB_EXPORT QString KexiDB::escapeBLOB ( const QByteArray &  array,
BLOBEscapingType  type 
)

Returns:
a string containing escaped, printable representation of array. Escaping is controlled by type. For empty array QString::null 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 Driver::escapeBLOB() and KexiDB::variantToString().

Definition at line 1061 of file kexidb/utils.cpp.

KEXI_DB_EXPORT QString KexiDB::exprClassName ( int  c  ) 

Returns:
class name of class c

Definition at line 35 of file expression.cpp.

KEXI_DB_EXPORT int KexiDB::fieldCount ( TableOrQuerySchema tableOrQuery  ) 

Returns:
a number of columns that can be retrieved from table or query schema. In case of query, expanded fields are counted. Can return -1 if tableOrQuery has neither table or query assigned.

Definition at line 542 of file kexidb/utils.cpp.

KEXI_DB_EXPORT QString KexiDB::formatNumberForVisibleDecimalPlaces ( double  value,
int  decimalPlaces 
)

Returns:
string constructed by converting value. If decimalPlaces is < 0, all meaningful fractional digits are returned. 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. For example, "12.345" becomes "12.345000" if N=6.
No rounding is actually performed. KLocale::formatNumber() and KLocale::decimalSymbol() are used to get locale settings.

See also:
KexiDB::Field::visibleDecimalPlaces()

Definition at line 606 of file kexidb/utils.cpp.

KEXI_DB_EXPORT void KexiDB::fromMap ( const QMap< QString, QString > &  map,
ConnectionData data 
)

Restores connection data data from map.

Definition at line 568 of file kexidb/utils.cpp.

KEXI_DB_EXPORT void KexiDB::getHTMLErrorMesage ( Object obj,
ResultInfo result 
)

This methods works like above, but works on result's members instead.

Definition at line 173 of file kexidb/utils.cpp.

KEXI_DB_EXPORT void KexiDB::getHTMLErrorMesage ( Object obj,
QString &  msg 
)

This methods works like above, but appends both a message and a description to msg.

Definition at line 168 of file kexidb/utils.cpp.

KEXI_DB_EXPORT void KexiDB::getHTMLErrorMesage ( Object obj,
QString &  msg,
QString &  details 
)

Sets msg to an error message retrieved from object obj, and details to details of this error (server message and result number). Does nothing if obj is null or no error occurred. msg and details strings are not overwritten. If msg is not empty, obj's error message is appended to details.

Definition at line 112 of file kexidb/utils.cpp.

KEXI_DB_EXPORT void KexiDB::getLimitsForType ( Field::Type  type,
int &  minValue,
int &  maxValue 
)

Gets limits for values of type type. The result is put into minValue and maxValue. Supported types are Byte, ShortInteger, Integer and BigInteger Results for BigInteger or non-integer types are the same as for Integer due to limitation of int type. Signed integers are assumed.

Todo:
add support for unsigned flag

Definition at line 1209 of file kexidb/utils.cpp.

KEXI_DB_EXPORT int KexiDB::idForObjectName ( Connection conn,
const QString &  objName,
int  objType 
)

Returns:
identifier for object objName of type objType or 0 if such object does not exist.

Definition at line 178 of file kexidb/utils.cpp.

KEXI_DB_EXPORT Field::Type KexiDB::intToFieldType ( int  type  ) 

Returns:
type of field for integer value type. If type cannot be casted to KexiDB::Field::Type, KexiDB::Field::InvalidType is returned. This can be used when type information is deserialized from a string or QVariant.

Definition at line 624 of file kexidb/utils.cpp.

KEXI_DB_EXPORT bool KexiDB::isBuiltinTableFieldProperty ( const QCString &  propertyName  ) 

Returns:
true if propertyName is a builtin field property.

Todo:
always update this when new builtins appear!

Definition at line 650 of file kexidb/utils.cpp.

KEXI_DB_EXPORT bool KexiDB::isDefaultValueAllowed ( Field 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. False is returned aslo if field is 0.

Definition at line 1204 of file kexidb/utils.cpp.

bool KexiDB::isEmptyValue ( Field *  f,
const QVariant &  v 
) [inline]

Returns:
true if v represents an empty (but not null) value. Values of some types (as for strings) can be both empty and not null.

Definition at line 105 of file kexidb/utils.h.

KEXI_DB_EXPORT bool KexiDB::isExtendedTableFieldProperty ( const QCString &  propertyName  ) 

Returns:
true if propertyName is an extended field property.

Definition at line 758 of file kexidb/utils.cpp.

KEXI_DB_EXPORT int KexiDB::loadIntPropertyValueFromDom ( const QDomNode &  node,
bool *  ok 
)

Convenience version of loadPropertyValueFromDom().

Returns:
int value.

Definition at line 889 of file kexidb/utils.cpp.

KEXI_DB_EXPORT QVariant KexiDB::loadPropertyValueFromDom ( const QDomNode &  node  ) 

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. You can check the validity of the returned value using QVariant::type().

Definition at line 913 of file kexidb/utils.cpp.

KEXI_DB_EXPORT QString KexiDB::loadStringPropertyValueFromDom ( const QDomNode &  node,
bool *  ok 
)

Convenience version of loadPropertyValueFromDom().

Returns:
QString value.

Definition at line 902 of file kexidb/utils.cpp.

KEXI_DB_EXPORT Field::Type KexiDB::maximumForIntegerTypes ( Field::Type  t1,
Field::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, Field::InvalidType is returned.

Definition at line 1236 of file kexidb/utils.cpp.

KEXI_DB_EXPORT QVariant KexiDB::notEmptyValueForType ( Field::Type  type  ) 

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 emptyValueForType( KexiDB::Field::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 KexiDB::Field::InvalidType. This function is efficient (uses a cache) and is heavily used by the AlterTableHandler for filling new columns.

Definition at line 1016 of file kexidb/utils.cpp.

KEXI_DB_EXPORT QByteArray KexiDB::pgsqlByteaToByteArray ( const char *  data,
int  length 
)

Returns:
byte array converted from data of length length. data is escaped in format used by PostgreSQL's bytea datatype described at http://www.postgresql.org/docs/8.1/interactive/datatype-binary.html This function is used by PostgreSQL KexiDB and migration drivers.

Definition at line 1116 of file kexidb/utils.cpp.

KEXI_DB_EXPORT int KexiDB::rowCount ( TableOrQuerySchema tableOrQuery  ) 

Like above but operates on a table or query schema variant.

Definition at line 533 of file kexidb/utils.cpp.

KEXI_DB_EXPORT int KexiDB::rowCount ( QuerySchema querySchema  ) 

Like above but operates on a query schema.

Definition at line 517 of file kexidb/utils.cpp.

KEXI_DB_EXPORT int KexiDB::rowCount ( const TableSchema tableSchema  ) 

Returns:
number of rows that can be retrieved from tableSchema. The table must be created or retrieved using a Connection object, i.e. tableSchema.connection() must not return 0. For SQL data sources it does not fetch any records, only "COUNT(*)" SQL aggregation is used at the backed. -1 is returned if error occurred.

Definition at line 501 of file kexidb/utils.cpp.

int KexiDB::rowCount ( Connection conn,
const QString &  sql 
)

Returns:
number of rows that can be retrieved after executing sql statement within a connection conn. The statement should be of type SELECT. For SQL data sources it does not fetch any records, only "COUNT(*)" SQL aggregation is used at the backed. -1 is returned if error occured.

Definition at line 493 of file kexidb/utils.cpp.

KEXI_DB_EXPORT QDomElement KexiDB::saveBooleanElementToDom ( QDomDocument &  doc,
QDomElement &  parentEl,
const QString &  elementName,
bool  value 
)

Saves boolean element for value value to doc document within parent element parentEl. Like saveNumberElementToDom() but creates "bool" tags. True/false values will be saved as "true"/"false" strings.

Returns:
the reference to element created with tag elementName.

Definition at line 960 of file kexidb/utils.cpp.

KEXI_DB_EXPORT QDomElement KexiDB::saveNumberElementToDom ( QDomDocument &  doc,
QDomElement &  parentEl,
const QString &  elementName,
int  value 
)

Saves integer element for value value to doc document within parent element parentEl. The value will be enclosed in "number" element and "elementName" element. Example: saveNumberElementToDom(doc, parentEl, "height", 15) will create

      <height><number>15</number></height>
Returns:
the reference to element created with tag elementName.

Definition at line 949 of file kexidb/utils.cpp.

KEXI_DB_EXPORT bool KexiDB::setFieldProperties ( Field field,
const QMap< QCString, 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 coming from extended schema are also supported. This function is used e.g. by AlterTableHandler when property information comes in form of text.

Definition at line 677 of file kexidb/utils.cpp.

KEXI_DB_EXPORT bool KexiDB::setFieldProperty ( Field field,
const QCString &  propertyName,
const QVariant &  value 
)

Sets property value for field.

Returns:
true if the property has been found and the value is valid for this property. On failure contents of field is undefined. Properties coming from extended schema are also supported as well as QVariant customProperty(const QString& propertyName) const;
This function is used e.g. by AlterTableHandler when property information comes in form of text.

Definition at line 779 of file kexidb/utils.cpp.

KEXI_DB_EXPORT bool KexiDB::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).

If option is SetFieldNameIfNoTableName and string does not contain '.', string is passed to fieldName and tableName is set to QString::null without failure.

If function fails, tableName and fieldName remain unchanged.

Returns:
true on success.

Definition at line 583 of file kexidb/utils.cpp.

KEXI_DB_EXPORT QString KexiDB::sqlWhere ( Driver *  drv,
Field::Type  t,
const QString  fieldName,
const QVariant  value 
) [inline]

Function useful for building WHERE parts of sql statements. Constructs an sql string like "fielname = value" for specific drv driver, field type t, fieldName and value. If value is null, "fieldname is NULL" string is returned.

Definition at line 130 of file kexidb/utils.h.

KEXI_DB_EXPORT QVariant KexiDB::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.

Definition at line 1171 of file kexidb/utils.cpp.

KEXI_DB_EXPORT bool KexiDB::supportsVisibleDecimalPlacesProperty ( Field::Type  type  ) 

Returns:
true if type supports "visibleDecimalPlaces" property.

Definition at line 600 of file kexidb/utils.cpp.

KEXI_DB_EXPORT QMap< QString, QString > KexiDB::toMap ( const ConnectionData data  ) 

Saves connection data data into map.

Definition at line 551 of file kexidb/utils.cpp.

KEXI_DB_EXPORT QStringList KexiDB::typeNamesForGroup ( Field::TypeGroup  typeGroup  ) 

Returns:
list of i18n'd type names for type group typeGroup.

Definition at line 91 of file kexidb/utils.cpp.

KEXI_DB_EXPORT const TypeGroupList KexiDB::typesForGroup ( Field::TypeGroup  typeGroup  ) 

Returns:
list of types for type group typeGroup.

Definition at line 84 of file kexidb/utils.cpp.

KEXI_DB_EXPORT QStringList KexiDB::typeStringsForGroup ( Field::TypeGroup  typeGroup  ) 

Returns:
list of (not-i18n'd) type names for type group typeGroup.

Definition at line 98 of file kexidb/utils.cpp.

KEXI_DB_EXPORT QString KexiDB::variantToString ( const QVariant &  v  ) 

Returns:
string value serialized from a variant value v. This functions works like QVariant::toString() except the case when v is of type ByteArray. In this case KexiDB::escapeBLOB(v.toByteArray(), KexiDB::BLOBEscapeHex) 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.

Definition at line 1164 of file kexidb/utils.cpp.

KEXI_DB_EXPORT DatabaseVersionInfo KexiDB::version (  ) 

Returns the encoded number of Kexi's version, see the KEXI_VERSION macro.

In contrary to that macro this function returns the number of the actually installed Kexi version, not the number of the Kexi version that was installed when the program was compiled.

Returns:
the version number, encoded in a single uint

Definition at line 55 of file global.cpp.


Variable Documentation

bool KexiDB::_dummy [static]

QAsciiDict keys need to be a pointer to *something*. Used for SQL keyword dictionaries

Definition at line 34 of file driver_p.cpp.

KDE Home | KDE Accessibility Home | Description of Access Keys