kexi

#include <field.h>

Inheritance diagram for KexiDB::Field:
KexiDB::QueryAsterisk

Public Types

enum  Type {
  InvalidType = 0 , Byte = 1 , ShortInteger = 2 , Integer = 3 ,
  BigInteger = 4 , Boolean = 5 , Date = 6 , DateTime = 7 ,
  Time = 8 , Float = 9 , Double = 10 , Text = 11 ,
  LongText = 12 , BLOB = 13 , LastType = 13 , Null = 64 ,
  Asterisk = 128 , Enum = 129 , Map = 130
}
enum  TypeGroup {
  InvalidGroup = 0 , TextGroup = 1 , IntegerGroup = 2 , FloatGroup = 3 ,
  BooleanGroup = 4 , DateTimeGroup = 5 , BLOBGroup = 6 , LastTypeGroup = 6
}
enum  Constraints {
  NoConstraints = 0 , AutoInc = 1 , Unique = 2 , PrimaryKey = 4 ,
  ForeignKey = 8 , NotNull = 16 , NotEmpty = 32 , Indexed = 64
}
enum  Options { NoOptions = 0 , Unsigned = 1 }
typedef TQPtrList< Field > List
typedef TQPtrVector< Field > Vector
typedef TQPtrListIterator< Field > ListIterator
typedef TQPair< Field *, Field * > Pair
typedef TQPtrList< Pair > PairList
typedef TQMap< TQCString, TQVariant > CustomPropertiesMap

Public Member Functions

 Field (TableSchema *tableSchema)
 Field ()
 Field (const TQString &name, Type ctype, uint cconst=NoConstraints, uint options=NoOptions, uint length=0, uint precision=0, TQVariant defaultValue=TQVariant(), const TQString &caption=TQString(), const TQString &description=TQString(), uint width=0)
 Field (const Field &f)
TQString name () const
virtual TableSchema * table () const
virtual void setTable (TableSchema *table)
QuerySchema * query () const
void setQuery (QuerySchema *query)
bool isAutoIncrement () const
bool isPrimaryKey () const
bool isUniqueKey () const
bool isForeignKey () const
bool isNotNull () const
bool isNotEmpty () const
bool isIndexed () const
bool isNumericType () const
bool isIntegerType () const
bool isFPNumericType () const
bool isDateTimeType () const
bool isTextType () const
uint options () const
void setOptions (uint options)
TQVariant::Type variantType () const
Type type () const
TQString typeName () const
TypeGroup typeGroup () const
TQString typeGroupName () const
TQString typeString () const
TQString typeGroupString () const
TQString subType () const
void setSubType (const TQString &subType)
TQVariant defaultValue () const
uint length () const
uint precision () const
uint scale () const
int visibleDecimalPlaces () const
uint constraints () const
int order () const
TQString caption () const
TQString captionOrName () const
TQString description () const
uint width () const
bool isUnsigned () const
bool hasEmptyProperty () const
bool isAutoIncrementAllowed () const
void setType (Type t)
void setName (const TQString &name)
void setConstraints (uint c)
void setLength (uint l)
void setScale (uint s)
void setVisibleDecimalPlaces (int p)
void setPrecision (uint p)
void setUnsigned (bool u)
void setDefaultValue (const TQVariant &def)
bool setDefaultValue (const TQCString &def)
void setAutoIncrement (bool a)
void setPrimaryKey (bool p)
void setUniqueKey (bool u)
void setForeignKey (bool f)
void setNotNull (bool n)
void setNotEmpty (bool n)
void setIndexed (bool s)
void setCaption (const TQString &caption)
void setDescription (const TQString &description)
void setWidth (uint w)
virtual bool isQueryAsterisk () const
virtual TQString debugString () const
void debug ()
KexiDB::BaseExpr * expression ()
void setExpression (KexiDB::BaseExpr *expr)
bool isExpression () const
TQValueVector< TQString > enumHints () const
TQString enumHint (uint num)
void setEnumHints (const TQValueVector< TQString > &l)
TQVariant customProperty (const TQCString &propertyName, const TQVariant &defaultValue=TQVariant()) const
void setCustomProperty (const TQCString &propertyName, const TQVariant &value)
const CustomPropertiesMap customProperties () const

Static Public Member Functions

static uint defaultTextLength ()
static TQVariant::Type variantType (uint type)
static TQString typeName (uint type)
static TQString typeString (uint type)
static Type typeForString (const TQString &typeString)
static TypeGroup typeGroupForString (const TQString &typeGroupString)
static TypeGroup typeGroup (uint type)
static TQString typeGroupName (uint typeGroup)
static TQString typeGroupString (uint typeGroup)
static bool isNumericType (uint type)
static bool isIntegerType (uint type)
static bool isFPNumericType (uint type)
static bool isDateTimeType (uint type)
static bool isTextType (uint type)
static bool hasEmptyProperty (uint type)
static bool isAutoIncrementAllowed (uint type)

Protected Member Functions

 Field (QuerySchema *querySchema, BaseExpr *expr=0)
void init ()
virtual Field * copy () const

Protected Attributes

FieldList * m_parent
TQString m_name
TQString m_subType
uint m_constraints
uint m_length
uint m_precision
int m_visibleDecimalPlaces
uint m_options
TQVariant m_defaultValue
int m_order
TQString m_caption
TQString m_desc
uint m_width
TQValueVector< TQString > m_hints
KexiDB::BaseExpr * m_expr
CustomPropertiesMap * m_customProperties

Static Protected Attributes

static FieldTypeNames m_typeNames
static FieldTypeGroupNames m_typeGroupNames

Friends

class Connection
class FieldList
class TableSchema
class QuerySchema

Detailed Description

Meta-data for a field.

KexiDB::Field provides information about single database field.

Field class has defined following members:

  • name
  • type
  • database constraints
  • additional options
  • length (make sense mostly for string types)
  • precision (for floating-point type)
  • defaultValue
  • caption (user readable name that can be e.g. translated)
  • description (user readable name additional text, can be useful for developers)
  • width (a hint for displaying in tabular mode or as text box)

Field can also have assigned expression (see KexiDB::BaseExpr class, and expression() method). If an expression is defined, then field's name is

Note that aliases for fields are defined within query, not in Field object, because the same field can be used in different queries with different alias.

Notes for advanced use: Field obeject is designed to be owned by a parent object. Such a parent object can be KexiDB::TableSchema, if the field defines single table column, or KexiDB::QuerySchema, if the field defines an expression (KexiDB::BaseExpr class).

Using expression class for fields allos to define expressions within queries like "SELECT AVG(price) FROM products"

You can choose whether your field is owned by query or table, using appropriate constructor, or using parameterless constructor and calling setTable() or setQuery() later.

Definition at line 72 of file field.h.

Member Typedef Documentation

◆ CustomPropertiesMap

typedef TQMap<TQCString,TQVariant> KexiDB::Field::CustomPropertiesMap

A data type used for handling custom properties of a field.

Definition at line 556 of file field.h.

◆ List

typedef TQPtrList<Field> KexiDB::Field::List

list of fields

Definition at line 75 of file field.h.

◆ ListIterator

typedef TQPtrListIterator<Field> KexiDB::Field::ListIterator

iterator for list of fields

Definition at line 77 of file field.h.

◆ Pair

typedef TQPair<Field*,Field*> KexiDB::Field::Pair

fields pair

Definition at line 78 of file field.h.

◆ PairList

typedef TQPtrList<Pair> KexiDB::Field::PairList

list of fields pair

Definition at line 79 of file field.h.

◆ Vector

typedef TQPtrVector<Field> KexiDB::Field::Vector

vector of fields

Definition at line 76 of file field.h.

Member Enumeration Documentation

◆ Constraints

Possible constraints defined for a field.

Enumerator
NotEmpty 

only legal for string-like and blob fields

Definition at line 129 of file field.h.

◆ Options

Possible options defined for a field.

Definition at line 142 of file field.h.

◆ Type

Unified (most common used) types of fields.

Enumerator
InvalidType 

Unsupported/Unimplemented type

Byte 

1 byte, signed or unsigned

ShortInteger 

2 bytes, signed or unsigned

Integer 

4 bytes, signed or unsigned

BigInteger 

8 bytes, signed or unsigned

Boolean 

0 or 1

Float 

4 bytes

Double 

8 bytes

Text 

Other name: Varchar; no more than 200 bytes, for efficiency

LongText 

Other name: Memo. More than 200 bytes

BLOB 

Large binary object

LastType 

This line should be at the end of the list of types!

Null 

Used for fields that are "NULL" expressions.

Asterisk 

Special, internal types:

Used in QueryAsterisk subclass objects only, not used in table definitions, but only in query definitions

Enum 

An integer internal with a string list of hints

Map 

Mapping from string to string list (more generic than Enum

Definition at line 82 of file field.h.

◆ TypeGroup

Type groups for fields.

Definition at line 115 of file field.h.

Constructor & Destructor Documentation

◆ Field() [1/5]

Field::Field ( TableSchema * tableSchema)

Creates a database field as a child of tableSchema table No other properties are set (even the name), so these should be set later.

Definition at line 48 of file field.cpp.

◆ Field() [2/5]

Field::Field ( )

Creates a database field without any properties set. These should be set later.

Definition at line 41 of file field.cpp.

◆ Field() [3/5]

Field::Field ( const TQString & name,
Type ctype,
uint cconst = NoConstraints,
uint options = NoOptions,
uint length = 0,
uint precision = 0,
TQVariant defaultValue = TQVariant(),
const TQString & caption = TQString(),
const TQString & description = TQString(),
uint width = 0 )

Creates a database field with specified properties.

Definition at line 66 of file field.cpp.

◆ Field() [4/5]

Field::Field ( const Field & f)

Copy constructor.

Definition at line 93 of file field.cpp.

◆ ~Field()

Field::~Field ( )
virtual

Definition at line 107 of file field.cpp.

◆ Field() [5/5]

Field::Field ( QuerySchema * querySchema,
BaseExpr * expr = 0 )
protected

Creates a database field as a child of querySchema table Assigns expr expression to this field, if present. Used internally by query schemas, e.g. to declare asterisks or to add expression columns. No other properties are set, so these should be set later.

Definition at line 56 of file field.cpp.

Member Function Documentation

◆ caption()

TQString KexiDB::Field::caption ( ) const
inline
Returns
caption of this field.

Definition at line 371 of file field.h.

◆ captionOrName()

TQString KexiDB::Field::captionOrName ( ) const
inline
Returns
caption of this field or - if empty - return its name.

Definition at line 374 of file field.h.

◆ constraints()

uint KexiDB::Field::constraints ( ) const
inline
Returns
the constraints defined for this field.

Definition at line 364 of file field.h.

◆ copy()

Field * Field::copy ( ) const
protectedvirtual
Returns
a deep copy of this object. Used in FieldList(const FieldList& fl).

Reimplemented in KexiDB::QueryAsterisk.

Definition at line 113 of file field.cpp.

◆ customProperties()

const CustomPropertiesMap KexiDB::Field::customProperties ( ) const
inline
Returns
all custom properties

Definition at line 559 of file field.h.

◆ customProperty()

TQVariant Field::customProperty ( const TQCString & propertyName,
const TQVariant & defaultValue = TQVariant() ) const
Returns
custom property propertyName. If there is no such a property, defaultValue is returned.

Definition at line 644 of file field.cpp.

◆ debug()

void Field::debug ( )

Shows debug information about this field.

Definition at line 628 of file field.cpp.

◆ debugString()

TQString Field::debugString ( ) const
virtual
Returns
string for debugging purposes.

Reimplemented in KexiDB::QueryAsterisk.

Definition at line 583 of file field.cpp.

◆ defaultTextLength()

uint KexiDB::Field::defaultTextLength ( )
inlinestatic

Definition at line 112 of file field.h.

◆ defaultValue()

TQVariant KexiDB::Field::defaultValue ( ) const
inline
Returns
default value for this field. Null value means there is no default value declared. The variant value is compatible with field's type.

Definition at line 326 of file field.h.

◆ description()

TQString KexiDB::Field::description ( ) const
inline
Returns
description text for this field.

Definition at line 377 of file field.h.

◆ enumHint()

TQString KexiDB::Field::enumHint ( uint num)
inline

Definition at line 542 of file field.h.

◆ enumHints()

TQValueVector< TQString > KexiDB::Field::enumHints ( ) const
inline
Returns
the hints for enum fields.

Definition at line 541 of file field.h.

◆ expression()

KexiDB::BaseExpr * KexiDB::Field::expression ( )
inline
Returns
KexiDB::BaseExpr object if the field value is an expression. Unless the expression is set with setExpression(), it is null.

Definition at line 521 of file field.h.

◆ hasEmptyProperty() [1/2]

bool KexiDB::Field::hasEmptyProperty ( ) const
inline
Returns
true if this field has EMPTY property (i.e. it is of type string or is a BLOB).

Definition at line 388 of file field.h.

◆ hasEmptyProperty() [2/2]

bool Field::hasEmptyProperty ( uint type)
static

static version of hasEmptyProperty() method

Returns
true if this field type has EMPTY property (i.e. it is string or BLOB type)

Definition at line 271 of file field.cpp.

◆ init()

void Field::init ( )
protected

Definition at line 118 of file field.cpp.

◆ isAutoIncrement()

bool KexiDB::Field::isAutoIncrement ( ) const
inline
Returns
true if the field is autoincrement (e.g. integer/numeric)

Definition at line 231 of file field.h.

◆ isAutoIncrementAllowed() [1/2]

bool KexiDB::Field::isAutoIncrementAllowed ( ) const
inline
Returns
true if this field can be auto-incremented. Actually, returns true for integer field type.
See also
IntegerType, isAutoIncrement()

Definition at line 396 of file field.h.

◆ isAutoIncrementAllowed() [2/2]

bool Field::isAutoIncrementAllowed ( uint type)
static

static version of isAutoIncrementAllowed() method

Returns
true if this field type can be auto-incremented.

Definition at line 276 of file field.cpp.

◆ isDateTimeType() [1/2]

bool KexiDB::Field::isDateTimeType ( ) const
inline
Returns
true if the field is of any date or time related type

Definition at line 273 of file field.h.

◆ isDateTimeType() [2/2]

bool Field::isDateTimeType ( uint type)
static

static version of isDateTimeType() method !

Returns
true if the field is of any date or time related type

Definition at line 248 of file field.cpp.

◆ isExpression()

bool KexiDB::Field::isExpression ( ) const
inline
Returns
true if there is expression defined for this field. This method is provided for better readibility

Definition at line 537 of file field.h.

◆ isForeignKey()

bool KexiDB::Field::isForeignKey ( ) const
inline
Returns
true if the field is member of single-field foreign key

Definition at line 240 of file field.h.

◆ isFPNumericType() [1/2]

bool KexiDB::Field::isFPNumericType ( ) const
inline
Returns
true if the field is of any floating point numeric type

Definition at line 266 of file field.h.

◆ isFPNumericType() [2/2]

bool Field::isFPNumericType ( uint type)
static

static version of isFPNumericType() method !

Returns
true if the field is of any floating point numeric type

Definition at line 243 of file field.cpp.

◆ isIndexed()

bool KexiDB::Field::isIndexed ( ) const
inline
Returns
true if the field is indexed using single-field database index.

Definition at line 249 of file field.h.

◆ isIntegerType() [1/2]

bool KexiDB::Field::isIntegerType ( ) const
inline
Returns
true if the field is of any integer type

Definition at line 259 of file field.h.

◆ isIntegerType() [2/2]

bool Field::isIntegerType ( uint type)
static

static version of isIntegerType() method !

Returns
true if the field is of any integer type

Definition at line 215 of file field.cpp.

◆ isNotEmpty()

bool KexiDB::Field::isNotEmpty ( ) const
inline
Returns
true if the field is not allowed to be null

Definition at line 246 of file field.h.

◆ isNotNull()

bool KexiDB::Field::isNotNull ( ) const
inline
Returns
true if the field is not allowed to be null

Definition at line 243 of file field.h.

◆ isNumericType() [1/2]

bool KexiDB::Field::isNumericType ( ) const
inline
Returns
true if the field is of any numeric type (integer or floating point)

Definition at line 252 of file field.h.

◆ isNumericType() [2/2]

bool Field::isNumericType ( uint type)
static

static version of isNumericType() method !

Returns
true if the field is of any numeric type (integer or floating point)

Definition at line 228 of file field.cpp.

◆ isPrimaryKey()

bool KexiDB::Field::isPrimaryKey ( ) const
inline
Returns
true if the field is member of single-field primary key

Definition at line 234 of file field.h.

◆ isQueryAsterisk()

virtual bool KexiDB::Field::isQueryAsterisk ( ) const
inlinevirtual

There can be added asterisks (QueryAsterisk objects) to query schemas' field list. QueryAsterisk subclasses Field class, and to check if the given object (pointed by Field*) is asterisk or just ordinary field definition, you can call this method. This is just effective version of TQObject::isA(). Every QueryAsterisk object returns true here, and every Field object returns false.

Reimplemented in KexiDB::QueryAsterisk.

Definition at line 510 of file field.h.

◆ isTextType() [1/2]

bool KexiDB::Field::isTextType ( ) const
inline
Returns
true if the field is of any text type

Definition at line 280 of file field.h.

◆ isTextType() [2/2]

bool Field::isTextType ( uint type)
static

static version of isTextType() method !

Returns
true if the field is of any text type

Definition at line 260 of file field.cpp.

◆ isUniqueKey()

bool KexiDB::Field::isUniqueKey ( ) const
inline
Returns
true if the field is member of single-field unique key

Definition at line 237 of file field.h.

◆ isUnsigned()

bool KexiDB::Field::isUnsigned ( ) const
inline

if the type has the unsigned attribute

Definition at line 384 of file field.h.

◆ length()

uint KexiDB::Field::length ( ) const
inline
Returns
length of text, only meaningful if the field type is text. 0 means "default length".

Definition at line 330 of file field.h.

◆ name()

TQString KexiDB::Field::name ( ) const
inline

Definition at line 202 of file field.h.

◆ options()

uint KexiDB::Field::options ( ) const
inline

Definition at line 286 of file field.h.

◆ order()

int KexiDB::Field::order ( ) const
inline
Returns
order of this field in containing table (counting starts from 0) (-1 if unspecified).

Definition at line 368 of file field.h.

◆ precision()

uint KexiDB::Field::precision ( ) const
inline
Returns
precision for numeric and other fields that have both length (scale) and precision (floating point types).

Definition at line 334 of file field.h.

◆ query()

QuerySchema * Field::query ( ) const

For special use when the field defines expression.

Returns
query schema of query that owns this field or null if it has no query assigned.
See also
table()

Definition at line 312 of file field.cpp.

◆ scale()

uint KexiDB::Field::scale ( ) const
inline
Returns
scale for numeric and other fields that have both length (scale) and precision (floating point types). The scale of a numeric is the count of decimal digits in the fractional part, to the right of the decimal point. The precision of a numeric is the total count of significant digits in the whole number, that is, the number of digits to both sides of the decimal point. So the number 23.5141 has a precision of 6 and a scale of 4. Integers can be considered to have a scale of zero.

Definition at line 343 of file field.h.

◆ setAutoIncrement()

void Field::setAutoIncrement ( bool a)

Sets auto increment flag. Only available to set true, if isAutoIncrementAllowed() is true.

Definition at line 515 of file field.cpp.

◆ setCaption()

void KexiDB::Field::setCaption ( const TQString & caption)
inline

Sets caption for this field to caption.

Definition at line 493 of file field.h.

◆ setConstraints()

void Field::setConstraints ( uint c)

Sets constraints to c. If PrimaryKey is set in c, also constraits implied by being primary key are enforced (see setPrimaryKey()). If Indexed is not set in c, constraits implied by not being are enforced as well (see setIndexed()).

Definition at line 341 of file field.cpp.

◆ setCustomProperty()

void Field::setCustomProperty ( const TQCString & propertyName,
const TQVariant & value )

Sets value value for custom property propertyName.

Definition at line 655 of file field.cpp.

◆ setDefaultValue() [1/2]

bool Field::setDefaultValue ( const TQCString & def)

Sets default value decoded from TQCString. Decoding errors are detected (value is strictly checked against field type)

  • if one is encountered, default value is cleared (defaultValue()==TQVariant()).
    Returns
    true if given value was valid for field type.
Todo
BigInteger support

Definition at line 402 of file field.cpp.

◆ setDefaultValue() [2/2]

void Field::setDefaultValue ( const TQVariant & def)

Sets default value for this field. Setting null value removes the default value.

See also
defaultValue()

Definition at line 396 of file field.cpp.

◆ setDescription()

void KexiDB::Field::setDescription ( const TQString & description)
inline

Sets description for this field to description.

Definition at line 496 of file field.h.

◆ setEnumHints()

void KexiDB::Field::setEnumHints ( const TQValueVector< TQString > & l)
inline

sets the hint for enum fields

Definition at line 544 of file field.h.

◆ setExpression()

void Field::setExpression ( KexiDB::BaseExpr * expr)

Sets expression data expr. If there was already expression set, it is destroyed before new assignment. This Field object becames owner of expr object, so you do not have to worry about deleting it later. If the expr is null, current field's expression is deleted, if exists.

Because the field defines an expression, it should be assigned to a query, not to a table.

Definition at line 633 of file field.cpp.

◆ setForeignKey()

void Field::setForeignKey ( bool f)

Sets whether the field has to be declared with single-field foreign key. Used in IndexSchema::setForeigKey().

Definition at line 551 of file field.cpp.

◆ setIndexed()

void Field::setIndexed ( bool s)

Specifies whether the field is indexed (KexiDB::Indexed item) (by single-field implicit index) or not. Use this with caution. Since index is used to control unique, not null/empty constratins, setting this to false implies setting:

  • setPrimaryKey(false)
  • setUniqueKey(false)
  • setNotNull(false)
  • setNotEmpty(false) because above flags need index to be present. Similarly, setting one of the above flags to true, will automatically do setIndexed(true) for the same reason.

Definition at line 570 of file field.cpp.

◆ setLength()

void Field::setLength ( uint l)

Sets length for this field. Only works for Text Type (even not LongText!). 0 means "default length".

See also
length()

Definition at line 357 of file field.cpp.

◆ setName()

void Field::setName ( const TQString & name)

Sets name name for this field.

Definition at line 324 of file field.cpp.

◆ setNotEmpty()

void Field::setNotEmpty ( bool n)

Specifies whether the field has single-field unique constraint or not (KexiDB::NotEmpty item). Setting this to true implies setting Indexed flag to true (setIndexed(true)), because index is required it control not empty constraint.

Definition at line 564 of file field.cpp.

◆ setNotNull()

void Field::setNotNull ( bool n)

Specifies whether the field has single-field unique constraint or not (KexiDB::NotNull item). Setting this to true implies setting Indexed flag to true (setIndexed(true)), because index is required it control not null constraint.

Definition at line 558 of file field.cpp.

◆ setOptions()

void KexiDB::Field::setOptions ( uint options)
inline

Definition at line 288 of file field.h.

◆ setPrecision()

void Field::setPrecision ( uint p)

Sets scale for this field. Only works for floating-point types.

Definition at line 365 of file field.cpp.

◆ setPrimaryKey()

void Field::setPrimaryKey ( bool p)

Specifies whether the field is single-field primary key or not (KexiDB::PrimeryKey item). Use this with caution. Setting this to true implies setting:

  • setUniqueKey(true)
  • setNotNull(true)
  • setNotEmpty(true)
  • setIndexed(true)

Setting this to false implies setting setAutoIncrement(false).

Todo
is this ok for all engines?

Definition at line 524 of file field.cpp.

◆ setQuery()

void Field::setQuery ( QuerySchema * query)

For special use when field defines expression. Sets query schema of query that owns this field. This does not adds the field to query object. You do not need to call this method by hand. Call QuerySchema::addField() instead.

See also
setQuery()

Definition at line 318 of file field.cpp.

◆ setScale()

void Field::setScale ( uint s)

Sets scale for this field. Only works for floating-point types.

See also
scale()

Definition at line 373 of file field.cpp.

◆ setSubType()

void KexiDB::Field::setSubType ( const TQString & subType)
inline

Sets (optional) subtype for this field.

See also
subType()

Definition at line 322 of file field.h.

◆ setTable()

void Field::setTable ( TableSchema * table)
virtual

Sets table schema of table that owns this field. This does not adds the field to table object. You do not need to call this method by hand. Call TableSchema::addField(Field *field) instead.

See also
setQuery()

Reimplemented in KexiDB::QueryAsterisk.

Definition at line 306 of file field.cpp.

◆ setType()

void Field::setType ( Type t)

Sets type t for this field. This does nothing if there's already expression assigned, see expression().

Definition at line 330 of file field.cpp.

◆ setUniqueKey()

void Field::setUniqueKey ( bool u)

Specifies whether the field has single-field unique constraint or not (KexiDB::Unique item). Setting this to true implies setting Indexed flag to true (setIndexed(true)), because index is required it control unique constraint.

Definition at line 541 of file field.cpp.

◆ setUnsigned()

void Field::setUnsigned ( bool u)

Sets unsigned flag for this field. Only works for integer types.

Definition at line 389 of file field.cpp.

◆ setVisibleDecimalPlaces()

void Field::setVisibleDecimalPlaces ( int p)

Sets number of decimal places that should be visible to the user.

See also
visibleDecimalPlaces()

Definition at line 381 of file field.cpp.

◆ setWidth()

void KexiDB::Field::setWidth ( uint w)
inline

Sets visible width for this field to w (usually in pixels or points). 0 means there is no hint for the width.

Definition at line 500 of file field.h.

◆ subType()

TQString KexiDB::Field::subType ( ) const
inline
Returns
(optional) subtype for this field. Subtype is a string providing additional hint for field's type. E.g. for BLOB type, it can be a MIME type or certain TQVariant type name, for example: "TQPixmap", "TQColor" or "TQFont"

Definition at line 318 of file field.h.

◆ table()

TableSchema * Field::table ( ) const
virtual
Returns
table schema of table that owns this field or null if it has no table assigned.
See also
query()

Reimplemented in KexiDB::QueryAsterisk.

Definition at line 300 of file field.cpp.

◆ type()

Field::Type Field::type ( ) const
Returns
a type for this field. If there's expression assigned, type of the expression is returned instead.

Definition at line 134 of file field.cpp.

◆ typeForString()

Field::Type Field::typeForString ( const TQString & typeString)
static
Returns
type for a given typeString

Definition at line 197 of file field.cpp.

◆ typeGroup() [1/2]

TypeGroup KexiDB::Field::typeGroup ( ) const
inline
Returns
type group for this field

Definition at line 301 of file field.h.

◆ typeGroup() [2/2]

Field::TypeGroup Field::typeGroup ( uint type)
static
Returns
group for type

Definition at line 281 of file field.cpp.

◆ typeGroupForString()

Field::TypeGroup Field::typeGroupForString ( const TQString & typeGroupString)
static
Returns
type group for a given typeGroupString

Definition at line 206 of file field.cpp.

◆ typeGroupName() [1/2]

TQString KexiDB::Field::typeGroupName ( ) const
inline
Returns
a i18n'd type group name for this field

Definition at line 304 of file field.h.

◆ typeGroupName() [2/2]

TQString Field::typeGroupName ( uint typeGroup)
static
Returns
a i18n'd group name for typeGroup (typeGroup has to be an element from Field::TypeGroup)

Definition at line 185 of file field.cpp.

◆ typeGroupString() [1/2]

TQString KexiDB::Field::typeGroupString ( ) const
inline
Returns
a type group string for this field, for example "Integer" string for Field::IntegerGroup.

Definition at line 312 of file field.h.

◆ typeGroupString() [2/2]

TQString Field::typeGroupString ( uint typeGroup)
static
Returns
type group string for typeGroup, e.g. "IntegerGroup" for IntegerGroup type (not-i18n'd, type has to be an element from Field::Type, not greater than Field::LastType)

Definition at line 191 of file field.cpp.

◆ typeName() [1/2]

TQString KexiDB::Field::typeName ( ) const
inline
Returns
a i18n'd type name for this field

Definition at line 298 of file field.h.

◆ typeName() [2/2]

TQString Field::typeName ( uint type)
static
Returns
a i18n'd type name for type (type has to be an element from Field::Type, not greater than Field::LastType)

Definition at line 173 of file field.cpp.

◆ typeString() [1/2]

TQString KexiDB::Field::typeString ( ) const
inline
Returns
a type string for this field, for example "Integer" string for Field::Integer type.

Definition at line 308 of file field.h.

◆ typeString() [2/2]

TQString Field::typeString ( uint type)
static
Returns
type string for type, e.g. "Integer" for Integer type (not-i18n'd, type has to be an element from Field::Type, not greater than Field::LastType)

Definition at line 179 of file field.cpp.

◆ variantType() [1/2]

TQVariant::Type KexiDB::Field::variantType ( ) const
inline

Converts field's type to TQVariant equivalent as accurate as possible.

Definition at line 291 of file field.h.

◆ variantType() [2/2]

TQVariant::Type Field::variantType ( uint type)
static

Converts type type to TQVariant equivalent as accurate as possible.

Definition at line 141 of file field.cpp.

◆ visibleDecimalPlaces()

int KexiDB::Field::visibleDecimalPlaces ( ) const
inline
Todo
should we keep extended properties here or move them to a TQVariant dictionary?
Returns
number of decimal places that should be visible to the user, e.g. within table view widget, form or printout. Only meaningful if the field type is floating point or (in the future: decimal or currency).
  • Any value less than 0 (-1 is the default) means that there should be displayed all digits of the fractional part, except the ending zeros. This is known as "auto" mode. For example, 12.345000 becomes 12.345.
  • Value of 0 means that all the fractional part should be hidden (as well as the dot or comma). For example, 12.345000 becomes 12.
  • Value N > 0 means that the 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.

Definition at line 361 of file field.h.

◆ width()

uint KexiDB::Field::width ( ) const
inline
Returns
width of this field (usually in pixels or points) 0 (the default) means there is no hint for the width.

Definition at line 381 of file field.h.

◆ Connection

friend class Connection
friend

Definition at line 624 of file field.h.

◆ FieldList

friend class FieldList
friend

Definition at line 625 of file field.h.

◆ QuerySchema

friend class QuerySchema
friend

Definition at line 627 of file field.h.

◆ TableSchema

friend class TableSchema
friend

Definition at line 626 of file field.h.

Member Data Documentation

◆ m_caption

TQString KexiDB::Field::m_caption
protected

Definition at line 587 of file field.h.

◆ m_constraints

uint KexiDB::Field::m_constraints
protected

Definition at line 580 of file field.h.

◆ m_customProperties

CustomPropertiesMap* KexiDB::Field::m_customProperties
protected

Definition at line 593 of file field.h.

◆ m_defaultValue

TQVariant KexiDB::Field::m_defaultValue
protected

Definition at line 585 of file field.h.

◆ m_desc

TQString KexiDB::Field::m_desc
protected

Definition at line 588 of file field.h.

◆ m_expr

KexiDB::BaseExpr* KexiDB::Field::m_expr
protected

Definition at line 592 of file field.h.

◆ m_hints

TQValueVector<TQString> KexiDB::Field::m_hints
protected

Definition at line 590 of file field.h.

◆ m_length

uint KexiDB::Field::m_length
protected

also used for storing scale for floating point types

Definition at line 581 of file field.h.

◆ m_name

TQString KexiDB::Field::m_name
protected

Definition at line 578 of file field.h.

◆ m_options

uint KexiDB::Field::m_options
protected

Definition at line 584 of file field.h.

◆ m_order

int KexiDB::Field::m_order
protected

Definition at line 586 of file field.h.

◆ m_parent

FieldList* KexiDB::Field::m_parent
protected

In most cases this points to a TableSchema object that field is assigned.

Definition at line 576 of file field.h.

◆ m_precision

uint KexiDB::Field::m_precision
protected

Definition at line 582 of file field.h.

◆ m_subType

TQString KexiDB::Field::m_subType
protected

Definition at line 579 of file field.h.

◆ m_typeGroupNames

Field::FieldTypeGroupNames Field::m_typeGroupNames
staticprotected

real i18n'd type group names (and not-i18n'd group name strings)

Definition at line 619 of file field.h.

◆ m_typeNames

Field::FieldTypeNames Field::m_typeNames
staticprotected

real i18n'd type names (and not-i18n'd type name strings)

Definition at line 616 of file field.h.

◆ m_visibleDecimalPlaces

int KexiDB::Field::m_visibleDecimalPlaces
protected

used in visibleDecimalPlaces()

Definition at line 583 of file field.h.

◆ m_width

uint KexiDB::Field::m_width
protected

Definition at line 589 of file field.h.


The documentation for this class was generated from the following files: