OCILIB (C and C++ Driver for Oracle)  4.7.5
Open source and cross platform Oracle Driver delivering efficient access to Oracle databases.
Loading...
Searching...
No Matches
Fetching data

Detailed Description

OcilibCApiBinding

OCILIB offers a really easy and smart mechanism to fetch data from a SQL Statement. It looks like what's found in JDBC and other object oriented databases frameworks.

ONLY the following statements can return resultsets that can be fetched by host programs:

These resultsets are encapsulated in OCILIB by OCI_Resultset objects.

Thus, after any successful call to an OCI_Executexxx() function that executed a fetchable statement or filled output bind variables, the resultset can be retrieved by calling OCI_GetResultset()

The creation of a OCI_Resultset object consists in :

OCILIB supports multi-row fetching for increasing performances. Instead of fetching data row by row from the server (that induces lots of round-trips between the client and the server), the library prefetches data chunk by chunks (default is 20 rows). So, less network traffic and better performances. These mechanisms are completely hidden from the application which fetches the resultset row by row.

Once the Resultset handle is retrieved :

Note
In case of a statement that has executed PL/SQL calls or blocks returning implicit resultsets:
Scrollable Resultsets

Oracle 9i introduced scrollable cursors (resultsets in OCILIB) that can be fetched:

Scrollable statements uses more server and client resources and should only be used when necessary.

Resultsets are 'forward only' by default. Call OCI_SetFetchMode() with OCI_SFM_SCROLLABLE to enable scrollable resultsets for a given statement.

Warning
Any use of scrollable fetching functions with a resultset that depends on a statement with fetch mode set to OCI_SFM_DEFAULT will fail !
If you intend to use OCI_FetchSeek() on a scrollable statement and if any of the selected columns is a ref cursor or a nested table, OCILIB will internally set the resultset internal array size to 1 and thus ignore any values set using OCI_SetFetchSize() This is performed due to an Oracle bug.
Note
If the column internal data does not match the requested type, OCILIB tries to convert the data when it's possible and throws an error if not.

The properties (columns names, types ...) of the resultset are accessible through a set of APIs.

Implicit conversion to string types

OCI_GetString() performs an implicit conversion from ANY Oracle types:

Note
For RAWs and BLOBs attributes, their binary values are converted to hexadecimal strings For LONG and CLOBs/NCLOBSs attributes, the whole string content is returned
The following OCILIB types are not supported for implicit conversion:
  • OCI_Statement
Warning
For Dates and numerics types, OCILIB uses OCI client calls to perform the conversion. For binary double and binary floats data types, OCI client functions cannot handle the full double range of values. Thus, OCILIB is using the standard C library to convert theses data types to string
Fetching rows into user structures

It is possible to fetch a complete row into a user defined structure. Each column of the resultset is mapped to a structure member. The mapping rules are :

See OCI_GetStruct() and OCI_SetStructNumericType() for more details

Fetch Example
#include "ocilib.h"
/* requires script demo/products.sql */
void err_handler(OCI_Error *err)
{
printf("%s\n", OCI_ErrorGetString(err));
}
int main(void)
{
if (!OCI_Initialize(err_handler, NULL, OCI_ENV_DEFAULT))
{
return EXIT_FAILURE;
}
cn = OCI_ConnectionCreate("db", "usr", "pwd", OCI_SESSION_DEFAULT);
OCI_ExecuteStmt(st, "select * from products");
rs = OCI_GetResultset(st);
while (OCI_FetchNext(rs))
{
printf("code: %i, name %s\n", OCI_GetInt(rs, 1), OCI_GetString(rs, 2));
}
printf("\n%d row(s) fetched\n", OCI_GetRowCount(rs));
return EXIT_SUCCESS;
}
OCI_SYM_PUBLIC boolean OCI_API OCI_ConnectionFree(OCI_Connection *con)
Close a physical connection to an Oracle database server.
OCI_SYM_PUBLIC OCI_Connection *OCI_API OCI_ConnectionCreate(const otext *db, const otext *user, const otext *pwd, unsigned int mode)
Create a physical connection to an Oracle database server.
struct OCI_Connection OCI_Connection
Oracle physical connection.
Definition: types.h:124
struct OCI_Statement OCI_Statement
Oracle SQL or PL/SQL statement.
Definition: types.h:136
struct OCI_Error OCI_Error
Encapsulates an Oracle or OCILIB exception.
Definition: types.h:390
struct OCI_Resultset OCI_Resultset
Collection of output columns from a select statement.
Definition: types.h:163
OCI_SYM_PUBLIC const otext *OCI_API OCI_ErrorGetString(OCI_Error *err)
Retrieve error message from error handle.
OCI_SYM_PUBLIC boolean OCI_API OCI_FetchNext(OCI_Resultset *rs)
Fetch the next row of the resultset.
OCI_SYM_PUBLIC unsigned int OCI_API OCI_GetRowCount(OCI_Resultset *rs)
Retrieve the number of rows fetched so far.
OCI_SYM_PUBLIC const otext *OCI_API OCI_GetString(OCI_Resultset *rs, unsigned int index)
Return the current string value of the column at the given index in the resultset.
OCI_SYM_PUBLIC OCI_Resultset *OCI_API OCI_GetResultset(OCI_Statement *stmt)
Retrieve the resultset handle from an executed statement.
OCI_SYM_PUBLIC int OCI_API OCI_GetInt(OCI_Resultset *rs, unsigned int index)
Return the current integer value of the column at the given index in the resultset.
OCI_SYM_PUBLIC boolean OCI_API OCI_Cleanup(void)
Clean up all resources allocated by the library.
OCI_SYM_PUBLIC boolean OCI_API OCI_Initialize(POCI_ERROR err_handler, const otext *lib_path, unsigned int mode)
Initialize the library.
OCI_SYM_PUBLIC OCI_Statement *OCI_API OCI_StatementCreate(OCI_Connection *con)
Create a statement object and return its handle.
OCI_SYM_PUBLIC boolean OCI_API OCI_ExecuteStmt(OCI_Statement *stmt, const otext *sql)
Prepare and Execute a SQL statement or PL/SQL block.
OCI_SYM_PUBLIC boolean OCI_API OCI_StatementFree(OCI_Statement *stmt)
Free a statement and all resources associated to it (resultsets ...)
Fetch Rows into user structures Example
#include "ocilib.h"
/* requires script demo/products.sql */
typedef struct product_t
{
int code;
char *name;
} product_t;
typedef struct product_ind_t
{
boolean code;
boolean name;
} product_ind_t;
void err_handler(OCI_Error *err)
{
printf("%s\n", OCI_ErrorGetString(err));
}
int main(void)
{
product_t prd;
product_ind_t ind;
int i = 0;
if (!OCI_Initialize(err_handler, NULL, OCI_ENV_DEFAULT))
{
return EXIT_FAILURE;
}
cn = OCI_ConnectionCreate("db", "usr", "pwd", OCI_SESSION_DEFAULT);
OCI_ExecuteStmt(st, "select * from products");
rs = OCI_GetResultset(st);
OCI_SetStructNumericType(rs, 1, OCI_NUM_INT);
while (OCI_FetchNext(rs))
{
OCI_GetStruct(rs, &prd, &ind);
printf("row #%d \n"
" \n"
"...prd.code : %d \n"
"...prd.name : %s \n"
" \n",
++i, prd.code, prd.name);
}
printf("\n\n%d row(s) fetched\n", OCI_GetRowCount(rs));
return EXIT_SUCCESS;
}
OCI_SYM_PUBLIC boolean OCI_API OCI_SetStructNumericType(OCI_Resultset *rs, unsigned int index, unsigned int type)
set the numeric data type of the given structure member (identified from position in the resultset) t...
OCI_SYM_PUBLIC boolean OCI_API OCI_GetStruct(OCI_Resultset *rs, void *row_struct, void *row_struct_ind)
Return the row columns values into a single structure.
Meta data Example
#include "ocilib.h"
void err_handler(OCI_Error *err)
{
printf("%s\n", OCI_ErrorGetString(err));
}
int main(void)
{
int i, n;
if (!OCI_Initialize(err_handler, NULL, OCI_ENV_DEFAULT))
{
return EXIT_FAILURE;
}
cn = OCI_ConnectionCreate("db", "usr", "pwd", OCI_SESSION_DEFAULT);
OCI_ExecuteStmt(st, "select * from user_tables");
rs = OCI_GetResultset(st);
for (i = 1; i <= n; i++)
{
OCI_Column *col = OCI_GetColumn(rs, i);
printf("Field #%i : name '%s' - size %i\n", i, OCI_ColumnGetName(col), OCI_ColumnGetSize(col));
}
return EXIT_SUCCESS;
}
struct OCI_Column OCI_Column
Oracle SQL Column and Type member representation.
Definition: types.h:175
OCI_SYM_PUBLIC OCI_Column *OCI_API OCI_GetColumn(OCI_Resultset *rs, unsigned int index)
Return the column object handle at the given index in the resultset.
OCI_SYM_PUBLIC const otext *OCI_API OCI_ColumnGetName(OCI_Column *col)
Return the name of the given column.
OCI_SYM_PUBLIC unsigned int OCI_API OCI_GetColumnCount(OCI_Resultset *rs)
Return the number of columns in the resultset.
OCI_SYM_PUBLIC unsigned int OCI_API OCI_ColumnGetSize(OCI_Column *col)
Return the size of the column.
Ref cursor Example
#include "ocilib.h"
void err_handler(OCI_Error *err)
{
printf("%s\n", OCI_ErrorGetString(err));
}
int main(void)
{
if (!OCI_Initialize(err_handler, NULL, OCI_ENV_DEFAULT))
{
return EXIT_FAILURE;
}
cn = OCI_ConnectionCreate("db", "usr", "pwd", OCI_SESSION_DEFAULT);
OCI_ExecuteStmt(st, "select rownum, cursor(select sysdate from dual) from (select 1 from dual connect by level <= 10)");
rs = OCI_GetResultset(st);
while (OCI_FetchNext(rs))
{
while (OCI_FetchNext(rs2))
{
printf("index: %d, date: %s\n", OCI_GetInt(rs, 1), OCI_GetString(rs2, 1));
}
}
return EXIT_SUCCESS;
}
OCI_SYM_PUBLIC OCI_Statement *OCI_API OCI_GetStatement(OCI_Resultset *rs, unsigned int index)
Return the current cursor value (Nested table) of the column at the given index in the resultset.
Implicit resultset Example
#include "ocilib.h"
void err_handler(OCI_Error *err)
{
printf("%s\n", OCI_ErrorGetString(err));
}
int main(void)
{
int nb_rs = 0;
if (!OCI_Initialize(err_handler, NULL, OCI_ENV_DEFAULT))
{
return EXIT_FAILURE;
}
cn = OCI_ConnectionCreate("db", "usr", "pwd", OCI_SESSION_DEFAULT);
"declare"
" c1 sys_refcursor;"
" c2 sys_refcursor;"
" begin"
" open c1 for select * from tabs;"
" dbms_sql.return_result (c1); "
" open c2 for select * from cols;"
" dbms_sql.return_result (c2); "
"end;");
rs = OCI_GetResultset(st);
while (rs)
{
printf("Iterating on resultset #%d\n", ++nb_rs);
while (OCI_FetchNext(rs))
{
printf("...%s\n", OCI_GetString(rs, 1));
}
}
printf("\nFound %d resultsets\n", nb_rs);
return EXIT_SUCCESS;
}
OCI_SYM_PUBLIC OCI_Resultset *OCI_API OCI_GetNextResultset(OCI_Statement *stmt)
Retrieve the next available resultset.
Scrollable resultset Example
#include "ocilib.h"
void err_handler(OCI_Error *err)
{
printf("%s\n", OCI_ErrorGetString(err));
}
int main(void)
{
if (!OCI_Initialize(err_handler, NULL, OCI_ENV_DEFAULT))
{
return EXIT_FAILURE;
}
cn = OCI_ConnectionCreate("db", "usr", "pwd", OCI_SESSION_DEFAULT);
OCI_SetFetchMode(st, OCI_SFM_SCROLLABLE);
OCI_ExecuteStmt(st, "select rownum, 'Row ' || rownum from (select 1 from dual connect by level <= 65)");
rs = OCI_GetResultset(st);
/* get resultset row count */
printf("resultset contains %i rows\n", OCI_GetRowCount(rs));
/* go to row 1 */
printf("%i - %s\n", OCI_GetInt(rs, 1), OCI_GetString(rs, 2));
/* enumerate from row 2 to row X */
while (OCI_FetchNext(rs))
{
printf("%i - %s\n", OCI_GetInt(rs, 1), OCI_GetString(rs, 2));
}
/* enumerate from row X back to row 1 */
while (OCI_FetchPrev(rs))
{
printf("%i - %s\n", OCI_GetInt(rs, 1), OCI_GetString(rs, 2));
}
/* print the 30th row */
OCI_FetchSeek(rs, OCI_SFD_ABSOLUTE, 30);
printf("%i - %s\n", OCI_GetInt(rs, 1), OCI_GetString(rs, 2));
/* fetch next 30 rows */
while ((OCI_GetCurrentRow(rs) < 60) && OCI_FetchNext(rs))
{
printf("%0i - %s\n", OCI_GetInt(rs, 1), OCI_GetString(rs, 2));
}
/* move back to the 45th row */
OCI_FetchSeek(rs, OCI_SFD_RELATIVE, -15);
printf("%i - %s\n", OCI_GetInt(rs, 1), OCI_GetString(rs, 2));
return EXIT_SUCCESS;
}
OCI_SYM_PUBLIC boolean OCI_API OCI_FetchSeek(OCI_Resultset *rs, unsigned int mode, int offset)
Custom Fetch of the resultset.
OCI_SYM_PUBLIC boolean OCI_API OCI_FetchPrev(OCI_Resultset *rs)
Fetch the previous row of the resultset.
OCI_SYM_PUBLIC boolean OCI_API OCI_FetchLast(OCI_Resultset *rs)
Fetch the last row of the resultset.
OCI_SYM_PUBLIC boolean OCI_API OCI_FetchFirst(OCI_Resultset *rs)
Fetch the first row of the resultset.
OCI_SYM_PUBLIC unsigned int OCI_API OCI_GetCurrentRow(OCI_Resultset *rs)
Retrieve the current row number.
OCI_SYM_PUBLIC boolean OCI_API OCI_SetFetchMode(OCI_Statement *stmt, unsigned int mode)
Set the fetch mode of a SQL statement.

Functions

OCI_SYM_PUBLIC OCI_Resultset *OCI_API OCI_GetResultset (OCI_Statement *stmt)
 Retrieve the resultset handle from an executed statement.
 
OCI_SYM_PUBLIC boolean OCI_API OCI_ReleaseResultsets (OCI_Statement *stmt)
 Free the statement resultsets.
 
OCI_SYM_PUBLIC boolean OCI_API OCI_FetchNext (OCI_Resultset *rs)
 Fetch the next row of the resultset.
 
OCI_SYM_PUBLIC boolean OCI_API OCI_FetchPrev (OCI_Resultset *rs)
 Fetch the previous row of the resultset.
 
OCI_SYM_PUBLIC boolean OCI_API OCI_FetchFirst (OCI_Resultset *rs)
 Fetch the first row of the resultset.
 
OCI_SYM_PUBLIC boolean OCI_API OCI_FetchLast (OCI_Resultset *rs)
 Fetch the last row of the resultset.
 
OCI_SYM_PUBLIC boolean OCI_API OCI_FetchSeek (OCI_Resultset *rs, unsigned int mode, int offset)
 Custom Fetch of the resultset.
 
OCI_SYM_PUBLIC unsigned int OCI_API OCI_GetRowCount (OCI_Resultset *rs)
 Retrieve the number of rows fetched so far.
 
OCI_SYM_PUBLIC unsigned int OCI_API OCI_GetCurrentRow (OCI_Resultset *rs)
 Retrieve the current row number.
 
OCI_SYM_PUBLIC unsigned int OCI_API OCI_GetColumnCount (OCI_Resultset *rs)
 Return the number of columns in the resultset.
 
OCI_SYM_PUBLIC OCI_Column *OCI_API OCI_GetColumn (OCI_Resultset *rs, unsigned int index)
 Return the column object handle at the given index in the resultset.
 
OCI_SYM_PUBLIC OCI_Column *OCI_API OCI_GetColumn2 (OCI_Resultset *rs, const otext *name)
 Return the column object handle from its name in the resultset.
 
OCI_SYM_PUBLIC unsigned int OCI_API OCI_GetColumnIndex (OCI_Resultset *rs, const otext *name)
 Return the index of the column in the result from its name.
 
OCI_SYM_PUBLIC const otext *OCI_API OCI_ColumnGetName (OCI_Column *col)
 Return the name of the given column.
 
OCI_SYM_PUBLIC unsigned int OCI_API OCI_ColumnGetType (OCI_Column *col)
 Return the type of the given column.
 
OCI_SYM_PUBLIC unsigned int OCI_API OCI_ColumnGetCharsetForm (OCI_Column *col)
 Return the charset form of the given column.
 
OCI_SYM_PUBLIC const otext *OCI_API OCI_ColumnGetSQLType (OCI_Column *col)
 Return the Oracle SQL type name of the column data type.
 
OCI_SYM_PUBLIC unsigned int OCI_API OCI_ColumnGetFullSQLType (OCI_Column *col, otext *buffer, unsigned int len)
 Return the Oracle SQL Full name including precision and size of the column data type.
 
OCI_SYM_PUBLIC unsigned int OCI_API OCI_ColumnGetSize (OCI_Column *col)
 Return the size of the column.
 
OCI_SYM_PUBLIC int OCI_API OCI_ColumnGetScale (OCI_Column *col)
 Return the scale of the column for numeric columns.
 
OCI_SYM_PUBLIC int OCI_API OCI_ColumnGetPrecision (OCI_Column *col)
 Return the precision of the column for numeric columns.
 
OCI_SYM_PUBLIC int OCI_API OCI_ColumnGetFractionalPrecision (OCI_Column *col)
 Return the fractional precision of the column for timestamp and interval columns.
 
OCI_SYM_PUBLIC int OCI_API OCI_ColumnGetLeadingPrecision (OCI_Column *col)
 Return the leading precision of the column for interval columns.
 
OCI_SYM_PUBLIC boolean OCI_API OCI_ColumnGetNullable (OCI_Column *col)
 Return the nullable attribute of the column.
 
OCI_SYM_PUBLIC boolean OCI_API OCI_ColumnGetCharUsed (OCI_Column *col)
 Return TRUE if the length of the column is character-length or FALSE if it is byte-length.
 
OCI_SYM_PUBLIC unsigned int OCI_API OCI_ColumnGetPropertyFlags (OCI_Column *col)
 Return the column property flags.
 
OCI_SYM_PUBLIC unsigned int OCI_API OCI_ColumnGetCollationID (OCI_Column *col)
 Return the column collation ID.
 
OCI_SYM_PUBLIC OCI_TypeInfo *OCI_API OCI_ColumnGetTypeInfo (OCI_Column *col)
 Return the type information object associated to the column.
 
OCI_SYM_PUBLIC unsigned int OCI_API OCI_ColumnGetSubType (OCI_Column *col)
 Return the OCILIB object subtype of a column.
 
OCI_SYM_PUBLIC boolean OCI_API OCI_SetStructNumericType (OCI_Resultset *rs, unsigned int index, unsigned int type)
 set the numeric data type of the given structure member (identified from position in the resultset) to retrieve when calling OCI_GetStruct()
 
OCI_SYM_PUBLIC boolean OCI_API OCI_SetStructNumericType2 (OCI_Resultset *rs, const otext *name, unsigned int type)
 set the numeric data type of the given structure member (identified from column name in the resultset) to retrieve when calling OCI_GetStruct()
 
OCI_SYM_PUBLIC boolean OCI_API OCI_GetStruct (OCI_Resultset *rs, void *row_struct, void *row_struct_ind)
 Return the row columns values into a single structure.
 
OCI_SYM_PUBLIC OCI_Number *OCI_API OCI_GetNumber (OCI_Resultset *rs, unsigned int index)
 Return the current Number value of the column at the given index in the resultset.
 
OCI_SYM_PUBLIC OCI_Number *OCI_API OCI_GetNumber2 (OCI_Resultset *rs, const otext *name)
 Return the current number value of the column from its name in the resultset.
 
OCI_SYM_PUBLIC short OCI_API OCI_GetShort (OCI_Resultset *rs, unsigned int index)
 Return the current short value of the column at the given index in the resultset.
 
OCI_SYM_PUBLIC short OCI_API OCI_GetShort2 (OCI_Resultset *rs, const otext *name)
 Return the current short value of the column from its name in the resultset.
 
OCI_SYM_PUBLIC unsigned short OCI_API OCI_GetUnsignedShort (OCI_Resultset *rs, unsigned int index)
 Return the current unsigned short value of the column at the given index in the resultset.
 
OCI_SYM_PUBLIC unsigned short OCI_API OCI_GetUnsignedShort2 (OCI_Resultset *rs, const otext *name)
 Return the current unsigned short value of the column from its name in the resultset.
 
OCI_SYM_PUBLIC int OCI_API OCI_GetInt (OCI_Resultset *rs, unsigned int index)
 Return the current integer value of the column at the given index in the resultset.
 
OCI_SYM_PUBLIC int OCI_API OCI_GetInt2 (OCI_Resultset *rs, const otext *name)
 Return the current integer value of the column from its name in the resultset.
 
OCI_SYM_PUBLIC unsigned int OCI_API OCI_GetUnsignedInt (OCI_Resultset *rs, unsigned int index)
 Return the current unsigned integer value of the column at the given index in the resultset.
 
OCI_SYM_PUBLIC unsigned int OCI_API OCI_GetUnsignedInt2 (OCI_Resultset *rs, const otext *name)
 Return the current unsigned integer value of the column from its name in the resultset.
 
OCI_SYM_PUBLIC big_int OCI_API OCI_GetBigInt (OCI_Resultset *rs, unsigned int index)
 Return the current big integer value of the column at the given index in the resultset.
 
OCI_SYM_PUBLIC big_int OCI_API OCI_GetBigInt2 (OCI_Resultset *rs, const otext *name)
 Return the current big integer value of the column from its name in the resultset.
 
OCI_SYM_PUBLIC big_uint OCI_API OCI_GetUnsignedBigInt (OCI_Resultset *rs, unsigned int index)
 Return the current unsigned big integer value of the column at the given index in the resultset.
 
OCI_SYM_PUBLIC big_uint OCI_API OCI_GetUnsignedBigInt2 (OCI_Resultset *rs, const otext *name)
 Return the current unsigned big integer value of the column from its name in the resultset.
 
OCI_SYM_PUBLIC const otext *OCI_API OCI_GetString (OCI_Resultset *rs, unsigned int index)
 Return the current string value of the column at the given index in the resultset.
 
OCI_SYM_PUBLIC const otext *OCI_API OCI_GetString2 (OCI_Resultset *rs, const otext *name)
 Return the current string value of the column from its name in the resultset.
 
OCI_SYM_PUBLIC unsigned int OCI_API OCI_GetRaw (OCI_Resultset *rs, unsigned int index, void *buffer, unsigned int len)
 Copy the current raw value of the column at the given index into the specified buffer.
 
OCI_SYM_PUBLIC unsigned int OCI_API OCI_GetRaw2 (OCI_Resultset *rs, const otext *name, void *buffer, unsigned int len)
 Copy the current raw value of the column from its name into the specified buffer.
 
OCI_SYM_PUBLIC double OCI_API OCI_GetDouble (OCI_Resultset *rs, unsigned int index)
 Return the current double value of the column at the given index in the resultset.
 
OCI_SYM_PUBLIC double OCI_API OCI_GetDouble2 (OCI_Resultset *rs, const otext *name)
 Return the current double value of the column from its name in the resultset.
 
OCI_SYM_PUBLIC float OCI_API OCI_GetFloat (OCI_Resultset *rs, unsigned int index)
 Return the current float value of the column at the given index in the resultset.
 
OCI_SYM_PUBLIC float OCI_API OCI_GetFloat2 (OCI_Resultset *rs, const otext *name)
 Return the current float value of the column from its name in the resultset.
 
OCI_SYM_PUBLIC OCI_Date *OCI_API OCI_GetDate (OCI_Resultset *rs, unsigned int index)
 Return the current date value of the column at the given index in the resultset.
 
OCI_SYM_PUBLIC OCI_Date *OCI_API OCI_GetDate2 (OCI_Resultset *rs, const otext *name)
 Return the current date value of the column from its name in the resultset.
 
OCI_SYM_PUBLIC OCI_Timestamp *OCI_API OCI_GetTimestamp (OCI_Resultset *rs, unsigned int index)
 Return the current timestamp value of the column at the given index in the resultset.
 
OCI_SYM_PUBLIC OCI_Timestamp *OCI_API OCI_GetTimestamp2 (OCI_Resultset *rs, const otext *name)
 Return the current timestamp value of the column from its name in the resultset.
 
OCI_SYM_PUBLIC OCI_Interval *OCI_API OCI_GetInterval (OCI_Resultset *rs, unsigned int index)
 Return the current interval value of the column at the given index in the resultset.
 
OCI_SYM_PUBLIC OCI_Interval *OCI_API OCI_GetInterval2 (OCI_Resultset *rs, const otext *name)
 Return the current interval value of the column from its name in the resultset.
 
OCI_SYM_PUBLIC OCI_Statement *OCI_API OCI_GetStatement (OCI_Resultset *rs, unsigned int index)
 Return the current cursor value (Nested table) of the column at the given index in the resultset.
 
OCI_SYM_PUBLIC OCI_Statement *OCI_API OCI_GetStatement2 (OCI_Resultset *rs, const otext *name)
 Return the current cursor value of the column from its name in the resultset.
 
OCI_SYM_PUBLIC OCI_Lob *OCI_API OCI_GetLob (OCI_Resultset *rs, unsigned int index)
 Return the current lob value of the column at the given index in the resultset.
 
OCI_SYM_PUBLIC OCI_Lob *OCI_API OCI_GetLob2 (OCI_Resultset *rs, const otext *name)
 Return the current lob value of the column from its name in the resultset.
 
OCI_SYM_PUBLIC OCI_File *OCI_API OCI_GetFile (OCI_Resultset *rs, unsigned int index)
 Return the current File value of the column at the given index in the resultset.
 
OCI_SYM_PUBLIC OCI_File *OCI_API OCI_GetFile2 (OCI_Resultset *rs, const otext *name)
 Return the current File value of the column from its name in the resultset.
 
OCI_SYM_PUBLIC OCI_Object *OCI_API OCI_GetObject (OCI_Resultset *rs, unsigned int index)
 Return the current Object value of the column at the given index in the resultset.
 
OCI_SYM_PUBLIC OCI_Object *OCI_API OCI_GetObject2 (OCI_Resultset *rs, const otext *name)
 Return the current Object value of the column from its name in the resultset.
 
OCI_SYM_PUBLIC OCI_Coll *OCI_API OCI_GetColl (OCI_Resultset *rs, unsigned int index)
 Return the current Collection value of the column at the given index in the resultset.
 
OCI_SYM_PUBLIC OCI_Coll *OCI_API OCI_GetColl2 (OCI_Resultset *rs, const otext *name)
 Return the current Collection value of the column from its name in the resultset.
 
OCI_SYM_PUBLIC OCI_Ref *OCI_API OCI_GetRef (OCI_Resultset *rs, unsigned int index)
 Return the current Ref value of the column at the given index in the resultset.
 
OCI_SYM_PUBLIC OCI_Ref *OCI_API OCI_GetRef2 (OCI_Resultset *rs, const otext *name)
 Return the current Ref value of the column from its name in the resultset.
 
OCI_SYM_PUBLIC OCI_Long *OCI_API OCI_GetLong (OCI_Resultset *rs, unsigned int index)
 Return the current Long value of the column at the given index in the resultset.
 
OCI_SYM_PUBLIC OCI_Long *OCI_API OCI_GetLong2 (OCI_Resultset *rs, const otext *name)
 Return the current Long value of the column from its name in the resultset.
 
OCI_SYM_PUBLIC boolean OCI_API OCI_IsNull (OCI_Resultset *rs, unsigned int index)
 Check if the current row value is null for the column at the given index in the resultset.
 
OCI_SYM_PUBLIC unsigned int OCI_API OCI_GetDataSize (OCI_Resultset *rs, unsigned int index)
 Return the size of the value of the column at the given index in the resultset.
 
OCI_SYM_PUBLIC unsigned int OCI_API OCI_GetDataSize2 (OCI_Resultset *rs, const otext *name)
 Return the size of the value of the column from its name in the resultset.
 
OCI_SYM_PUBLIC boolean OCI_API OCI_IsNull2 (OCI_Resultset *rs, const otext *name)
 Check if the current row value is null for the column of the given name in the resultset.
 
OCI_SYM_PUBLIC OCI_Statement *OCI_API OCI_ResultsetGetStatement (OCI_Resultset *rs)
 Return the statement handle associated with a resultset handle.
 
OCI_SYM_PUBLIC unsigned int OCI_API OCI_GetDataLength (OCI_Resultset *rs, unsigned int index)
 Return the current row data length of the column at the given index in the resultset.
 

Function Documentation

◆ OCI_GetResultset()

OCI_SYM_PUBLIC OCI_Resultset *OCI_API OCI_GetResultset ( OCI_Statement stmt)

#include <api.h>

Retrieve the resultset handle from an executed statement.

Parameters
stmt- Statement handle
Note
See Fetching data for more details about what statements can return resultsets
Warning
If the statement has not been prepared and executed, no resultset will be returned
Returns
A resultset handle on success otherwise NULL

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

◆ OCI_ReleaseResultsets()

OCI_SYM_PUBLIC boolean OCI_API OCI_ReleaseResultsets ( OCI_Statement stmt)

#include <api.h>

Free the statement resultsets.

Parameters
stmt- Statement handle
Note
This call is optional. Resultsets are automatically freed when the statement is destroyed or when it's reused.
This function has been introduced for releasing big resultsets when the application wants to keep the statement alive and does not know when it will be destroyed.
Returns
TRUE on success otherwise FALSE

◆ OCI_FetchNext()

OCI_SYM_PUBLIC boolean OCI_API OCI_FetchNext ( OCI_Resultset rs)

#include <api.h>

Fetch the next row of the resultset.

Parameters
rs- Resultset handle
Note
OCI_FetchNext() works for normal and scrollable resultsets
Returns
TRUE on success otherwise FALSE if :
  • Empty resultset
  • Last row already fetched
  • An error occurred

Referenced by ocilib::Resultset::Next().

◆ OCI_FetchPrev()

OCI_SYM_PUBLIC boolean OCI_API OCI_FetchPrev ( OCI_Resultset rs)

#include <api.h>

Fetch the previous row of the resultset.

Parameters
rs- Resultset handle
Note
OCI_FetchPrev() works ONLY for scrollable resultsets
Returns
TRUE on success otherwise FALSE if :
  • Empty resultset
  • First row already fetched
  • An error occurred

Referenced by ocilib::Resultset::Prev().

◆ OCI_FetchFirst()

OCI_SYM_PUBLIC boolean OCI_API OCI_FetchFirst ( OCI_Resultset rs)

#include <api.h>

Fetch the first row of the resultset.

Parameters
rs- Resultset handle
Note
OCI_FetchFirst() works ONLY for scrollable resultsets
Returns
TRUE on success otherwise FALSE if :
  • Empty resultset
  • An error occurred f

Referenced by ocilib::Resultset::First().

◆ OCI_FetchLast()

OCI_SYM_PUBLIC boolean OCI_API OCI_FetchLast ( OCI_Resultset rs)

#include <api.h>

Fetch the last row of the resultset.

Parameters
rs- Resultset handle
Note
OCI_FetchLast() works ONLY for scrollable resultsets
Returns
TRUE on success otherwise FALSE if:
  • Empty resultset
  • An error occurred

Referenced by ocilib::Resultset::Last().

◆ OCI_FetchSeek()

OCI_SYM_PUBLIC boolean OCI_API OCI_FetchSeek ( OCI_Resultset rs,
unsigned int  mode,
int  offset 
)

#include <api.h>

Custom Fetch of the resultset.

Parameters
rs- Resultset handle
mode- Fetch direction
offset- Fetch offset
Note
Possible values for 'direction' parameter are:
  • OCI_SFD_ABSOLUTE
  • OCI_SFD_RELATIVE
OCI_FetchSeek() works ONLY for scrollable resultsets
Warning
If you intend to use OCI_FetchSeek() on a scrollable statement and if any of the selected columns is a ref cursor or a nested table, you must set the fetching size to 1 using OCI_SetFetchSize() before calling OCI_GetResultset() Otherwise OCI_FetchSeek() will fails with a OCI-10002 error
Returns
TRUE on success otherwise FALSE if:
  • Empty resultset
  • An error occurred
  • OCI_SetFetchMode() has not been called with OCI_SFM_SCROLLABLE

Referenced by ocilib::Resultset::Seek().

◆ OCI_GetRowCount()

OCI_SYM_PUBLIC unsigned int OCI_API OCI_GetRowCount ( OCI_Resultset rs)

#include <api.h>

Retrieve the number of rows fetched so far.

Parameters
rs- Resultset handle

Referenced by ocilib::Resultset::GetCount().

◆ OCI_GetCurrentRow()

OCI_SYM_PUBLIC unsigned int OCI_API OCI_GetCurrentRow ( OCI_Resultset rs)

#include <api.h>

Retrieve the current row number.

Parameters
rs- Resultset handle
Note
  • OCI_GetCurrentRow() returns the current row number starting from 1
  • If the resultset has not been fetched or if the resultset is empty, it returns 0
  • If the resultset has been fully fetched, it returns the last fetched row number

Referenced by ocilib::Resultset::GetCurrentRow().

◆ OCI_GetColumnCount()

OCI_SYM_PUBLIC unsigned int OCI_API OCI_GetColumnCount ( OCI_Resultset rs)

#include <api.h>

Return the number of columns in the resultset.

Parameters
rs- Resultset handle

Referenced by ocilib::Resultset::GetColumnCount().

◆ OCI_GetColumn()

OCI_SYM_PUBLIC OCI_Column *OCI_API OCI_GetColumn ( OCI_Resultset rs,
unsigned int  index 
)

#include <api.h>

Return the column object handle at the given index in the resultset.

Parameters
rs- Resultset handle
index- Column position
Returns
  • Column handle on success
  • NULL if index is out of bounds or on error

Referenced by ocilib::Resultset::GetColumn().

◆ OCI_GetColumn2()

OCI_SYM_PUBLIC OCI_Column *OCI_API OCI_GetColumn2 ( OCI_Resultset rs,
const otext *  name 
)

#include <api.h>

Return the column object handle from its name in the resultset.

Parameters
rs- Resultset handle
name- Column name
Note
The column name is case insensitive
Returns
  • Column handle on success or
  • NULL if no column found with the given name or on error

Referenced by ocilib::Resultset::GetColumn().

◆ OCI_GetColumnIndex()

OCI_SYM_PUBLIC unsigned int OCI_API OCI_GetColumnIndex ( OCI_Resultset rs,
const otext *  name 
)

#include <api.h>

Return the index of the column in the result from its name.

Parameters
rs- Resultset handle
name- Column name
Note
The column name is case insensitive
Column indexes start with 1 in OCILIB
Returns
Column index on success or zero on error

Referenced by ocilib::Resultset::GetColumnIndex().

◆ OCI_ColumnGetName()

OCI_SYM_PUBLIC const otext *OCI_API OCI_ColumnGetName ( OCI_Column col)

#include <api.h>

Return the name of the given column.

Parameters
col- Column handle

Referenced by ocilib::Column::GetName().

◆ OCI_ColumnGetType()

OCI_SYM_PUBLIC unsigned int OCI_API OCI_ColumnGetType ( OCI_Column col)

#include <api.h>

Return the type of the given column.

Parameters
col- Column handle
Note
Possible values are :
  • OCI_CDT_NUMERIC : short, int, long long, float, double
  • OCI_CDT_DATETIME : OCI_Date *
  • OCI_CDT_TEXT : otext *
  • OCI_CDT_LONG : OCI_Long *
  • OCI_CDT_CURSOR : OCI_Statement *
  • OCI_CDT_LOB : OCI_Lob *
  • OCI_CDT_FILE : OCI_File *
  • OCI_CDT_TIMESTAMP : OCI_Timestamp *
  • OCI_CDT_INTERVAL : OCI_Interval *
  • OCI_CDT_RAW : void *
  • OCI_CDT_OBJECT : OCI_Object *
  • OCI_CDT_COLLECTION : OCI_Coll *
  • OCI_CDT_REF : OCI_Ref *
  • OCI_CDT_BOOLEAN : boolean
Returns
The column type or OCI_CDT_UNKNOWN if index is out of bounds

Referenced by ocilib::Column::GetType().

◆ OCI_ColumnGetCharsetForm()

OCI_SYM_PUBLIC unsigned int OCI_API OCI_ColumnGetCharsetForm ( OCI_Column col)

#include <api.h>

Return the charset form of the given column.

Parameters
col- Column handle
Note
Possible values are :
  • OCI_CSF_NONE : the column is not an character or lob column
  • OCI_CSF_DEFAULT : the column has server default charset
  • OCI_CSF_NATIONAL : the column has national server charset

Referenced by ocilib::Column::GetCharsetForm().

◆ OCI_ColumnGetSQLType()

OCI_SYM_PUBLIC const otext *OCI_API OCI_ColumnGetSQLType ( OCI_Column col)

#include <api.h>

Return the Oracle SQL type name of the column data type.

Parameters
col- Column handle
Note
For possible values, consults Oracle Documentation

Referenced by ocilib::Column::GetSQLType().

◆ OCI_ColumnGetFullSQLType()

OCI_SYM_PUBLIC unsigned int OCI_API OCI_ColumnGetFullSQLType ( OCI_Column col,
otext *  buffer,
unsigned int  len 
)

#include <api.h>

Return the Oracle SQL Full name including precision and size of the column data type.

Parameters
col- Column handle
buffer- buffer to store the full column type name and size
len- max size of the buffer in characters
Note
This function returns a description that matches the one given by SQL*Plus
Return the number of characters written into the buffer

Referenced by ocilib::Column::GetFullSQLType().

◆ OCI_ColumnGetSize()

OCI_SYM_PUBLIC unsigned int OCI_API OCI_ColumnGetSize ( OCI_Column col)

#include <api.h>

Return the size of the column.

Note
For all types, the size is expressed is bytes, excepted for character based columns that were created with a character based size or of type NCHAR/NVARCHAR
Parameters
col- Column handle

Referenced by ocilib::Column::GetSize().

◆ OCI_ColumnGetScale()

OCI_SYM_PUBLIC int OCI_API OCI_ColumnGetScale ( OCI_Column col)

#include <api.h>

Return the scale of the column for numeric columns.

Parameters
col- Column handle

Referenced by ocilib::Column::GetScale().

◆ OCI_ColumnGetPrecision()

OCI_SYM_PUBLIC int OCI_API OCI_ColumnGetPrecision ( OCI_Column col)

#include <api.h>

Return the precision of the column for numeric columns.

Parameters
col- Column handle

Referenced by ocilib::Column::GetPrecision().

◆ OCI_ColumnGetFractionalPrecision()

OCI_SYM_PUBLIC int OCI_API OCI_ColumnGetFractionalPrecision ( OCI_Column col)

#include <api.h>

Return the fractional precision of the column for timestamp and interval columns.

Parameters
col- Column handle

Referenced by ocilib::Column::GetFractionalPrecision().

◆ OCI_ColumnGetLeadingPrecision()

OCI_SYM_PUBLIC int OCI_API OCI_ColumnGetLeadingPrecision ( OCI_Column col)

#include <api.h>

Return the leading precision of the column for interval columns.

Parameters
col- Column handle

Referenced by ocilib::Column::GetLeadingPrecision().

◆ OCI_ColumnGetNullable()

OCI_SYM_PUBLIC boolean OCI_API OCI_ColumnGetNullable ( OCI_Column col)

#include <api.h>

Return the nullable attribute of the column.

Parameters
col- Column handle
Returns
Return TRUE if the column is nullable otherwise FALSE

Referenced by ocilib::Column::IsNullable().

◆ OCI_ColumnGetCharUsed()

OCI_SYM_PUBLIC boolean OCI_API OCI_ColumnGetCharUsed ( OCI_Column col)

#include <api.h>

Return TRUE if the length of the column is character-length or FALSE if it is byte-length.

Parameters
col- Column handle
Note
This was introduced in Oracle 9i. So for version that are not supporting this property, it always return FALSE

Referenced by ocilib::Column::IsCharSemanticUsed().

◆ OCI_ColumnGetPropertyFlags()

OCI_SYM_PUBLIC unsigned int OCI_API OCI_ColumnGetPropertyFlags ( OCI_Column col)

#include <api.h>

Return the column property flags.

Parameters
col- Column handle

For flags are:

  • OCI_CPF_NONE : The column has no flags or the OCI client does not support this call
  • OCI_CPF_IS_IDENTITY:
    • If Set, the column is an IDENTITY column
    • Otherwise, it is not an IDENTITY column
  • OCI_CPF_IS_GEN_ALWAYS:
    • If set, means that the value is "ALWAYS GENERATED"
    • Otherwise means that the value is "GENERATED BY"
  • OCI_CPF_IS_GEN_BY_DEFAULT_ON_NULL:
    • If set, means that the value is generated by default on NULL
  • OCI_CPF_IS_LPART:
    • If set, Column is an implicitly generated logical partitioning column for container_map enabled object
  • OCI_CPF_IS_CONID:
    • If set, Column is a CON_ID column implicitly generated by CONTAINERS() or is an ORIGIN_CON_ID column implicitly generated for Extended Data Link
Note
This was introduced in Oracle 12cR1. For earlier versions, it always return OCI_CPF_NONE

Referenced by ocilib::Column::GetPropertyFlags().

◆ OCI_ColumnGetCollationID()

OCI_SYM_PUBLIC unsigned int OCI_API OCI_ColumnGetCollationID ( OCI_Column col)

#include <api.h>

Return the column collation ID.

Parameters
col- Column handle

Possible values:

  • OCI_CCI_NONE
  • OCI_CCI_NLS_COMP
  • OCI_CCI_NLS_SORT
  • OCI_CCI_NLS_SORT_CI
  • OCI_CCI_NLS_SORT_AI
  • OCI_CCI_NLS_SORT_CS
  • OCI_CCI_NLS_SORT_VAR1
  • OCI_CCI_NLS_SORT_VAR1_CI
  • OCI_CCI_NLS_SORT_VAR1_AI
  • OCI_CCI_NLS_SORT_VAR1_CS
  • OCI_CCI_BINARY
  • OCI_CCI_BINARY_CI
  • OCI_CCI_BINARY_AI
Note
This was introduced in Oracle 12cR2. For earlier versions, it always return OCI_CCI_NONE

Referenced by ocilib::Column::GetCollationID().

◆ OCI_ColumnGetTypeInfo()

OCI_SYM_PUBLIC OCI_TypeInfo *OCI_API OCI_ColumnGetTypeInfo ( OCI_Column col)

#include <api.h>

Return the type information object associated to the column.

Parameters
col- Column handle
Note
This call is used only for Named Object typed and collection columns. It returns NULL if the column is not a Named Object or a collection.

Referenced by ocilib::Column::GetTypeInfo().

◆ OCI_ColumnGetSubType()

OCI_SYM_PUBLIC unsigned int OCI_API OCI_ColumnGetSubType ( OCI_Column col)

#include <api.h>

Return the OCILIB object subtype of a column.

Parameters
col- Column handle
Note
This call is valid for the following OCILIB types:
  • OCI_CDT_LONG
  • OCI_CDT_LOB
  • OCI_CDT_FILE
  • OCI_CDT_TIMESTAMP
  • OCI_CDT_INTERVAL
  • OCI_CDT_NUMERIC

For OCI_Long type the possible values are:

  • OCI_BLONG
  • OCI_CLONG

For OCI_Lob type the possible values are:

  • OCI_BLOB
  • OCI_CLOB
  • OCI_NCLOB

For OCI_File type the possible values are:

  • OCI_BFILE
  • OCI_CFILE

For OCI_Timestamp type the possible values are:

  • OCI_TIMESTAMP
  • OCI_TIMESTAMP_TZ
  • OCI_TIMESTAMP_LTZ

For OCI_Interval type the possible values are:

  • OCI_INTERVAL_YM
  • OCI_INTERVAL_DS

For numeric columns the possible values are:

  • OCI_NUM_SHORT
  • OCI_NUM_INT
  • OCI_NUM_BIGINT
  • OCI_NUM_USHORT
  • OCI_NUM_UINT
  • OCI_NUM_BIGUINT
  • OCI_NUM_DOUBLE
  • OCI_NUM_FLOAT
  • OCI_NUM_NUMBER
Warning
For numeric columns, the value may be not accurate at all! OCI does not allow to find out the real SQL precise type of an numeric column (int, real, ...). OCI based libraries can only 'guess' some types in some situations : float, binary_float, binary_float, number. For example:
  • with the statement 'select 101 from dual', OCI would report numeric type NUMBER.
  • if a column is declared as "INT", OCI would report also NUMBER.
Note
For all other OCILIB types, it returns OCI_UNKNOWN

Referenced by ocilib::Column::GetSubType().

◆ OCI_SetStructNumericType()

OCI_SYM_PUBLIC boolean OCI_API OCI_SetStructNumericType ( OCI_Resultset rs,
unsigned int  index,
unsigned int  type 
)

#include <api.h>

set the numeric data type of the given structure member (identified from position in the resultset) to retrieve when calling OCI_GetStruct()

Parameters
rs- Resultset handle
index- Column position
type- Numeric type
Note
Possible values for parameter 'type' :
  • OCI_NUM_SHORT
  • OCI_NUM_USHORT
  • OCI_NUM_INT
  • OCI_NUM_UINT
  • OCI_NUM_BIGINT
  • OCI_NUM_BIGUINT
  • OCI_NUM_DOUBLE
  • OCI_NUM_FLOAT
  • OCI_NUM_NUMBER
Returns
Return TRUE on success otherwise FALSE

◆ OCI_SetStructNumericType2()

OCI_SYM_PUBLIC boolean OCI_API OCI_SetStructNumericType2 ( OCI_Resultset rs,
const otext *  name,
unsigned int  type 
)

#include <api.h>

set the numeric data type of the given structure member (identified from column name in the resultset) to retrieve when calling OCI_GetStruct()

Parameters
rs- Resultset handle
name- Column name
type- Numeric type
Note
Possible values for parameter 'type' :
  • OCI_NUM_SHORT
  • OCI_NUM_USHORT
  • OCI_NUM_INT
  • OCI_NUM_UINT
  • OCI_NUM_BIGINT
  • OCI_NUM_BIGUINT
  • OCI_NUM_DOUBLE
  • OCI_NUM_FLOAT
  • OCI_NUM_NUMBER
Returns
Return TRUE on success otherwise FALSE

◆ OCI_GetStruct()

OCI_SYM_PUBLIC boolean OCI_API OCI_GetStruct ( OCI_Resultset rs,
void *  row_struct,
void *  row_struct_ind 
)

#include <api.h>

Return the row columns values into a single structure.

Parameters
rs- Resultset handle
row_struct- pointer to user row structure
row_struct_ind- pointer to user indicator structure
Note
Structure members values are contextual to the current row. The returned values can get out of scope when the current row changes when calling any OCI_FecthXXX() calls
User row structure

The user structure must have the same members than the resultset. Each column in the resultset must have its equivalent in the structure. Fields must be in the same order.

The mapping rules are :

  • LOBs (CLOB, NCLOB, BLOB) : OCI_Lob *
  • DATE : OCI_Date *
  • TIMESTAMPS : OCI_Timestamp *
  • INTERVALS : OCI_Interval *
  • LONG, LONG RAW : OCI_Long *
  • REFs : OCI_Ref *
  • CURSOR, RESULSET : OCI_Statement *
  • OBJECTS, UDT : OCI_Object *
  • Character columns (CHAR,VARCHAR, etc..) : otext *
  • All NUMERIC types :

The user structure pointer is not mandatory

User row indicator structure

This structure must have one boolean field per column in the resultset and respect in the same member order.

If the value of the given member is TRUE, it means the value in the user row structure is NOT NULL, otherwise its NULL

The user indicator structure pointer is mandatory

Returns
Return TRUE on success otherwise FALSE

◆ OCI_GetNumber()

OCI_SYM_PUBLIC OCI_Number *OCI_API OCI_GetNumber ( OCI_Resultset rs,
unsigned int  index 
)

#include <api.h>

Return the current Number value of the column at the given index in the resultset.

Parameters
rs- Resultset handle
index- Column position
Note
Column position starts at 1.
Returns
The column current row value or 0 if index is out of bounds

◆ OCI_GetNumber2()

OCI_SYM_PUBLIC OCI_Number *OCI_API OCI_GetNumber2 ( OCI_Resultset rs,
const otext *  name 
)

#include <api.h>

Return the current number value of the column from its name in the resultset.

Parameters
rs- Resultset handle
name- Column name
Note
The column name is case insensitive
Returns
The column current row value or 0 if no column found with the given name

◆ OCI_GetShort()

OCI_SYM_PUBLIC short OCI_API OCI_GetShort ( OCI_Resultset rs,
unsigned int  index 
)

#include <api.h>

Return the current short value of the column at the given index in the resultset.

Parameters
rs- Resultset handle
index- Column position
Note
Column position starts at 1.
Returns
The column current row value or 0 if index is out of bounds

◆ OCI_GetShort2()

OCI_SYM_PUBLIC short OCI_API OCI_GetShort2 ( OCI_Resultset rs,
const otext *  name 
)

#include <api.h>

Return the current short value of the column from its name in the resultset.

Parameters
rs- Resultset handle
name- Column name
Note
The column name is case insensitive
Returns
The column current row value or 0 if no column found with the given name

◆ OCI_GetUnsignedShort()

OCI_SYM_PUBLIC unsigned short OCI_API OCI_GetUnsignedShort ( OCI_Resultset rs,
unsigned int  index 
)

#include <api.h>

Return the current unsigned short value of the column at the given index in the resultset.

Parameters
rs- Resultset handle
index- Column position
Note
Column position starts at 1.
Returns
The column current row value or 0 if index is out of bounds

◆ OCI_GetUnsignedShort2()

OCI_SYM_PUBLIC unsigned short OCI_API OCI_GetUnsignedShort2 ( OCI_Resultset rs,
const otext *  name 
)

#include <api.h>

Return the current unsigned short value of the column from its name in the resultset.

Parameters
rs- Resultset handle
name- Column name
Note
The column name is case insensitive
Returns
The column current row value or 0 if no column found with the given name

◆ OCI_GetInt()

OCI_SYM_PUBLIC int OCI_API OCI_GetInt ( OCI_Resultset rs,
unsigned int  index 
)

#include <api.h>

Return the current integer value of the column at the given index in the resultset.

Parameters
rs- Resultset handle
index- Column position
Note
Column position starts at 1.
Returns
The column current row value or 0 if index is out of bounds

◆ OCI_GetInt2()

OCI_SYM_PUBLIC int OCI_API OCI_GetInt2 ( OCI_Resultset rs,
const otext *  name 
)

#include <api.h>

Return the current integer value of the column from its name in the resultset.

Parameters
rs- Resultset handle
name- Column name
Note
The column name is case insensitive
Returns
The column current row value or 0 if no column found with the given name

◆ OCI_GetUnsignedInt()

OCI_SYM_PUBLIC unsigned int OCI_API OCI_GetUnsignedInt ( OCI_Resultset rs,
unsigned int  index 
)

#include <api.h>

Return the current unsigned integer value of the column at the given index in the resultset.

Parameters
rs- Resultset handle
index- Column position
Note
Column position starts at 1.
Returns
The column current row value or 0 if index is out of bounds

◆ OCI_GetUnsignedInt2()

OCI_SYM_PUBLIC unsigned int OCI_API OCI_GetUnsignedInt2 ( OCI_Resultset rs,
const otext *  name 
)

#include <api.h>

Return the current unsigned integer value of the column from its name in the resultset.

Parameters
rs- Resultset handle
name- Column name
Note
The column name is case insensitive
Returns
The column current row value or 0 if no column found with the given name

◆ OCI_GetBigInt()

OCI_SYM_PUBLIC big_int OCI_API OCI_GetBigInt ( OCI_Resultset rs,
unsigned int  index 
)

#include <api.h>

Return the current big integer value of the column at the given index in the resultset.

Parameters
rs- Resultset handle
index- Column position
Note
Column position starts at 1.
Returns
The column current row value or 0 if index is out of bounds

◆ OCI_GetBigInt2()

OCI_SYM_PUBLIC big_int OCI_API OCI_GetBigInt2 ( OCI_Resultset rs,
const otext *  name 
)

#include <api.h>

Return the current big integer value of the column from its name in the resultset.

Parameters
rs- Resultset handle
name- Column name
Note
The column name is case insensitive
Returns
The column current row value or 0 if no column found with the given name

◆ OCI_GetUnsignedBigInt()

OCI_SYM_PUBLIC big_uint OCI_API OCI_GetUnsignedBigInt ( OCI_Resultset rs,
unsigned int  index 
)

#include <api.h>

Return the current unsigned big integer value of the column at the given index in the resultset.

Parameters
rs- Resultset handle
index- Column position
Note
Column position starts at 1.
Returns
The column current row value or 0 if index is out of bounds

◆ OCI_GetUnsignedBigInt2()

OCI_SYM_PUBLIC big_uint OCI_API OCI_GetUnsignedBigInt2 ( OCI_Resultset rs,
const otext *  name 
)

#include <api.h>

Return the current unsigned big integer value of the column from its name in the resultset.

Parameters
rs- Resultset handle
name- Column name
Note
The column name is case insensitive
Returns
The column current row value or 0 if no column found with the given name

◆ OCI_GetString()

OCI_SYM_PUBLIC const otext *OCI_API OCI_GetString ( OCI_Resultset rs,
unsigned int  index 
)

#include <api.h>

Return the current string value of the column at the given index in the resultset.

Parameters
rs- Resultset handle
index- Column position
Note
Column position starts at 1.
OCI_GetString() performs an implicit conversion from the following data types:
  • Numerics (based on the current connection handle numeric format)
  • Binary doubles and floats (using the standard C Library functions)
  • OCI_Number (based on the current connection handle numeric format)
  • OCI_Date (based on the current connection handle date format)
  • OCI_Timestamp (based on the current connection handle date format)
  • OCI_Interval (based on Oracle default conversion)
  • OCI_Lob (for BLOBs, output is expressed in hexadecimal)
  • OCI_Long (for BLONGs, output is expressed in hexadecimal)
  • OCI_File ("[directory]/[name]" will be output)
  • OCI_Object (Textual SQL string representation)
  • OCI_Coll (Textual SQL string representation)
  • RAW buffer (expressed in hexadecimal)
  • OCI_Statement (SQL statement string or cursor name)
Returns
The column current row value or NULL if index is out of bounds

◆ OCI_GetString2()

OCI_SYM_PUBLIC const otext *OCI_API OCI_GetString2 ( OCI_Resultset rs,
const otext *  name 
)

#include <api.h>

Return the current string value of the column from its name in the resultset.

Parameters
rs- Resultset handle
name- Column name
Note
The column name is case insensitive
Returns
The column current row value or NULL if no column found with the given name

◆ OCI_GetRaw()

OCI_SYM_PUBLIC unsigned int OCI_API OCI_GetRaw ( OCI_Resultset rs,
unsigned int  index,
void *  buffer,
unsigned int  len 
)

#include <api.h>

Copy the current raw value of the column at the given index into the specified buffer.

Parameters
rs- Resultset handle
index- Column position
buffer- Buffer that receive the raw value
len- Max size of the input buffer in bytes
Note
Column position starts at 1.
Returns
Number of bytes copied into the buffer on SUCCESS otherwise 0

◆ OCI_GetRaw2()

OCI_SYM_PUBLIC unsigned int OCI_API OCI_GetRaw2 ( OCI_Resultset rs,
const otext *  name,
void *  buffer,
unsigned int  len 
)

#include <api.h>

Copy the current raw value of the column from its name into the specified buffer.

Parameters
rs- Resultset handle
name- Column name
buffer- Buffer that receive the raw value
len- Max size of the input buffer
Note
The column name is case insensitive
Returns
Number of bytes copied into the buffer on SUCCESS otherwise 0

◆ OCI_GetDouble()

OCI_SYM_PUBLIC double OCI_API OCI_GetDouble ( OCI_Resultset rs,
unsigned int  index 
)

#include <api.h>

Return the current double value of the column at the given index in the resultset.

Parameters
rs- Resultset handle
index- Column position
Note
Column position starts at 1.
Returns
The column current row value or 0.O if index is out of bounds

◆ OCI_GetDouble2()

OCI_SYM_PUBLIC double OCI_API OCI_GetDouble2 ( OCI_Resultset rs,
const otext *  name 
)

#include <api.h>

Return the current double value of the column from its name in the resultset.

Parameters
rs- Resultset handle
name- Column name
Note
The column name is case insensitive
Returns
The column current row value or 0.0 if no column found with the given name

◆ OCI_GetFloat()

OCI_SYM_PUBLIC float OCI_API OCI_GetFloat ( OCI_Resultset rs,
unsigned int  index 
)

#include <api.h>

Return the current float value of the column at the given index in the resultset.

Parameters
rs- Resultset handle
index- Column position
Note
Column position starts at 1.
Returns
The column current row value or 0.O if index is out of bounds

◆ OCI_GetFloat2()

OCI_SYM_PUBLIC float OCI_API OCI_GetFloat2 ( OCI_Resultset rs,
const otext *  name 
)

#include <api.h>

Return the current float value of the column from its name in the resultset.

Parameters
rs- Resultset handle
name- Column name
Note
The column name is case insensitive
Returns
The column current row value or 0.0 if no column found with the given name

◆ OCI_GetDate()

OCI_SYM_PUBLIC OCI_Date *OCI_API OCI_GetDate ( OCI_Resultset rs,
unsigned int  index 
)

#include <api.h>

Return the current date value of the column at the given index in the resultset.

Parameters
rs- Resultset handle
index- Column position
Note
Column position starts at 1.
Returns
The column current row value or NULL if index is out of bounds

◆ OCI_GetDate2()

OCI_SYM_PUBLIC OCI_Date *OCI_API OCI_GetDate2 ( OCI_Resultset rs,
const otext *  name 
)

#include <api.h>

Return the current date value of the column from its name in the resultset.

Parameters
rs- Resultset handle
name- Column name
Returns
The column current row value or NULL if no column found with the given name

◆ OCI_GetTimestamp()

OCI_SYM_PUBLIC OCI_Timestamp *OCI_API OCI_GetTimestamp ( OCI_Resultset rs,
unsigned int  index 
)

#include <api.h>

Return the current timestamp value of the column at the given index in the resultset.

Parameters
rs- Resultset handle
index- Column position
Note
Column position starts at 1.
Returns
The column current row value or NULL if index is out of bounds

◆ OCI_GetTimestamp2()

OCI_SYM_PUBLIC OCI_Timestamp *OCI_API OCI_GetTimestamp2 ( OCI_Resultset rs,
const otext *  name 
)

#include <api.h>

Return the current timestamp value of the column from its name in the resultset.

Parameters
rs- Resultset handle
name- Column name
Returns
The column current row value or NULL if no column found with the given name

◆ OCI_GetInterval()

OCI_SYM_PUBLIC OCI_Interval *OCI_API OCI_GetInterval ( OCI_Resultset rs,
unsigned int  index 
)

#include <api.h>

Return the current interval value of the column at the given index in the resultset.

Parameters
rs- Resultset handle
index- Column position
Note
Column position starts at 1.
Returns
The column current row value or NULL if index is out of bounds

◆ OCI_GetInterval2()

OCI_SYM_PUBLIC OCI_Interval *OCI_API OCI_GetInterval2 ( OCI_Resultset rs,
const otext *  name 
)

#include <api.h>

Return the current interval value of the column from its name in the resultset.

Parameters
rs- Resultset handle
name- Column name
Returns
The column current row value or NULL if no column found with the given name

◆ OCI_GetStatement()

OCI_SYM_PUBLIC OCI_Statement *OCI_API OCI_GetStatement ( OCI_Resultset rs,
unsigned int  index 
)

#include <api.h>

Return the current cursor value (Nested table) of the column at the given index in the resultset.

Parameters
rs- Resultset handle
index- Column position
Note
Column position starts at 1.
Returns
The column current row value or NULL if index is out of bounds

◆ OCI_GetStatement2()

OCI_SYM_PUBLIC OCI_Statement *OCI_API OCI_GetStatement2 ( OCI_Resultset rs,
const otext *  name 
)

#include <api.h>

Return the current cursor value of the column from its name in the resultset.

Parameters
rs- Resultset handle
name- Column name
Returns
The column current row value or NULL if no column found with the given name

◆ OCI_GetLob()

OCI_SYM_PUBLIC OCI_Lob *OCI_API OCI_GetLob ( OCI_Resultset rs,
unsigned int  index 
)

#include <api.h>

Return the current lob value of the column at the given index in the resultset.

Parameters
rs- Resultset handle
index- Column position
Note
Column position starts at 1.
Returns
The column current row value or NULL if index is out of bounds

◆ OCI_GetLob2()

OCI_SYM_PUBLIC OCI_Lob *OCI_API OCI_GetLob2 ( OCI_Resultset rs,
const otext *  name 
)

#include <api.h>

Return the current lob value of the column from its name in the resultset.

Parameters
rs- Resultset handle
name- Column name
Returns
The column current row value or NULL if no column found with the given name

◆ OCI_GetFile()

OCI_SYM_PUBLIC OCI_File *OCI_API OCI_GetFile ( OCI_Resultset rs,
unsigned int  index 
)

#include <api.h>

Return the current File value of the column at the given index in the resultset.

Parameters
rs- Resultset handle
index- Column position
Note
Column position starts at 1.
Returns
The column current row value or NULL if index is out of bounds

◆ OCI_GetFile2()

OCI_SYM_PUBLIC OCI_File *OCI_API OCI_GetFile2 ( OCI_Resultset rs,
const otext *  name 
)

#include <api.h>

Return the current File value of the column from its name in the resultset.

Parameters
rs- Resultset handle
name- Column name
Returns
The column current row value or NULL if no column found with the given name

◆ OCI_GetObject()

OCI_SYM_PUBLIC OCI_Object *OCI_API OCI_GetObject ( OCI_Resultset rs,
unsigned int  index 
)

#include <api.h>

Return the current Object value of the column at the given index in the resultset.

Parameters
rs- Resultset handle
index- Column position
Note
Column position starts at 1.
Returns
The column current row value or NULL if index is out of bounds

◆ OCI_GetObject2()

OCI_SYM_PUBLIC OCI_Object *OCI_API OCI_GetObject2 ( OCI_Resultset rs,
const otext *  name 
)

#include <api.h>

Return the current Object value of the column from its name in the resultset.

Parameters
rs- Resultset handle
name- Column name
Returns
The column current row value or NULL if no column found with the given name

◆ OCI_GetColl()

OCI_SYM_PUBLIC OCI_Coll *OCI_API OCI_GetColl ( OCI_Resultset rs,
unsigned int  index 
)

#include <api.h>

Return the current Collection value of the column at the given index in the resultset.

Parameters
rs- Resultset handle
index- Column position
Note
Column position starts at 1.
Returns
The column current row value or NULL if index is out of bounds

Referenced by ocilib::Resultset::Get().

◆ OCI_GetColl2()

OCI_SYM_PUBLIC OCI_Coll *OCI_API OCI_GetColl2 ( OCI_Resultset rs,
const otext *  name 
)

#include <api.h>

Return the current Collection value of the column from its name in the resultset.

Parameters
rs- Resultset handle
name- Column name
Returns
The column current row value or NULL if no column found with the given name

Referenced by ocilib::Resultset::Get().

◆ OCI_GetRef()

OCI_SYM_PUBLIC OCI_Ref *OCI_API OCI_GetRef ( OCI_Resultset rs,
unsigned int  index 
)

#include <api.h>

Return the current Ref value of the column at the given index in the resultset.

Parameters
rs- Resultset handle
index- Column position
Note
Column position starts at 1.
Returns
The column current row value or NULL if index is out of bounds

◆ OCI_GetRef2()

OCI_SYM_PUBLIC OCI_Ref *OCI_API OCI_GetRef2 ( OCI_Resultset rs,
const otext *  name 
)

#include <api.h>

Return the current Ref value of the column from its name in the resultset.

Parameters
rs- Resultset handle
name- Column name
Returns
The column current row value or NULL if no column found with the given name

◆ OCI_GetLong()

OCI_SYM_PUBLIC OCI_Long *OCI_API OCI_GetLong ( OCI_Resultset rs,
unsigned int  index 
)

#include <api.h>

Return the current Long value of the column at the given index in the resultset.

Parameters
rs- Resultset handle
index- Column position
Note
Column position starts at 1.
Returns
The column current row value or NULL if index is out of bounds

◆ OCI_GetLong2()

OCI_SYM_PUBLIC OCI_Long *OCI_API OCI_GetLong2 ( OCI_Resultset rs,
const otext *  name 
)

#include <api.h>

Return the current Long value of the column from its name in the resultset.

Parameters
rs- Resultset handle
name- Column name
Returns
The column current row value or NULL if no column found with the given name

◆ OCI_IsNull()

OCI_SYM_PUBLIC boolean OCI_API OCI_IsNull ( OCI_Resultset rs,
unsigned int  index 
)

#include <api.h>

Check if the current row value is null for the column at the given index in the resultset.

Parameters
rs- Resultset handle
index- Column position
Note
Column position starts at 1.
Returns
TRUE if it's null otherwise FALSE

Referenced by ocilib::Resultset::IsColumnNull().

◆ OCI_GetDataSize()

OCI_SYM_PUBLIC unsigned int OCI_API OCI_GetDataSize ( OCI_Resultset rs,
unsigned int  index 
)

#include <api.h>

Return the size of the value of the column at the given index in the resultset.

Parameters
rs- Resultset handle
index- Column position
Note
Column position starts at 1.
Warning
For binds of type OCI_CDT_TEXT (strings), the returned value is expressed in number of characters.
Returns
value size of 0 if the value is NULL

◆ OCI_GetDataSize2()

OCI_SYM_PUBLIC unsigned int OCI_API OCI_GetDataSize2 ( OCI_Resultset rs,
const otext *  name 
)

#include <api.h>

Return the size of the value of the column from its name in the resultset.

Parameters
rs- Resultset handle
name- Column name
Warning
For binds of type OCI_CDT_TEXT (strings), the returned value is expressed in number of characters.
Returns
value size of 0 if the value is NULL

◆ OCI_IsNull2()

OCI_SYM_PUBLIC boolean OCI_API OCI_IsNull2 ( OCI_Resultset rs,
const otext *  name 
)

#include <api.h>

Check if the current row value is null for the column of the given name in the resultset.

Parameters
rs- Resultset handle
name- Column name
Returns
TRUE if it's null otherwise FALSE

Referenced by ocilib::Resultset::IsColumnNull().

◆ OCI_ResultsetGetStatement()

OCI_SYM_PUBLIC OCI_Statement *OCI_API OCI_ResultsetGetStatement ( OCI_Resultset rs)

#include <api.h>

Return the statement handle associated with a resultset handle.

Parameters
rs- resultset handle

Referenced by ocilib::Resultset::GetStatement().

◆ OCI_GetDataLength()

OCI_SYM_PUBLIC unsigned int OCI_API OCI_GetDataLength ( OCI_Resultset rs,
unsigned int  index 
)

#include <api.h>

Return the current row data length of the column at the given index in the resultset.

Parameters
rs- Resultset handle
index- Column position
Note
Column position starts at 1.
Returns
The column current row data length or 0 if index is out of bounds