ocilib::Statement Class Reference

Object used for executing SQL or PL/SQL statement and returning the produced results. More...

`#include <ocilib.hpp>`

Inherits ocilib::HandleHolder< OCI_Statement *>.

## Public Types

enum | StatementTypeValues { TypeSelect = OCI_CST_SELECT, TypeUpdate = OCI_CST_UPDATE, TypeDelete = OCI_CST_DELETE, TypeInsert = OCI_CST_INSERT, TypeCreate = OCI_CST_CREATE, TypeDrop = OCI_CST_DROP, TypeAlter = OCI_CST_ALTER, TypeBegin = OCI_CST_BEGIN, TypeDeclare = OCI_CST_DECLARE, TypeCall = OCI_CST_CALL }
| Statement Type enumerated values. More...
enum | FetchModeValues { FetchForward = OCI_SFM_DEFAULT, FetchScrollable = OCI_SFM_SCROLLABLE }
| Fetch Modes enumerated values. More...
enum | BindModeValues { BindByPosition = OCI_BIND_BY_POS, BindByName = OCI_BIND_BY_NAME }
| Bind Modes enumerated values. More...
enum | LongModeValues { LongExplicit = OCI_LONG_EXPLICIT, LongImplicit = OCI_LONG_IMPLICIT }
| LONG data type mapping modes enumerated values. More...
typedef Enum< StatementTypeValues > | StatementType
| Statement Type. More...
typedef Enum< FetchModeValues > | FetchMode
| Fetch Modes. More...
typedef Enum< BindModeValues > | BindMode
| Bind Modes. More...
typedef Enum< LongModeValues > | LongMode
| LONG data type mapping modes. More...

## Public Member Functions

| Statement ()
| Create an empty null Statement instance.
| Statement (const Connection &connection)
| Parametrized constructor. More...
Connection | GetConnection () const
| Return the connection associated with a statement.
void | Describe (const ostring &sql)
| Describe the select list of a SQL select statement. More...
void | Parse (const ostring &sql)
| Parse a SQL statement or PL/SQL block. More...
void | Prepare (const ostring &sql)
| Prepare a SQL statement or PL/SQL block. More...
void | ExecutePrepared ()
| Execute a prepared SQL statement or PL/SQL block.
void | Execute (const ostring &sql)
| Prepare and execute a SQL statement or PL/SQL block. More...
template<class T >
unsigned int | ExecutePrepared (T callback)
| Execute the prepared statement, retrieve all resultsets, and call the given callback for each row of each resultsets. More...
template<class T , class U >
unsigned int | ExecutePrepared (T callback, U adapter)
| Execute the prepared statement, retrieve all resultsets, and call the given callback with adapted type wit for each row of each resultsets. More...
template<class T >
unsigned int | Execute (const ostring &sql, T callback)
| Execute the given SQL statement, retrieve all resultsets, and call the given callback for each row of each resultsets. More...
template<class T , class U >
unsigned int | Execute (const ostring &sql, T callback, U adapter)
| Execute the given SQL statement, retrieve all resultsets, and call the given callback with adapted type wit for each row of each resultsets. More...
unsigned int | GetAffectedRows () const
| Return the number of rows affected by the SQL statement. More...
ostring | GetSql () const
| Return the last SQL or PL/SQL statement prepared or executed by the statement.
Resultset | GetResultset ()
| Retrieve the resultset from an executed statement. More...
Resultset | GetNextResultset ()
| Retrieve the next available resultset. More...
void | SetBindArraySize (unsigned int size)
| Set the input array size for bulk operations. More...
unsigned int | GetBindArraySize () const
| Return the current input array size for bulk operations.
void | AllowRebinding (bool value)
| Allow different host variables to be binded using the same bind name or position between executions of a prepared statement. More...
bool | IsRebindingAllowed () const
| Indicate if rebinding is allowed on the statement. More...
unsigned int | GetBindIndex (const ostring &name) const
| Return the index of the bind from its name belonging to the statement. More...
unsigned int | GetBindCount () const
| Return the number of binds currently associated to a statement.
BindInfo | GetBind (unsigned int index) const
| Return the bind at the given index in the internal array of bind objects. More...
BindInfo | GetBind (const ostring &name) const
| Return a bind handle from its name. More...
template<class T >
void | Bind (const ostring &name, T &value, BindInfo::BindDirection mode)
| Bind an host variable. More...
template<class T , class U >
void | Bind (const ostring &name, T &value, U extraInfo, BindInfo::BindDirection mode)
| Bind an host variable with more information. More...
template<class T >
void | Bind (const ostring &name, Collection< T > &value, BindInfo::BindDirection mode)
| Bind a host collection variable. More...
template<class T >
void | Bind (const ostring &name, std::vector< T > &values, BindInfo::BindDirection mode)
| Bind a vector of host variables. More...
template<class T >
void | Bind (const ostring &name, std::vector< T > &values, TypeInfo &typeInfo, BindInfo::BindDirection mode)
| Bind a vector of host variables with Oracle type information. More...
template<class T >
void | Bind (const ostring &name, std::vector< Collection< T > > &values, TypeInfo &typeInfo, BindInfo::BindDirection mode)
| Bind a vector of host collection variables with Oracle type information. More...
template<class T , class U >
void | Bind (const ostring &name, std::vector< T > &values, U extraInfo, BindInfo::BindDirection mode)
| Bind a vector of host variables with more information. More...
template<class T >
void | Register (const ostring &name)
| Register a host variable as an output for a column present in a SQL RETURNING INTO clause. More...
template<class T , class U >
void | Register (const ostring &name, U &extraInfo)
| Register a host variable with Oracle type information as an output for a column present in a SQL RETURNING INTO clause. More...
template<class T , class U >
void | Register (const ostring &name, U extraInfo)
| Register a host variable with more information as an output for a column present in a SQL RETURNING INTO clause. More...
StatementType | GetStatementType () const
| Return the type of a SQL statement.
unsigned int | GetSqlErrorPos () const
| Return the error position (in terms of characters) in the SQL statement where the error occurred in case of SQL parsing error. More...
void | SetFetchMode (FetchMode value)
| Set the fetch mode of a SQL statement. More...
FetchMode | GetFetchMode () const
| Return the fetch mode of a SQL statement. More...
void | SetBindMode (BindMode value)
| Set the binding mode of a SQL statement. More...
BindMode | GetBindMode () const
| Return the binding mode of a SQL statement. More...
void | SetFetchSize (unsigned int value)
| Set the number of rows fetched per internal server fetch call. More...
unsigned int | GetFetchSize () const
| Return the number of rows fetched per internal server fetch call. More...
void | SetPrefetchSize (unsigned int value)
| Set the number of rows pre-fetched by OCI Client. More...
unsigned int | GetPrefetchSize () const
| Return the number of rows pre-fetched by OCI Client. More...
void | SetPrefetchMemory (unsigned int value)
| Set the amount of memory pre-fetched by OCI Client. More...
unsigned int | GetPrefetchMemory () const
| Return the amount of memory used to retrieve rows pre-fetched by OCI Client. More...
void | SetLongMaxSize (unsigned int value)
| Set the LONG data type piece buffer size. More...
unsigned int | GetLongMaxSize () const
| Return the LONG data type piece buffer size. More...
void | SetLongMode (LongMode value)
| Set the long data type handling mode of a SQL statement. More...
LongMode | GetLongMode () const
| Return the long data type handling mode of a SQL statement.
unsigned int | GetSQLCommand () const
| Return the Oracle SQL code the command held by the statement. More...
ostring | GetSQLVerb () const
| Return the verb of the SQL command held by the statement. More...
void | GetBatchErrors (std::vector< Exception > &exceptions)
| Returns all errors that occurred within a DML array statement execution.

## Detailed Description

Object used for executing SQL or PL/SQL statement and returning the produced results.

This class wraps the OCILIB object handle OCI_Statement and its related methods

Definition at line 5476 of file ocilib.hpp.

## Member Typedef Documentation

## StatementType

typedef Enum<StatementTypeValues> ocilib::Statement::StatementType

Statement Type.

Possible values are Statement::StatementTypeValues

Definition at line 5523 of file ocilib.hpp.

## FetchMode

typedef Enum<FetchModeValues> ocilib::Statement::FetchMode

Fetch Modes.

Possible values are Statement::FetchModeValues

Definition at line 5545 of file ocilib.hpp.

## BindMode

typedef Enum<BindModeValues> ocilib::Statement::BindMode

Bind Modes.

Possible values are Statement::BindModeValues

Definition at line 5567 of file ocilib.hpp.

## LongMode

typedef Enum<LongModeValues> ocilib::Statement::LongMode

LONG data type mapping modes.

Possible values are Statement::LongModeValues

Definition at line 5589 of file ocilib.hpp.

## Member Enumeration Documentation

## StatementTypeValues

enum ocilib::Statement::StatementTypeValues

Statement Type enumerated values.

Enumerator
TypeSelect | SELECT statement
TypeUpdate | UPDATE statement
TypeDelete | DELETE statement
TypeInsert | INSERT statement
TypeCreate | CREATE statement
TypeDrop | DROP statement
TypeAlter | ALTER statement
TypeBegin | BEGIN statement
TypeDeclare | DECLARE statement
TypeCall | CALL statement

Definition at line 5492 of file ocilib.hpp.

## FetchModeValues

enum ocilib::Statement::FetchModeValues

Fetch Modes enumerated values.

Enumerator
FetchForward | Statement is forward only
FetchScrollable | Statement is scrollable

Definition at line 5530 of file ocilib.hpp.

## BindModeValues

enum ocilib::Statement::BindModeValues

Bind Modes enumerated values.

Enumerator
BindByPosition | Bind variables are binded by name
BindByName | Bind variables are binded by position

Definition at line 5552 of file ocilib.hpp.

## LongModeValues

enum ocilib::Statement::LongModeValues

LONG data type mapping modes enumerated values.

Enumerator
LongExplicit | LONG and LONG RAW are mapped to Long objects
LongImplicit | LONG and LONG RAW are mapped to ostring objects

Definition at line 5574 of file ocilib.hpp.

## Constructor & Destructor Documentation

## Statement()

ocilib::Statement::Statement | ( | const Connection & | connection | ) |

inline

Parametrized constructor.

Parameters

  connection | - Parent connection

Note
  - The statement object must not be accessed anymore once the parent connection object gets out of scope

Definition at line 4943 of file ocilib_impl.hpp.

References ocilib::Check(), OCI_StatementCreate(), OCI_StatementFree(), and Statement().

## Member Function Documentation

## Describe()

void ocilib::Statement::Describe | ( | const ostring & | sql | ) |

inline

Describe the select list of a SQL select statement.

Parameters

  sql | - SELECT sql statement

Note
  This call sends the SELECT SQL order to the server for retrieving the description of the select order only. The command is not executed. This call is only useful to retrieve information on the associated resultset Call GetResultet() after Describe() to access to SELECT list information
  This call prepares the statement (internal call to Prepare()) and ask the Oracle server to describe the output SELECT list. Execute() can be called after Describe() in order to execute the statement, which means that the server will parse, and describe again the SQL order.

Warning
  Do not use Describe() unless you're only interested in the resultset information because the statement will be parsed again when executed and thus leading to unnecessary server round trips and less performance

Definition at line 4958 of file ocilib_impl.hpp.

References ocilib::Check(), and OCI_Describe().

## Parse()

void ocilib::Statement::Parse | ( | const ostring & | sql | ) |

inline

Parse a SQL statement or PL/SQL block.

Parameters

  sql | - SQL order - PL/SQL block

Note
  This call sends the SQL or PL/SQL command to the server for parsing only. The command is not executed. This call is only useful to check is a command is valid or not.
  This call prepares the statement (internal call to Prepare()) and ask the Oracle server to parse its SQL or PL/SQL command. Execute() can be call after Parse() in order to execute the statement, which means that the server will parse again the command.

Warning
  Do not use Parse() unless you're only interested in the parsing result because the statement will be parsed again when executed and thus leading to unnecessary server round trips and less performance

Definition at line 4965 of file ocilib_impl.hpp.

References ocilib::Check(), and OCI_Parse().

## Prepare()

void ocilib::Statement::Prepare | ( | const ostring & | sql | ) |

inline

Prepare a SQL statement or PL/SQL block.

Parameters

  sql | - SQL order or PL/SQL block

Note
  With version 1.3.0 and above, do not call this function for fetched statements (REF cursors)

Definition at line 4972 of file ocilib_impl.hpp.

References ocilib::Check(), and OCI_Prepare().

## Execute() [1/3]

void ocilib::Statement::Execute | ( | const ostring & | sql | ) |

inline

Prepare and execute a SQL statement or PL/SQL block.

Parameters

  sql | - SQL order - PL/SQL block

Definition at line 5003 of file ocilib_impl.hpp.

References ocilib::Check(), and OCI_ExecuteStmt().

Referenced by ocilib::Subscription::Watch().

## ExecutePrepared() [1/2]

template<class T >

unsigned int ocilib::Statement::ExecutePrepared | ( | T | callback | ) |

Execute the prepared statement, retrieve all resultsets, and call the given callback for each row of each resultsets.

Template Parameters

  TFetchCallback | - type of the fetch callback

Parameters

  callback | - User defined callback

Note
  The user defined callback function must conform to the following prototype: bool callback(const Resultset &) It shall return true to continue fetching the resultset or false to stop the fetch

Returns
  The number of rows fetched

Definition at line 4988 of file ocilib_impl.hpp.

## ExecutePrepared() [2/2]

template<class T , class U >

unsigned int ocilib::Statement::ExecutePrepared | ( | T | callback,
|  | U | adapter
| ) |  |

Execute the prepared statement, retrieve all resultsets, and call the given callback with adapted type wit for each row of each resultsets.

Template Parameters

  TAdapter | - type of the adapter callback
  TFetchCallback | - type of the fetch callback

Parameters

  callback | - User defined callback
  adapter | - User defined adapter function

Note
  The user defined callback function must conform to the following prototype: bool callback(const Resultset &) It shall return true to continue fetching the resultset or false to stop the fetch

Returns
  The number of rows fetched

Definition at line 4996 of file ocilib_impl.hpp.

## Execute() [2/3]

template<class T >

unsigned int ocilib::Statement::Execute | ( | const ostring & | sql,
|  | T | callback
| ) |  |

Execute the given SQL statement, retrieve all resultsets, and call the given callback for each row of each resultsets.

Template Parameters

  TFetchCallback | - type of the fetch callback

Parameters

  sql | - SQL order - PL/SQL block
  callback | - User defined callback

Note
  The user defined callback function must conform to the following prototype: bool callback(const Resultset &) It shall return true to continue fetching the resultset or false to stop the fetch

Returns
  The number of rows fetched

Definition at line 5011 of file ocilib_impl.hpp.

## Execute() [3/3]

template<class T , class U >

unsigned int ocilib::Statement::Execute | ( | const ostring & | sql,
|  | T | callback,
|  | U | adapter
| ) |  |

Execute the given SQL statement, retrieve all resultsets, and call the given callback with adapted type wit for each row of each resultsets.

Template Parameters

  TAdapter | - type of the adapter callback
  TFetchCallback | - type of the fetch callback

Parameters

  sql | - SQL order - PL/SQL block
  callback | - User defined callback
  adapter | - User defined adapter function

Note
  The user defined callback function must conform to the following prototype: bool callback(const Resultset &) It shall return true to continue fetching the resultset or false to stop the fetch

Returns
  The number of rows fetched

Definition at line 5019 of file ocilib_impl.hpp.

References ocilib::Resultset::ForEach().

## GetAffectedRows()

unsigned int ocilib::Statement::GetAffectedRows | ( |  | ) | const

inline

Return the number of rows affected by the SQL statement.

The returned value is :

- For UPDATEs : number of rows updated
- For INSERTs : number of rows inserted
- For DELETEs : number of rows deleted

Note
  For SELECTs statements, use GetRowCount() instead

Definition at line 5058 of file ocilib_impl.hpp.

References ocilib::Check(), and OCI_GetAffectedRows().

## GetResultset()

Resultset ocilib::Statement::GetResultset | ( |  | ) |

inline

Retrieve the resultset from an executed statement.

Note
  See Fetching data for more details about what statements can return resultsets

Warning
  If the statement has not been prepared and executed, null resultset object will be returned

Definition at line 5068 of file ocilib_impl.hpp.

References ocilib::Check(), and OCI_GetResultset().

## GetNextResultset()

Resultset ocilib::Statement::GetNextResultset | ( |  | ) |

inline

Retrieve the next available resultset.

Note
  it is only valid for the following statements:
  - Statements executing SQL UPDATE/DELETE using a RETURNING INTO clause
  - Statements implicitly returned from PL/SQL procedure or blocks (new feature in Oracle 12cR1) using DBMS_SQL.RETURN_RESULT()
  SQL statements with a 'returning' clause can return multiple resultsets. When arrays of program variables are binded to the statement, Oracle will execute the statement for every row (iteration). Each iteration generates a resultset that can be fetched like regular ones.
  Starting withOracle 12cR1, PL/SQ procedure and blocks can return multiple implicit resultsets Refer to Oracle documentation for more information.

Definition at line 5073 of file ocilib_impl.hpp.

References ocilib::Check(), and OCI_GetNextResultset().

## SetBindArraySize()

void ocilib::Statement::SetBindArraySize | ( | unsigned int | size | ) |

inline

Set the input array size for bulk operations.

Parameters

  size | - Array size

Warning
  Do not use SetBindArraySize() for PL/SQL tables binding

Note
  SetBindArraySize() is used to set the size of input bind array when using arrays for DML statements. SetBindArraySize() MUST be called to set the maximum size of the arrays to bind to the statement before any of its execution. This initial call must be bone AFTER OPrepare() and BEFORE any Bind() call taking vectors as parameter.
  SetBindArraySize() can optionally be called before any later Execute() call in order to notify the statement of the exact number of elements populating the input arrays for the next execution. The array size passed to later SetBindArraySize() calls cannot be greater than the initial size otherwise an exception will be thrown.

Definition at line 5078 of file ocilib_impl.hpp.

References ocilib::Check(), and OCI_BindArraySetSize().

## AllowRebinding()

void ocilib::Statement::AllowRebinding | ( | bool | value | ) |

inline

Allow different host variables to be binded using the same bind name or position between executions of a prepared statement.

Parameters

  value | - Rebinding mode allowed

Note
  Default value is false

Warning
  When using rebinding feature, host variable re-binded to a previously allocated bind MUST be of the same data type !

Definition at line 5088 of file ocilib_impl.hpp.

References ocilib::Check(), and OCI_AllowRebinding().

## IsRebindingAllowed()

bool ocilib::Statement::IsRebindingAllowed | ( |  | ) | const

inline

Indicate if rebinding is allowed on the statement.

Note
  See AllowRebinding() for more details

Definition at line 5093 of file ocilib_impl.hpp.

References ocilib::Check(), and OCI_IsRebindingAllowed().

## GetBindIndex()

unsigned int ocilib::Statement::GetBindIndex | ( | const ostring & | name | ) | const

inline

Return the index of the bind from its name belonging to the statement.

Parameters

  name | - Bind variable name

Warning
  The bind name is case insensitive

Note
  Bind indexes start with 1 in OCILIB

Returns
  Bind index on success or zero if the bind does not exists

Definition at line 5098 of file ocilib_impl.hpp.

References ocilib::Check(), and OCI_GetBindIndex().

## GetBind() [1/2]

BindInfo ocilib::Statement::GetBind | ( | unsigned int | index | ) | const

inline

Return the bind at the given index in the internal array of bind objects.

Parameters

  index | - Bind position

Warning
  Index starts at 1.

Note
  Bind handle are created sequentially. For example, the third call to a Bind() call generates a bind object of index 3.

Definition at line 5108 of file ocilib_impl.hpp.

References ocilib::Check(), and OCI_GetBind().

## GetBind() [2/2]

BindInfo ocilib::Statement::GetBind | ( | const ostring & | name | ) | const

inline

Return a bind handle from its name.

Parameters

  name | - Bind variable name

Note
  Bind names must include a semicolon at the beginning.

Definition at line 5113 of file ocilib_impl.hpp.

References ocilib::Check(), OCI_BindArrayOfBigInts(), OCI_BindArrayOfDates(), OCI_BindArrayOfDoubles(), OCI_BindArrayOfFloats(), OCI_BindArrayOfInts(), OCI_BindArrayOfNumbers(), OCI_BindArrayOfShorts(), OCI_BindArrayOfUnsignedBigInts(), OCI_BindArrayOfUnsignedInts(), OCI_BindArrayOfUnsignedShorts(), OCI_BindBigInt(), OCI_BindBoolean(), OCI_BindDate(), OCI_BindDouble(), OCI_BindFile(), OCI_BindFloat(), OCI_BindInt(), OCI_BindInterval(), OCI_BindLob(), OCI_BindLong(), OCI_BindNumber(), OCI_BindObject(), OCI_BindRaw(), OCI_BindRef(), OCI_BindShort(), OCI_BindStatement(), OCI_BindString(), OCI_BindTimestamp(), OCI_BindUnsignedBigInt(), OCI_BindUnsignedInt(), OCI_BindUnsignedShort(), and OCI_GetBind2().

## Bind() [1/7]

template<class T >

void ocilib::Statement::Bind | ( | const ostring & | name,
|  | T & | value,
|  | BindInfo::BindDirection | mode
| ) |  |

Bind an host variable.

Template Parameters

  T | - C++ type of the host variable

Parameters

  name | - Bind name
  value | - Host variable
  mode | - bind direction mode

Warning
  This method has built-in specialized versions for all supported types except ostring, Clong and Blong variables. For binding ostring, Clong and Blong variables, use the version with an extra parameter.

Note
  It is not necessary to specify the template data type in the bind call as all possible specializations can be resolved automatically from the arguments.

## Bind() [2/7]

template<class T , class U >

void ocilib::Statement::Bind | ( | const ostring & | name,
|  | T & | value,
|  | U | extraInfo,
|  | BindInfo::BindDirection | mode
| ) |  |

Bind an host variable with more information.

Template Parameters

  T | - C++ type of the host variable
  TExtraInfo | - C++ type if the extra information needed for the bind call

Parameters

  name | - Bind name
  value | - Host variable
  extraInfo | - Extra information needed for the bind call
  mode | - bind direction mode

Warning
  This method has built-in specialized versions for ostring, Clong and Blong variables. Pass the maximum length/size of the variable in the parameter extraInfo

Note
  It is not necessary to specify the template data type in the bind call as all possible specializations can be resolved automatically from the arguments.

## Bind() [3/7]

template<class T >

void ocilib::Statement::Bind | ( | const ostring & | name,
|  | Collection< T > & | value,
|  | BindInfo::BindDirection | mode
| ) |  |

Bind a host collection variable.

Template Parameters

  T | - C++ type of the host collection variable

Parameters

  name | - Bind name
  value | - Host Collection variable
  mode | - bind direction mode

Definition at line 5466 of file ocilib_impl.hpp.

References ocilib::Check(), OCI_BindArrayOfFiles(), OCI_BindArrayOfIntervals(), OCI_BindArrayOfLobs(), OCI_BindArrayOfObjects(), OCI_BindArrayOfRefs(), OCI_BindArrayOfTimestamps(), and OCI_BindColl().

## Bind() [4/7]

template<class T >

void ocilib::Statement::Bind | ( | const ostring & | name,
|  | std::vector< T > & | values,
|  | BindInfo::BindDirection | mode
| ) |  |

Bind a vector of host variables.

Template Parameters

  T | - C++ type of the host variable

Parameters

  name | - Bind name
  values | - Vector of host variables
  mode | - bind direction mode

Warning
  This method has built-in specialized versions for all C++ native scalar types, Date time and Statement objects. For others types (ostring, Clong, Blong, Raw, Object, Reference, Collection, Timestamp, Interval), use versions with extra parameters.

Note
  It is not necessary to specify the template data type in the bind call as all possible specializations can be resolved automatically from the arguments.

## Bind() [5/7]

template<class T >

void ocilib::Statement::Bind | ( | const ostring & | name,
|  | std::vector< T > & | values,
|  | TypeInfo & | typeInfo,
|  | BindInfo::BindDirection | mode
| ) |  |

Bind a vector of host variables with Oracle type information.

Template Parameters

  T | - C++ type of the host variable

Parameters

  name | - Bind name
  values | - Vector of host variables
  typeInfo | - Object type information
  mode | - bind direction mode

Warning
  This method has built-in specialized versions for Object, Reference.

Note
  It is not necessary to specify the template data type in the bind call as all possible specializations can be resolved automatically from the arguments.

Definition at line 5589 of file ocilib_impl.hpp.

References ocilib::Check(), OCI_BindArrayOfColls(), OCI_RegisterBigInt(), OCI_RegisterDate(), OCI_RegisterDouble(), OCI_RegisterFile(), OCI_RegisterFloat(), OCI_RegisterInt(), OCI_RegisterInterval(), OCI_RegisterLob(), OCI_RegisterNumber(), OCI_RegisterObject(), OCI_RegisterRaw(), OCI_RegisterRef(), OCI_RegisterShort(), OCI_RegisterString(), OCI_RegisterTimestamp(), OCI_RegisterUnsignedBigInt(), OCI_RegisterUnsignedInt(), and OCI_RegisterUnsignedShort().

## Bind() [6/7]

template<class T >

void ocilib::Statement::Bind | ( | const ostring & | name,
|  | std::vector< Collection< T > > & | values,
|  | TypeInfo & | typeInfo,
|  | BindInfo::BindDirection | mode
| ) |  |

Bind a vector of host collection variables with Oracle type information.

Template Parameters

  T | - collection C++ type of the host collection variables

Parameters

  name | - Bind name
  values | - Vector of host collection variables
  typeInfo | - Object type information
  mode | - bind direction mode

Definition at line 5533 of file ocilib_impl.hpp.

References ocilib::Check(), OCI_BindArrayOfColls(), OCI_BindArrayOfRaws(), and OCI_BindArrayOfStrings().

## Bind() [7/7]

template<class T , class U >

void ocilib::Statement::Bind | ( | const ostring & | name,
|  | std::vector< T > & | values,
|  | U | extraInfo,
|  | BindInfo::BindDirection | mode
| ) |  |

Bind a vector of host variables with more information.

Template Parameters

  T | - C++ type of the host variable
  TExtraInfo | - C++ type if the extra information needed for the bind call

Parameters

  name | - Bind name
  values | - Vector of host variables
  extraInfo | - Extra information needed for the bind call
  mode | - bind direction mode

Warning
  This method has built-in specialized versions for ostring, Raw , Clong, Blong, Timestamp, Interval variables.
  - For ostring, Clong, Blong, Raw : Pass the maximum length/size of variables in the parameter extraInfo
  - For Timestamp, Interval : Pass a value of the matching C++ class GetType() property type OR the underlying enumeration type.

Note
  It is not necessary to specify the template data type in the bind call as all possible specializations can be resolved automatically from the arguments.

## Register() [1/3]

template<class T >

void ocilib::Statement::Register | ( | const ostring & | name | ) |

Register a host variable as an output for a column present in a SQL RETURNING INTO clause.

Template Parameters

  T | - C++ type of the host variable

Parameters

  name | - Bind name

Warning
  This method has built-in specialized versions for all supported types except:
  - Timestamp and Interval, Object and Reference : use the version that takes a TypeInfo parameter
  - ostring and Raw : use the version that takes an extraInfo parameter

Note
  Statement, Blong and Clong are not supported for register calls

Warning
  It is necessary to specify the template data type in the register call

## Register() [2/3]

template<class T , class U >

void ocilib::Statement::Register | ( | const ostring & | name,
|  | U & | extraInfo
| ) |  |

Register a host variable with Oracle type information as an output for a column present in a SQL RETURNING INTO clause.

Template Parameters

  T | - C++ type of the host variable
  TExtraInfo | - C++ type if the extra information needed for the bind call

Parameters

  name | - Bind name
  extraInfo | - Extra information needed for the bind call

Warning
  This method has built-in specialized versions for Object and Reference.
  It is necessary to specify the template data type in the register call

## Register() [3/3]

template<class T , class U >

void ocilib::Statement::Register | ( | const ostring & | name,
|  | U | extraInfo
| ) |  |

Register a host variable with more information as an output for a column present in a SQL RETURNING INTO clause.

Template Parameters

  T | - C++ type of the host variable
  TExtraInfo | - C++ type if the extra information needed for the bind call

Parameters

  name | - Bind name
  extraInfo | - Extra information needed for the bind call

Warning
  This method has built-in specialized versions for ostring and Raw variables. Pass the maximum length/size of variables in the parameter extraInfo

Note
  It is necessary to specify the template data type in the register call

## GetSqlErrorPos()

unsigned int ocilib::Statement::GetSqlErrorPos | ( |  | ) | const

inline

Return the error position (in terms of characters) in the SQL statement where the error occurred in case of SQL parsing error.

Note
  Positions start at 1.

Definition at line 5743 of file ocilib_impl.hpp.

References ocilib::Check(), and OCI_GetSqlErrorPos().

## SetFetchMode()

void ocilib::Statement::SetFetchMode | ( | FetchMode | value | ) |

inline

Set the fetch mode of a SQL statement.

Parameters

  value | - fetch mode value

Warning
  SetFetchMode() MUST be called before any Execute() call

Definition at line 5748 of file ocilib_impl.hpp.

References ocilib::Check(), and OCI_SetFetchMode().

## GetFetchMode()

Statement::FetchMode ocilib::Statement::GetFetchMode | ( |  | ) | const

inline

Return the fetch mode of a SQL statement.

Note
  Default value is Statement::FetchForward

Definition at line 5753 of file ocilib_impl.hpp.

References ocilib::Check(), and OCI_GetFetchMode().

## SetBindMode()

void ocilib::Statement::SetBindMode | ( | BindMode | value | ) |

inline

Set the binding mode of a SQL statement.

Parameters

  value | - binding mode value

Definition at line 5758 of file ocilib_impl.hpp.

References ocilib::Check(), and OCI_SetBindMode().

## GetBindMode()

Statement::BindMode ocilib::Statement::GetBindMode | ( |  | ) | const

inline

Return the binding mode of a SQL statement.

Note
  Default value is Statement::BindByName

Definition at line 5763 of file ocilib_impl.hpp.

References ocilib::Check(), and OCI_GetBindMode().

## SetFetchSize()

void ocilib::Statement::SetFetchSize | ( | unsigned int | value | ) |

inline

Set the number of rows fetched per internal server fetch call.

Parameters

  value | - number of rows to fetch

Definition at line 5768 of file ocilib_impl.hpp.

References ocilib::Check(), and OCI_SetFetchSize().

## GetFetchSize()

unsigned int ocilib::Statement::GetFetchSize | ( |  | ) | const

inline

Return the number of rows fetched per internal server fetch call.

Note
  Default value is set to constant OCI_FETCH_SIZE

Definition at line 5773 of file ocilib_impl.hpp.

References ocilib::Check(), and OCI_GetFetchSize().

## SetPrefetchSize()

void ocilib::Statement::SetPrefetchSize | ( | unsigned int | value | ) |

inline

Set the number of rows pre-fetched by OCI Client.

Parameters

  value | - number of rows to pre-fetch

Note
  To turn off pre-fetching, set both attributes (size and memory) to 0.

Definition at line 5778 of file ocilib_impl.hpp.

References ocilib::Check(), and OCI_SetPrefetchSize().

## GetPrefetchSize()

unsigned int ocilib::Statement::GetPrefetchSize | ( |  | ) | const

inline

Return the number of rows pre-fetched by OCI Client.

Note
  Default value is set to constant OCI_PREFETCH_SIZE

Definition at line 5783 of file ocilib_impl.hpp.

References ocilib::Check(), and OCI_GetPrefetchSize().

## SetPrefetchMemory()

void ocilib::Statement::SetPrefetchMemory | ( | unsigned int | value | ) |

inline

Set the amount of memory pre-fetched by OCI Client.

Parameters

  value | - amount of memory to fetch

Note
  Default value is 0 and the pre-fetch size attribute is used instead. When both attributes are set (pre-fetch size and memory) and pre-fetch memory value can hold more rows than specified by pre-fetch size, OCI uses pre-fetch size instead.
  OCILIB set pre-fetch attribute to OCI_PREFETCH_SIZE when a statement is created. To setup a big value for SetPrefetchMemory(), you must call SetPrefetchSize() to 0 to make OCI consider this attribute.

Definition at line 5788 of file ocilib_impl.hpp.

References ocilib::Check(), and OCI_SetPrefetchMemory().

## GetPrefetchMemory()

unsigned int ocilib::Statement::GetPrefetchMemory | ( |  | ) | const

inline

Return the amount of memory used to retrieve rows pre-fetched by OCI Client.

Note
  Default value is 0

Definition at line 5793 of file ocilib_impl.hpp.

References ocilib::Check(), and OCI_GetPrefetchMemory().

## SetLongMaxSize()

void ocilib::Statement::SetLongMaxSize | ( | unsigned int | value | ) |

inline

Set the LONG data type piece buffer size.

Parameters

  value | - maximum size for long buffer

Definition at line 5798 of file ocilib_impl.hpp.

References ocilib::Check(), and OCI_SetLongMaxSize().

## GetLongMaxSize()

unsigned int ocilib::Statement::GetLongMaxSize | ( |  | ) | const

inline

Return the LONG data type piece buffer size.

Note
  Default value is set to constant OCI_SIZE_LONG

Definition at line 5803 of file ocilib_impl.hpp.

References ocilib::Check(), and OCI_GetLongMaxSize().

## SetLongMode()

void ocilib::Statement::SetLongMode | ( | LongMode | value | ) |

inline

Set the long data type handling mode of a SQL statement.

Parameters

  value | - long mode value

Note
  LONG RAWs can't be handled with Statement::LongImplicit mode

Definition at line 5808 of file ocilib_impl.hpp.

References ocilib::Check(), and OCI_SetLongMode().

## GetSQLCommand()

unsigned int ocilib::Statement::GetSQLCommand | ( |  | ) | const

inline

Return the Oracle SQL code the command held by the statement.

Warning
  GetSQLCommand() must be called after the statement has be executed because that's the server engine that computes the SQL command code

Note
  The SQL command list is available in Oracle documentations and guides

Definition at line 5818 of file ocilib_impl.hpp.

References ocilib::Check(), and OCI_GetSQLCommand().

## GetSQLVerb()

ostring ocilib::Statement::GetSQLVerb | ( |  | ) | const

inline

Return the verb of the SQL command held by the statement.

Warning
  GetSQLVerb() must be called after the statement has been executed because that's the server engine that computes the SQL verb

Note
  The SQL verb list is available in Oracle documentations and guides

Definition at line 5823 of file ocilib_impl.hpp.

References ocilib::Check(), ocilib::MakeString(), and OCI_GetSQLVerb().