db_conn  v0.2.1-alpha
Database Connection API
vgi::dbconn::dbi::statement Class Reference

statement - is a class that manages native driver statement handle. More...

#include <statement.hpp>

Public Member Functions

 statement (statement &&stmt)
 Move constructor. More...
 
statementoperator= (statement &&stmt)
 Assignment operator. More...
 
void prepare (const std::string &sql)
 Function prepares dynamic SQL statement. More...
 
void call (const std::string &proc)
 Function prepares SQL stored procedure. More...
 
result_set execute ()
 Function runs last executed SQL statement. More...
 
result_set execute (const std::string &sql, bool cursor=false, bool scrollable=false)
 Function runs SQL statement. More...
 
bool cancel ()
 Function cancels currently running SQL statements. More...
 
int proc_retval ()
 Function returns stored procedure return value. More...
 

Detailed Description

statement - is a class that manages native driver statement handle.

statement object cannot be instantiated directly, only via connection get_statement() function call. statement objects automatically delete the native statement handle they manage as soon as they themselves are destroyed, or as soon as their value changes by an assignment operation. When an assignment operation takes place between two statement objects, ownership of native statement handle is transferred, which means that the object losing ownership is no longer has access to the native statement handle.

Definition at line 72 of file statement.hpp.

Constructor & Destructor Documentation

vgi::dbconn::dbi::statement::statement ( statement &&  stmt)
inline

Move constructor.

Parameters
stmt

Definition at line 79 of file statement.hpp.

Member Function Documentation

void vgi::dbconn::dbi::statement::call ( const std::string &  proc)
inline

Function prepares SQL stored procedure.

Parameters
procstored procedure to be executed

Definition at line 108 of file statement.hpp.

bool vgi::dbconn::dbi::statement::cancel ( )
inline

Function cancels currently running SQL statements.

Returns
true if canceled, false otherwise

Definition at line 138 of file statement.hpp.

result_set vgi::dbconn::dbi::statement::execute ( )
inline

Function runs last executed SQL statement.

Returns
result set object

Definition at line 117 of file statement.hpp.

result_set vgi::dbconn::dbi::statement::execute ( const std::string &  sql,
bool  cursor = false,
bool  scrollable = false 
)
inline

Function runs SQL statement.

Parameters
sqlstatement to be executed
cursor= true to use cursor with select statements
scrollable= true to use scrollable cursor
Returns
result set object

Definition at line 129 of file statement.hpp.

statement& vgi::dbconn::dbi::statement::operator= ( statement &&  stmt)
inline

Assignment operator.

Parameters
stmt
Returns

Definition at line 88 of file statement.hpp.

void vgi::dbconn::dbi::statement::prepare ( const std::string &  sql)
inline

Function prepares dynamic SQL statement.

Parameters
sqlstatement to be executed

Definition at line 99 of file statement.hpp.

int vgi::dbconn::dbi::statement::proc_retval ( )
inline

Function returns stored procedure return value.

This function must be called after all result sets from stored proc select statements had been processed

Returns
int

Definition at line 149 of file statement.hpp.


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