Main Page   Namespace List   Compound List   File List   Namespace Members   Compound Members   File Members  

oralib::statement Class Reference

Encapsulates a prepared SQL (or PL/SQL) statement. More...

#include <statement.h>

List of all members.

Public Methods

parameterbind (IN const char *name, IN OPTIONAL DataTypesEnum type=DT_UNKNOWN)
 Binds a named variable (parameter) to the statement.

void execute (void)
 Executes a prepared SQL (or PL/SQL) statement.

resultsetselect (void)
 Executes a prepared SQL select statement and returns the resultset.

void release (void)
 Releases resources allocated for a prepared SQL (or PL/SQL) statement. Cannot be reused.

parameteroperator[] (IN const char *name)
 Access to bound variables by name.

parameteroperator[] (IN ub2 parameter_index)
 Access to bound variables by index.


Friends

class parameter
class connection


Detailed Description

Encapsulates a prepared SQL (or PL/SQL) statement.

statement class handles SQL or PL/SQL statements. In order a statement to be processed by the Oracle server following steps are executed: preparation, binding of named variables, execution (last step for DDL statements), description for select-list columns, definition of output variables and fetching of query results.

Steps necessary for execution of a DDL statement:

Steps necessary for execution of a simple select statement: Steps necessary for execution of a statement with bound variables: All bound variables could be accessed via array element operator[] where index could be a numeric (0- or 1-based sequential number for the bound variable) or string (exact parameter name, including leading colon).


Member Function Documentation

parameter & oralib::statement::bind IN const char *    name,
IN OPTIONAL DataTypesEnum    type = DT_UNKNOWN
 

Binds a named variable (parameter) to the statement.

Parameters:
name  exact name of the bound variable (including ':')
type  (optional) data type for the named variable; if left to DT_UNKNOWN data type will be deduced from the name's prefix (check oralib::ParameterPrefixesEnum)
Returns :
a parameter; could be imediately used to assign a value to the variable

bind could be called after statement has been prepared (connection::prepare) and before statement is to be executed (statement::execute).

No cleanup is necessary. Named variables (or parameters) are automatically cleaned-up when statement is released.

void oralib::statement::execute void    [inline]
 

Executes a prepared SQL (or PL/SQL) statement.

On success values of out parameters could be updated (depending on SQL statements).

resultset * oralib::statement::select void   
 

Executes a prepared SQL select statement and returns the resultset.

Returns :
a resultset

Could be used to execute a SQL select statement where conditions are controlled by using a named variable.

resultset::release should be called when resultset is no longer needed.

parameter & oralib::statement::operator[] IN const char *    name
 

Access to bound variables by name.

Parameters:
name  exact name of the bound variable (including ':')
Returns :
a parameter

parameter & oralib::statement::operator[] IN ub2    parameter_index
 

Access to bound variables by index.

Parameters:
parameter_index  0- or 1-based index for the bound variable (whether index is 0- or 1-based is controlled by oralib::FIRST_PARAMETER_NO)
Returns :
a parameter


The documentation for this class was generated from the following files:
Generated on Sun Aug 18 13:56:27 2002 for OraLib by doxygen1.2.17