Kexi API Documentation (2.0 alpha)

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

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  ConnectionInternal
 Interface for connection's internals, implemented within drivers. 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  DriverBehaviour
class  DriverPrivate
class  DriverManager
 Database driver management, e.g. finding and loading drivers. More...
class  DriverManagerInternal
class  MySqlConnection
class  MySqlCursor
class  MySqlDriver
 MySQL database driver. More...
class  MySqlPreparedStatement
class  pqxxTransactionData
class  pqxxSqlConnection
class  pqxxSqlConnectionInternal
class  pqxxSqlCursor
class  pqxxSqlDriver
 PostgreSQL database driver. More...
class  pqxxPreparedStatement
class  SQLiteConnection
 sqlite-specific connection More...
class  SQLiteConnectionInternal
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  ParserPrivate
class  ParseInfo
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
 structure for storing single record with type information
typedef QValueList< QuerySchemaParameterQuerySchemaParameterList
typedef QValueList< OrderByColumnOrderByColumnListBase
 A base for KexiDB::OrderByColumnList.
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 }
 Used in splitToTableAndFieldParts(). More...
enum  BLOBEscapingType { BLOBEscapeXHex = 1, BLOBEscape0xHex, BLOBEscapeHex, BLOBEscapeOctal }
 Escaping types used in escapeBLOB(). More...

Functions

QVariant pgsqlCStrToVariant (const pqxx::result::field &r)
QString exprClassName (int c)
DatabaseVersionInfo version ()
 Returns the encoded number of Kexi's version, see the KEXI_VERSION macro.
void debug (const QuerySchemaParameterList &list)
 Shows debug information for list.
bool deleteRow (Connection &conn, TableSchema *table, const QString &keyname, const QString &keyval)
 for convenience
bool deleteRow (Connection &conn, const QString &tableName, const QString &keyname, const QString &keyval)
bool deleteRow (Connection &conn, TableSchema *table, const QString &keyname, int keyval)
bool deleteRow (Connection &conn, const QString &tableName, const QString &keyname, int keyval)
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)
bool replaceRow (Connection &conn, TableSchema *table, const QString &keyname, const QString &keyval, const QString &valname, QVariant val, int ftype)
const TypeGroupList typesForGroup (Field::TypeGroup typeGroup)
QStringList typeNamesForGroup (Field::TypeGroup typeGroup)
QStringList typeStringsForGroup (Field::TypeGroup typeGroup)
Field::Type defaultTypeForGroup (Field::TypeGroup typeGroup)
bool isEmptyValue (Field *f, const QVariant &v)
void getHTMLErrorMesage (Object *obj, QString &msg, QString &details)
void getHTMLErrorMesage (Object *obj, QString &msg)
void getHTMLErrorMesage (Object *obj, ResultInfo *result)
QString sqlWhere (Driver *drv, Field::Type t, const QString fieldName, const QVariant value)
int idForObjectName (Connection &conn, const QString &objName, int objType)
int rowCount (Connection &conn, const QString &sql)
int rowCount (const TableSchema &tableSchema)
int rowCount (QuerySchema &querySchema)
int rowCount (TableOrQuerySchema &tableOrQuery)
int fieldCount (TableOrQuerySchema &tableOrQuery)
void connectionTestDialog (QWidget *parent, const ConnectionData &data, MessageHandler &msgHandler)
QMap< QString, QStringtoMap (const ConnectionData &data)
void fromMap (const QMap< QString, QString > &map, ConnectionData &data)
bool splitToTableAndFieldParts (const QString &string, QString &tableName, QString &fieldName, SplitToTableAndFieldPartsOptions option=FailIfNoTableOrFieldName)
bool supportsVisibleDecimalPlacesProperty (Field::Type type)
QString formatNumberForVisibleDecimalPlaces (double value, int decimalPlaces)
bool isBuiltinTableFieldProperty (const QCString &propertyName)
bool isExtendedTableFieldProperty (const QCString &propertyName)
Field::Type intToFieldType (int type)
bool setFieldProperties (Field &field, const QMap< QCString, QVariant > &values)
bool setFieldProperty (Field &field, const QCString &propertyName, const QVariant &value)
QVariant loadPropertyValueFromDom (const QDomNode &node)
int loadIntPropertyValueFromDom (const QDomNode &node, bool *ok)
QString loadStringPropertyValueFromDom (const QDomNode &node, bool *ok)
QDomElement saveNumberElementToDom (QDomDocument &doc, QDomElement &parentEl, const QString &elementName, int value)
QDomElement saveBooleanElementToDom (QDomDocument &doc, QDomElement &parentEl, const QString &elementName, bool value)
QVariant emptyValueForType (Field::Type type)
QVariant notEmptyValueForType (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 (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)
QVariant cstringToVariant (const char *data, KexiDB::Field *f, int length=-1)

Variables

static bool _dummy


Typedef Documentation

typedef QValueList<OrderByColumn> KexiDB::OrderByColumnListBase
 

A base for KexiDB::OrderByColumnList.

Definition at line 153 of file queryschema.h.

typedef QValueList< QuerySchemaParameter > KexiDB::QuerySchemaParameterList
 

Definition at line 38 of file queryschema.h.

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

Definition at line 43 of file queryschemaparameter.h.

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

Definition at line 42 of file queryschemaparameter.h.

typedef QValueVector<QVariant> KexiDB::RowData
 

structure for storing single record with type information

Definition at line 47 of file connection.h.

typedef QValueList<uint> KexiDB::TypeGroupList
 

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


Enumeration Type Documentation

enum KexiDB::BLOBEscapingType
 

Escaping types used in escapeBLOB().

Enumeration values:
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  (only non-printable characters are escaped using octal numbers) See http://www.postgresql.org/docs/8.1/interactive/datatype-binary.html

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

enum KexiDB::ObjectTypes
 

Object types set like table or query.

Enumeration values:
UnknownObjectType  helper
AnyObjectType  helper
TableObjectType 
QueryObjectType 
LastObjectType 
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.

enum KexiDB::SplitToTableAndFieldPartsOptions
 

Used in splitToTableAndFieldParts().

Enumeration values:
FailIfNoTableOrFieldName  default value for splitToTableAndFieldParts()
SetFieldNameIfNoTableName  see splitToTableAndFieldParts()

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


Function Documentation

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.

Referenced by KexiDBConnectionTabWidget::slotTestConnection().

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

References KexiDB::Field::BigInteger, KexiDB::Field::BLOB, KexiDB::Field::isFPNumericType(), KexiDB::Field::isIntegerType(), KexiDB::Field::isTextType(), KexiDB::Field::type(), and KexiDB::Field::variantType().

Referenced by KexiMigration::PqxxMigrate::drv_copyTable(), KexiMigration::MySQLMigrate::drv_copyTable(), KexiDB::MySqlCursor::storeCurrentRow(), and KexiDB::MySqlCursor::value().

void KexiDB::debug const QuerySchemaParameterList list  ) 
 

Shows debug information for list.

Referenced by KexiQueryView::executeQuery().

void KexiDB::debugRowData const RowData rowData  ) 
 

Shows debug information about rowData row data.

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.

Referenced by KexiTableDesignerView::slotBeforeCellChanged(), and KexiTableDesignerView::slotRowUpdated().

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.

bool KexiDB::deleteRow Connection &  conn,
const QString tableName,
const QString keyname,
int  keyval
[inline]
 

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

References KexiDB::Field::Integer.

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

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

References KexiDB::Field::Integer, and KexiDB::SchemaData::name().

bool KexiDB::deleteRow Connection &  conn,
const QString tableName,
const QString keyname,
const QString keyval
[inline]
 

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

References KexiDB::Field::Text.

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.

References KexiDB::Connection::driver(), KexiDB::Connection::executeSQL(), KexiDB::SchemaData::name(), and KexiDB::Field::Text.

Referenced by KexiDB::Connection::createTable(), KexiDB::Connection::dropTable(), KexiDB::Connection::removeDataBlock(), KexiDB::Connection::removeObject(), and replaceRow().

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.

Referenced by KexiDB::AlterTableHandler::execute(), and KexiDB::notEmptyValueForType().

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().

Referenced by KexiDB::SQLiteDriver::escapeBLOB(), KexiDB::pqxxSqlDriver::escapeBLOB(), KexiDB::MySqlDriver::escapeBLOB(), KexiCSVExport::exportData(), and KexiDB::variantToString().

QString KexiDB::exprClassName int  c  ) 
 

Referenced by KexiDB::BinaryExpr::debugString(), and KexiDB::NArgExpr::debugString().

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.

Referenced by KexiDB::PreparedStatement::generateStatementString(), and KexiCSVExportWizard::showPage().

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()

Referenced by KexiTableEdit::setupContents(), and KexiTextFormatter::valueToText().

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

Restores connection data data from map.

void KexiDB::getHTMLErrorMesage Object *  obj,
ResultInfo *  result
 

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

void KexiDB::getHTMLErrorMesage Object *  obj,
QString msg
 

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

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.

Referenced by KexiTableViewData::deleteRow(), KexiDB::getHTMLErrorMesage(), KexiTableViewData::saveRow(), KexiBrowser::setProject(), and KexiGUIMessageHandler::showErrorMessage().

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

Referenced by KexiQueryParameters::getParameters().

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.

Referenced by KexiDBSubForm::setFormName(), and KexiSubReport::setReportName().

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.

Referenced by KexiTableDesignerView::buildField(), KexiDB::SQLiteConnection::drv_changeFieldProperty(), setIntToFieldType(), KexiTableDesignerView::slotPropertyChanged(), and KexiTableDesignerView::slotRowUpdated().

bool KexiDB::isBuiltinTableFieldProperty const QCString &  propertyName  ) 
 

Returns:
true if propertyName is a builtin field property.

Referenced by KexiDB::setFieldProperties().

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.

Referenced by KexiDB::RowEditBuffer::at(), and KexiDB::Connection::insertRow().

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.

References KexiDB::Field::hasEmptyProperty().

Referenced by KexiTableViewData::saveRow().

bool KexiDB::isExtendedTableFieldProperty const QCString &  propertyName  ) 
 

Returns:
true if propertyName is an extended field property.

Referenced by KexiDB::setFieldProperties(), and KexiDB::setFieldProperty().

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

Convenience version of loadPropertyValueFromDom().

Returns:
int value.

Referenced by KexiDB::Connection::loadExtendedTableSchemaData().

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().

Referenced by KexiDB::Connection::loadExtendedTableSchemaData(), and KexiDB::LookupFieldSchema::loadFromDom().

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

Convenience version of loadPropertyValueFromDom().

Returns:
QString value.

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.

Referenced by KexiDB::maximumForIntegerTypes(), and KexiDB::BinaryExpr::type().

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.

Referenced by KexiDB::AlterTableHandler::execute().

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.

Referenced by KexiMigration::PqxxMigrate::drv_copyTable(), pgsqlByteaToByteArray(), and pgsqlCStrToVariant().

QVariant KexiDB::pgsqlCStrToVariant const pqxx::result::field r  )  [inline]
 

Definition at line 77 of file pqxxcursor.h.

References BOOLOID, BPCHAROID, BYTEAOID, DATEOID, FLOAT4OID, FLOAT8OID, INT2OID, INT4OID, INT8OID, NUMERICOID, pgsqlByteaToByteArray(), TEXTOID, TIMEOID, TIMESTAMPOID, and VARCHAROID.

Referenced by KexiMigration::PqxxMigrate::drv_fetchRecordFromSQL().

bool KexiDB::replaceRow Connection &  conn,
TableSchema *  table,
const QString keyname,
const QString keyval,
const QString valname,
QVariant  val,
int  ftype
[inline]
 

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

References deleteRow(), KexiDB::SchemaData::name(), and KexiDB::Field::Text.

int KexiDB::rowCount TableOrQuerySchema &  tableOrQuery  ) 
 

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

int KexiDB::rowCount QuerySchema &  querySchema  ) 
 

Like above but operates on a query schema.

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.

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.

Referenced by KexiCSVExport::exportData(), KexiDB::rowCount(), and KexiCSVExportWizard::showPage().

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.

Referenced by KexiDB::LookupFieldSchema::saveToDom().

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.

Referenced by KexiDB::LookupFieldSchema::saveToDom().

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.

Referenced by KexiTableDesignerView::buildField(), and KexiDB::AlterTableHandler::InsertFieldAction::simplifyActions().

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