# class toQuery | This class is used to perform a query on a database connection. More...
Definition | `#include <toconnection.h>`
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

#### Public Types

- enum queryMode { Normal, /** Run the query normally on the main backgrround connection of the }
- struct queryDescribe
- class queryImpl

#### Public Methods

- toQuery (toConnection &conn,toSQL &sql,const std::list<toQValue> ¶ms)
- toQuery (toConnection &conn,const QString &sql,const std::list<toQValue> ¶ms)
- toQuery (toConnection &conn,toSQL &sql, const QString &arg1=QString::null,const QString &arg2=QString::null, const QString &arg3=QString::null,const QString &arg4=QString::null, const QString &arg5=QString::null,const QString &arg6=QString::null, const QString &arg7=QString::null,const QString &arg8=QString::null, const QString &arg9=QString::null)
- toQuery (toConnection &conn,const QString &sql, const QString &arg1=QString::null,const QString &arg2=QString::null, const QString &arg3=QString::null,const QString &arg4=QString::null, const QString &arg5=QString::null,const QString &arg6=QString::null, const QString &arg7=QString::null,const QString &arg8=QString::null, const QString &arg9=QString::null)
- toQuery (toConnection &conn,queryMode mode,toSQL &sql,const std::list<toQValue> ¶ms)
- toQuery (toConnection &conn,queryMode mode,const QString &sql,const std::list<toQValue> ¶ms)
- toQuery (toConnection &conn,queryMode mode=Normal)
- virtual ~toQuery ()
- void execute (toSQL &sql,const std::list<toQValue> ¶ms)
- void execute (const QString &sql,const std::list<toQValue> ¶ms)
- toConnection & connection (void)
- toConnectionSub * connectionSub (void)
- std::list<toQValue> & params (void)
- QCString sql (void)
- toQuery::queryMode mode (void) const
- toQValue readValue (void)
- toQValue readValueNull (void)
- bool eof (void)
- int rowsProcessed (void)
- std::list describe (void)
- int columns (void)
- void cancel (void)

#### Public Static Methods

- static std::list<toQValue> readQuery (toConnection &conn, toSQL &sql, std::list<toQValue> ¶ms)
- static std::list<toQValue> readQuery (toConnection &conn, const QString &sql, std::list<toQValue> ¶ms)
- static std::list<toQValue> readQuery (toConnection &conn,toSQL &sql, const QString &arg1=QString::null,const QString &arg2=QString::null, const QString &arg3=QString::null,const QString &arg4=QString::null, const QString &arg5=QString::null,const QString &arg6=QString::null, const QString &arg7=QString::null,const QString &arg8=QString::null, const QString &arg9=QString::null)
- static std::list<toQValue> readQuery (toConnection &conn,const QString &sql, const QString &arg1=QString::null,const QString &arg2=QString::null, const QString &arg3=QString::null,const QString &arg4=QString::null, const QString &arg5=QString::null,const QString &arg6=QString::null, const QString &arg7=QString::null,const QString &arg8=QString::null, const QString &arg9=QString::null)
- static std::list<toQValue> readQueryNull (toConnection &conn, toSQL &sql, std::list<toQValue> ¶ms)
- static std::list<toQValue> readQueryNull (toConnection &conn, const QString &sql, std::list<toQValue> ¶ms)
- static std::list<toQValue> readQueryNull (toConnection &conn,toSQL &sql, const QString &arg1=QString::null,const QString &arg2=QString::null, const QString &arg3=QString::null,const QString &arg4=QString::null, const QString &arg5=QString::null,const QString &arg6=QString::null, const QString &arg7=QString::null,const QString &arg8=QString::null, const QString &arg9=QString::null)
- static std::list<toQValue> readQueryNull (toConnection &conn,const QString &sql, const QString &arg1=QString::null,const QString &arg2=QString::null, const QString &arg3=QString::null,const QString &arg4=QString::null, const QString &arg5=QString::null,const QString &arg6=QString::null, const QString &arg7=QString::null,const QString &arg8=QString::null, const QString &arg9=QString::null)

## Detailed Description

This class is used to perform a query on a database connection.

enum queryMode { Normal, /** Run the query normally on the main backgrround connection of the } | ### queryMode

Run the query normally on the main connection of the toConnection object.

queryDescribe (struct) | ### queryDescribe

This structure is used to describe the resultset of a query.

queryImpl (class) | ### queryImpl

Abstract parent of implementations of a query for a database provider (See toConnection::connectionImpl and toConnectionProvider)

toQuery (toConnection &conn,toSQL &sql,const std::list<toQValue> ¶ms) | ### toQuery

Create a normal query.

Parameters:

conn | Connection to create query on.
sql | SQL to run.
params | Parameters to pass to query.

toQuery (toConnection &conn,const QString &sql,const std::list<toQValue> ¶ms) | ### toQuery

Create a normal query.

Parameters:

conn | Connection to create query on.
sql | SQL to run.
params | Parameters to pass to query.

toQuery (toConnection &conn,toSQL &sql, const QString &arg1=QString::null,const QString &arg2=QString::null, const QString &arg3=QString::null,const QString &arg4=QString::null, const QString &arg5=QString::null,const QString &arg6=QString::null, const QString &arg7=QString::null,const QString &arg8=QString::null, const QString &arg9=QString::null) | ### toQuery

Create a normal query.

Parameters:

conn | Connection to create query on.
sql | SQL to run.
arg1 | Arguments to pass to query.

toQuery (toConnection &conn,const QString &sql, const QString &arg1=QString::null,const QString &arg2=QString::null, const QString &arg3=QString::null,const QString &arg4=QString::null, const QString &arg5=QString::null,const QString &arg6=QString::null, const QString &arg7=QString::null,const QString &arg8=QString::null, const QString &arg9=QString::null) | ### toQuery

Create a normal query.

Parameters:

conn | Connection to create query on.
sql | SQL to run.
arg1 | Arguments to pass to query.

toQuery (toConnection &conn,queryMode mode,toSQL &sql,const std::list<toQValue> ¶ms) | ### toQuery

Create a query.

Parameters:

conn | Connection to create query on.
mode | Mode to run query in.
sql | SQL to run.
params | Arguments to pass to query.

toQuery (toConnection &conn,queryMode mode,const QString &sql,const std::list<toQValue> ¶ms) | ### toQuery

Create a query.

Parameters:

conn | Connection to create query on.
mode | Mode to run query in.
sql | SQL to run.
params | Arguments to pass to query.

toQuery (toConnection &conn,queryMode mode=Normal) | ### toQuery

Create a query. Don't runn any SQL using it yet. Observe though that the toConnectionSub object is assigned here so you know that all queries run using this query object will run on the same actual connection to the database (Unless mode is All off course).

Parameters:

conn | Connection to create query for.
mode | Mode to execute queries in.

~toQuery () | ### ~toQuery

[virtual]

Destroy query.

void execute (toSQL &sql,const std::list<toQValue> ¶ms) | ### execute

Execute an SQL statement using this query.

Parameters:

sql | SQL to run.
params | Parameters to pass to query.

void execute (const QString &sql,const std::list<toQValue> ¶ms) | ### execute

Execute an SQL statement using this query.

Parameters:

sql | SQL to run.
params | Parameters to pass to query.

toConnection & connection (void) | ### connection

Connection object of this object.

toConnectionSub * connectionSub (void) | ### connectionSub

Actual database connection that this query is currently using.

std::list<toQValue> & params (void) | ### params

Parameters of the current query.

QCString sql (void) | ### sql

SQL to run. Observe that this string is in UTF8 format.

toQuery::queryMode mode (void) | ### mode

[const]

Get the mode this query is executed in.

toQValue readValue (void) | ### readValue

Read a value from the query. Convert the value NULL to the string {null}.

Returns: Value read.

toQValue readValueNull (void) | ### readValueNull

Read a value from the query. Nulls are returned as empty toQValue.

Returns: Value read.

bool eof (void) | ### eof

Check if end of query is reached.

Returns: True if end of query is reached.

int rowsProcessed (void) | ### rowsProcessed

Get the number of rows processed by the query.

std::list describe (void) | ### describe

Get a list of descriptions for the columns. This function is relatively slow.

int columns (void) | ### columns

Get the number of columns in the resultset of the query.

std::list<toQValue> readQuery (toConnection &conn, toSQL &sql, std::list<toQValue> ¶ms) | ### readQuery

[static]

Execute a query and return all the values returned by it.

Parameters:

conn | Connection to run query on.
sql | SQL to run.
params | Parameters to pass to query.

Returns: A list of toQValues:s read from the query.

std::list<toQValue> readQuery (toConnection &conn, const QString &sql, std::list<toQValue> ¶ms) | ### readQuery

[static]

Execute a query and return all the values returned by it.

Parameters:

conn | Connection to run query on.
sql | SQL to run.
params | Parameters to pass to query.

Returns: A list of toQValues:s read from the query.

std::list<toQValue> readQuery (toConnection &conn,toSQL &sql, const QString &arg1=QString::null,const QString &arg2=QString::null, const QString &arg3=QString::null,const QString &arg4=QString::null, const QString &arg5=QString::null,const QString &arg6=QString::null, const QString &arg7=QString::null,const QString &arg8=QString::null, const QString &arg9=QString::null) | ### readQuery

[static]

Execute a query and return all the values returned by it.

Parameters:

conn | Connection to run query on.
sql | SQL to run.
arg1 | Parameters to pass to query.

Returns: A list of toQValues:s read from the query.

std::list<toQValue> readQuery (toConnection &conn,const QString &sql, const QString &arg1=QString::null,const QString &arg2=QString::null, const QString &arg3=QString::null,const QString &arg4=QString::null, const QString &arg5=QString::null,const QString &arg6=QString::null, const QString &arg7=QString::null,const QString &arg8=QString::null, const QString &arg9=QString::null) | ### readQuery

[static]

Execute a query and return all the values returned by it.

Parameters:

conn | Connection to run query on.
sql | SQL to run.
arg1 | Parameters to pass to query.

Returns: A list of toQValues:s read from the query.

std::list<toQValue> readQueryNull (toConnection &conn, toSQL &sql, std::list<toQValue> ¶ms) | ### readQueryNull

[static]

Execute a query and return all the values returned by it.

Parameters:

conn | Connection to run query on.
sql | SQL to run.
params | Parameters to pass to query.

Returns: A list of toQValues:s read from the query.

std::list<toQValue> readQueryNull (toConnection &conn, const QString &sql, std::list<toQValue> ¶ms) | ### readQueryNull

[static]

Execute a query and return all the values returned by it.

Parameters:

conn | Connection to run query on.
sql | SQL to run.
params | Parameters to pass to query.

Returns: A list of toQValues:s read from the query.

std::list<toQValue> readQueryNull (toConnection &conn,toSQL &sql, const QString &arg1=QString::null,const QString &arg2=QString::null, const QString &arg3=QString::null,const QString &arg4=QString::null, const QString &arg5=QString::null,const QString &arg6=QString::null, const QString &arg7=QString::null,const QString &arg8=QString::null, const QString &arg9=QString::null) | ### readQueryNull

[static]

Execute a query and return all the values returned by it.

Parameters:

conn | Connection to run query on.
sql | SQL to run.
arg1 | Parameters to pass to query.

Returns: A list of toQValues:s read from the query.

std::list<toQValue> readQueryNull (toConnection &conn,const QString &sql, const QString &arg1=QString::null,const QString &arg2=QString::null, const QString &arg3=QString::null,const QString &arg4=QString::null, const QString &arg5=QString::null,const QString &arg6=QString::null, const QString &arg7=QString::null,const QString &arg8=QString::null, const QString &arg9=QString::null) | ### readQueryNull

[static]

Execute a query and return all the values returned by it.

Parameters:

conn | Connection to run query on.
sql | SQL to run.
arg1 | Parameters to pass to query.

Returns: A list of toQValues:s read from the query.

void cancel (void) | ### cancel

Cancel the current execution of a query.