kexi
KexiDB::FieldList Class Reference
#include <fieldlist.h>
Inheritance diagram for KexiDB::FieldList:

Detailed Description
Helper class that stores list of fields.
Definition at line 37 of file fieldlist.h.
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 QString &name) |
bool | hasField (const Field *field) |
int | indexOf (const Field *field) |
QStringList | names () const |
Field::ListIterator | fieldsIterator () const |
Field::List * | fields () |
Field::List * | autoIncrementFields () |
bool | isOwner () const |
virtual void | clear () |
virtual QString | debugString () |
void | debug () |
FieldList * | subList (const QString &n1, const QString &n2=QString::null, const QString &n3=QString::null, const QString &n4=QString::null, const QString &n5=QString::null, const QString &n6=QString::null, const QString &n7=QString::null, const QString &n8=QString::null, const QString &n9=QString::null, const QString &n10=QString::null, const QString &n11=QString::null, const QString &n12=QString::null, const QString &n13=QString::null, const QString &n14=QString::null, const QString &n15=QString::null, const QString &n16=QString::null, const QString &n17=QString::null, const QString &n18=QString::null) |
FieldList * | subList (const QStringList &list) |
FieldList * | subList (const QValueList< uint > &list) |
QString | sqlFieldsList (Driver *driver, const QString &separator=QString::fromLatin1(","), const QString &tableAlias=QString::null, int drvEscaping=Driver::EscapeDriver|Driver::EscapeAsNecessary) |
void | renameField (const QString &oldName, const QString &newName) |
void | renameField (KexiDB::Field *field, const QString &newName) |
Static Public Member Functions | |
static QString | sqlFieldsList (Field::List *list, Driver *driver, const QString &separator=QString::fromLatin1(","), const QString &tableAlias=QString::null, int drvEscaping=Driver::EscapeDriver|Driver::EscapeAsNecessary) |
Protected Attributes | |
Field::List | m_fields |
QDict< Field > | m_fields_by_name |
Field::List * | m_autoinc_fields |
Constructor & Destructor Documentation
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::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 | ( | ) | [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
uint KexiDB::FieldList::fieldCount | ( | ) | const [inline] |
Adds field at the and of field list.
Reimplemented in KexiDB::IndexSchema.
Definition at line 106 of file fieldlist.cpp.
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::QuerySchema, and KexiDB::TableSchema.
Definition at line 71 of file fieldlist.cpp.
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.
Field* KexiDB::FieldList::field | ( | uint | id | ) | [inline] |
- Returns:
- field id or NULL if there is no such a field.
Reimplemented in KexiDB::QuerySchema.
Definition at line 76 of file fieldlist.h.
Field * FieldList::field | ( | const QString & | name | ) | [virtual] |
- Returns:
- field with name name or NULL if there is no such a field.
Definition at line 121 of file fieldlist.cpp.
bool KexiDB::FieldList::hasField | ( | const Field * | field | ) | [inline] |
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.
QStringList FieldList::names | ( | ) | const |
Field::List * FieldList::autoIncrementFields | ( | ) |
- Returns:
- list of autoincremented fields. The list is owned by this FieldList object.
Reimplemented in KexiDB::QuerySchema.
Definition at line 266 of file fieldlist.cpp.
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.
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.
QString 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.
void FieldList::debug | ( | ) |
Shows debug information about all fields in the list.
Definition at line 146 of file fieldlist.cpp.
FieldList * FieldList::subList | ( | const QString & | n1, | |
const QString & | n2 = QString::null , |
|||
const QString & | n3 = QString::null , |
|||
const QString & | n4 = QString::null , |
|||
const QString & | n5 = QString::null , |
|||
const QString & | n6 = QString::null , |
|||
const QString & | n7 = QString::null , |
|||
const QString & | n8 = QString::null , |
|||
const QString & | n9 = QString::null , |
|||
const QString & | n10 = QString::null , |
|||
const QString & | n11 = QString::null , |
|||
const QString & | n12 = QString::null , |
|||
const QString & | n13 = QString::null , |
|||
const QString & | n14 = QString::null , |
|||
const QString & | n15 = QString::null , |
|||
const QString & | n16 = QString::null , |
|||
const QString & | n17 = QString::null , |
|||
const QString & | n18 = QString::null | |||
) |
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.
FieldList * FieldList::subList | ( | const QStringList & | list | ) |
Like above, but with a QStringList
Definition at line 198 of file fieldlist.cpp.
FieldList * FieldList::subList | ( | const QValueList< uint > & | list | ) |
Like above, but with a list of field indices
Definition at line 208 of file fieldlist.cpp.
QString FieldList::sqlFieldsList | ( | Driver * | driver, | |
const QString & | separator = QString::fromLatin1(",") , |
|||
const QString & | tableAlias = QString::null , |
|||
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.
static QString KexiDB::FieldList::sqlFieldsList | ( | Field::List * | list, | |
Driver * | driver, | |||
const QString & | separator = QString::fromLatin1(",") , |
|||
const QString & | tableAlias = QString::null , |
|||
int | drvEscaping = Driver::EscapeDriver|Driver::EscapeAsNecessary | |||
) | [static] |
Like above, but this is convenient static function, so you can pass any list here.
Member Data Documentation
QDict<Field> KexiDB::FieldList::m_fields_by_name [protected] |
The documentation for this class was generated from the following files: