28#include <tqvaluevector.h>
29#include <tqptrvector.h>
30#include "kexidb/kexidb_export.h"
75 typedef TQPtrList<Field>
List;
78 typedef TQPair<Field*,Field*>
Pair;
112 static uint defaultTextLength() {
return 200; }
157 Field(
const TQString& name, Type ctype,
158 uint cconst=NoConstraints,
159 uint options = NoOptions,
160 uint length=0, uint precision=0,
161 TQVariant defaultValue=TQVariant(),
162 const TQString& caption = TQString(),
163 const TQString& description = TQString(),
172 static TQVariant::Type variantType(uint type);
176 static TQString typeName(uint type);
181 static TQString typeString(uint type);
184 static Type typeForString(
const TQString& typeString);
187 static TypeGroup typeGroupForString(
const TQString& typeGroupString);
190 static TypeGroup typeGroup(uint type);
194 static TQString typeGroupName(uint typeGroup);
199 static TQString typeGroupString(uint typeGroup);
202 inline TQString name()
const {
return m_name; }
207 virtual TableSchema* table()
const;
214 virtual void setTable(TableSchema *table);
220 QuerySchema* query()
const;
228 void setQuery(QuerySchema *query);
256 static bool isNumericType(uint type);
263 static bool isIntegerType(uint type);
270 static bool isFPNumericType(uint type);
277 static bool isDateTimeType(uint type);
284 static bool isTextType(uint type);
286 uint options()
const {
return m_options; }
288 void setOptions(uint options) { m_options = options; }
318 inline TQString
subType()
const {
return m_subType; }
368 inline int order()
const {
return m_order; }
371 inline TQString
caption()
const {
return m_caption; }
374 inline TQString
captionOrName()
const {
return m_caption.isEmpty() ? m_name : m_caption; }
381 inline uint
width()
const {
return m_width; }
384 inline bool isUnsigned()
const {
return m_options & Unsigned; }
392 static bool hasEmptyProperty(uint type);
400 static bool isAutoIncrementAllowed(uint type);
404 void setType(Type t);
407 void setName(
const TQString& name);
413 void setConstraints(uint c);
417 void setLength(uint l);
421 void setScale(uint s);
425 void setVisibleDecimalPlaces(
int p);
428 void setPrecision(uint p);
431 void setUnsigned(
bool u);
435 void setDefaultValue(
const TQVariant& def);
441 bool setDefaultValue(
const TQCString& def);
445 void setAutoIncrement(
bool a);
456 void setPrimaryKey(
bool p);
461 void setUniqueKey(
bool u);
465 void setForeignKey(
bool f);
471 void setNotNull(
bool n);
477 void setNotEmpty(
bool n);
490 void setIndexed(
bool s);
513 virtual TQString debugString()
const;
541 TQValueVector<TQString>
enumHints()
const {
return m_hints; }
542 TQString enumHint(uint num) {
return (num < m_hints.size()) ? m_hints.at(num) : TQString(); }
549 TQVariant customProperty(
const TQCString& propertyName,
550 const TQVariant& defaultValue = TQVariant())
const;
553 void setCustomProperty(
const TQCString& propertyName,
const TQVariant& value);
574 virtual Field* copy()
const;
585 TQVariant m_defaultValue;
590 TQValueVector<TQString> m_hints;
596 class KEXI_DB_EXPORT FieldTypeNames :
public TQValueVector<TQString> {
600 TQMap<TQString,Type> str2num;
602 bool m_initialized : 1;
606 class KEXI_DB_EXPORT FieldTypeGroupNames :
public TQValueVector<TQString> {
608 FieldTypeGroupNames();
610 TQMap<TQString,TypeGroup> str2num;
612 bool m_initialized : 1;
624 friend class Connection;
625 friend class FieldList;
626 friend class TableSchema;
627 friend class QuerySchema;
A base class for all expressions.
bool isPrimaryKey() const
TQString typeName() const
KexiDB::BaseExpr * expression()
TQPair< Field *, Field * > Pair
fields pair
TQValueVector< TQString > enumHints() const
bool isAutoIncrementAllowed() const
@ NotEmpty
only legal for string-like and blob fields
void setDescription(const TQString &description)
void setCaption(const TQString &caption)
@ Asterisk
Special, internal types:
TQString captionOrName() const
TQVariant::Type variantType() const
Converts field's type to TQVariant equivalent as accurate as possible.
const CustomPropertiesMap customProperties() const
TQString typeString() const
TQString typeGroupString() const
void setEnumHints(const TQValueVector< TQString > &l)
bool hasEmptyProperty() const
TQPtrList< Field > List
list of fields
void setSubType(const TQString &subType)
uint m_length
also used for storing scale for floating point types
bool isFPNumericType() const
TQPtrList< Pair > PairList
list of fields pair
bool isIntegerType() const
bool isAutoIncrement() const
static TQString typeGroupString(uint typeGroup)
TQPtrListIterator< Field > ListIterator
iterator for list of fields
static TQString typeName(uint type)
virtual bool isQueryAsterisk() const
static FieldTypeGroupNames m_typeGroupNames
real i18n'd type group names (and not-i18n'd group name strings)
bool isNumericType() const
TypeGroup typeGroup() const
bool isExpression() const
int visibleDecimalPlaces() const
TQString typeGroupName() const
TQPtrVector< Field > Vector
vector of fields
bool isForeignKey() const
static TypeGroup typeGroup(uint type)
int m_visibleDecimalPlaces
used in visibleDecimalPlaces()
TQString description() const
TQMap< TQCString, TQVariant > CustomPropertiesMap
A data type used for handling custom properties of a field.
TQVariant defaultValue() const
bool isUnsigned() const
if the type has the unsigned attribute
bool isDateTimeType() const
Field(TableSchema *tableSchema)
static FieldTypeNames m_typeNames
real i18n'd type names (and not-i18n'd type name strings)
static TQString typeGroupName(uint typeGroup)
static TQString typeString(uint type)
KexiDB::QuerySchema provides information about database query.
High-level database connectivity library with database backend drivers.
KEXI_DB_EXPORT void debug(const QuerySchemaParameterList &list)
Shows debug information for list.