Public Types | Public Member Functions | Protected Attributes
DtDatabaseTable Class Reference

A table is simply a table name and a list of column entries (DtDatabaseColumn). More...

+ Collaboration diagram for DtDatabaseTable:

List of all members.

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 DtDatabaseColumnaddColumn (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 DtStringtableName () 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

Detailed Description

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).


Member Function Documentation

virtual DtDatabaseColumn& DtDatabaseTable::addColumn ( const DtDatabaseColumn column) [virtual]

Makes a copy of the column argument and puts it on the column entries list.

Returns:
A reference to the column in the table. This allows modifying the actual column without copying or doing another lookup.
Exceptions:
DtInvalidInputif 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.

Exceptions:
DtInvalidInputif the iterator is invalid.

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

Document ID: Generated on Tue Oct 11 19:41:03 EDT 2011 from SVN revision 107422
Copyright © 2005-2011 VT MÄK Inc. All Rights Reserved (www.mak.com)