OCILIB (C and C++ Driver for Oracle)  4.9.0
Open source and cross platform Oracle Driver delivering efficient access to Oracle databases.
Loading...
Searching...
No Matches
Statements control

Detailed Description

OcilibCApiRowIds

These functions provide extra information about OCILIB statements and can modify their behavior.

Functions

OCI_SYM_PUBLIC unsigned int OCI_API OCI_GetStatementType (OCI_Statement *stmt)
 Return the type of a SQL statement.
 
OCI_SYM_PUBLIC boolean OCI_API OCI_SetFetchMode (OCI_Statement *stmt, unsigned int mode)
 Set the fetch mode of a SQL statement.
 
OCI_SYM_PUBLIC unsigned int OCI_API OCI_GetFetchMode (OCI_Statement *stmt)
 Return the fetch mode of a SQL statement.
 
OCI_SYM_PUBLIC boolean OCI_API OCI_SetBindMode (OCI_Statement *stmt, unsigned int mode)
 Set the binding mode of a SQL statement.
 
OCI_SYM_PUBLIC unsigned int OCI_API OCI_GetBindMode (OCI_Statement *stmt)
 Return the binding mode of a SQL statement.
 
OCI_SYM_PUBLIC boolean OCI_API OCI_SetBindAllocation (OCI_Statement *stmt, unsigned int mode)
 Set the current bind allocation mode that will be used for subsequent binding calls.
 
OCI_SYM_PUBLIC unsigned int OCI_API OCI_GetBindAllocation (OCI_Statement *stmt)
 Return the current bind allocation mode used for subsequent binding calls.
 
OCI_SYM_PUBLIC boolean OCI_API OCI_SetFetchSize (OCI_Statement *stmt, unsigned int size)
 Set the number of rows fetched per internal server fetch call.
 
OCI_SYM_PUBLIC unsigned int OCI_API OCI_GetFetchSize (OCI_Statement *stmt)
 Return the number of rows fetched per internal server fetch call.
 
OCI_SYM_PUBLIC boolean OCI_API OCI_SetPrefetchSize (OCI_Statement *stmt, unsigned int size)
 Set the number of rows pre-fetched by OCI Client.
 
OCI_SYM_PUBLIC unsigned int OCI_API OCI_GetPrefetchSize (OCI_Statement *stmt)
 Return the number of rows pre-fetched by OCI Client.
 
OCI_SYM_PUBLIC boolean OCI_API OCI_SetPrefetchMemory (OCI_Statement *stmt, unsigned int size)
 Set the amount of memory pre-fetched by OCI Client.
 
OCI_SYM_PUBLIC unsigned int OCI_API OCI_GetPrefetchMemory (OCI_Statement *stmt)
 Return the amount of memory used to retrieve rows pre-fetched by OCI Client.
 
OCI_SYM_PUBLIC boolean OCI_API OCI_SetPieceSize (OCI_Statement *stmt, unsigned int size)
 Set the piece size for dynamic fetch operations (XMLTYPE, LONGs)
 
OCI_SYM_PUBLIC unsigned int OCI_API OCI_GetPieceSize (OCI_Statement *stmt)
 Return the piece size for dynamic fetch operations (XMLTYPE, LONGs)
 
OCI_SYM_PUBLIC boolean OCI_API OCI_SetLongMode (OCI_Statement *stmt, unsigned int mode)
 Set the long data type handling mode of a SQL statement.
 
OCI_SYM_PUBLIC unsigned int OCI_API OCI_GetLongMode (OCI_Statement *stmt)
 Return the long data type handling mode of a SQL statement.
 
OCI_SYM_PUBLIC OCI_Connection *OCI_API OCI_StatementGetConnection (OCI_Statement *stmt)
 Return the connection handle associated with a statement handle.
 

Function Documentation

◆ OCI_GetStatementType()

OCI_SYM_PUBLIC unsigned int OCI_API OCI_GetStatementType ( OCI_Statement stmt)

#include <api.h>

Return the type of a SQL statement.

Parameters
stmt- Statement handle
Note
Possible values are:
  • OCI_CST_SELECT : SELECT statement.
  • OCI_CST_UPDATE : UPDATE statement.
  • OCI_CST_DELETE : DELETE statement.
  • OCI_CST_INSERT : INSERT statement.
  • OCI_CST_CREATE : CREATE statement.
  • OCI_CST_DROP : DROP statement.
  • OCI_CST_ALTER : ALTER statement.
  • OCI_CST_BEGIN : BEGIN (PL/SQL) statement.
  • OCI_CST_DECLARE : DECLARE (PL/SQL) statement.
  • OCI_CST_CALL : KPU call.
  • OCI_CST_MERGE : MERGE statement.
Returns
The statement type on success, or OCI_UNKNOWN on error.

Referenced by ocilib::Statement::GetStatementType().

◆ OCI_SetFetchMode()

OCI_SYM_PUBLIC boolean OCI_API OCI_SetFetchMode ( OCI_Statement stmt,
unsigned int  mode 
)

#include <api.h>

Set the fetch mode of a SQL statement.

Parameters
stmt- Statement handle
mode- Fetch mode value
Warning
OCI_SetFetchMode() MUST be called before any OCI_ExecuteXXX() call.
Note
Possible values are:
  • OCI_SFM_DEFAULT
  • OCI_SFM_SCROLLABLE
Warning
If Oracle Client is 9iR1:
  • When setting OCI_SFM_SCROLLABLE, OCI_SetPrefetchSize() is internally called with value 0 to disable prefetching (to avoid an Oracle bug).
  • When re-setting OCI_SFM_DEFAULT after having set OCI_SFM_SCROLLABLE, OCI_SetPrefetchSize() is internally called with value OCI_PREFETCH_SIZE.

Referenced by ocilib::Statement::SetFetchMode().

◆ OCI_GetFetchMode()

OCI_SYM_PUBLIC unsigned int OCI_API OCI_GetFetchMode ( OCI_Statement stmt)

#include <api.h>

Return the fetch mode of a SQL statement.

Parameters
stmt- Statement handle
Note
See OCI_SetFetchMode() for possible values. Default value is OCI_SFM_DEFAULT.
Returns
The fetch mode value.

Referenced by ocilib::Statement::GetFetchMode().

◆ OCI_SetBindMode()

OCI_SYM_PUBLIC boolean OCI_API OCI_SetBindMode ( OCI_Statement stmt,
unsigned int  mode 
)

#include <api.h>

Set the binding mode of a SQL statement.

Parameters
stmt- Statement handle
mode- Binding mode value
Note
Possible values are:
  • OCI_BIND_BY_POS : Position binding.
  • OCI_BIND_BY_NAME : Name binding.
Returns
TRUE on success, otherwise FALSE.

Referenced by ocilib::Statement::SetBindMode().

◆ OCI_GetBindMode()

OCI_SYM_PUBLIC unsigned int OCI_API OCI_GetBindMode ( OCI_Statement stmt)

#include <api.h>

Return the binding mode of a SQL statement.

Parameters
stmt- Statement handle
Note
See OCI_SetBindMode() for possible values. Default value is OCI_BIND_BY_NAME.
If stmt is NULL, the return value is OCI_UNKNOWN.
Returns
The binding mode value.

Referenced by ocilib::Statement::GetBindMode().

◆ OCI_SetBindAllocation()

OCI_SYM_PUBLIC boolean OCI_API OCI_SetBindAllocation ( OCI_Statement stmt,
unsigned int  mode 
)

#include <api.h>

Set the current bind allocation mode that will be used for subsequent binding calls.

Parameters
stmt- Statement handle
mode- Bind allocation mode value
Note
Possible values are:
  • OCI_BAM_EXTERNAL : Bind variables are allocated by user code.
  • OCI_BAM_INTERNAL : Bind variables are allocated internally.
Warning
This call must be made after preparing a statement, as OCI_Prepare() resets it by default to OCI_BAM_EXTERNAL. When calling an OCI_BindXXXX() function, this value is used and stored in the OCI_Bind object created during the bind call. Each bind can have its own allocation mode, returned by OCI_BindGetAllocationMode(). OCI_SetBindAllocation() can be called before each binding call if needed, resulting in some binds allocated externally and others internally.
Note
Refer to the section "Binding variables and arrays" of the documentation about allocation mode, as OCI_BAM_INTERNAL is not compatible with all bind calls.

◆ OCI_GetBindAllocation()

OCI_SYM_PUBLIC unsigned int OCI_API OCI_GetBindAllocation ( OCI_Statement stmt)

#include <api.h>

Return the current bind allocation mode used for subsequent binding calls.

Parameters
stmt- Statement handle
Note
See OCI_SetBindAllocation() for possible values. Default value is OCI_BAM_EXTERNAL.
Warning
Each OCI_Bind object has its own allocation mode that may differ from the one returned by OCI_GetBindAllocation(). The return value of OCI_GetBindAllocation() is the mode that will be used for any subsequent OCI_BindXXXX() calls.
Note
If stmt is NULL, the return value is OCI_UNKNOWN.
Returns
The bind allocation mode value.

◆ OCI_SetFetchSize()

OCI_SYM_PUBLIC boolean OCI_API OCI_SetFetchSize ( OCI_Statement stmt,
unsigned int  size 
)

#include <api.h>

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

Parameters
stmt- Statement handle
size- Number of rows to fetch
Returns
TRUE on success, otherwise FALSE.

Referenced by ocilib::Statement::SetFetchSize().

◆ OCI_GetFetchSize()

OCI_SYM_PUBLIC unsigned int OCI_API OCI_GetFetchSize ( OCI_Statement stmt)

#include <api.h>

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

Parameters
stmt- Statement handle
Note
Default value is set to constant OCI_FETCH_SIZE.
Returns
The number of rows fetched per internal server fetch call.

Referenced by ocilib::Statement::GetFetchSize().

◆ OCI_SetPrefetchSize()

OCI_SYM_PUBLIC boolean OCI_API OCI_SetPrefetchSize ( OCI_Statement stmt,
unsigned int  size 
)

#include <api.h>

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

Parameters
stmt- Statement handle
size- Number of rows to pre-fetch
Note
To turn off pre-fetching, set both attributes (size and memory) to 0.
Warning
Prefetch does not work with scrollable cursors in Oracle 9iR1. In that case, argument 'size' is not used and replaced by 0.
Returns
TRUE on success, otherwise FALSE.

Referenced by ocilib::Statement::SetPrefetchSize().

◆ OCI_GetPrefetchSize()

OCI_SYM_PUBLIC unsigned int OCI_API OCI_GetPrefetchSize ( OCI_Statement stmt)

#include <api.h>

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

Parameters
stmt- Statement handle
Note
Default value is set to constant OCI_PREFETCH_SIZE.
Returns
The number of rows pre-fetched.

Referenced by ocilib::Statement::GetPrefetchSize().

◆ OCI_SetPrefetchMemory()

OCI_SYM_PUBLIC boolean OCI_API OCI_SetPrefetchMemory ( OCI_Statement stmt,
unsigned int  size 
)

#include <api.h>

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

Parameters
stmt- Statement handle
size- 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 the pre-fetch memory value can hold more rows than specified by pre-fetch size, OCI uses pre-fetch size instead.
OCILIB sets the pre-fetch attribute to OCI_PREFETCH_SIZE when a statement is created. To set a large value for OCI_SetPrefetchMemory(), you must call OCI_SetPrefetchSize() with 0 to make OCI consider this attribute.
Returns
TRUE on success, otherwise FALSE.

Referenced by ocilib::Statement::SetPrefetchMemory().

◆ OCI_GetPrefetchMemory()

OCI_SYM_PUBLIC unsigned int OCI_API OCI_GetPrefetchMemory ( OCI_Statement stmt)

#include <api.h>

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

Parameters
stmt- Statement handle
Note
Default value is 0.
Returns
The amount of memory used for pre-fetching.

Referenced by ocilib::Statement::GetPrefetchMemory().

◆ OCI_SetPieceSize()

OCI_SYM_PUBLIC boolean OCI_API OCI_SetPieceSize ( OCI_Statement stmt,
unsigned int  size 
)

#include <api.h>

Set the piece size for dynamic fetch operations (XMLTYPE, LONGs)

Parameters
stmt- Statement handle
size- Piece size
Returns
TRUE on success, otherwise FALSE.

Referenced by ocilib::Statement::SetPieceSize().

◆ OCI_GetPieceSize()

OCI_SYM_PUBLIC unsigned int OCI_API OCI_GetPieceSize ( OCI_Statement stmt)

#include <api.h>

Return the piece size for dynamic fetch operations (XMLTYPE, LONGs)

Parameters
stmt- Statement handle
Note
Default value is set to constant OCI_SIZE_PIECE_DYNAMIC_FETCH.
Returns
The piece size value.

Referenced by ocilib::Statement::GetPieceSize().

◆ OCI_SetLongMode()

OCI_SYM_PUBLIC boolean OCI_API OCI_SetLongMode ( OCI_Statement stmt,
unsigned int  mode 
)

#include <api.h>

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

Parameters
stmt- Statement handle
mode- Long mode value
Note
Possible values are:
  • OCI_LONG_EXPLICIT : LONGs are explicitly handled by the OCI_Long type.
  • OCI_LONG_IMPLICIT : LONGs are implicitly mapped to string type within the limits of VARCHAR2 size capacity.
Warning
LONG RAWs cannot be handled with OCI_LONG_IMPLICIT.
Returns
TRUE on success, otherwise FALSE.

Referenced by ocilib::Statement::SetLongMode().

◆ OCI_GetLongMode()

OCI_SYM_PUBLIC unsigned int OCI_API OCI_GetLongMode ( OCI_Statement stmt)

#include <api.h>

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

Parameters
stmt- Statement handle
Note
See OCI_SetLongMode() for possible values.
Returns
The long mode value.

Referenced by ocilib::Statement::GetLongMode().

◆ OCI_StatementGetConnection()

OCI_SYM_PUBLIC OCI_Connection *OCI_API OCI_StatementGetConnection ( OCI_Statement stmt)

#include <api.h>

Return the connection handle associated with a statement handle.

Parameters
stmt- Statement handle
Returns
The connection handle, or NULL on failure.

Referenced by ocilib::Statement::GetConnection().