Statement Class
A Statement object is used for executing SQL statements. The statement may be a query returning result set, or a non-query statement returning an update count. Non-query SQL can be insert, update, or delete statements. Non-query SQL statements can also be DML statements (such as create, grant, and so on) or stored procedure calls.
A query, insert / update / delete, or stored procedure call statements may have IN bind parameters, while a stored procedure call statement may have either OUT bind parameters or bind parameters that are both IN and OUT, referred to as IN/OUT parameters.
The Statement class methods are divided into three categories:
-
Statementmethods applicable to all statements -
Methods applicable to prepared statements with
INbind parameters -
Methods applicable to callable statements with
OUTorIN/OUTbind parameters.
Table 13-43 Enumerated Values used by the Statement Class
| Attribute | Options |
|---|---|
Status |
|
Table 13-44 Statement Methods
| Method | Description |
|---|---|
|
Adds an iteration for execution. |
|
|
Immediately releases a result set's database and OCCI resources instead of waiting for automatic release. |
|
|
Closes the stream specified by the parameter |
|
|
Disables statement caching. |
|
|
Runs the SQL statement. |
|
|
Runs insert, update, and delete statements that use only the |
|
|
Runs a SQL statement that returns a single |
|
|
Runs a SQL statement that does not return a |
|
|
Returns the current auto-commit state. |
|
|
Returns the state of the batch error mode. |
|
|
Returns the value of an IEEE754 |
|
|
Returns the value of a |
|
|
Returns the value of a |
|
|
Returns the value of a |
|
|
Returns the value of a |
|
|
Returns the characterset that is in effect for the specified parameter, as a |
|
|
Returns the characterset that is in effect for the specified parameter, as a |
|
|
Returns the value of a |
|
|
Returns the connection from which the |
|
|
Returns the iteration number of the current iteration that is being processed. |
|
|
Returns the current iteration for which stream data is to be read or written. |
|
|
Returns the parameter index of the current output Stream that must be read or written. |
|
|
Returns the |
|
|
Returns whether data is in NCHAR character set. |
|
|
Returns the value of a parameter as a |
|
|
Returns the row counts affected by each iteration of the current DML statement when it executes with multiple iterations. |
|
|
Returns the value of a parameter as a C++ double. |
|
|
Returns the value of a parameter as an IEEE754 float. |
|
|
Returns the value of a parameter as a C++ float. |
|
|
Returns the value of a parameter as a C++ int. |
|
|
Returns the value of a parameter as a |
|
|
Returns the value of a parameter as a |
|
|
Returns the current limit on maximum number of iterations. |
|
|
Returns the current max parameter size limit. |
|
|
Returns the value of a parameter as a |
|
|
Returns the value of a parameter as a |
|
|
Returns the OCI statement handle associated with the |
|
|
Returns the value of a REF parameter as |
|
|
Returns the current result as a |
|
|
Determines if the DML row counts option is enabled. |
|
|
Returns the row id parameter value as a |
|
|
Returns the current SQL string associated with the |
|
|
Returns the current SQL string associated with the |
|
|
Returns the value of the parameter as a stream. |
|
|
Returns the value of the parameter as a string. |
|
|
Returns the value of the parameter as a |
|
|
Returns the number of rows processed. |
|
|
Returns the value of the parameter as a C++ unsigned integer. |
|
|
Returns the number of rows processed. |
|
|
Returns the value of a |
|
|
Returns the specified parameter as a vector. |
|
|
Returns the column in the current position as a vector of |
|
|
Checks whether the parameter is |
|
|
Checks whether the value is truncated. |
|
|
Returns the actual length of the parameter before truncation. |
|
|
Registers the type and max size of the OUT parameter. |
|
|
Specifies auto commit mode. |
|
|
Enables or disables the batch error processing mode. |
|
|
Sets a parameter to an IEEE double value. |
|
|
Sets a parameter to a |
|
|
Sets a parameter to an IEEE float value. |
|
|
Specifies that a column is to be returned as a binary stream. |
|
|
Sets a parameter to a |
|
|
Sets a parameter to a |
|
|
Specifies that a column is to be returned as a character stream. |
|
|
Specifies the characterset as a |
|
|
Specifies the character set as a |
|
|
Sets a parameter to a |
|
|
Sets a parameter to a |
|
|
Sets to true if the data is to be in the NCHAR character set of the database; set to false to restore the default. |
|
|
Specifies a data buffer where data would be available for reading or writing. |
|
|
Specifies an array of data buffers where data would be available for reading or writing. |
|
|
Sets a parameter to a C++ double value. |
|
|
Enables Or Disables exceptions for reading of |
|
|
Enables Or Disables exception when truncation occurs. |
|
|
Sets a parameter to a C++ float value. |
|
|
Sets a parameter to a C++ int value. |
|
|
Sets a parameter to a |
|
|
Sets a parameter to a |
|
|
Sets the maximum number of invocations that area made for the DML statement. |
|
|
Sets the maximum amount of data that can sent or returned from the parameter. |
|
|
Sets a parameter to SQL |
|
|
Sets a parameter to a |
|
|
Sets the value of a parameter using an object. |
|
|
Sets the amount of memory that is used internally by OCCI to store data fetched during each round trip to the server. |
|
|
Sets the number of rows that are fetched internally by OCCI during each round trip to the server. |
|
|
Sets the value of a parameter to a reference. |
|
|
Set |
|
|
Sets a row id bytes array for a bind position. |
|
|
Associates new SQL string with |
|
|
Associates new SQL string with |
|
|
Sets a parameter for a specified index. |
|
|
Sets a parameter to a |
|
|
Sets a parameter to a C++ unsigned int value. |
|
|
Sets a parameter for a specified index; globalization enabled. |
|
|
Sets a parameter to a vector of unsigned int. |
|
|
Sets a parameter to a vector; is necessary when the type is a collection of |
|
|
Returns the current status of the statement. This is useful when there is streamed data to be written. |
- addIteration()
- closeResultSet()
- closeStream()
- disableCaching()
- execute()
- executeArrayUpdate()
- executeQuery()
- executeUpdate()
- getAutoCommit()
- getBatchErrorMode()
- getBDouble()
- getBfile()
- getBFloat()
- getBlob()
- getBoolean()
- getBytes()
- getCharSet()
- getCharSetUString()
- getClob()
- getConnection()
- getCurrentIteration()
- getCurrentStreamIteration()
- getCurrentStreamParam()
- getCursor()
- getDatabaseNCHARParam()
- getDate()
- getDMLRowCounts()
- getDouble()
- getFloat()
- getInt()
- getIntervalDS()
- getIntervalYM()
- getMaxIterations()
- getMaxParamSize()
- getNumber()
- getObject()
- getOCIStatement()
- getRef()
- getResultSet()
- getRowCountsOption()
- getRowid()
- getSQL()
- getSQLUString()
- getStream()
- getString()
- getTimestamp()
- getUb8RowCount()
- getUInt()
- getUpdateCount()
- getUString()
- getVector()
- getVectorOfRefs()
- isNull()
- isTruncated()
- preTruncationLength()
- registerOutParam()
- setAutoCommit()
- setBatchErrorMode()
- setBDouble()
- setBfile()
- setBFloat()
- setBinaryStreamMode()
- setBlob()
- setBoolean()
- setBytes()
- setCharacterStreamMode()
- setCharSet()
- setCharSetUString()
- setClob()
- setDate()
- setDatabaseNCHARParam()
- setDataBuffer()
- setDataBufferArray()
- setDouble()
- setErrorOnNull()
- setErrorOnTruncate()
- setFloat()
- setInt()
- setIntervalDS()
- setIntervalYM()
- setMaxIterations()
- setMaxParamSize()
- setNull()
- setNumber()
- setObject()
- setPrefetchMemorySize()
- setPrefetchRowCount()
- setRef()
- setRowCountsOption()
- setRowid()
- setSQL()
- setSQLUString()
- setString()
- setTimestamp()
- setUInt()
- setUString()
- setVector()
- setVectorOfRefs()
- status()
Parent topic: OCCI Application Programming Interface
addIteration()
After specifying set parameters, an iteration is added for execution.
Syntax
void addIteration();
Parent topic: Statement Class
closeResultSet()
Immediately releases the specified resultSet's database and OCCI resources when the result set is not needed.
Syntax
void closeResultSet( ResultSet *resultSet);
| Parameter | Description |
|---|---|
resultSet |
The result set to be closed; may be a result of getResultSet(), executeQuery(), or getCursor() calls on the current statement, or by a getCursor() call of another result set on the same statement. |
Parent topic: Statement Class
closeStream()
Closes the stream specified by the parameter stream.
Syntax
void closeStream( Stream *stream);
| Parameter | Description |
|---|---|
stream |
The stream to be closed. |
Parent topic: Statement Class
disableCaching()
Disables statement caching. Used if a user wants to destroy a statement instead of caching it. Effective only if statement caching is enabled.
Syntax
void disableCaching();
Parent topic: Statement Class
execute()
Executes an SQL statement that may return either a result set or an update count. The statement may have read-able streams which may have to be written, in which case the results of the execution may not be readily available. The returned value Status is defined in Table 13-43.
If output streams are used for OUT bind variables, they must be completely read in order. The getCurrentStreamParam() method would indicate which stream must be read. Similarly, getCurrentIteration() would indicate the iteration for which data is available.
| Syntax | Description |
|---|---|
Status execute( const string &sql=""); |
Executes the SQL Statement. |
Status execute( const UString &sql); |
Executes the SQL Statement; globalization enabled. |
| Parameter | Description |
|---|---|
sql |
The SQL statement to be executed. This can be |
Parent topic: Statement Class
executeArrayUpdate()
Executes insert/update/delete statements which use only the setDataBuffer() or stream interface for bind parameters. The bind parameters must be arrays of size arrayLength parameter. The statement may have writable streams which may have to be written. The returned value Status is defined in Table 13-43.
If output streams are used for OUT bind variables, they must be completely read in order. The getCurrentStreamParam() method would indicate which stream must be read. Similarly, getCurrentIteration() would indicate the iteration for which data is available.
Note that you cannot perform array executes for queries or callable statements.
Syntax
Status executeArrayUpdate( unsigned int arrayLength);
| Parameter | Description |
|---|---|
arrayLength |
The number of elements provided in each buffer of bind variables. |
Parent topic: Statement Class
executeQuery()
Runs a SQL statement that returns a ResultSet. Should not be called for a statement which is not a query, has streamed parameters. Returns a ResultSet that contains the data produced by the query.
| Syntax | Description |
|---|---|
ResultSet* executeQuery( const string &sql=""); |
Executes the SQL Statement that returns a |
ResultSet* executeQuery( const UString &sql); |
Executes the SQL Statement that returns a |
| Parameter | Description |
|---|---|
sql |
The SQL statement to be executed. This can be |
Parent topic: Statement Class
executeUpdate()
Executes a non-query statement such as a SQL INSERT, UPDATE, DELETE statement, a DDL statement such as CREATE/ALTER and so on, or a stored procedure call. Returns either the row count for INSERT, UPDATE or DELETE or 0 for SQL statements that return nothing.
If the number of rows processed as a result of this call exceeds UB4MAXVAL, it may throw an exception. In such scenarios, use execute() instead, followed by getUb8RowCount() to obtain the number of rows processed.
| Syntax | Description |
|---|---|
unsigned int executeUpdate( const string &sql=""); |
Executes a non-query statement. |
unsigned int executeUpdate( const UString &sql); |
Executes a non-query statement; globalization enabled. |
| Parameter | Description |
|---|---|
sql |
The SQL statement to be executed. This can be |
Parent topic: Statement Class
getAutoCommit()
Returns the current auto-commit state.
Syntax
bool getAutoCommit() const;
Parent topic: Statement Class
getBatchErrorMode()
Returns the state of the batch error mode; TRUE if the batch error mode is enabled, FALSE otherwise.
Syntax
bool getBatchErrorMode() const;
Parent topic: Statement Class
getBDouble()
Returns the value of an IEEE754 DOUBLE column, which has been defined as an OUT bind. If the value is SQL NULL, the result is 0.
Syntax
BDouble getBDouble( unsigned int paramIndex) = 0;
| Parameter | Description |
|---|---|
paramIndex |
Parameter index; first parameter is 1, second is 2, and so on. |
Parent topic: Statement Class
getBfile()
Returns the value of a BFILE parameter as a Bfile object.
Syntax
Bfile getBfile( unsigned int paramIndex);
| Parameter | Description |
|---|---|
paramIndex |
Parameter index; first parameter is 1, second is 2, and so on. |
Parent topic: Statement Class
getBFloat()
Gets the value of an IEEE754 FLOAT column, which has been defined as an OUT bind. If the value is SQL NULL, the result is 0.
Syntax
BFloat getBFloat( unsigned int paramIndex) = 0;
| Parameter | Description |
|---|---|
paramIndex |
Parameter index; first parameter is 1, second is 2, and so on. |
Parent topic: Statement Class
getBlob()
Returns the value of a BLOB parameter as a Blob.
Syntax
Blob getBlob( unsigned int paramIndex);
| Parameter | Description |
|---|---|
paramIndex |
Parameter index; first parameter is 1, second is 2, and so on. |
Parent topic: Statement Class
getBoolean()
Gets the output values of IN/OUT and OUT parameters of the BOOLEAN type in PL/SQL procedures and functions.
Syntax
virtual bool getBoolean (unsigned int paramIndex) =
0;| Parameter | Description |
|---|---|
paramIndex |
Parameter index; first parameter is 1, second is 2, and so on. Index of BOOLEAN type. |
Sample usage scenarios of Statement::getBoolean()
OUT BIND PL/SQL using getBoolean()
This returns an OUT bind parameter value at a given position in a statement object as a boolean value./*-------------------------------------------------------------------*//* OUT param of boolean
type */OCCIStatement *stmt =
conn->createStatement("BEGIN myproc (:1); END;"); try{
stmt->registerOutParam(1, Type::OCCIBOOL)
stmt->execute(); bool b = stmt->getBoolean (1); …}
/*-------------------------------------------------------------------*/IN BIND PL/SQL
/* IN param of boolean type */
bool bVal = true;
OCCIStatement *stmt = conn->createStatement("BEGIN myproc (:1); END;");
try
{
stmt->setBoolean(1, bVal);
stmt->execute();
…
}
IN/OUT BIND PL/SQL
/* IN/OUT param of boolean type */
bool bVal = true;
OCCIStatement *stmt = conn->createStatement("BEGIN myproc (:1); END;");
try
{
stmt->setBoolean(1, bVal);
stmt->execute();
bool b = stmt->getBoolean (1); …
}
Binding Boolean values in SELECT and DML statements
/*-------------------------------------------------------------------*/
Statement *stmt = conn->createStatement(“ INSERT INTO BoolTable (booleanColumn) VALUES (:1)" );
try
{
bool boolIn = true;
stmt->setMaxIterations (1);
stmt->setBoolean(1, boolIn);
stmt->executeUpdate ();
}
/*-------------------------------------------------------------------*/
Selecting BOOLEAN column values from tables and views
Class: ResultSet
virtual bool getBoolean(unsigned int colIndex) = 0;
This returns the selected column value as a boolean value from the ResultSet object
/*-------------------------------------------------------------------*/
Statement *stmt = conn->createStatement( " SELECT * from BoolTable " );
try
{
ResultSet rs = stmt->executeQuery();
rs->next();
string sname = rs->getString(1);
bool boolOut = rs->getBoolean(2);
}
/*-------------------------------------------------------------------*/
Parent topic: Statement Class
getBytes()
Returns the value of n SQL BINARY or VARBINARY parameter as Bytes; if the value is SQL NULL, the result is NULL.
Syntax
Bytes getBytes( unsigned int paramIndex);
| Parameter | Description |
|---|---|
paramIndex |
Parameter index; first parameter is 1, second is 2, and so on. |
Parent topic: Statement Class
getCharSet()
Returns the characterset that is in effect for the specified parameter, as a string.
Syntax
string getCharSet( unsigned int paramIndex) const;
| Parameter | Description |
|---|---|
paramIndex |
Parameter index; first parameter is 1, second is 2, and so on. |
Parent topic: Statement Class
getCharSetUString()
Returns the character set that is in effect for the specified parameter, as a UString.
Syntax
UString getCharSetUString( unsigned int paramIndex) const;
| Parameter | Description |
|---|---|
paramIndex |
Parameter index; first parameter is 1, second is 2, and so on. |
Parent topic: Statement Class
getClob()
Get the value of a CLOB parameter as a Clob. Returns the parameter value.
Syntax
Clob getClob( unsigned int paramIndex);
| Parameter | Description |
|---|---|
paramIndex |
Parameter index; first parameter is 1, second is 2, and so on. |
Parent topic: Statement Class
getConnection()
Returns the connection from which the Statement object was instantiated.
Syntax
Connection* getConnection() const;
Parent topic: Statement Class
getCurrentIteration()
If the prepared statement has any output Streams, this method returns the current iteration of the statement that is being processed by OCCI. If this method is called after all the invocations in the set of iterations has been processed, it returns 0. Returns the iteration number of the current iteration that is being processed. The first iteration is numbered 1 and so on. If the statement has finished execution, a 0 is returned.
Syntax
unsigned int getCurrentIteration() const;
Parent topic: Statement Class
getCurrentStreamIteration()
Returns the current parameter stream for which data is available.
Syntax
unsigned int getCurrentStreamIteration() const;
Parent topic: Statement Class
getCurrentStreamParam()
Returns the parameter index of the current output Stream parameter that must be written. If the prepared statement has any output Stream parameters, this method returns the parameter index of the current output Stream that must be written. If no output Stream must be written, or there are no output Stream parameters in the prepared statement, this method returns 0.
Syntax
unsigned int getCurrentStreamParam() const;
Parent topic: Statement Class
getCursor()
Gets the REF CURSOR value of an OUT parameter as a ResultSet. Data can be fetched from this result set. The OUT parameter must be registered as CURSOR with the registerOutParam() method. Returns a ResultSet for the OUT parameter value.
Note that if there are multiple REF CURSORs being returned due to a batched call, data from each cursor must be completely fetched before retrieving the next REF CURSOR and starting fetch on it.
Syntax
ResultSet * getCursor( unsigned int paramIndex);
| Parameter | Description |
|---|---|
paramIndex |
Parameter index; first parameter is 1, second is 2, and so on. |
Parent topic: Statement Class
getDatabaseNCHARParam()
Returns whether data is in NCHAR character set or not.
Syntax
bool getDatabaseNCHARParam( unsigned int paramIndex) const;
| Parameter | Description |
|---|---|
paramIndex |
Parameter index; first parameter is 1, second is 2, and so on. |
Parent topic: Statement Class
getDate()
Get the value of a SQL DATE parameter as a Date object. Returns the parameter value; if the value is SQL NULL, the result is NULL.
Syntax
Date getDate( unsigned int paramIndex) const;
| Parameter | Description |
|---|---|
paramIndex |
Parameter index; first parameter is 1, second is 2, and so on. |
Parent topic: Statement Class
getDMLRowCounts()
Returns the row counts affected by each iteration of the current DML statement when it executes with multiple iterations.
Use this method in conjunction with getRowCountsOption() and setRowCountsOption().
Syntax
vector<oraub8> getDMLRowCounts();
Parent topic: Statement Class
getDouble()
Get the value of a DOUBLE parameter as a C++ double. Returns the parameter value; if the value is SQL NULL, the result is 0.
Syntax
double getDouble( unsigned int paramIndex);
| Parameter | Description |
|---|---|
paramIndex |
Parameter index; first parameter is 1, second is 2, and so on. |
Parent topic: Statement Class
getFloat()
Get the value of a FLOAT parameter as a C++ float. Returns the parameter value; if the value is SQL NULL, the result is 0.
Syntax
float getFloat( unsigned int paramIndex);
| Parameter | Description |
|---|---|
paramIndex |
Parameter index; first parameter is 1, second is 2, and so on. |
Parent topic: Statement Class
getInt()
Get the value of an INTEGER parameter as a C++ int. Returns the parameter value; if the value is SQL NULL, the result is 0.
Syntax
unsigned int getInt( unsigned int paramIndex);
| Parameter | Description |
|---|---|
paramIndex |
Parameter index; first parameter is 1, second is 2, and so on. |
Parent topic: Statement Class
getIntervalDS()
Get the value of a parameter as a IntervalDS object.
Syntax
IntervalDS getIntervalDS( unsigned int paramIndex);
| Parameter | Description |
|---|---|
paramIndex |
Parameter index; first parameter is 1, second is 2, and so on. |
Parent topic: Statement Class
getIntervalYM()
Get the value of a parameter as a IntervalYM object.
Syntax
IntervalYM getIntervalYM( unsigned int paramIndex);
| Parameter | Description |
|---|---|
paramIndex |
Parameter index; first parameter is 1, second is 2, and so on. |
Parent topic: Statement Class
getMaxIterations()
Gets the current limit on maximum number of iterations. Default is 1. Returns the current maximum number of iterations.
Syntax
unsigned int getMaxIterations() const;
Parent topic: Statement Class
getMaxParamSize()
The maxParamSize limit (in bytes) is the maximum amount of data sent or returned for any parameter value; it only applies to character and binary types. If the limit is exceeded, the excess data is silently discarded. Returns the current max parameter size limit.
Syntax
unsigned int getMaxParamSize( unsigned int paramIndex) const;
| Parameter | Description |
|---|---|
paramIndex |
Parameter index; first parameter is 1, second is 2, and so on. |
Parent topic: Statement Class
getNumber()
Gets the value of a NUMERIC parameter as a Number object. Returns the parameter value; if the value is SQL NULL, the result is NULL.
Syntax
Number getNumber( unsigned int paramIndex);
| Parameter | Description |
|---|---|
paramIndex |
Parameter index; first parameter is 1, second is 2, and so on. |
Parent topic: Statement Class
getObject()
Gets the value of a parameter as a PObject. This method returns an PObject whose type corresponds to the SQL type that was registered for this parameter using registerOutParam(). Returns A PObject holding the OUT parameter value.
This method may be used to read database-specific, abstract data types.
Syntax
PObject * getObject( unsigned int paramIndex);
| Parameter | Description |
|---|---|
paramIndex |
Parameter index; first parameter is 1, second is 2, and so on. |
Parent topic: Statement Class
getOCIStatement()
Get the OCI statement handle associated with the Statement.
Syntax
OCIStmt * getOCIStatement() const;
Parent topic: Statement Class
getRef()
Get the value of a REF parameter as RefAny. Returns the parameter value.
Syntax
RefAny getRef( unsigned int paramIndex);
| Parameter | Description |
|---|---|
paramIndex |
Parameter index; first parameter is 1, second is 2, and so on. |
Parent topic: Statement Class
getResultSet()
Returns the current result as a ResultSet.
Syntax
ResultSet * getResultSet();
Parent topic: Statement Class
getRowCountsOption()
Determines if the DML row counts option is enabled.
If TRUE, DML statements can be executed to return the row counts for each iteration using the method getDMLRowCounts().
Syntax
bool getRowCountsOption();
Parent topic: Statement Class
getRowid()
Get the rowid parameter value as a Bytes.
Syntax
Bytes getRowid( unsigned int paramIndex);
| Parameter | Description |
|---|---|
paramIndex |
Parameter index; first parameter is 1, second is 2, and so on. |
Parent topic: Statement Class
getSQL()
Returns the current SQL string associated with the Statement object.
Syntax
string getSQL() const;
Parent topic: Statement Class
getSQLUString()
Returns the current SQL UString associated with the Statement object; globalization enabled.
Syntax
UString getSQLUString() const;
Parent topic: Statement Class
getStream()
Returns the value of the parameter as a stream.
Syntax
Stream * getStream( unsigned int paramIndex);
| Parameter | Description |
|---|---|
paramIndex |
Parameter index; first parameter is 1, second is 2, and so on. |
Parent topic: Statement Class
getString()
Get the value of a CHAR, VARCHAR, or LONGVARCHAR parameter as an string. Returns the parameter value; if the value is SQL NULL, the result is empty string.
Syntax
string getString( unsigned int paramIndex);
| Parameter | Description |
|---|---|
paramIndex |
Parameter index; first parameter is 1, second is 2, and so on. |
Parent topic: Statement Class
getTimestamp()
Get the value of a SQL TIMESTAMP parameter as a Timestamp object. Returns the parameter value; if the value is SQL NULL, the result is NULL
Syntax
Timestamp getTimestamp( unsigned int paramIndex);
| Parameter | Description |
|---|---|
paramIndex |
Parameter index; first parameter is 1, second is 2, and so on. |
Parent topic: Statement Class
getUb8RowCount()
Returns the number of rows affected by the execution of a DML statement.
This method enables a return of a large number of rows than was possible before Oracle Database Release 12c.
Syntax
oraub8 getUb8RowCount();
Parent topic: Statement Class
getUInt()
Get the value of a BIGINT parameter as a C++ unsigned int. Returns the parameter value; if the value is SQL NULL, the result is 0.
Syntax
unsigned int getUInt( unsigned int paramIndex);
| Parameter | Description |
|---|---|
paramIndex |
Parameter index; first parameter is 1, second is 2, and so on. |
Parent topic: Statement Class
getUpdateCount()
Returns the number of rows affected, if DML statement is executed.
Note: This method has been deprecated. Use getUb8RowCount() instead.
Syntax
unsigned int getUpdateCount() const;
Parent topic: Statement Class
getUString()
Returns the value as a UString.
This method should be called only if the environment's character set is UTF16, or if setCharset() method has been called to explicitly retrieve UTF16 data.
Syntax
UString getUString( unsigned int paramIndex);
| Parameter | Description |
|---|---|
paramIndex |
Parameter index; first parameter is 1, second is 2, and so on. |
Parent topic: Statement Class
getVector()
Returns the column in the current position as a vector. The column at the position, specified by index, should be a collection type (varray or nested table). The SQL type of the elements in the collection should be compatible with the type of the vector.
| Syntax | Description |
|---|---|
void getVector( Statement *stmt, unsigned int paramIndex, std::vector<UString> &vect); |
Used for vectors of |
void getVector( Statement *stmt, unsigned int paramIndex, vector<BDouble> &vect); |
Used for |
void getVector( Statement *stmt, unsigned int paramIndex, vector<BFile> &vect); |
Used for vectors of Bfile Class. |
void getVector( Statement *stmt, unsigned int paramIndex, vector<BFloat> &vect); |
Used for |
void getVector( Statement *stmt, unsigned int paramIndex, vector<Blob> &vect); |
Used for vectors of Blob Class. |
void getVector( Statement *stmt, unsigned int paramIndex, vector<Bytes> &vect); |
Used for vectors of Bytes Class. |
void getVector( Statement *stmt, unsigned int paramIndex, vector<Clob> &vect); |
Used for |
void getVector( Statement *stmt, unsigned int paramIndex, vector<Date> &vect); |
Used for vectors of Date Class. |
void getVector( Statement *stmt, unsigned int paramIndex, vector<double> &vect); |
Used for vectors of |
void getVector( Statement *stmt, unsigned int paramIndex, vector<float> &vect); |
Used for vectors of |
void getVector( Statement *stmt, unsigned int paramIndex, vector<int> &vect); |
Used for vectors of |
void getVector( Statement *stmt, unsigned int paramIndex, vector<IntervalDS> &vect); |
Used for vectors of IntervalDS Class. |
void getVector( Statement *stmt, unsigned int paramIndex, vector<IntervalYM> &vect); |
Used for vectors of IntervalYM Class. |
void getVector( Statement *stmt, unsigned int paramIndex, vector<Number> &vect); |
Used for vectors of Number Class. |
void getVector( Statement *stmt, unsigned int paramIndex, vector<RefAny> &vect); |
Used for vectors of RefAny Class. |
void getVector( Statement *stmt, unsigned int paramIndex, vector<string> &vect); |
Used for vectors of |
void getVector( Statement *stmt, unsigned int paramIndex, vector<T *> &vect); |
Intended for use on platforms where partial ordering of function templates is supported. |
void getVector( Statement *stmt, unsigned int paramIndex, vector<T> &vect); |
Intended for use on platforms where partial ordering of function templates is not supported, such as Windows NT and z/OS. For |
void getVector( Statement *stmt, unsigned int paramIndex, vector<Timestamp> &vect); |
Used for vectors of Timestamp Class. |
void getVector( Statement *stmt, unsigned int paramIndex, vector<u <Ref<T> > &vect); |
Available only on platforms where partial ordering of function templates is supported. |
void getVector( Statement *stmt, unsigned int paramIndex, vector<unsigned int> &vect); |
Used for on vectors of |
| Parameter | Description |
|---|---|
stmt |
The statement. |
paramIndex |
Parameter index. |
vect |
Reference to the vector ( |
Parent topic: Statement Class
getVectorOfRefs()
This method returns the column in the current position as a vector of REFs. The column should be a collection type (varray or nested table) of REFs. Used with OUT binds.
Syntax
void getVectorOfRefs( Statement *stmt, unsigned int colIndex, vector< Ref<T> > &vect);
| Parameter | Description |
|---|---|
stmt |
The statement object. |
colIndex |
Column index; first column is 1, second is 2, and so on. |
vect |
The reference to the vector of |
Parent topic: Statement Class
isNull()
An OUT parameter may have the value of SQL NULL; isNull() reports whether the last value read has this special value. Note that you must first call getxxx() on a parameter to read its value and then call isNull() to see if the value was SQL NULL. Returns TRUE if the last parameter read was SQL NULL.
Syntax
bool isNull( unsigned int paramIndex ) const;
| Parameter | Description |
|---|---|
paramIndex |
Parameter index; first parameter is 1, second is 2, and so on. |
Parent topic: Statement Class
isTruncated()
This method checks whether the value of the parameter is truncated. If the value of the parameter is truncated, then TRUE is returned; otherwise, FALSE is returned.
Syntax
bool isTruncated( unsigned int paramIndex) const;
| Parameter | Description |
|---|---|
paramIndex |
Parameter index; first parameter is 1, second is 2, and so on. |
Parent topic: Statement Class
preTruncationLength()
Returns the actual length of the parameter before truncation.
Syntax
int preTruncationLength( unsigned int paramIndex) const;
| Parameter | Description |
|---|---|
paramIndex |
Parameter index; first parameter is 1, second is 2, and so on. |
Parent topic: Statement Class
registerOutParam()
This method registers the type of each out parameter of a PL/SQL stored procedure. Before executing a PL/SQL stored procedure, you must explicitly call this method to register the type of each out parameter. This method should be called for out parameters only. Use the setxxx() method for in/out parameters.
-
When reading the value of an
outparameter, you must use thegetxxx()method that corresponds to the parameter's registered SQL type. For example, usegetIntorgetNumberwhenOCCIINTorOCCINumberis the type specified. -
If a PL/SQL stored procedure has an
outparameter oftypeROWID, thetypespecified in this method should beOCCISTRING. The value of theoutparameter can then be retrieved by calling thegetString()method. -
If a PL/SQL stored procedure has an in/out parameter of type
ROWID, call the methodssetString()andgetString()to set the type and retrieve the value of theIN/OUTparameter.
| Syntax | Description |
|---|---|
void registerOutParam( unsigned int paramIndex, Type type, unsigned int maxSize=0, const string &sqltype=""); |
Registers the |
void registerOutParam( unsigned int paramIndex, Type type, unsigned int maxSize, const string typName, const string &schName); |
Registers the |
void registerOutParam( unsigned int paramIndex, Type type, unsigned int maxSize, const UString &typName, const UString &schName); |
Registers the |
| Parameter | Description |
|---|---|
paramIndex |
Parameter index; first parameter is 1, second is 2, and so on. |
type |
SQL type code defined by |
maxSize |
The maximum size of the retrieved value. For data types of |
sqltype |
The name of the type in the data base (used for types which have been created with |
typName |
The name of the type. |
schName |
The schema name. |
Parent topic: Statement Class
setAutoCommit()
A Statement can be in auto-commit mode. In this case any statement executed is also automatically committed. By default, the auto-commit mode is turned-off.
Syntax
void setAutoCommit( bool autoCommit);
| Parameter | Description |
|---|---|
autoCommit |
|
Parent topic: Statement Class
setBatchErrorMode()
Enables or disables the batch error processing mode.
Syntax
virtual void setBatchErrorMode( bool batchErrorMode);
| Parameter | Description |
|---|---|
batchErrorMode |
|
Parent topic: Statement Class
setBDouble()
Sets an IEEE754 double as a bind value to a Statement object at the position specified by paramIndex attribute.
Syntax
void setBDouble( unsigned int paramIndex, const BDouble &dval);
| Parameter | Description |
|---|---|
paramIndex |
Parameter index; first parameter is 1, second is 2, and so on. |
dval |
The parameter value. |
Parent topic: Statement Class
setBfile()
Sets a parameter to a Bfile value.
Syntax
void setBfile( unsigned int paramIndex, const Bfile &val);
| Parameter | Description |
|---|---|
paramIndex |
Parameter index; first parameter is 1, second is 2, and so on. |
val |
The parameter value. |
Parent topic: Statement Class
setBFloat()
Sets an IEEE754 float as a bind value to a Statement object at the position specified by the paramIndex attribute.
Syntax
void setBFloat( unsigned int paramIndex, const BFloat &fval);
| Parameter | Description |
|---|---|
paramIndex |
Parameter index; first parameter is 1, second is 2, and so on. |
fval |
The parameter value. |
Parent topic: Statement Class
setBinaryStreamMode()
Defines that a column is to be returned as a binary stream.
| Syntax | Description |
|---|---|
void setBinaryStreamMode( unsigned int colIndex, unsigned int size); |
Sets column returned to be a binary stream. |
void setBinaryStreamMode( unsigned int colIndex, unsigned int size bool inArg); |
Sets column returned to be a binary stream; used with PL/SQL |
| Parameter | Description |
|---|---|
colIndex |
Column index; first column is 1, second is 2, and so on. |
size |
The amount of data to be read or returned as a binary |
inArg |
Pass |
Parent topic: Statement Class
setBlob()
Sets a parameter to a Blob value.
Syntax
void setBlob( unsigned int paramIndex, const Blob &val);
| Parameter | Description |
|---|---|
paramIndex |
Parameter index; first parameter is 1, second is 2, and so on. |
val |
The parameter value. |
Parent topic: Statement Class
setBoolean()
Sets an input value on statement object at the given position, using the given boolean value, for PL/SQL IN and IN/OUT BOOLEAN parameters and all BOOLEAN bind values for SELECT and DML statements.
Syntax
virtual void setBoolean(unsigned int paramIndex, bool val) =
0;| Parameters | Description |
|---|---|
paramIndex |
Parameter index; first parameter is 1, second is 2, and so on. This is the index of BOOLEAN type parameter of the PL/SQL procedure or function, or the bind position of the BOOLEAN type in the SELECT or DML statement executed. |
val |
val is the boolean value passed.
|
Parent topic: Statement Class
setBytes()
Sets a parameter to a Bytes array.
Syntax
void setBytes( unsigned int paramIndex, const Bytes &val);
| Parameter | Description |
|---|---|
paramIndex |
Parameter index; first parameter is 1, second is 2, and so on. |
val |
The parameter value. |
Parent topic: Statement Class
setCharacterStreamMode()
Defines that a column is to be returned as a character stream.
| Syntax | Description |
|---|---|
void setCharacterStreamMode( unsigned int colIndex, unsigned int size); |
Sets column returned to be a character stream. |
void setCharacterStreamMode( unsigned int colIndex, unsigned int size, bool inArg); |
Sets column returned to be a character stream; used with PL/SQL |
| Parameter | Description |
|---|---|
colIndex |
Column index; first column is 1, second is 2, and so on. |
size |
The amount of data to be read or returned as a character |
inArg |
Pass |
Parent topic: Statement Class
setCharSet()
Overrides the default character set for the specified parameter. Data is assumed to be in the specified character set and is converted to database character set. For OUT binds, this specifies the character set to which database characters are converted to.
Syntax
void setCharSet( unsigned int paramIndex, string &charSet);
| Parameter | Description |
|---|---|
paramIndex |
Parameter index; first parameter is 1, second is 2, and so on. |
charSet |
Selected character set, as a string. |
Parent topic: Statement Class
setCharSetUString()
Overrides the default character set for the specified parameter. Data is assumed to be in the specified character set and is converted to database character set. For OUT binds, this specifies the character set to which database characters are converted to.
Syntax
void setCharSetUString( unsigned int paramIndex, const UString& charSet);
| Parameter | Description |
|---|---|
paramIndex |
Parameter index; first parameter is 1, second is 2, and so on. |
charSet |
Selected character set, as a |
Parent topic: Statement Class
setClob()
Sets a parameter to a Clob value.
Syntax
void setClob( unsigned int paramIndex, const Clob &val);
| Parameter | Description |
|---|---|
paramIndex |
Parameter index; first parameter is 1, second is 2, and so on. |
val |
The parameter value. |
Parent topic: Statement Class
setDate()
Sets a parameter to a Date value.
Syntax
void setDate( unsigned int paramIndex, const Date &val);
| Parameter | Description |
|---|---|
paramIndex |
Parameter index; first parameter is 1, second is 2, and so on. |
val |
The parameter value. |
Parent topic: Statement Class
setDatabaseNCHARParam()
If the parameter is going to be inserted in a column that contains data in the database's NCHAR character set, then OCCI must be informed by passing a TRUE value. A FALSE can be passed to restore the dafault.Returns returns the character set that is in effect for the specified parameter.
Syntax
void setDatabaseNCHARParam( unsigned int paramIndex, bool isNCHAR);
| Parameter | Description |
|---|---|
paramIndex |
Parameter index; first parameter is 1, second is 2, and so on. |
isNCHAR |
|
Parent topic: Statement Class
setDataBuffer()
Specifies a data buffer where data would be available. Also used for OUT bind parameters of callable statements.
The buffer parameter is a pointer to a user allocated data buffer. The current length of data must be specified in the length parameter. The amount of data should not exceed the size parameter. Finally, type is the data type of the data.
Note that not all types can be supplied in the buffer. For example, all OCCI allocated types (such as Bytes, Date and so on) cannot be provided by the setDataBuffer() interface. Similarly, C++ Standard Library strings cannot be provided with the setDataBuffer() interface either. The type can be any of OCI data types such VARCHAR2, CSTRING, CHARZ and so on.
If setDataBuffer() is used to specify data for iterative or array executes, it should be called only once in the first iteration only. For subsequent iterations, OCCI would assume that data is at buffer +(i*size) location where i is the iteration number. Similarly the length of the data would be assumed to be at (length+i).
For more information on the version of this method that uses 32K length parameter, see Oracle AI Database SQL
Language Reference.
| Syntax | Description |
|---|---|
void setDataBuffer( unsigned int paramIndex, void *buffer, Type type, sb4 size, ub2 *length, sb2 *ind = NULL, ub2 *rc= NULL); |
Uses |
void setDataBuffer( unsigned int paramIndex, void *buffer, Type type, sb4 size, ub4 *length, sb2 *ind = NULL, ub2 *rc= NULL); |
Uses |
| Parameter | Description |
|---|---|
paramIndex |
Parameter index; first parameter is 1, second is 2, and so on. |
buffer |
Pointer to user-allocated buffer. For iterative or array executes, it should have |
type |
Type of the data that is provided (or retrieved) in the buffer. |
size |
Size of the data buffer; for iterative and array executes, it is the size of each element of the data items. For gather or scatter binds and defines, it is the size of the |
length |
Pointer to the length of data in the buffer; for iterative and array executes, it should be an array of length data for each buffer element; the size of the array should be equal to |
ind |
Indicator. For iterative and array executes, an indicator for every buffer element. |
rc |
Returns code; for iterative and array executes, a return code for every buffer element. |
Parent topic: Statement Class
setDataBufferArray()
Specifies an array of data buffers where data would be available for reading or writing. Used for IN, OUT, and IN/OUT bind parameters for stored procedures which read/write array parameters.
-
A stored procedure can have an array of values for
IN,IN/OUT, orOUTparameters. In this case, the parameter must be specified using the setDataBufferArray() method. The array is specified just as for the setDataBuffer() method for iterative or array executes, but the number of elements in the array is determined by*arrayLengthparameter. -
For
OUTandIN/OUTparameters, the maximum number of elements in the array is specified (and returned) by thearraySizeparameter. The client must ensure that it has allocated size *arraySizebytes for thebuffer. For iterative prepared statements, the number of elements in the array is determined by the number of iterations, and for array executes the number of elements in the array is determined by thearrayLengthparameter of the executeArrayUpdate() method. However, for array parameters of stored procedures, the number of elements in the array must be specified in thearrayLengthparameter of the setDataBufferArray() method because each parameter may have a different size array. -
This is different from prepared statements where for iterative and array executes, the number of elements in the array for each parameter is the same and is determined by the number of iterations of the statement, but a callable statement is executed only once, and each of its parameter can be a varying length array with possibly a different length.
-
For more information on the version of this method that uses 32K
elementLengthparameter, see Oracle AI Database SQL Language Reference.
| Syntax | Description |
|---|---|
void setDataBufferArray( unsigned int paramIndex, void *buffer, Type type, ub4 arraySize, ub4 *arrayLength, sb4 elementSize, ub2 *elementLength, sb2 *ind = NULL, ub2 *rc = NULL); |
Uses |
void setDataBufferArray( unsigned int paramIndex, void *buffer, Type type, ub4 arraySize, ub4 *arrayLength, sb4 elementSize, ub4 *elementLength, sb2 *ind = NULL, ub2 *rc = NULL); |
Uses |
| Parameter | Description |
|---|---|
paramIndex |
Parameter index; first parameter is 1, second is 2, and so on. |
buffer |
Pointer to user-allocated buffer. It should have |
type |
Type of the data that is provided (or retrieved) in the buffer. |
arraySize |
Maximum number of elements in the array. |
arrayLength |
Pointer to number of current elements in the array. |
elementSize |
Size of the data buffer for each element. For iterative and array executes, it is the size of each element of the data items. When using gather or scatter binds and defines, it is the size of the |
elementLemgth |
Pointer to an array of lengths. |
ind |
Pointer to an array of indicators. An indicator for every buffer element. |
rcs |
Pointer to an array of return codes. |
Parent topic: Statement Class
setDouble()
Sets a parameter to a C++ double value.
Syntax
void setDouble( unsigned int paramIndex, double val);
| Parameter | Description |
|---|---|
paramIndex |
Parameter index; first parameter is 1, second is 2, and so on. |
val |
The parameter value. |
Parent topic: Statement Class
setErrorOnNull()
Enables/disables exceptions for reading of NULL values on paramIndex parameter of the statement. If exceptions are enabled, calling a getxxx() on paramIndex parameter would result in an SQLException if the parameter value is NULL. This call can also be used to disable exceptions.
Syntax
void setErrorOnNull( unsigned int paramIndex, bool causeException);
| Parameter | Description |
|---|---|
paramIndex |
Parameter index; first parameter is 1, second is 2, and so on. |
causeException |
Enable exceptions if |
Parent topic: Statement Class
setErrorOnTruncate()
This method enables/disables exceptions when truncation occurs.
Syntax
void setErrorOnTruncate( unsigned int paramIndex, bool causeException);
| Parameter | Description |
|---|---|
paramIndex |
Parameter index; first parameter is 1, second is 2, and so on. |
causeException |
Enable exceptions if |
Parent topic: Statement Class
setFloat()
Sets a parameter to a C++ float value.
Syntax
void setFloat( unsigned int paramIndex, float val);
| Parameter | Description |
|---|---|
paramIndex |
Parameter index; first parameter is 1, second is 2, and so on. |
val |
The parameter value. |
Parent topic: Statement Class
setInt()
Sets a parameter to a C++ int value.
Syntax
void setInt( unsigned int paramIndex, int val);
| Parameter | Description |
|---|---|
paramIndex |
Parameter index; first parameter is 1, second is 2, and so on. |
val |
The parameter value. |
Parent topic: Statement Class
setIntervalDS()
Sets a parameter to a IntervalDS value.
Syntax
void setIntervalDS( unsigned int paramIndex, const IntervalDS &val);
| Parameter | Description |
|---|---|
paramIndex |
Parameter index; first parameter is 1, second is 2, and so on. |
val |
The parameter value. |
Parent topic: Statement Class
setIntervalYM()
Sets a parameter to a Interval value.
Syntax
void setIntervalYM( unsigned int paramIndex, const IntervalYM &val);
| Parameter | Description |
|---|---|
paramIndex |
Parameter index; first parameter is 1, second is 2, and so on. |
val |
The parameter value. |
Parent topic: Statement Class
setMaxIterations()
Sets the maximum number of invocations that are made for the DML statement. This must be called before any parameters are set on the prepared statement. The larger the iterations, the larger the numbers of parameters sent to the server in one round trip. However, a large number causes more memory to be reserved for all the parameters. Note that this is just the maximum limit. Actual number of iterations depends on the number of calls to addIteration().
Syntax
void setMaxIterations( unsigned int maxIterations);
| Parameter | Description |
|---|---|
maxIterations |
Maximum number of iterations allowed on this statement. |
Parent topic: Statement Class
setMaxParamSize()
This method sets the maximum amount of data to be sent or received for the specified parameter. It only applies to character and binary data. If the maximum amount is exceeded, the excess data is discarded. This method can be very useful when working with a LONG column. It can be used to truncate the LONG column by reading or writing it into a string or Bytes data type.
If the getSQL() or setBytes() method has been called to bind a value to an IN/OUT parameter of a PL/SQL procedure, and the size of the OUT value is expected to be greater than the size of the IN value, then setMaxParamSize() should be called.
Syntax
void setMaxParamSize( unsigned int paramIndex, unsigned int maxSize);
| Parameter | Description |
|---|---|
paramIndex |
Parameter index; first parameter is 1, second is 2, and so on. |
maxSize |
The new maximum parameter size limit; must be >0. |
Parent topic: Statement Class
setNull()
Sets a parameter to SQL NULL. Note that you must specify the parameter's SQL type.
| Syntax | Description |
|---|---|
void setNull( unsigned int paramIndex, Type type); |
Sets the value of a parameter to |
void setNull( unsigned int paramIndex, Type type, const string &typeName, const string &schemaName = "") |
Sets the value of a parameter to |
void setNull( unsigned int paramIndex, Type type, UString &typeName, UString &schemaName); |
Sets the value of a parameter to |
| Parameter | Description |
|---|---|
paramIndex |
Parameter index; first parameter is 1, second is 2, and so on. |
type |
SQL type. |
typeName |
Type name of the object or collection. |
schemaName |
Name of the schema where the object or collection is defined. |
Parent topic: Statement Class
setNumber()
Sets a parameter to a Number value.
Syntax
void setNumber( unsigned int paramIndex, const Number &val);
| Parameter | Description |
|---|---|
paramIndex |
Parameter index; first parameter is 1, second is 2, and so on. |
val |
The parameter value. |
Parent topic: Statement Class
setObject()
Sets the value of a parameter using an object; use the C++.lang equivalent objects for integral values. The OCCI specification specifies a standard mapping from C++ Object types to SQL types. The given parameter C++ object is converted to the corresponding SQL type before being sent to the database.
Syntax
void setObject( unsigned int paramIndex, PObject* val);
| Parameter | Description |
|---|---|
paramIndex |
Parameter index; first parameter is 1, second is 2, and so on. |
val |
The object containing the input parameter value. |
sqltyp |
The SQL type name of the object to be set. |
Parent topic: Statement Class
setPrefetchMemorySize()
Sets the amount of memory that is used internally by OCCI to store data fetched during each round trip to the server. A value of 0 means that the amount of data fetched during the round trip is constrained by the FetchRowCount parameter. If both parameters are nonzero, the smaller of the two is used.
Syntax
void setPrefetchMemorySize( unsigned int bytes);
| Parameter | Description |
|---|---|
bytes |
Number of bytes used for storing data fetched during each server round trip. |
Parent topic: Statement Class
setPrefetchRowCount()
Sets the number of rows that are fetched internally by OCCI during each round trip to the server. A value of 0 means that the amount of data fetched during the round trip is constrained by the FetchMemorySize parameter. If both parameters are nonzero, the smaller of the two is used. If both of these parameters are zero, row count internally defaults to 1 row and that is the value returned from the getFetchRowCount() method.
Syntax
void setPrefetchRowCount( unsigned int rowCount);
| Parameter | Description |
|---|---|
rowCount |
Number of rows to fetch for each round trip to the server. |
Parent topic: Statement Class
setRef()
Sets the value of a parameter to a reference. A Ref<T> instance is implicitly converted to a RefAny object during this call.
| Syntax | Description |
|---|---|
void setRef( unsigned int paramIndex, const RefAny &refAny); |
Sets the value of a parameter to a reference. |
void setRef( unsigned int paramIndex, const RefAny &refAny, const string &typName, const string &schName = ""); |
Sets the value of a parameter to a reference. If the |
void setRef( unsigned int paramIndex, const RefAny &refAny, const UString &typName, const UString &schName); |
Sets the value of a parameter to a reference. If the |
| Parameter | Description |
|---|---|
paramIndex |
Parameter index; first parameter is 1, second is 2, and so on. |
refAny |
The reference. |
typName |
The type of the object [optional]. |
schName |
The schema where the object type is defined [optional]. |
Parent topic: Statement Class
setRowCountsOption()
Set flag to TRUE to enable return of DML row counts per iteration when invoking getDMLRowCounts().
This option should be set before the statement executes. By default, the DML row counts per iteration are not returned.
Syntax
void setRowCountsOption( bool flag);
| Parameter | Description |
|---|---|
flag |
|
Parent topic: Statement Class
setRowid()
Sets a Rowid bytes array for a bind position.
Syntax
void setRowid( unsigned int paramIndex, const Bytes &val);
| Parameter | Description |
|---|---|
paramIndex |
Parameter index; first parameter is 1, second is 2, and so on. |
val |
The parameter value. |
Parent topic: Statement Class
setSQL()
A new SQL string can be associated with a Statement object using this call. Resources associated with the previous SQL statement are freed. In particular, a previously obtained result set is invalidated. If an empty SQL string, "", is used when the Statement is created, a setSQL method with the proper SQL string must be performed first.
Syntax
void setSQL( const string &sql);
| Parameter | Description |
|---|---|
sql |
Any SQL statement. |
Parent topic: Statement Class
setSQLUString()
Associate an SQL statement with this object. Unicode support: the client Environment should be initialized in OCCIUTIF16 mode.
Syntax
void setSQLUString( const UString &sql);
| Parameter | Description |
|---|---|
sql |
A SQL statement in same character set as the connection source of the statement. |
Parent topic: Statement Class
setString()
Sets a parameter for a specified index.
Syntax
void setString( unsigned int paramIndex, const string &val);
| Parameter | Description |
|---|---|
paramIndex |
Parameter index; first parameter is 1, second is 2, and so on. |
val |
The parameter value. |
Parent topic: Statement Class
setTimestamp()
Sets a parameter to a Timestamp value.
Syntax
void setTimestamp( unsigned int paramIndex, const Timestamp &val);
| Parameter | Description |
|---|---|
paramIndex |
Parameter index; first parameter is 1, second is 2, and so on. |
val |
The parameter value. |
Parent topic: Statement Class
setUInt()
Sets a parameter to a C++ unsigned int value.
Syntax
void setUInt( unsigned int paramIndex, unsigned int val);
| Parameter | Description |
|---|---|
paramIndex |
Parameter index; first parameter is 1, second is 2, and so on. |
val |
The parameter value. |
Parent topic: Statement Class
setUString()
Sets a parameter for a specified index; globalization enabled.
Syntax
void setUString( unsigned int paramIndex, const UString &val);
| Parameter | Description |
|---|---|
paramIndex |
Parameter index; first parameter is 1, second is 2, and so on. |
val |
The parameter value. |
Parent topic: Statement Class
setVector()
Sets a parameter to a vector. This method is necessary when the type is a collection type, varrays or nested tables. The SQL Type of the elements in the collection should be compatible with the type of the vector. For example, if the collection is a varray of VARCHAR2, use vector<string>.
| Syntax | Description |
|---|---|
void setVector( Statement *stmt, unsigned int paramIndex, const vector< T > &vect, const string &schemaName, const string &typeName); |
Intended for use on platforms where partial ordering of function templates is not supported, such as Windows NT and z/OS. Multibyte support. |
void setVector( Statement *stmt, unsigned int paramIndex, const vector<T* > &vect, const string &schemaName, const string &typeName); |
Intended for use on platforms where partial ordering of function templates is supported. Multibyte support. |
void setVector( Statement *stmt, unsigned int paramIndex, const vector<BDouble> &vect const string &sqltype); |
Sets a |
void setVector( Statement *stmt, unsigned int paramIndex, const vector<Bfile> &vect, const string &schemaName, const string &typeName); |
Sets a |
void setVector( Statement *stmt, unsigned int paramIndex, const vector<Bfile> &vect, const UString &schemaName, const UString &typeName); |
Sets a |
void setVector( Statement *stmt, unsigned int paramIndex, const vector<BFloat> &vect const string &sqltype); |
Sets a |
void setVector( Statement *stmt, unsigned int paramIndex, const vector<Blob> &vect, const string &schemaName, const string &typeName); |
Sets a |
void setVector( Statement *stmt, unsigned int paramIndex, const vector<Blob> &vect, const UString &schemaName, const UString &typeName); |
Sets a |
void setVector( Statement *stmt, unsigned int paramIndex, const vector<Bytes> &vect, const string &sqltype); |
Sets a |
void setVector( Statement *stmt, unsigned int paramIndex, const vector<Bytes> &vect, const string &schemaName, const string &typeName); |
Sets a |
void setVector( Statement *stmt, unsigned int paramIndex, const vector<Bytes> &vect, const Ustring &schemaName, const Ustring &typeName); |
Sets a |
void setVector( Statement *stmt, unsigned int paramIndex, const vector<Clob> &vect, const string &schemaName, const string &typeName); |
Sets a |
void setVector( Statement *stmt, unsigned int paramIndex, const vector<Clob> &vect, const UString &schemaName, const UString &typeName); |
Sets a |
void setVector( Statement *stmt, unsigned int paramIndex, const vector<Date> &vect, const string &schemaName, const string &typeName); |
Sets a |
void setVector( Statement *stmt, unsigned int paramIndex, const vector<Date> &vect, const UString &schemaName, const UString &typeName); |
Sets a |
void setVector( Statement *stmt, unsigned int paramIndex, const vector<double> &vect, const string &schemaName, const string &typeName); |
Sets a |
void setVector( Statement *stmt, unsigned int paramIndex, const vector<double> &vect, const UString &schemaName, const UString &typeName); |
Sets a |
void setVector( Statement *stmt, unsigned int paramIndex, const vector<float> &vect, const string &schemaName, const string &typeName); |
Sets a |
void setVector( Statement *stmt, unsigned int paramIndex, const vector<float> &vect, const UString &schemaName, const UString &typeName); |
Sets a |
void setVector( Statement *stmt, unsigned int paramIndex, const vector<int> &vect, const string &schemaName, const string &typeName); |
Sets a |
void setVector( Statement *stmt, unsigned int paramIndex, const vector<int> &vect, const UString &schemaName, const UString &typeName); |
Sets a |
void setVector( Statement *stmt, unsigned int paramIndex, const vector<IntervalDS> &vect, const string &schemaName, const string &typeName); |
Sets a |
void setVector( Statement *stmt, unsigned int paramIndex, const vector<IntervalDS> &vect, const UString &schemaName, const UString &typeName); |
Sets a |
void setVector( Statement *stmt, unsigned int paramIndex, const vector<IntervalYM> &vect, const string &schemaName, const string &typeName); |
Sets a |
void setVector( Statement *stmt, unsigned int paramIndex, const vector<IntervalYM> &vect, const UString &schemaName, const UString &typeName); |
Sets a |
void setVector( Statement *stmt, unsigned int paramIndex, const vector<Number> &vect, const string &schemaName, const string &typeName); |
Sets a |
void setVector( Statement *stmt, unsigned int paramIndex, const vector<Number> &vect, const UString &schemaName, const UString &typeName); |
Sets a |
void setVector( Statement *stmt, unsigned int paramIndex, const vector<RefAny> &vect, const string &schemaName, const string &typeName); |
Sets a |
void setVector( Statement *stmt, unsigned int paramIndex, const vector<RefAny> &vect, const UString &schemaName, const UString &typeName); |
Sets a |
void setVector( Statement *stmt, unsigned int paramIndex, const vector<string> &vect, const string &schemaName, const string &typeName); |
Sets a |
void setVector( Statement *stmt, unsigned int paramIndex, const vector<string> &vect, const UString &schemaName, const UString &typeName); |
Sets a |
void setVector( Statement *stmt, unsigned int paramIndex, const vector<Timestamp> &vect, const string &schemaName, const string &typeName); |
Sets a |
void setVector( Statement *stmt, unsigned int paramIndex, const vector<Timestamp> &vect, const UString &schemaName, const UString &typeName); |
Sets a |
void setVector( Statement *stmt, unsigned int paramIndex, const vector<unsigned int> &vect, const string &schemaName, const string &typeName); |
Sets a |
void setVector( Statement *stmt, unsigned int paramIndex, const vector<unsigned int> &vect, const UString &schemaName, const UString &typeName); |
Sets a |
void setVector( Statement *stmt, unsigned int paramIndex, vector<Bfile> &vect, string &sqltype); |
Sets a |
void setVector( Statement *stmt, unsigned int paramIndex, vector<Blob> &vect, string &sqltype); |
Sets a |
void setVector( Statement *stmt, unsigned int paramIndex, vector<Clob> &vect, string &sqltype); |
Sets a |
void setVector( Statement *stmt, unsigned int paramIndex, vector<Date> &vect, string &sqltype); |
Sets a |
void setVector( Statement *stmt, unsigned int paramIndex, vector<double> &vect, string &sqltype); |
Sets a |
void setVector( Statement *stmt, unsigned int paramIndex, vector<float> &vect, string &sqltype); |
Sets a |
void setVector( Statement *stmt, unsigned int paramIndex, vector<int> &vect, string &sqltype); |
Sets an |
void setVector( Statement *stmt, unsigned int paramIndex, vector<IntervalDS> &vect, string &sqltype); |
Sets an |
void setVector( Statement *stmt, unsigned int paramIndex, vector<IntervalYM> &vect, string &sqltype); |
Sets an |
void setVector( Statement *stmt, unsigned int paramIndex, vector<Number> &vect, string &sqltype); |
Sets a |
void setVector( Statement *stmt, unsigned int paramIndex, vector<RefAny> &vect, string &sqltype); |
Sets a |
void setVector( Statement *stmt, unsigned int paramIndex, vector<string> &vect, string &sqltype); |
Sets a |
void setVector( Statement *stmt, unsigned int paramIndex, vector<Timestamp> &vect, string &sqltype); |
Sets a |
void setVector( Statement *stmt, unsigned int paramIndex, vector<unsigned int> &vect, string &sqltype); |
Sets an |
template <class T> void setVector( Statement *stmt, unsigned int paramIndex, const vector< T* > &vect, const string &sqltype); |
Intended for use on platforms where partial ordering of function templates is not supported. |
template <class T> void setVector( Statement *stmt, unsigned int paramIndex, const vector<T> &vect, const string &sqltype); |
Intended for use on platforms where partial ordering of function templates is supported. |
template <class T> void setVector( Statement *stmt, unsigned int paramIndex, vector<Ref<T>> &vect, string &sqltype); |
Available only on platforms where partial ordering of function templates is supported. setVectorOfRefs() can be used instead. |
| Parameter | Description |
|---|---|
stmt |
Statement on which parameter is to be set. |
paramIndex |
Parameter index; first parameter is 1, second is 2, and so on. |
vect |
The vector to be set. |
sqltype |
Sqltype of the collection in the database. For example, |
schemaName |
Name of the schema used |
typeName |
Type |
Parent topic: Statement Class
setVectorOfRefs()
Sets a parameter to a vector; is necessary when the type is a collection of REFs or nested tables of REFs.
| Syntax | Description |
|---|---|
template <class T> void setVectorOfRefs( Statement *stmt, unsigned int paramIndex, const vector<Ref<T> > &vect, const string &sqltype); |
Sets a parameter to a vector; is necessary when the type is a collection of |
template <class T> void setVectorOfRefs( Statement *stmt, unsigned int paramIndex, const vector<Ref<T> > &vect, const string &sqltype); |
Used for multibyte support. |
template <class T> void setVectorOfRefs( Statement *stmt, unsigned int paramIndex, const vector<Ref<T>> &vect, const string &schemaName, const string &typeName); |
Used for multibyte support. |
template <class T> void setVectorOfRefs( Statement *stmt, unsigned int paramIndex, const vector<Ref<T> &vect, const UString &schemaName, const UString &typeName); |
Used for UTF16 support on platforms where partial ordering of function templates is not supported, such as Windows NT and z/OS. |
template <class T> void setVector( Statement *stmt, unsigned int paramIndex, const vector<T* > &vect, const UString &schemaName, const UString &typeName); |
Used for UTF16 support on platforms where partial ordering of function templates is supported. |
| Parameter | Description |
|---|---|
stmt |
Statement on which parameter is to be set. |
paramIndex |
Parameter index; first parameter is 1, second is 2, and so on. |
vect |
Vector to be set. |
sqltype |
Sqltype of the parameter or column. Use setVectorOfRefs() instead of specialized function setVector() for |
schemaName |
Name of the schema used |
typeName |
Type |
Parent topic: Statement Class
status()
Returns the current status of the statement. Useful when there is streamed data to be written (or read). Other methods such as getCurrentStreamParam() and getCurrentIteration() can be called to find out the streamed parameter that must be written and the current iteration number for an iterative or array execute. The status()method can be called repeatedly to find out the status of the execution.
The returned value, Status, is defined in Table 13-43.
Syntax
Status status() const;
Parent topic: Statement Class