kexi

KexiDB Namespace Reference

Classes

class  AdminTools
class  AlterTableHandler
class  Connection
class  ConnectionDataBase
class  ConnectionData
class  Cursor
class  ObjectNameValidator
class  DatabaseProperties
class  Driver
class  DriverManager
class  MySqlConnection
class  MySqlDriver
class  MySqlPreparedStatement
class  pqxxSqlConnection
class  pqxxSqlDriver
class  pqxxPreparedStatement
class  SQLiteConnection
class  SQLiteDriver
class  SQLitePreparedStatement
class  ResultInfo
class  BaseExpr
class  NArgExpr
class  UnaryExpr
class  BinaryExpr
class  ConstExpr
class  QueryParameterExpr
class  VariableExpr
class  FunctionExpr
class  Field
class  FieldList
class  FieldValidator
class  DatabaseVersionInfo
class  ServerVersionInfo
class  IndexSchema
class  LookupFieldSchema
class  MessageTitle
class  MessageHandler
class  Object
class  ParserError
class  Parser
class  PreparedStatement
class  QueryColumnInfo
class  OrderByColumn
class  OrderByColumnList
class  QuerySchema
class  QueryAsterisk
class  QuerySchemaParameter
class  QuerySchemaParameterValueListIterator
class  Record
class  RowEditBuffer
class  SchemaData
class  SimpleCommandLineApp
class  TableSchema
class  InternalTableSchema
class  TransactionData
class  Transaction
class  TransactionGuard
class  TableOrQuerySchema

Typedefs

typedef TQValueVector< TQVariant > RowData
typedef TQValueList< QuerySchemaParameter > QuerySchemaParameterList
typedef TQValueList< OrderByColumn > OrderByColumnListBase
typedef TQValueList< QuerySchemaParameter >::Iterator QuerySchemaParameterListIterator
typedef TQValueList< QuerySchemaParameter >::ConstIterator QuerySchemaParameterListConstIterator
typedef TQValueList< 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

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

Variables

static bool _dummy

Detailed Description

High-level database connectivity library with database backend drivers.

Author
Jaroslaw Staniek js@ii.nosp@m.dea..nosp@m.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 TQString& 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 TQString &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.

Typedef Documentation

◆ OrderByColumnListBase

A base for KexiDB::OrderByColumnList.

Definition at line 155 of file queryschema.h.

◆ QuerySchemaParameterList

typedef TQValueList< QuerySchemaParameter > KexiDB::QuerySchemaParameterList

Definition at line 39 of file queryschema.h.

◆ QuerySchemaParameterListConstIterator

typedef TQValueList<QuerySchemaParameter>::ConstIterator KexiDB::QuerySchemaParameterListConstIterator

Definition at line 43 of file queryschemaparameter.h.

◆ QuerySchemaParameterListIterator

typedef TQValueList<QuerySchemaParameter>::Iterator KexiDB::QuerySchemaParameterListIterator

Definition at line 42 of file queryschemaparameter.h.

◆ RowData

typedef TQValueVector<TQVariant> KexiDB::RowData

structure for storing single record with type information

Definition at line 47 of file connection.h.

◆ TypeGroupList

typedef TQValueList<uint> KexiDB::TypeGroupList

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

Enumeration Type Documentation

◆ BLOBEscapingType

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 389 of file kexidb/utils.h.

◆ ObjectTypes

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.

◆ SplitToTableAndFieldPartsOptions

Used in splitToTableAndFieldParts().

Enumerator
FailIfNoTableOrFieldName 

default value for splitToTableAndFieldParts()

SetFieldNameIfNoTableName 

see splitToTableAndFieldParts()

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

Function Documentation

◆ connectionTestDialog()

void KexiDB::connectionTestDialog ( TQWidget * parent,
const ConnectionData & data,
KexiDB::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.

◆ cstringToVariant()

TQVariant KexiDB::cstringToVariant ( const char * data,
KexiDB::Field * f,
int length = -1 )
inline
Returns
TQVariant 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 447 of file kexidb/utils.h.

◆ debug()

void KexiDB::debug ( const QuerySchemaParameterList & list)

Shows debug information for list.

Definition at line 42 of file queryschemaparameter.cpp.

◆ debugRowData()

void KexiDB::debugRowData ( const RowData & rowData)

Shows debug information about rowData row data.

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

◆ defaultTypeForGroup()

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

◆ deleteRow() [1/5]

KEXI_DB_EXPORT bool KexiDB::deleteRow ( Connection & conn,
const TQString & tableName,
const TQString & keyname,
const TQString & keyval )
inline

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

◆ deleteRow() [2/5]

KEXI_DB_EXPORT bool KexiDB::deleteRow ( Connection & conn,
const TQString & tableName,
const TQString & keyname,
int keyval )
inline

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

◆ deleteRow() [3/5]

KEXI_DB_EXPORT bool KexiDB::deleteRow ( Connection & conn,
const TQString & tableName,
const TQString & keyname1,
Field::Type keytype1,
const TQVariant & keyval1,
const TQString & keyname2,
Field::Type keytype2,
const TQVariant & keyval2 )
inline

Delete row with two generic criterias.

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

◆ deleteRow() [4/5]

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

for convenience

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

◆ deleteRow() [5/5]

KEXI_DB_EXPORT bool KexiDB::deleteRow ( Connection & conn,
TableSchema * table,
const TQString & keyname,
int keyval )
inline

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

◆ emptyValueForType()

TQVariant 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 TQVariant 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.
Todo
ok? we have no better defaults

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

◆ escapeBLOB()

TQString KexiDB::escapeBLOB ( const TQByteArray & array,
BLOBEscapingType type )
Todo
reverse function for BLOBEscapeOctal is available: processBinaryData() in pqxxcursor.cpp - move it here
Returns
a string containing escaped, printable representation of array. Escaping is controlled by type. For empty array TQString() 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.

◆ exprClassName()

KEXI_DB_EXPORT TQString KexiDB::exprClassName ( int c)

Custom tokens are not used in parser but used as extension in expression classes.

Returns
class name of class c

Definition at line 35 of file expression.cpp.

◆ fieldCount()

int KexiDB::fieldCount ( KexiDB::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.

◆ formatNumberForVisibleDecimalPlaces()

TQString 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. TDELocale::formatNumber() and TDELocale::decimalSymbol() are used to get locale settings.

See also
KexiDB::Field::visibleDecimalPlaces()
Todo
round?

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

◆ fromMap()

void KexiDB::fromMap ( const TQMap< TQString, TQString > & map,
ConnectionData & data )

Restores connection data data from map.

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

◆ getHTMLErrorMesage() [1/3]

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.

◆ getHTMLErrorMesage() [2/3]

void KexiDB::getHTMLErrorMesage ( Object * obj,
TQString & 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.

◆ getHTMLErrorMesage() [3/3]

void KexiDB::getHTMLErrorMesage ( Object * obj,
TQString & msg,
TQString & 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.

◆ getLimitsForType()

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
Todo
always ok?

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

◆ idForObjectName()

int KexiDB::idForObjectName ( Connection & conn,
const TQString & 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.

◆ intToFieldType()

KexiDB::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 TQVariant.

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

◆ isBuiltinTableFieldProperty()

bool KexiDB::isBuiltinTableFieldProperty ( const TQCString & 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.

◆ isDefaultValueAllowed()

bool KexiDB::isDefaultValueAllowed ( KexiDB::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.

◆ isEmptyValue()

bool KexiDB::isEmptyValue ( Field * f,
const TQVariant & 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 112 of file kexidb/utils.h.

◆ isExtendedTableFieldProperty()

bool KexiDB::isExtendedTableFieldProperty ( const TQCString & propertyName)
Returns
true if propertyName is an extended field property.

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

◆ loadIntPropertyValueFromDom()

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

Convenience version of loadPropertyValueFromDom().

Returns
int value.

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

◆ loadPropertyValueFromDom()

TQVariant KexiDB::loadPropertyValueFromDom ( const TQDomNode & node)
Returns
property value loaded from a DOM node, written in a TQtDesigner-like notation: <number>int</number> or <bool>bool</bool>, etc. Supported types are "string", "cstring", "bool", "number". For invalid values null TQVariant is returned. You can check the validity of the returned value using TQVariant::type().
Todo
add more TQVariant types

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

◆ loadStringPropertyValueFromDom()

TQString KexiDB::loadStringPropertyValueFromDom ( const TQDomNode & node,
bool * ok )

Convenience version of loadPropertyValueFromDom().

Returns
TQString value.

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

◆ maximumForIntegerTypes()

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.

◆ notEmptyValueForType()

TQVariant 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 TQVariant 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 "document-new" PNG image (icon) for BLOB type Returns null TQVariant 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.
Todo
blobs will contain other mime types too
Todo
default?

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

◆ pgsqlByteaToByteArray()

TQByteArray 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.

◆ pgsqlCStrToVariant()

TQVariant KexiDB::pgsqlCStrToVariant ( const PQXX_FIELD_CLASS & r)
inline

Definition at line 77 of file pqxxcursor.h.

◆ replaceRow()

KEXI_DB_EXPORT bool KexiDB::replaceRow ( Connection & conn,
TableSchema * table,
const TQString & keyname,
const TQString & keyval,
const TQString & valname,
TQVariant val,
int ftype )
inline

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

◆ rowCount() [1/4]

int KexiDB::rowCount ( Connection & conn,
const TQString & sql )
Todo
perhaps use TQ_ULLONG here?
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.

◆ rowCount() [2/4]

int KexiDB::rowCount ( const TableSchema & tableSchema)
Todo
perhaps use TQ_ULLONG here?
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.
Todo
does not work with non-SQL data sources

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

◆ rowCount() [3/4]

int KexiDB::rowCount ( KexiDB::QuerySchema & querySchema)
Todo
perhaps use TQ_ULLONG here?

Like above but operates on a query schema.

Todo
does not work with non-SQL data sources

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

◆ rowCount() [4/4]

int KexiDB::rowCount ( KexiDB::TableOrQuerySchema & tableOrQuery)
Todo
perhaps use TQ_ULLONG here?

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

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

◆ saveBooleanElementToDom()

TQDomElement KexiDB::saveBooleanElementToDom ( TQDomDocument & doc,
TQDomElement & parentEl,
const TQString & 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.

◆ saveNumberElementToDom()

TQDomElement KexiDB::saveNumberElementToDom ( TQDomDocument & doc,
TQDomElement & parentEl,
const TQString & 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.

◆ setFieldProperties()

bool KexiDB::setFieldProperties ( Field & field,
const TQMap< TQCString, TQVariant > & 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.

◆ setFieldProperty()

bool KexiDB::setFieldProperty ( Field & field,
const TQCString & propertyName,
const TQVariant & 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 TQVariant customProperty(const TQString& 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.

◆ simplifiedTypeName()

TQString KexiDB::simplifiedTypeName ( const Field & field)
Returns
a slightly simplified type name for field. For BLOB type it returns i18n'd "Image" string or other, depending on the mime type. For numbers (either floating-point or integer) it returns i18n'd "Number: string. For other types it the same string as Field::typeGroupName() is returned.
Todo
support names of other BLOB subtypes
Todo
support names of other BLOB subtypes

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

◆ splitToTableAndFieldParts()

bool KexiDB::splitToTableAndFieldParts ( const TQString & string,
TQString & tableName,
TQString & 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 TQString() without failure.

If function fails, tableName and fieldName remain unchanged.

Returns
true on success.

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

◆ sqlWhere()

KEXI_DB_EXPORT TQString KexiDB::sqlWhere ( Driver * drv,
Field::Type t,
const TQString fieldName,
const TQVariant 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 137 of file kexidb/utils.h.

◆ stringToVariant()

TQVariant KexiDB::stringToVariant ( const TQString & s,
TQVariant::Type type,
bool & ok )
Returns
variant value of type type for a string s that was previously serialized using variantToString( const TQVariant& v ) function. ok is set to the result of the operation.

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

◆ supportsVisibleDecimalPlacesProperty()

bool KexiDB::supportsVisibleDecimalPlacesProperty ( Field::Type type)
Returns
true if type supports "visibleDecimalPlaces" property.
Todo
add check for decimal type as well

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

◆ toMap()

TQMap< TQString, TQString > KexiDB::toMap ( const ConnectionData & data)

Saves connection data data into map.

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

◆ typeNamesForGroup()

TQStringList 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.

◆ typesForGroup()

const TypeGroupList KexiDB::typesForGroup ( Field::TypeGroup typeGroup)
Returns
list of types for type group typeGroup.

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

◆ typeStringsForGroup()

TQStringList 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.

◆ variantToString()

TQString KexiDB::variantToString ( const TQVariant & v)
Returns
string value serialized from a variant value v. This functions works like TQVariant::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.

◆ version()

DatabaseVersionInfo KexiDB::version ( )
Returns
KexiDB version info

Definition at line 55 of file global.cpp.

Variable Documentation

◆ _dummy

bool KexiDB::_dummy
static

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

Definition at line 34 of file driver_p.cpp.