|
|
#ifndef TABLE_H #define TABLE_H #ifdef HAVE_CONFIG_H #include <config.h> #endif #include <qstring.h> #include <qlist.h> #include "dataobject.h" namespace KDB { class Field; class Index; class RecordsetPtr; typedef QList<Field> Fields; typedef QList<Index> Indexes; /** * Representation of a database table. * * Trough this object we access the fields and * indices of a given table (when available). This object will allow building of * new fields and indexes, as well as editing of the table data using * @ref openRecordset */ class Table :public DataObject { Q_OBJECT public: Table(const char * name); virtual ~Table(); /** * creates a new field for the current table. * If the table is not create()d, the field is appended * to the list of fields and created with the table itself. * else no modification will occur. To apply the changes to the * table, you must use @ref appendField */ virtual Field * newField(const QString &name) = 0; /** * appends the field to the list of fields and issue an * alter table to the underlying DBMS. */ virtual void appendField(Field *) = 0; /** * returns an existing field by name, or 0L if the * table does not exists */ Field * getField(const QString &name); /** * return the list of available fields */ Fields fields(); /** * creates a new index * * @param name this is the name of the index */ virtual Index * newIndex(const QString &name) = 0; /** * return an index by name */ Index * getIndex(const QString &name); /** * return the list of available indexes */ Indexes indexes(); /** * creates a recordset based on this table. */ virtual RecordsetPtr openRecordset() = 0; /** * actually create the table. * returns true if the table has been successfully created, * false otherwise. */ virtual bool create() = 0; protected: Fields m_fields; Indexes m_indexes; }; } #endif
Generated by: pradu@server.rete.casa on Fri Jul 28 15:15:55 2000, using kdoc 2.0a36. |