#include <tsqlormapper.h>
|
| 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 |
|
| TAbstractSqlORMapper (const QSqlDatabase &db) |
|
virtual | ~TAbstractSqlORMapper () |
|
template<class T>
class TSqlORMapper< T >
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.
- See also
- TSqlObject, TCriteria
◆ TSqlORMapper()
◆ ~TSqlORMapper()
◆ begin()
◆ clear()
Clears and releases any acquired resource.
◆ end()
◆ find()
◆ findBy()
template<class T >
int TSqlORMapper< T >::findBy |
( |
int |
column, |
|
|
const QVariant & |
value |
|
) |
| |
|
inlinevirtual |
◆ findByPrimaryKey()
template<class T >
T TSqlORMapper< T >::findByPrimaryKey |
( |
const QVariant & |
pk | ) |
|
|
inline |
Returns the ORM object retrieved with the primary key pk from the table.
◆ findCount()
Returns the number of records retrieved with the criteria cri from the table.
Implements TAbstractSqlORMapper.
◆ findCountBy()
template<class T >
int TSqlORMapper< T >::findCountBy |
( |
int |
column, |
|
|
const QVariant & |
value |
|
) |
| |
|
inlinevirtual |
Returns the number of records retrieved with the criteria for the column as the value from the table.
Implements TAbstractSqlORMapper.
◆ findFirst()
Returns the first ORM object retrieved with the criteria cri from the table.
◆ findFirstBy()
template<class T >
T TSqlORMapper< T >::findFirstBy |
( |
int |
column, |
|
|
const QVariant & |
value |
|
) |
| |
|
inline |
Returns the first ORM object retrieved with the criteria for the column as the value in the table.
◆ findIn()
template<class T >
int TSqlORMapper< T >::findIn |
( |
int |
column, |
|
|
const QVariantList & |
values |
|
) |
| |
|
inlinevirtual |
◆ first()
◆ join()
template<class T >
template<class C >
◆ last()
◆ limit()
Sets the limit to limit, which is the limited number of rows for execution of SELECT statement.
◆ offset()
Sets the offset to offset, which is the number of rows to skip for execution of SELECT statement.
◆ orderBy() [1/3]
Returns a SQL WHERE clause generated from a criteria.
◆ orderBy() [2/3]
Sets the sort order for column to order.
◆ orderBy() [3/3]
Sets the sort order for column to order.
◆ orderByClause()
◆ removeAll()
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.
◆ reset()
◆ rowCount() [1/2]
Returns the number of rows of the current query.
◆ rowCount() [2/2]
template<class T >
int TSqlORMapper< T >::rowCount |
( |
const QModelIndex & |
parent | ) |
const |
|
inlineprotectedvirtual |
Returns the number of rows of the current query.
◆ selectStatement()
Returns a SELECT statement generated from the specified parameters.
This function is for internal use only.
◆ setFilter()
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.
◆ setJoin()
template<class T >
template<class C >
Sets a JOIN clause for column to join.
◆ setLimit()
Sets the limit to limit, which is the limited number of rows for execution of SELECT statement.
Implements TAbstractSqlORMapper.
◆ setOffset()
Sets the offset to offset, which is the number of rows to skip for execution of SELECT statement.
Implements TAbstractSqlORMapper.
◆ setSortOrder() [1/2]
◆ setSortOrder() [2/2]
◆ updateAll() [1/2]
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.
◆ updateAll() [2/2]
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.
◆ value()
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.
The documentation for this class was generated from the following file: