Kexi API Documentation (2.0 alpha)

kexidb/utils.cpp File Reference

#include "utils.h"
#include "cursor.h"
#include "drivermanager.h"
#include <qmap.h>
#include <qthread.h>
#include <qdom.h>
#include <qintdict.h>
#include <qbuffer.h>
#include <kdebug.h>
#include <klocale.h>
#include <kstaticdeleter.h>
#include <kmessagebox.h>
#include <kiconloader.h>
#include "utils_p.h"
#include "utils_p.moc"

Go to the source code of this file.

Defines

#define ADD(name)   KexiDB_builtinFieldProperties->insert(name, (char*)1)
#define SET_BOOLEAN_FLAG(flag, value)
#define ADD(name)   KexiDB_extendedProperties->insert(name, (char*)1)
#define SET_BOOLEAN_FLAG(flag, value)
#define GET_INT(method)
#define ADD(t, value)   (*KexiDB_emptyValueForTypeCache)[t]=value;
#define ADD(t, value)   (*KexiDB_notEmptyValueForTypeCache)[t]=value;

Functions

static void initList ()
const TypeGroupList KexiDB::typesForGroup (KexiDB::Field::TypeGroup typeGroup)
QStringList KexiDB::typeNamesForGroup (KexiDB::Field::TypeGroup typeGroup)
QStringList KexiDB::typeStringsForGroup (KexiDB::Field::TypeGroup typeGroup)
KexiDB::Field::Type KexiDB::defaultTypeForGroup (KexiDB::Field::TypeGroup typeGroup)
void KexiDB::getHTMLErrorMesage (Object *obj, QString &msg, QString &details)
void KexiDB::getHTMLErrorMesage (Object *obj, QString &msg)
void KexiDB::getHTMLErrorMesage (Object *obj, ResultInfo *result)
int KexiDB::idForObjectName (Connection &conn, const QString &objName, int objType)
void KexiDB::connectionTestDialog (QWidget *parent, const KexiDB::ConnectionData &data, KexiDB::MessageHandler &msgHandler)
int KexiDB::rowCount (Connection &conn, const QString &sql)
int KexiDB::rowCount (const KexiDB::TableSchema &tableSchema)
int KexiDB::rowCount (KexiDB::QuerySchema &querySchema)
int KexiDB::rowCount (KexiDB::TableOrQuerySchema &tableOrQuery)
int KexiDB::fieldCount (KexiDB::TableOrQuerySchema &tableOrQuery)
QMap< QString, QStringKexiDB::toMap (const ConnectionData &data)
void KexiDB::fromMap (const QMap< QString, QString > &map, ConnectionData &data)
bool KexiDB::splitToTableAndFieldParts (const QString &string, QString &tableName, QString &fieldName, SplitToTableAndFieldPartsOptions option)
bool KexiDB::supportsVisibleDecimalPlacesProperty (Field::Type type)
QString KexiDB::formatNumberForVisibleDecimalPlaces (double value, int decimalPlaces)
KexiDB::Field::Type KexiDB::intToFieldType (int type)
static bool setIntToFieldType (Field &field, const QVariant &value)
bool KexiDB::isBuiltinTableFieldProperty (const QCString &propertyName)
bool KexiDB::setFieldProperties (Field &field, const QMap< QCString, QVariant > &values)
bool KexiDB::isExtendedTableFieldProperty (const QCString &propertyName)
bool KexiDB::setFieldProperty (Field &field, const QCString &propertyName, const QVariant &value)
int KexiDB::loadIntPropertyValueFromDom (const QDomNode &node, bool *ok)
QString KexiDB::loadStringPropertyValueFromDom (const QDomNode &node, bool *ok)
QVariant KexiDB::loadPropertyValueFromDom (const QDomNode &node)
QDomElement KexiDB::saveNumberElementToDom (QDomDocument &doc, QDomElement &parentEl, const QString &elementName, int value)
QDomElement KexiDB::saveBooleanElementToDom (QDomDocument &doc, QDomElement &parentEl, const QString &elementName, bool value)
QVariant KexiDB::emptyValueForType (KexiDB::Field::Type type)
QVariant KexiDB::notEmptyValueForType (KexiDB::Field::Type type)
QString KexiDB::escapeBLOB (const QByteArray &array, BLOBEscapingType type)
QByteArray KexiDB::pgsqlByteaToByteArray (const char *data, int length)
QString KexiDB::variantToString (const QVariant &v)
QVariant KexiDB::stringToVariant (const QString &s, QVariant::Type type, bool &ok)
bool KexiDB::isDefaultValueAllowed (KexiDB::Field *field)
void KexiDB::getLimitsForType (Field::Type type, int &minValue, int &maxValue)
void KexiDB::debugRowData (const RowData &rowData)
Field::Type KexiDB::maximumForIntegerTypes (Field::Type t1, Field::Type t2)

Variables

static KStaticDeleter< TypeCache > KexiDB_typeCacheDeleter
TypeCache * KexiDB_typeCache = 0
static KStaticDeleter< QAsciiDict<
char > > 
KexiDB_builtinFieldPropertiesDeleter
 for KexiDB::isBuiltinTableFieldProperty()
QAsciiDict< char > * KexiDB_builtinFieldProperties = 0
 for KexiDB::isBuiltinTableFieldProperty()
static KStaticDeleter< QAsciiDict<
char > > 
KexiDB_extendedPropertiesDeleter
 for KexiDB::isExtendedTableFieldProperty()
QAsciiDict< char > * KexiDB_extendedProperties = 0
 for KexiDB::isExtendedTableFieldProperty()
static KStaticDeleter< QValueVector<
QVariant > > 
KexiDB_emptyValueForTypeCacheDeleter
 Used in KexiDB::emptyValueForType().
QValueVector< QVariant > * KexiDB_emptyValueForTypeCache = 0
static KStaticDeleter< QValueVector<
QVariant > > 
KexiDB_notEmptyValueForTypeCacheDeleter
 Used in KexiDB::notEmptyValueForType().
QValueVector< QVariant > * KexiDB_notEmptyValueForTypeCache = 0


Define Documentation

#define ADD t,
value   )     (*KexiDB_notEmptyValueForTypeCache)[t]=value;
 

#define ADD t,
value   )     (*KexiDB_emptyValueForTypeCache)[t]=value;
 

#define ADD name   )     KexiDB_extendedProperties->insert(name, (char*)1)
 

#define ADD name   )     KexiDB_builtinFieldProperties->insert(name, (char*)1)
 

#define GET_INT method   ) 
 

Value:

{ \
            const uint ival = value.toUInt(&ok); \
            if (!ok) \
                return false; \
            field.method( ival ); \
            return true; \
        }

Referenced by KexiDB::setFieldProperty().

#define SET_BOOLEAN_FLAG flag,
value   ) 
 

Value:

{ \
            constraints |= KexiDB::Field::flag; \
            if (!value) \
                constraints ^= KexiDB::Field::flag; \
            field.setConstraints( constraints ); \
            return true; \
        }

#define SET_BOOLEAN_FLAG flag,
value   ) 
 

Value:

{ \
        constraints |= KexiDB::Field::flag; \
        if (!value) \
            constraints ^= KexiDB::Field::flag; \
    }

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


Function Documentation

static void initList  )  [static]
 

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

References KexiDB_typeCacheDeleter, KexiDB::Field::LastType, KexiDB::Field::typeGroup(), KexiDB::Field::typeName(), and KexiDB::Field::typeString().

Referenced by KexiDB::defaultTypeForGroup(), KexiDB::typeNamesForGroup(), KexiDB::typesForGroup(), and KexiDB::typeStringsForGroup().

void KexiDB::connectionTestDialog QWidget parent,
const KexiDB::ConnectionData data,
KexiDB::MessageHandler msgHandler
 

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

References ConnectionTestDialog::exec().

void KexiDB::debugRowData const RowData rowData  ) 
 

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

References foreach, and KexiDBDbg.

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

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

References initList().

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

Todo:
ok? we have no better defaults

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

References ADD, and KexiDBWarn.

QString KexiDB::escapeBLOB const QByteArray &  array,
BLOBEscapingType  type
 

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

References KexiDB::BLOBEscape0xHex, KexiDB::BLOBEscapeOctal, KexiDB::BLOBEscapeXHex, KexiDBWarn, and size.

int KexiDB::fieldCount KexiDB::TableOrQuerySchema tableOrQuery  ) 
 

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

References KexiDB::TableOrQuerySchema::query(), and KexiDB::TableOrQuerySchema::table().

QString KexiDB::formatNumberForVisibleDecimalPlaces double  value,
int  decimalPlaces
 

Todo:
round?

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

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

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

References KexiDB::ConnectionDataBase::caption, KexiDB::ConnectionDataBase::description, KexiDB::ConnectionDataBase::driverName, KexiDB::ConnectionDataBase::hostName, KexiDB::ConnectionDataBase::localSocketFileName, KexiDB::ConnectionDataBase::password, KexiDB::ConnectionDataBase::port, KexiDB::ConnectionDataBase::savePassword, KexiDB::ConnectionData::setFileName(), KexiDB::ConnectionDataBase::useLocalSocketFile, and KexiDB::ConnectionDataBase::userName.

void KexiDB::getHTMLErrorMesage Object obj,
ResultInfo result
 

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

References KexiDB::ResultInfo::desc, KexiDB::getHTMLErrorMesage(), and KexiDB::ResultInfo::msg.

void KexiDB::getHTMLErrorMesage Object obj,
QString msg
 

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

References KexiDB::getHTMLErrorMesage().

void KexiDB::getHTMLErrorMesage Object obj,
QString msg,
QString details
 

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

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

Todo:
always ok?

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

int KexiDB::idForObjectName Connection conn,
const QString objName,
int  objType
 

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

References KexiDB::Connection::querySingleRecord().

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

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

References KexiDB::Field::InvalidType, KexiDBWarn, and KexiDB::Field::LastType.

bool KexiDB::isBuiltinTableFieldProperty const QCString &  propertyName  ) 
 

Todo:
always update this when new builtins appear!

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

References ADD.

bool KexiDB::isDefaultValueAllowed KexiDB::Field field  ) 
 

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

References KexiDB::Field::isUniqueKey().

bool KexiDB::isExtendedTableFieldProperty const QCString &  propertyName  ) 
 

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

References ADD.

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

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

QVariant KexiDB::loadPropertyValueFromDom const QDomNode &  node  ) 
 

Todo:
add more QVariant types

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

References KexiDBWarn.

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

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

Field::Type KexiDB::maximumForIntegerTypes Field::Type  t1,
Field::Type  t2
 

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

References KexiDB::maximumForIntegerTypes().

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

Todo:
blobs will contain other mime types too
Todo:
default?

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

References ADD, KexiDB::emptyValueForType(), and KexiDBWarn.

QByteArray KexiDB::pgsqlByteaToByteArray const char *  data,
int  length
 

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

References KexiDBDbg, and KexiDBDrvWarn.

int KexiDB::rowCount KexiDB::TableOrQuerySchema tableOrQuery  ) 
 

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

References KexiDB::rowCount().

int KexiDB::rowCount KexiDB::QuerySchema querySchema  ) 
 

Todo:
does not work with non-SQL data sources

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

References KexiDB::QuerySchema::connection(), and KexiDBWarn.

int KexiDB::rowCount const KexiDB::TableSchema tableSchema  ) 
 

Todo:
does not work with non-SQL data sources

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

References KexiDBWarn.

int KexiDB::rowCount Connection conn,
const QString sql
 

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

References KexiDB::Connection::querySingleNumber().

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

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

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

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

bool KexiDB::setFieldProperties Field field,
const QMap< QCString, QVariant > &  values
 

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

References foreach, KexiDB::Field::isAutoIncrementAllowed(), KexiDB::isBuiltinTableFieldProperty(), KexiDB::isExtendedTableFieldProperty(), options, SET_BOOLEAN_FLAG, setIntToFieldType(), KexiDB::supportsVisibleDecimalPlacesProperty(), and KexiDB::Field::Unsigned.

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

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

References GET_INT, KexiDB::Field::isAutoIncrementAllowed(), KexiDB::isExtendedTableFieldProperty(), KexiDBWarn, options, SET_BOOLEAN_FLAG, setIntToFieldType(), KexiDB::supportsVisibleDecimalPlacesProperty(), and KexiDB::Field::Unsigned.

bool KexiDB::splitToTableAndFieldParts const QString string,
QString tableName,
QString fieldName,
SplitToTableAndFieldPartsOptions  option
 

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

References KexiDB::SetFieldNameIfNoTableName.

QVariant KexiDB::stringToVariant const QString s,
QVariant::Type  type,
bool &  ok
 

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

References KexiDBWarn, and len.

bool KexiDB::supportsVisibleDecimalPlacesProperty Field::Type  type  ) 
 

Todo:
add check for decimal type as well

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

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

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

References KexiDB::ConnectionDataBase::caption, KexiDB::ConnectionDataBase::description, KexiDB::ConnectionDataBase::driverName, KexiDB::ConnectionData::fileName(), KexiDB::ConnectionDataBase::hostName, KexiDB::ConnectionDataBase::localSocketFileName, KexiDB::ConnectionDataBase::password, KexiDB::ConnectionDataBase::port, KexiDB::ConnectionDataBase::savePassword, KexiDB::ConnectionDataBase::useLocalSocketFile, and KexiDB::ConnectionDataBase::userName.

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

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

References initList().

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

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

References initList().

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

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

References initList().

QString KexiDB::variantToString const QVariant &  v  ) 
 

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

References KexiDB::BLOBEscapeHex, and KexiDB::escapeBLOB().

static bool setIntToFieldType Field field,
const QVariant &  value
[static]
 

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

References KexiDB::intToFieldType(), KexiDB::Field::InvalidType, and KexiDBWarn.

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


Variable Documentation

QAsciiDict<char>* KexiDB_builtinFieldProperties = 0
 

for KexiDB::isBuiltinTableFieldProperty()

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

KStaticDeleter< QAsciiDict<char> > KexiDB_builtinFieldPropertiesDeleter [static]
 

for KexiDB::isBuiltinTableFieldProperty()

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

QValueVector<QVariant>* KexiDB_emptyValueForTypeCache = 0
 

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

KStaticDeleter< QValueVector<QVariant> > KexiDB_emptyValueForTypeCacheDeleter [static]
 

Used in KexiDB::emptyValueForType().

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

QAsciiDict<char>* KexiDB_extendedProperties = 0
 

for KexiDB::isExtendedTableFieldProperty()

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

KStaticDeleter< QAsciiDict<char> > KexiDB_extendedPropertiesDeleter [static]
 

for KexiDB::isExtendedTableFieldProperty()

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

QValueVector<QVariant>* KexiDB_notEmptyValueForTypeCache = 0
 

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

KStaticDeleter< QValueVector<QVariant> > KexiDB_notEmptyValueForTypeCacheDeleter [static]
 

Used in KexiDB::notEmptyValueForType().

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

TypeCache* KexiDB_typeCache = 0
 

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

KStaticDeleter<TypeCache> KexiDB_typeCacheDeleter [static]
 

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

Referenced by initList().

KDE Logo
This file is part of the documentation for Kexi 2.0 alpha.
Documentation copyright © 2002-2007 the Kexi Team.
Generated on Tue Apr 1 20:49:35 2008 by doxygen 1.4.2 written by Dimitri van Heesch, © 1997-2003