TreeFrogFramework 2.10
|
#include <tsqlormapper.h>
Classes | |
class | ConstIterator |
Public Member Functions | |
TSqlORMapper () | |
virtual | ~TSqlORMapper () |
TSqlORMapper< T > & | limit (int limit) |
TSqlORMapper< T > & | offset (int offset) |
TSqlORMapper< T > & | orderBy (int column, Tf::SortOrder order=Tf::AscendingOrder) |
TSqlORMapper< T > & | orderBy (const QString &column, Tf::SortOrder order=Tf::AscendingOrder) |
template<class C > | |
TSqlORMapper< T > & | join (int column, const TSqlJoin< C > &join) |
void | setLimit (int limit) |
void | setOffset (int offset) |
void | setSortOrder (int column, Tf::SortOrder order=Tf::AscendingOrder) |
void | setSortOrder (const QString &column, Tf::SortOrder order=Tf::AscendingOrder) |
template<class C > | |
void | setJoin (int column, const TSqlJoin< C > &join) |
void | reset () |
T | findFirst (const TCriteria &cri=TCriteria()) |
T | findFirstBy (int column, const QVariant &value) |
T | findByPrimaryKey (const QVariant &pk) |
int | find (const TCriteria &cri=TCriteria()) |
int | findBy (int column, const QVariant &value) |
int | findIn (int column, const QVariantList &values) |
int | rowCount () const |
T | first () const |
T | last () const |
T | value (int i) const |
int | findCount (const TCriteria &cri=TCriteria()) |
int | findCountBy (int column, const QVariant &value) |
int | updateAll (const TCriteria &cri, int column, const QVariant &value) |
int | updateAll (const TCriteria &cri, const QMap< int, QVariant > &values) |
int | removeAll (const TCriteria &cri=TCriteria()) |
ConstIterator | begin () const |
ConstIterator | end () const |
Public Member Functions inherited from TAbstractSqlORMapper | |
TAbstractSqlORMapper (const QSqlDatabase &db) | |
virtual | ~TAbstractSqlORMapper () |
Protected Member Functions | |
void | setFilter (const QString &filter) |
QString | orderBy () const |
virtual QString | orderByClause () const |
virtual void | clear () |
virtual QString | selectStatement () const |
virtual int | rowCount (const QModelIndex &parent) const |
The TSqlORMapper class is a template class that provides concise functionality to object-relational mapping.
It can be used to retrieve TSqlObject objects with a TCriteria from a table.
|
inline |
Constructor.
|
inlinevirtual |
Destructor.
|
inline |
|
inlineprotectedvirtual |
Clears and releases any acquired resource.
|
inline |
|
inlinevirtual |
Retrieves with the criteria cri from the table and returns the number of the ORM objects.
TSqlORMapperIterator is used to get the retrieved ORM objects.
Implements TAbstractSqlORMapper.
|
inlinevirtual |
Retrieves with the criteria for the column as the value in the table and returns the number of the ORM objects.
TSqlORMapperIterator is used to get the retrieved ORM objects.
Implements TAbstractSqlORMapper.
|
inline |
Returns the ORM object retrieved with the primary key pk from the table.
|
inlinevirtual |
Returns the number of records retrieved with the criteria cri from the table.
Implements TAbstractSqlORMapper.
|
inlinevirtual |
Returns the number of records retrieved with the criteria for the column as the value from the table.
Implements TAbstractSqlORMapper.
|
inline |
Returns the first ORM object retrieved with the criteria cri from the table.
|
inline |
Returns the first ORM object retrieved with the criteria for the column as the value in the table.
|
inlinevirtual |
Retrieves with the criteria that the column is within the list of values values returns the number of the ORM objects.
TSqlORMapperIterator is used to get the retrieved ORM objects.
Implements TAbstractSqlORMapper.
|
inline |
Returns the first ORM object in the results retrieved by find() function.
|
inline |
|
inline |
Returns the last ORM object in the results retrieved by find() function.
|
inline |
Sets the limit to limit, which is the limited number of rows for execution of SELECT statement.
|
inline |
Sets the offset to offset, which is the number of rows to skip for execution of SELECT statement.
|
inlineprotected |
Returns a SQL WHERE clause generated from a criteria.
|
inline |
Sets the sort order for column to order.
|
inline |
Sets the sort order for column to order.
|
inlineprotectedvirtual |
|
inlinevirtual |
Removes all rows based on the criteria cri from the table and returns the number of the rows affected by the query executed.
Implements TAbstractSqlORMapper.
|
inlinevirtual |
Reset the internal state of the mapper object.
Implements TAbstractSqlORMapper.
|
inline |
Returns the number of rows of the current query.
|
inlineprotectedvirtual |
Returns the number of rows of the current query.
|
inlineprotectedvirtual |
Returns a SELECT statement generated from the specified parameters.
This function is for internal use only.
|
inlineprotected |
Sets the current filter to filter.
The filter is a SQL WHERE clause without the keyword WHERE (for example, name='Hanako'). The filter will be applied the next time a query is executed.
|
inline |
Sets a JOIN clause for column to join.
|
inlinevirtual |
Sets the limit to limit, which is the limited number of rows for execution of SELECT statement.
Implements TAbstractSqlORMapper.
|
inlinevirtual |
Sets the offset to offset, which is the number of rows to skip for execution of SELECT statement.
Implements TAbstractSqlORMapper.
|
inlinevirtual |
Sets the sort order for column to order.
Implements TAbstractSqlORMapper.
|
inlinevirtual |
Sets the sort order for column to order.
Implements TAbstractSqlORMapper.
|
virtual |
Updates the values of the columns specified in the first elements in the each pairs of values in all rows that satisfy the criteria cri and returns the number of the rows affected by the query executed.
Implements TAbstractSqlORMapper.
|
inlinevirtual |
Updates the value of the specified column in all rows that satisfy the criteria cri and returns the number of the rows affected by the query executed.
Implements TAbstractSqlORMapper.
|
inline |
Returns the ORM object in the results retrieved by find() function.
If i is the index of a valid row on the results, the ORM object will be populated with values from that row.