|
OCILIB (C and C++ Driver for Oracle)
4.0.0
|
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 datatype 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 datatype mapping modes. More... | |
Public Member Functions | |
| Statement (const Connection &connection) | |
| Parametrized constructor. More... | |
| ~Statement () | |
| Destructor. | |
| 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 | Execute () |
| 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... | |
| 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 TDataType > | |
| void | Bind (const ostring &name, TDataType &value, BindInfo::BindDirection mode) |
| Bind an host variable. More... | |
| template<class TDataType , class TExtraInfo > | |
| void | Bind (const ostring &name, TDataType &value, TExtraInfo extraInfo, BindInfo::BindDirection mode) |
| Bind an host variable with more information. More... | |
| template<class TDataType > | |
| void | Bind (const ostring &name, std::vector< TDataType > &values, BindInfo::BindDirection mode) |
| Bind a vector of host variables. More... | |
| template<class TDataType > | |
| void | Bind (const ostring &name, std::vector< TDataType > &values, TypeInfo &typeInfo, BindInfo::BindDirection mode) |
| Bind a vector of host variables with Oracle type information. More... | |
| template<class TDataType , class TExtraInfo > | |
| void | Bind (const ostring &name, std::vector< TDataType > &values, TExtraInfo extraInfo, BindInfo::BindDirection mode) |
| Bind a vector of host variables with more information. More... | |
| template<class TDataType > | |
| 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 TDataType , class TExtraInfo > | |
| void | Register (const ostring &name, TExtraInfo &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 TDataType , class TExtraInfo > | |
| void | Register (const ostring &name, TExtraInfo 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 datatype piece buffer size. More... | |
| unsigned int | GetLongMaxSize () const |
| Return the LONG datatype piece buffer size. More... | |
| void | SetLongMode (LongMode value) |
| Set the long datatype handling mode of a SQL statement. More... | |
| LongMode | GetLongMode () const |
| Return the long datatype 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. | |
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 4907 of file ocilib.hpp.
Statement Type.
Possible values are Statement::StatementTypeValues
Definition at line 4954 of file ocilib.hpp.
Fetch Modes.
Possible values are Statement::FetchModeValues
Definition at line 4976 of file ocilib.hpp.
Bind Modes.
Possible values are Statement::BindModeValues
Definition at line 4998 of file ocilib.hpp.
LONG datatype mapping modes.
Possible values are Statement::LongModeValues
Definition at line 5020 of file ocilib.hpp.
Statement Type enumerated values.
Definition at line 4923 of file ocilib.hpp.
Fetch Modes enumerated values.
| Enumerator | |
|---|---|
| FetchForward |
Statement is forward only |
| FetchScrollable |
Statement is scrollable |
Definition at line 4961 of file ocilib.hpp.
Bind Modes enumerated values.
| Enumerator | |
|---|---|
| BindByPosition |
Bind variables are binded by name |
| BindByName |
Bind variables are binded by position |
Definition at line 4983 of file ocilib.hpp.
LONG datatype 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 5005 of file ocilib.hpp.
|
inline |
Parametrized constructor.
| connection | - Parent connection |
Definition at line 4006 of file ocilib_impl.hpp.
References ocilib::Check(), OCI_StatementCreate(), and OCI_StatementFree().
|
inline |
Describe the select list of a SQL select statement.
| sql | - SELECT sql statement |
Definition at line 4031 of file ocilib_impl.hpp.
References ocilib::Check(), and OCI_Describe().
|
inline |
Parse a SQL statement or PL/SQL block.
| sql | - SQL order - PL/SQL block |
Definition at line 4038 of file ocilib_impl.hpp.
References ocilib::Check(), and OCI_Parse().
|
inline |
Prepare a SQL statement or PL/SQL block.
| sql | - SQL order or PL/SQL block |
Definition at line 4045 of file ocilib_impl.hpp.
References ocilib::Check(), and OCI_Prepare().
|
inline |
Prepare and execute a SQL statement or PL/SQL block.
| sql | - SQL order - PL/SQL block |
Definition at line 4060 of file ocilib_impl.hpp.
References ocilib::Check(), and OCI_ExecuteStmt().
|
inline |
Return the number of rows affected by the SQL statement.
The returned value is :
Definition at line 4067 of file ocilib_impl.hpp.
References ocilib::Check(), and OCI_GetAffectedRows().
|
inline |
Retrieve the resultset from an executed statement.
Definition at line 4077 of file ocilib_impl.hpp.
References ocilib::Check(), and OCI_GetResultset().
|
inline |
Retrieve the next available resultset.
Definition at line 4082 of file ocilib_impl.hpp.
References ocilib::Check(), and OCI_GetNextResultset().
|
inline |
Set the input array size for bulk operations.
| size | - Array size |
Definition at line 4087 of file ocilib_impl.hpp.
References ocilib::Check(), and OCI_BindArraySetSize().
|
inline |
Allow different host variables to be binded using the same bind name or position between executions of a prepared statement.
| value | - Rebinding mode allowed |
Definition at line 4097 of file ocilib_impl.hpp.
References ocilib::Check(), and OCI_AllowRebinding().
|
inline |
Indicate if rebinding is allowed on the statement.
Definition at line 4102 of file ocilib_impl.hpp.
References ocilib::Check(), and OCI_IsRebindingAllowed().
|
inline |
Return the index of the bind from its name belonging to the statement.
| name | - Bind variable name |
Definition at line 4107 of file ocilib_impl.hpp.
References ocilib::Check(), and OCI_GetBindIndex().
|
inline |
Return the bind at the given index in the internal array of bind objects.
| index | - Bind position |
Definition at line 4117 of file ocilib_impl.hpp.
References ocilib::Check(), and OCI_GetBind().
Return a bind handle from its name.
| name | - Bind variable name |
Definition at line 4122 of file ocilib_impl.hpp.
References ocilib::Check(), and OCI_GetBind2().
|
inline |
Bind an host variable.
| TDataType | - C++ type of the host variable |
| name | - Bind name |
| value | - Host variable |
| mode | - bind direction mode |
Definition at line 4440 of file ocilib_impl.hpp.
References OCI_BindColl().
| void ocilib::Statement::Bind | ( | const ostring & | name, |
| TDataType & | value, | ||
| TExtraInfo | extraInfo, | ||
| BindInfo::BindDirection | mode | ||
| ) |
Bind an host variable with more information.
| TDataType | - C++ type of the host variable |
| TExtraInfo | - C++ type if the extra information needed for the bind call |
| name | - Bind name |
| value | - Host variable |
| extraInfo | - Extra information needed for the bind call |
| mode | - bind direction mode |
| void ocilib::Statement::Bind | ( | const ostring & | name, |
| std::vector< TDataType > & | values, | ||
| BindInfo::BindDirection | mode | ||
| ) |
Bind a vector of host variables.
| TDataType | - C++ type of the host variable |
| name | - Bind name |
| values | - Vector of host variables |
| mode | - bind direction mode |
| void ocilib::Statement::Bind | ( | const ostring & | name, |
| std::vector< TDataType > & | values, | ||
| TypeInfo & | typeInfo, | ||
| BindInfo::BindDirection | mode | ||
| ) |
Bind a vector of host variables with Oracle type information.
| TDataType | - C++ type of the host variable |
| name | - Bind name |
| values | - Vector of host variables |
| typeInfo | - Object type information |
| mode | - bind direction mode |
Definition at line 4552 of file ocilib_impl.hpp.
References OCI_BindArrayOfColls().
| void ocilib::Statement::Bind | ( | const ostring & | name, |
| std::vector< TDataType > & | values, | ||
| TExtraInfo | extraInfo, | ||
| BindInfo::BindDirection | mode | ||
| ) |
Bind a vector of host variables with more information.
| TDataType | - C++ type of the host variable |
| TExtraInfo | - C++ type if the extra information needed for the bind call |
| name | - Bind name |
| values | - Vector of host variables |
| extraInfo | - Extra information needed for the bind call |
| mode | - bind direction mode |
| void ocilib::Statement::Register | ( | const ostring & | name | ) |
Register a host variable as an output for a column present in a SQL RETURNING INTO clause.
| TDataType | - C++ type of the host variable |
| name | - Bind name |
| void ocilib::Statement::Register | ( | const ostring & | name, |
| TExtraInfo & | extraInfo | ||
| ) |
Register a host variable with Oracle type information as an output for a column present in a SQL RETURNING INTO clause.
| TDataType | - C++ type of the host variable |
| TExtraInfo | - C++ type if the extra information needed for the bind call |
| name | - Bind name |
| extraInfo | - Extra information needed for the bind call |
| void ocilib::Statement::Register | ( | const ostring & | name, |
| TExtraInfo | extraInfo | ||
| ) |
Register a host variable with more information as an output for a column present in a SQL RETURNING INTO clause.
| TDataType | - C++ type of the host variable |
| TExtraInfo | - C++ type if the extra information needed for the bind call |
| name | - Bind name |
| extraInfo | - Extra information needed for the bind call |
|
inline |
Return the error position (in terms of characters) in the SQL statement where the error occurred in case of SQL parsing error.
Definition at line 4701 of file ocilib_impl.hpp.
References ocilib::Check(), and OCI_GetSqlErrorPos().
|
inline |
Set the fetch mode of a SQL statement.
| value | - fetch mode value |
Definition at line 4706 of file ocilib_impl.hpp.
References ocilib::Check(), and OCI_SetFetchMode().
|
inline |
Return the fetch mode of a SQL statement.
Definition at line 4711 of file ocilib_impl.hpp.
References ocilib::Check(), and OCI_GetFetchMode().
|
inline |
Set the binding mode of a SQL statement.
| value | - binding mode value |
Definition at line 4716 of file ocilib_impl.hpp.
References ocilib::Check(), and OCI_SetBindMode().
|
inline |
Return the binding mode of a SQL statement.
Definition at line 4721 of file ocilib_impl.hpp.
References ocilib::Check(), and OCI_GetBindMode().
|
inline |
Set the number of rows fetched per internal server fetch call.
| value | - number of rows to fetch |
Definition at line 4726 of file ocilib_impl.hpp.
References ocilib::Check(), and OCI_SetFetchSize().
|
inline |
Return the number of rows fetched per internal server fetch call.
Definition at line 4731 of file ocilib_impl.hpp.
References ocilib::Check(), and OCI_GetFetchSize().
|
inline |
Set the number of rows pre-fetched by OCI Client.
| value | - number of rows to pre-fetch |
Definition at line 4736 of file ocilib_impl.hpp.
References ocilib::Check(), and OCI_SetPrefetchSize().
|
inline |
Return the number of rows pre-fetched by OCI Client.
Definition at line 4741 of file ocilib_impl.hpp.
References ocilib::Check(), and OCI_GetPrefetchSize().
|
inline |
Set the amount of memory pre-fetched by OCI Client.
| value | - amount of memory to fetch |
Definition at line 4746 of file ocilib_impl.hpp.
References ocilib::Check(), and OCI_SetPrefetchMemory().
|
inline |
Return the amount of memory used to retrieve rows pre-fetched by OCI Client.
Definition at line 4751 of file ocilib_impl.hpp.
References ocilib::Check(), and OCI_GetPrefetchMemory().
|
inline |
Set the LONG datatype piece buffer size.
| value | - maximum size for long buffer |
Definition at line 4756 of file ocilib_impl.hpp.
References ocilib::Check(), and OCI_SetLongMaxSize().
|
inline |
Return the LONG datatype piece buffer size.
Definition at line 4761 of file ocilib_impl.hpp.
References ocilib::Check(), and OCI_GetLongMaxSize().
|
inline |
Set the long datatype handling mode of a SQL statement.
| value | - long mode value |
Definition at line 4766 of file ocilib_impl.hpp.
References ocilib::Check(), and OCI_SetLongMode().
|
inline |
Return the Oracle SQL code the command held by the statement.
Definition at line 4776 of file ocilib_impl.hpp.
References ocilib::Check(), and OCI_GetSQLCommand().
|
inline |
Return the verb of the SQL command held by the statement.
Definition at line 4781 of file ocilib_impl.hpp.
References ocilib::Check(), ocilib::MakeString(), and OCI_GetSQLVerb().