EasyQtSql
Easy SQL data access helper for QtSql
PreparedQuery Class Reference

Class for query preparation and execution. More...

#include <EasyQtSql_PreparedQuery.h>

Public Member Functions

 PreparedQuery (const QString &stmt, const QSqlDatabase &db, bool forwardOnly=true)
 
QueryResultexec ()
 
QueryResultexec (const QVariant &bindValue)
 
QueryResultexec (const In &paramWrapper)
 
QueryResultexec (const Out &paramWrapper)
 
QueryResultexec (const InOut &paramWrapper)
 
template<typename... Rest>
QueryResultexec (const QVariant &bindValue, const Rest &... rest)
 
template<typename... Rest>
QueryResultexec (const In &paramWrapper, const Rest &... rest)
 
template<typename... Rest>
QueryResultexec (const Out &paramWrapper, const Rest &... rest)
 
template<typename... Rest>
QueryResultexec (const InOut &paramWrapper, const Rest &... rest)
 

Detailed Description

Class for query preparation and execution.

//SELECT a, b, c, d FROM table WHERE a=? AND b=?
PreparedQuery query = t.prepare("SELECT a, b, c, d FROM table WHERE a=? AND b=?");
//parameters a and b are bound with values 1 and 2, query executed
QueryResult res = query.exec(1, 2);
while(res.next())
{
//fetch data here
}
//parameters a and b are bound with values 3 and 4, query executed
res = query.exec(3, 4);
while(res.next())
{
//fetch data here
}

Constructor & Destructor Documentation

◆ PreparedQuery()

PreparedQuery::PreparedQuery ( const QString &  stmt,
const QSqlDatabase &  db,
bool  forwardOnly = true 
)
inline

Member Function Documentation

◆ exec() [1/9]

QueryResult& PreparedQuery::exec ( )
inline

◆ exec() [2/9]

QueryResult& PreparedQuery::exec ( const QVariant &  bindValue)
inline

◆ exec() [3/9]

QueryResult& PreparedQuery::exec ( const In paramWrapper)
inline

◆ exec() [4/9]

QueryResult& PreparedQuery::exec ( const Out paramWrapper)
inline

◆ exec() [5/9]

QueryResult& PreparedQuery::exec ( const InOut paramWrapper)
inline

◆ exec() [6/9]

template<typename... Rest>
QueryResult& PreparedQuery::exec ( const QVariant &  bindValue,
const Rest &...  rest 
)
inline

◆ exec() [7/9]

template<typename... Rest>
QueryResult& PreparedQuery::exec ( const In paramWrapper,
const Rest &...  rest 
)
inline

◆ exec() [8/9]

template<typename... Rest>
QueryResult& PreparedQuery::exec ( const Out paramWrapper,
const Rest &...  rest 
)
inline

◆ exec() [9/9]

template<typename... Rest>
QueryResult& PreparedQuery::exec ( const InOut paramWrapper,
const Rest &...  rest 
)
inline

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