Zen
A cross-platform functional programming language

statement Class Reference

SQL query statement. More...

#include <zbl.hpp>

List of all members.

Public Member Functions

 statement (database &db, const z::string &sql)
 Default constructor.
bool next ()
 Fetch the next record, execute the sql query when first called.
bool exec ()
 Execute the sql statement.
void finish ()
 Free up statement resources.
int insert ()
 Insert a record.
void bind (const z::string &key, const z::any &val)
 Bind a query argument.
any getVar (const int &idx)
 Get any value.

Private Attributes

database_db
 The database.
QSqlQuery _val
 The value.

Detailed Description

SQL query statement.


Constructor & Destructor Documentation

statement ( database db,
const z::string sql 
) [inline, explicit]

Default constructor.

Parameters:
dbThe database for the statement
sqlThe SQL query

Member Function Documentation

void bind ( const z::string key,
const z::any val 
)

Bind a query argument.

Parameters:
keyName of argument
valValue to bind
bool exec ( ) [inline]

Execute the sql statement.

Returns:
True if success, else false
z::any getVar ( const int &  idx)

Get any value.

Parameters:
idxColumn number of value to fetch
Returns:
The any value
int insert ( )

Insert a record.

Returns:
The id of the record just inserted
bool next ( ) [inline]

Fetch the next record, execute the sql query when first called.

Returns:
True if more data available, else false

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines