#include <fieldlist.h>

Inheritance diagram for KexiDB::FieldList:
KexiDB::IndexSchema KexiDB::QuerySchema KexiDB::TableSchema KexiDB::InternalTableSchema

Public Member Functions

 FieldList (bool owner=false)
 
 FieldList (const FieldList &fl, bool deepCopyFields=true)
 
virtual ~FieldList ()
 
uint fieldCount () const
 
FieldList & addField (Field *field)
 
virtual FieldList & insertField (uint index, Field *field)
 
virtual void removeField (KexiDB::Field *field)
 
Field * field (uint id)
 
virtual Field * field (const TQString &name)
 
bool hasField (const Field *field)
 
int indexOf (const Field *field)
 
TQStringList names () const
 
Field::ListIterator fieldsIterator () const
 
Field::List * fields ()
 
Field::List * autoIncrementFields ()
 
bool isOwner () const
 
virtual void clear ()
 
virtual TQString debugString ()
 
void debug ()
 
FieldList * subList (const TQString &n1, const TQString &n2=TQString(), const TQString &n3=TQString(), const TQString &n4=TQString(), const TQString &n5=TQString(), const TQString &n6=TQString(), const TQString &n7=TQString(), const TQString &n8=TQString(), const TQString &n9=TQString(), const TQString &n10=TQString(), const TQString &n11=TQString(), const TQString &n12=TQString(), const TQString &n13=TQString(), const TQString &n14=TQString(), const TQString &n15=TQString(), const TQString &n16=TQString(), const TQString &n17=TQString(), const TQString &n18=TQString())
 
FieldList * subList (const TQStringList &list)
 
FieldList * subList (const TQValueList< uint > &list)
 
TQString sqlFieldsList (Driver *driver, const TQString &separator=TQString::fromLatin1(","), const TQString &tableAlias=TQString(), int drvEscaping=Driver::EscapeDriver|Driver::EscapeAsNecessary)
 
void renameField (const TQString &oldName, const TQString &newName)
 
void renameField (KexiDB::Field *field, const TQString &newName)
 

Static Public Member Functions

static TQString sqlFieldsList (Field::List *list, Driver *driver, const TQString &separator=TQString::fromLatin1(","), const TQString &tableAlias=TQString(), int drvEscaping=Driver::EscapeDriver|Driver::EscapeAsNecessary)
 

Protected Attributes

Field::List m_fields
 
TQDict< Field > m_fields_by_name
 
Field::List * m_autoinc_fields
 

Detailed Description

Helper class that stores list of fields.

Definition at line 37 of file fieldlist.h.

Constructor & Destructor Documentation

◆ FieldList() [1/2]

FieldList::FieldList ( bool  owner = false)

Creates empty list of fields. If owner is true, the list will be owner of any added field, what means that these field will be removed on the list destruction. Otherwise, the list just points any field that was added.

See also
isOwner()

Definition at line 29 of file fieldlist.cpp.

◆ FieldList() [2/2]

FieldList::FieldList ( const FieldList &  fl,
bool  deepCopyFields = true 
)

Copy constructor. If deepCopyFields is true, all fields are deeply copied, else only pointer are copied. Reimplemented in QuerySchema constructor.

Definition at line 38 of file fieldlist.cpp.

◆ ~FieldList()

FieldList::~FieldList ( )
virtual

Destroys the list. If the list owns fields (see constructor), these are also deleted.

Definition at line 56 of file fieldlist.cpp.

Member Function Documentation

◆ addField()

FieldList & FieldList::addField ( KexiDB::Field *  field)

Adds field at the and of field list.

Definition at line 106 of file fieldlist.cpp.

◆ autoIncrementFields()

Field::List * FieldList::autoIncrementFields ( )
Returns
list of autoincremented fields. The list is owned by this FieldList object.

Definition at line 266 of file fieldlist.cpp.

◆ clear()

void FieldList::clear ( )
virtual

Removes all fields from the list.

Reimplemented in KexiDB::QuerySchema, and KexiDB::TableSchema.

Definition at line 61 of file fieldlist.cpp.

◆ debug()

void FieldList::debug ( )

Shows debug information about all fields in the list.

Definition at line 146 of file fieldlist.cpp.

◆ debugString()

TQString FieldList::debugString ( )
virtual
Returns
String for debugging purposes.

Reimplemented in KexiDB::IndexSchema, KexiDB::QuerySchema, and KexiDB::TableSchema.

Definition at line 126 of file fieldlist.cpp.

◆ field() [1/2]

Field * FieldList::field ( const TQString &  name)
virtual
Returns
field with name name or NULL if there is no such a field.

Definition at line 121 of file fieldlist.cpp.

◆ field() [2/2]

Field * KexiDB::FieldList::field ( uint  id)
inline
Returns
field id or NULL if there is no such a field.

Definition at line 76 of file fieldlist.h.

◆ fieldCount()

uint KexiDB::FieldList::fieldCount ( ) const
inline
Returns
number of fields in the list.

Definition at line 58 of file fieldlist.h.

◆ fields()

Field::List * KexiDB::FieldList::fields ( )
inline

Definition at line 93 of file fieldlist.h.

◆ fieldsIterator()

Field::ListIterator KexiDB::FieldList::fieldsIterator ( ) const
inline

Definition at line 91 of file fieldlist.h.

◆ hasField()

bool KexiDB::FieldList::hasField ( const Field *  field)
inline
Returns
true if this list contains given field.

Definition at line 82 of file fieldlist.h.

◆ indexOf()

int KexiDB::FieldList::indexOf ( const Field *  field)
inline
Returns
first occurrence of field in the list or -1 if this list does not contain this field.

Definition at line 86 of file fieldlist.h.

◆ insertField()

FieldList & FieldList::insertField ( uint  index,
KexiDB::Field *  field 
)
virtual

Inserts field into a specified position (index).

Note: You can reimplement this method but you should still call this implementation in your subclass.

Reimplemented in KexiDB::TableSchema, and KexiDB::QuerySchema.

Definition at line 71 of file fieldlist.cpp.

◆ isOwner()

bool KexiDB::FieldList::isOwner ( ) const
inline
Returns
true if fields in the list are owned by this list.

Definition at line 99 of file fieldlist.h.

◆ names()

TQStringList FieldList::names ( ) const
Returns
list of field names for this list.

Definition at line 224 of file fieldlist.cpp.

◆ removeField()

void FieldList::removeField ( KexiDB::Field *  field)
virtual

Removes field from the field list. Use with care.

Note: You can reimplement this method but you should still call this implementation in your subclass.

Reimplemented in KexiDB::QuerySchema, and KexiDB::TableSchema.

Definition at line 111 of file fieldlist.cpp.

◆ renameField() [1/2]

void FieldList::renameField ( const TQString &  oldName,
const TQString &  newName 
)

Definition at line 88 of file fieldlist.cpp.

◆ renameField() [2/2]

void FieldList::renameField ( KexiDB::Field *  field,
const TQString &  newName 
)

Definition at line 93 of file fieldlist.cpp.

◆ sqlFieldsList() [1/2]

TQString FieldList::sqlFieldsList ( Driver *  driver,
const TQString &  separator = TQString::fromLatin1(","),
const TQString &  tableAlias = TQString(),
int  drvEscaping = Driver::EscapeDriver|Driver::EscapeAsNecessary 
)
Returns
a string that is a result of all field names concatenated and with separator. This is usable e.g. as argument like "field1,field2" for "INSERT INTO (xxx) ..". The result of this method is effectively cached, and it is invalidated when set of fields changes (e.g. using clear() or addField()). tableAlias, if provided is prepended to each field, so the resulting names will be in form tableAlias.fieldName. This option is used for building queries with joins, where fields have to be spicified without ambiguity. See Connection::selectStatement() for example use. drvEscaping can be used to alter default escaping type.

Definition at line 256 of file fieldlist.cpp.

◆ sqlFieldsList() [2/2]

TQString FieldList::sqlFieldsList ( Field::List *  list,
Driver *  driver,
const TQString &  separator = TQString::fromLatin1(","),
const TQString &  tableAlias = TQString(),
int  drvEscaping = Driver::EscapeDriver|Driver::EscapeAsNecessary 
)
static

Like above, but this is convenient static function, so you can pass any list here.

Definition at line 237 of file fieldlist.cpp.

◆ subList() [1/3]

FieldList * FieldList::subList ( const TQString &  n1,
const TQString &  n2 = TQString(),
const TQString &  n3 = TQString(),
const TQString &  n4 = TQString(),
const TQString &  n5 = TQString(),
const TQString &  n6 = TQString(),
const TQString &  n7 = TQString(),
const TQString &  n8 = TQString(),
const TQString &  n9 = TQString(),
const TQString &  n10 = TQString(),
const TQString &  n11 = TQString(),
const TQString &  n12 = TQString(),
const TQString &  n13 = TQString(),
const TQString &  n14 = TQString(),
const TQString &  n15 = TQString(),
const TQString &  n16 = TQString(),
const TQString &  n17 = TQString(),
const TQString &  n18 = TQString() 
)

Creates and returns a list that contain fields selected by name. At least one field (exising on this list) should be selected, otherwise 0 is returned. Returned FieldList object is not owned by any parent (so you need to destroy yourself) and Field objects included in it are not owned by it (but still as before, by 'this' object). Returned list can be usable e.g. as argument for Connection::insertRecord(). 0 is returned if at least one name cannot be found.

Definition at line 163 of file fieldlist.cpp.

◆ subList() [2/3]

FieldList * FieldList::subList ( const TQStringList &  list)

Like above, but with a TQStringList

Definition at line 198 of file fieldlist.cpp.

◆ subList() [3/3]

FieldList * FieldList::subList ( const TQValueList< uint > &  list)

Like above, but with a list of field indices

Definition at line 208 of file fieldlist.cpp.

Member Data Documentation

◆ m_autoinc_fields

Field::List* KexiDB::FieldList::m_autoinc_fields
protected

Definition at line 166 of file fieldlist.h.

◆ m_fields

Field::List KexiDB::FieldList::m_fields
protected

Definition at line 164 of file fieldlist.h.

◆ m_fields_by_name

TQDict<Field> KexiDB::FieldList::m_fields_by_name
protected

Fields collected by name. Not used by QuerySchema.

Definition at line 165 of file fieldlist.h.


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