A table is simply a table name and a list of column entries (DtDatabaseColumn). More...
Collaboration diagram for DtDatabaseTable:Public Types | |
|
typedef std::list < DtDatabaseColumn > | ColumnList |
| Various useful types. | |
| typedef ColumnList::iterator | iterator |
| typedef ColumnList::const_iterator | const_iterator |
Public Member Functions | |
| DtDatabaseTable (const DtString &tableName) | |
| constructor | |
| virtual | ~DtDatabaseTable () |
| destructor | |
| virtual bool | isShared () const |
| Share this table object is shared, a shared table can have calls to create without destroying the original data. | |
| virtual void | setShared (bool shared) |
| virtual bool | hasTableBeenCreated () const |
| Check to see if a table has been created using this object. | |
| virtual void | setTableCreated (bool created) |
| virtual DtDatabaseColumn & | addColumn (const DtDatabaseColumn &column) |
| Makes a copy of the column argument and puts it on the column entries list. | |
| virtual void | removeColumn (iterator column) |
| Remove a column by iterator. | |
| virtual void | clearColumns () |
| Remove all columns. | |
| virtual void | resetValues () |
| Set all values to null. | |
| virtual bool | isEmpty (bool checkPrimaryKey) const |
| Check to see if this table has any values. | |
| unsigned int | autoIncrementKey () |
| Get a new auto increment key which will be unique for this table. | |
| unsigned int | lastLocalAutoIncrementKey () const |
| Get the last auto increment key calculated. | |
| virtual DtString | createCSVList (size_t index, bool skipNull, int maxColumnWidth) const |
| Return a comma separated value list. | |
| virtual const DtString & | tableName () const |
| returns the table's name | |
| virtual void | setName (const DtString &tableName) |
| Set the table name. | |
| virtual size_t | rowCount () const |
| Iterate throw each column and get the maximum value count. | |
| virtual iterator | getColumn (const DtString &columnName) |
| Get a iterator to a column with a given name. | |
| virtual const_iterator | getColumn (const DtString &columnName) const |
| Get a iterator to a column with a given name. | |
| virtual iterator | begin () |
| Get an iterator to the first column. | |
| virtual const_iterator | begin () const |
| Get an iterator to the first column. | |
| virtual iterator | end () |
| Get an iterator to after the last column. | |
| virtual const_iterator | end () const |
| Get an iterator to after the last column. | |
Protected Attributes | |
| DtString | myName |
| ColumnList | myColumns |
| unsigned int | myLocalAutoIncrementKey |
| bool | mySharedFlag |
| bool | myCreatedFlag |
A table is simply a table name and a list of column entries (DtDatabaseColumn).
This class provides the infrastructure and interface for specific SQL tables. It also provides methods for generating a comma- separated list of column names (for use in INSERT commands) and a properly formatted argument string for table creation (CREATE TABLE).
| virtual DtDatabaseColumn& DtDatabaseTable::addColumn | ( | const DtDatabaseColumn & | column | ) | [virtual] |
Makes a copy of the column argument and puts it on the column entries list.
| DtInvalidInput | if a column with the same name exists. |
| virtual bool DtDatabaseTable::isShared | ( | ) | const [virtual] |
Share this table object is shared, a shared table can have calls to create without destroying the original data.
| unsigned int DtDatabaseTable::lastLocalAutoIncrementKey | ( | ) | const |
Get the last auto increment key calculated.
if autoIncrementKey has not been called this function will return a Zero.
| virtual void DtDatabaseTable::removeColumn | ( | iterator | column | ) | [virtual] |
Remove a column by iterator.
| DtInvalidInput | if the iterator is invalid. |