MyMoneyDbTable Class Reference

#include <mymoneystoragesql.h>

Collaboration diagram for MyMoneyDbTable:

Collaboration graph
[legend]

List of all members.

Public Types

typedef QValueList< KSharedPtr
< MyMoneyDbColumn >
>::const_iterator 
field_iterator

Public Member Functions

 MyMoneyDbTable (const QString &iname, const QValueList< KSharedPtr< MyMoneyDbColumn > > &ifields, const QString &initVersion="1.0")
 MyMoneyDbTable (void)
const QString & name (void) const
const QString & insertString (void) const
const QString selectAllString (bool terminate=true) const
const QString & updateString (void) const
const QString & deleteString (void) const
const QString dropPrimaryKeyString (databaseTypeE dbType) const
const QString columnList () const
const QString modifyColumnString (databaseTypeE dbType, const QString &columnName, const MyMoneyDbColumn &newDef) const
void buildSQLStrings (void)
const QString generateCreateSQL (databaseTypeE dbType) const
void addIndex (const QString &name, const QStringList &columns, bool unique=false)
field_iterator begin (void) const
field_iterator end (void) const

Private Types

typedef QValueList
< MyMoneyDbIndex >
::const_iterator 
index_iterator

Private Attributes

QString m_name
QValueList< KSharedPtr
< MyMoneyDbColumn > > 
m_fields
QValueList< MyMoneyDbIndexm_indices
QString m_initVersion
QString m_insertString
QString m_selectAllString
QString m_updateString
QString m_deleteString


Detailed Description

The MyMoneyDbTable class is a representation of a db table. It has a list of the columns (pointers to MyMoneyDbColumn types) and a list of any indices that may be on the table. Additionally, a string for a parameterized query for each of some common tasks on a table is created by the ctor.

Const iterators over the list of columns are provided as a convenience.


Member Typedef Documentation

typedef QValueList<KSharedPtr <MyMoneyDbColumn> >::const_iterator MyMoneyDbTable::field_iterator

typedef QValueList<MyMoneyDbIndex>::const_iterator MyMoneyDbTable::index_iterator [private]


Constructor & Destructor Documentation

MyMoneyDbTable::MyMoneyDbTable ( const QString &  iname,
const QValueList< KSharedPtr< MyMoneyDbColumn > > &  ifields,
const QString &  initVersion = "1.0" 
) [inline]

MyMoneyDbTable::MyMoneyDbTable ( void   )  [inline]


Member Function Documentation

const QString& MyMoneyDbTable::name ( void   )  const [inline]

const QString& MyMoneyDbTable::insertString ( void   )  const [inline]

const QString MyMoneyDbTable::selectAllString ( bool  terminate = true  )  const [inline]

const QString& MyMoneyDbTable::updateString ( void   )  const [inline]

const QString& MyMoneyDbTable::deleteString ( void   )  const [inline]

const QString MyMoneyDbTable::dropPrimaryKeyString ( databaseTypeE  dbType  )  const

This method determines the string required to drop the primary key for the table based on the db specific syntax.

Parameters:
dbType The driver type of the database.
Returns:
QString for the syntax to drop the primary key.

const QString MyMoneyDbTable::columnList (  )  const

This method returns a comma-separated list of all column names in the table

Returns:
QString column list.

const QString MyMoneyDbTable::modifyColumnString ( databaseTypeE  dbType,
const QString &  columnName,
const MyMoneyDbColumn newDef 
) const

This method returns the string for changing a column's definition. It covers statements like ALTER TABLE..CHANGE COLUMN, MODIFY COLUMN, etc.

Parameters:
dbType The driver type of the database.
columnName The name of the column to be modified.
newDef The MyMoneyColumn object of the new column definition.
Returns:
QString containing DDL to change the column.

void MyMoneyDbTable::buildSQLStrings ( void   ) 

This method builds all of the SQL strings for common operations.

const QString MyMoneyDbTable::generateCreateSQL ( databaseTypeE  dbType  )  const

This method generates the DDL required to create the table.

Parameters:
dbType The driver type of the database.
Returns:
QString of the DDL.

void MyMoneyDbTable::addIndex ( const QString &  name,
const QStringList &  columns,
bool  unique = false 
)

This method creates a MyMoneyDbIndex object and adds it to the list of indices for the table.

Parameters:
name The name of the index.
columns The list of the columns affected.
unique Whether or not this should be a unique index.

field_iterator MyMoneyDbTable::begin ( void   )  const [inline]

field_iterator MyMoneyDbTable::end ( void   )  const [inline]


Member Data Documentation

QString MyMoneyDbTable::m_name [private]

QString MyMoneyDbTable::m_initVersion [private]

QString MyMoneyDbTable::m_insertString [private]

QString MyMoneyDbTable::m_updateString [private]

QString MyMoneyDbTable::m_deleteString [private]


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

Generated on Wed Jan 26 13:09:13 2011 for KMyMoney by  doxygen 1.5.6