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 SELECTs statement, DML with returning clause and some PL/SQL blocks return a cursor that can be fetched by host programs. That cursor, or resultset, is encapsulated in OCILIB by the OCI_Resultset object.
So, 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 roundtrips 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 :
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.
OCILIB support scrollable cursors from version OCILIB 3.0.0.
Resultsets are 'forward only' by default. Call OCI_SetFetchMode() with OCI_SFM_SCROLLABLE to enable scrollable resultsets for a given statement.
The properties (columns names, types ...) of the resultset are accessible through a set of APIs.
OCI_GetString() performs an implicit conversion from the following datatypes:
The following type are not supported for implicit conversion:
OCI_GetString() performs an implicit conversion from the following datatypes:
From version 3.7.0, 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
#include "ocilib.h" int main(void) { OCI_Connection *cn; OCI_Statement *st; OCI_Resultset *rs; if (!OCI_Initialize(NULL, NULL, OCI_ENV_DEFAULT)) return EXIT_FAILURE; cn = OCI_ConnectionCreate("db", "usr", "pwd", OCI_SESSION_DEFAULT); st = OCI_StatementCreate(cn); 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)); OCI_Cleanup(); return EXIT_SUCCESS; }
#include "ocilib.h" typedef struct product_t { int code; char *name; double price; OCI_Date *creation; } product_t; typedef struct product_ind_t { boolean code; boolean name; boolean price; boolean creation; } product_ind_t; int main(void) { OCI_Connection *cn; OCI_Statement *st; OCI_Resultset *rs; product_t prd; product_ind_t ind; char buf[100]; int i = 0; if (!OCI_Initialize(NULL, NULL, OCI_ENV_DEFAULT)) return EXIT_FAILURE; cn = OCI_ConnectionCreate("db", "usr", "pwd", OCI_SESSION_DEFAULT); st = OCI_StatementCreate(cn); OCI_ExecuteStmt(st, "select * from products"); rs = OCI_GetResultset(st); OCI_SetStructNumericType(rs, 1, OCI_NUM_INT); OCI_SetStructNumericType(rs, 3, OCI_NUM_DOUBLE); while (OCI_FetchNext(rs)) { i++; OCI_GetStruct(rs, &prd, &ind); OCI_DateToText(prd.creation, "DD-MM-YYYY", 100, buf); printf("row #%d \n" "...prd.code : %d \n" "...prd.name : %s \n" "...prd.price : %g \n" "...prd.creation : %s \n" " \n", i, prd.code, prd.name, prd.price, buf ); } printf("\n\n%d row(s) fetched\n", OCI_GetRowCount(rs)); OCI_Cleanup(); return EXIT_SUCCESS; }
#include "ocilib.h" int main(void) { OCI_Connection *cn; OCI_Statement *st; OCI_Resultset *rs; int i, n; if (!OCI_Initialize(NULL, NULL, OCI_ENV_DEFAULT)) return EXIT_FAILURE; cn = OCI_ConnectionCreate("db", "usr", "pwd", OCI_SESSION_DEFAULT); st = OCI_StatementCreate(cn); OCI_ExecuteStmt(st, "select * from test_fetch"); rs = OCI_GetResultset(st); n = OCI_GetColumnCount(rs); 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)); } OCI_Cleanup(); return EXIT_SUCCESS; }
#include "ocilib.h" int main(void) { OCI_Connection *cn; OCI_Statement *st; OCI_Resultset *rs; if (!OCI_Initialize(NULL, NULL, OCI_ENV_DEFAULT)) return EXIT_FAILURE; cn = OCI_ConnectionCreate("db", "usr", "pwd", OCI_SESSION_DEFAULT); st = OCI_StatementCreate(cn); OCI_ExecuteStmt(st, "select article, cursor(select sysdate from dual) from test_fetch"); rs = OCI_GetResultset(st); while (OCI_FetchNext(rs)) { OCI_Statement *st2 = OCI_GetStatement(rs, 2); OCI_Resultset *rs2 = OCI_GetResultset(st2); while (OCI_FetchNext(rs2)) { printf("article : %s, sysdate : %s\n", OCI_GetString(rs, 1), OCI_GetString(rs2, 1)); } } return EXIT_SUCCESS; }
#include "ocilib.h" int main(void) { OCI_Connection *cn; OCI_Statement *st; OCI_Resultset *rs; if (!OCI_Initialize(NULL, NULL, OCI_ENV_DEFAULT)) return EXIT_FAILURE; cn = OCI_ConnectionCreate("db", "usr", "pwd", OCI_SESSION_DEFAULT); st = OCI_StatementCreate(cn); OCI_SetFetchMode(st, OCI_SFM_SCROLLABLE); OCI_ExecuteStmt(st, "select int_col1, str_col from my_table"); rs = OCI_GetResultset(st); /* get resultset row count */ OCI_FetchLast(rs); printf("resultset contains %i rows\n", OCI_GetRowCount(rs)); /* go to row 1 */ OCI_FetchFirst(rs); 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_GetCurrentRow(rs), 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)); OCI_Cleanup(); return EXIT_SUCCESS; }
Functions | |
OCI_EXPORT OCI_Resultset *OCI_API | OCI_GetResultset (OCI_Statement *stmt) |
Retrieve the resultset handle from an executed statement. | |
OCI_EXPORT boolean OCI_API | OCI_ReleaseResultsets (OCI_Statement *stmt) |
Free the statement resultsets. | |
OCI_EXPORT boolean OCI_API | OCI_FetchNext (OCI_Resultset *rs) |
Fetch the next row of the resultset. | |
OCI_EXPORT boolean OCI_API | OCI_FetchPrev (OCI_Resultset *rs) |
Fetch the previous row of the resultset. | |
OCI_EXPORT boolean OCI_API | OCI_FetchFirst (OCI_Resultset *rs) |
Fetch the first row of the resultset. | |
OCI_EXPORT boolean OCI_API | OCI_FetchLast (OCI_Resultset *rs) |
Fetch the last row of the resultset. | |
OCI_EXPORT boolean OCI_API | OCI_FetchSeek (OCI_Resultset *rs, unsigned int mode, int offset) |
Custom Fetch of the resultset. | |
OCI_EXPORT unsigned int OCI_API | OCI_GetRowCount (OCI_Resultset *rs) |
Retrieve the number of rows fetched so far. | |
OCI_EXPORT unsigned int OCI_API | OCI_GetCurrentRow (OCI_Resultset *rs) |
Retrieve the current row number. | |
OCI_EXPORT unsigned int OCI_API | OCI_GetColumnCount (OCI_Resultset *rs) |
Return the number of columns in the resultset. | |
OCI_EXPORT 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_EXPORT OCI_Column *OCI_API | OCI_GetColumn2 (OCI_Resultset *rs, const mtext *name) |
Return the column object handle from its name in the resultset. | |
OCI_EXPORT unsigned int OCI_API | OCI_GetColumnIndex (OCI_Resultset *rs, const mtext *name) |
Return the index of the column in the result from its name. | |
OCI_EXPORT const mtext *OCI_API | OCI_ColumnGetName (OCI_Column *col) |
Return the name of the given column. | |
OCI_EXPORT unsigned int OCI_API | OCI_ColumnGetType (OCI_Column *col) |
Return the type of the given column. | |
OCI_EXPORT unsigned int OCI_API | OCI_ColumnGetCharsetForm (OCI_Column *col) |
Return the charset form of the given column. | |
OCI_EXPORT const mtext *OCI_API | OCI_ColumnGetSQLType (OCI_Column *col) |
Return the Oracle SQL type name of the column datatype. | |
OCI_EXPORT unsigned int OCI_API | OCI_ColumnGetFullSQLType (OCI_Column *col, mtext *buffer, unsigned int len) |
Return the Oracle SQL Full name including precision and size of the column datatype. | |
OCI_EXPORT unsigned int OCI_API | OCI_ColumnGetSize (OCI_Column *col) |
Return the size of the column. | |
OCI_EXPORT int OCI_API | OCI_ColumnGetScale (OCI_Column *col) |
Return the scale of the column for numeric columns. | |
OCI_EXPORT int OCI_API | OCI_ColumnGetPrecision (OCI_Column *col) |
Return the precision of the column for numeric columns. | |
OCI_EXPORT int OCI_API | OCI_ColumnGetFractionalPrecision (OCI_Column *col) |
Return the fractional precision of the column for timestamp and interval columns. | |
OCI_EXPORT int OCI_API | OCI_ColumnGetLeadingPrecision (OCI_Column *col) |
Return the leading precision of the column for interval columns. | |
OCI_EXPORT boolean OCI_API | OCI_ColumnGetNullable (OCI_Column *col) |
Return the nullable attribute of the column. | |
OCI_EXPORT 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_EXPORT OCI_TypeInfo *OCI_API | OCI_ColumnGetTypeInfo (OCI_Column *col) |
Return the type information object associated to the column. | |
OCI_EXPORT unsigned int OCI_API | OCI_ColumnGetSubType (OCI_Column *col) |
Return the OCILIB object subtype of a column. | |
OCI_EXPORT boolean OCI_API | OCI_SetStructNumericType (OCI_Resultset *rs, unsigned int index, unsigned int type) |
set the numeric datatype of the given structure member (identified from position in the resultset) to retrieve when calling OCI_GetStruct() | |
OCI_EXPORT boolean OCI_API | OCI_SetStructNumericType2 (OCI_Resultset *rs, const mtext *name, unsigned int type) |
set the numeric datatype of the given structure member (identified from column name in the resultset) to retrieve when calling OCI_GetStruct() | |
OCI_EXPORT 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_EXPORT 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_EXPORT short OCI_API | OCI_GetShort2 (OCI_Resultset *rs, const mtext *name) |
Return the current short value of the column from its name in the resultset. | |
OCI_EXPORT 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_EXPORT unsigned short OCI_API | OCI_GetUnsignedShort2 (OCI_Resultset *rs, const mtext *name) |
Return the current unsigned short value of the column from its name in the resultset. | |
OCI_EXPORT 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_EXPORT int OCI_API | OCI_GetInt2 (OCI_Resultset *rs, const mtext *name) |
Return the current integer value of the column from its name in the resultset. | |
OCI_EXPORT 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_EXPORT unsigned int OCI_API | OCI_GetUnsignedInt2 (OCI_Resultset *rs, const mtext *name) |
Return the current unsigned integer value of the column from its name in the resultset. | |
OCI_EXPORT 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_EXPORT big_int OCI_API | OCI_GetBigInt2 (OCI_Resultset *rs, const mtext *name) |
Return the current big integer value of the column from its name in the resultset. | |
OCI_EXPORT 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_EXPORT big_uint OCI_API | OCI_GetUnsignedBigInt2 (OCI_Resultset *rs, const mtext *name) |
Return the current unsigned big integer value of the column from its name in the resultset. | |
OCI_EXPORT const dtext *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_EXPORT const dtext *OCI_API | OCI_GetString2 (OCI_Resultset *rs, const mtext *name) |
Return the current string value of the column from its name in the resultset. | |
OCI_EXPORT 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_EXPORT unsigned int OCI_API | OCI_GetRaw2 (OCI_Resultset *rs, const mtext *name, void *buffer, unsigned int len) |
Copy the current raw value of the column from its name into the specified buffer. | |
OCI_EXPORT 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_EXPORT double OCI_API | OCI_GetDouble2 (OCI_Resultset *rs, const mtext *name) |
Return the current double value of the column from its name in the resultset. | |
OCI_EXPORT 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_EXPORT OCI_Date *OCI_API | OCI_GetDate2 (OCI_Resultset *rs, const mtext *name) |
Return the current date value of the column from its name in the resultset. | |
OCI_EXPORT 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_EXPORT OCI_Timestamp *OCI_API | OCI_GetTimestamp2 (OCI_Resultset *rs, const mtext *name) |
Return the current timestamp value of the column from its name in the resultset. | |
OCI_EXPORT 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_EXPORT OCI_Interval *OCI_API | OCI_GetInterval2 (OCI_Resultset *rs, const mtext *name) |
Return the current interval value of the column from its name in the resultset. | |
OCI_EXPORT 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_EXPORT OCI_Statement *OCI_API | OCI_GetStatement2 (OCI_Resultset *rs, const mtext *name) |
Return the current cursor value of the column from its name in the resultset. | |
OCI_EXPORT 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_EXPORT OCI_Lob *OCI_API | OCI_GetLob2 (OCI_Resultset *rs, const mtext *name) |
Return the current lob value of the column from its name in the resultset. | |
OCI_EXPORT 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_EXPORT OCI_File *OCI_API | OCI_GetFile2 (OCI_Resultset *rs, const mtext *name) |
Return the current File value of the column from its name in the resultset. | |
OCI_EXPORT 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_EXPORT OCI_Object *OCI_API | OCI_GetObject2 (OCI_Resultset *rs, const mtext *name) |
Return the current Object value of the column from its name in the resultset. | |
OCI_EXPORT 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_EXPORT OCI_Coll *OCI_API | OCI_GetColl2 (OCI_Resultset *rs, const mtext *name) |
Return the current Collection value of the column from its name in the resultset. | |
OCI_EXPORT 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_EXPORT OCI_Ref *OCI_API | OCI_GetRef2 (OCI_Resultset *rs, const mtext *name) |
Return the current Ref value of the column from its name in the resultset. | |
OCI_EXPORT 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_EXPORT OCI_Long *OCI_API | OCI_GetLong2 (OCI_Resultset *rs, const mtext *name) |
Return the current Long value of the column from its name in the resultset. | |
OCI_EXPORT 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_EXPORT boolean OCI_API | OCI_IsNull2 (OCI_Resultset *rs, const mtext *name) |
Check if the current row value is null for the column of the given name in the resultset. | |
OCI_EXPORT OCI_Statement *OCI_API | OCI_ResultsetGetStatement (OCI_Resultset *rs) |
Return the statement handle associated with a resultset handle. | |
OCI_EXPORT 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. |
OCI_EXPORT OCI_Resultset* OCI_API OCI_GetResultset | ( | OCI_Statement * | stmt | ) |
Retrieve the resultset handle from an executed statement.
stmt | - Statement handle |
Definition at line 754 of file resultset.c.
Referenced by OCI_SubscriptionAddStatement().
OCI_EXPORT boolean OCI_API OCI_ReleaseResultsets | ( | OCI_Statement * | stmt | ) |
Free the statement resultsets.
stmt | - Statement handle |
Definition at line 1787 of file statement.c.
OCI_EXPORT boolean OCI_API OCI_FetchNext | ( | OCI_Resultset * | rs | ) |
Fetch the next row of the resultset.
rs | - Resultset handle |
Definition at line 1075 of file resultset.c.
OCI_EXPORT boolean OCI_API OCI_FetchPrev | ( | OCI_Resultset * | rs | ) |
Fetch the previous row of the resultset.
rs | - Resultset handle |
Definition at line 1001 of file resultset.c.
OCI_EXPORT boolean OCI_API OCI_FetchFirst | ( | OCI_Resultset * | rs | ) |
Fetch the first row of the resultset.
rs | - Resultset handle |
Definition at line 1155 of file resultset.c.
OCI_EXPORT boolean OCI_API OCI_FetchLast | ( | OCI_Resultset * | rs | ) |
Fetch the last row of the resultset.
rs | - Resultset handle |
Definition at line 1195 of file resultset.c.
OCI_EXPORT boolean OCI_API OCI_FetchSeek | ( | OCI_Resultset * | rs, | |
unsigned int | mode, | |||
int | offset | |||
) |
Custom Fetch of the resultset.
rs | - Resultset handle | |
mode | - Fetch direction | |
offset | - Fetch offset |
Definition at line 1237 of file resultset.c.
OCI_EXPORT unsigned int OCI_API OCI_GetRowCount | ( | OCI_Resultset * | rs | ) |
Retrieve the number of rows fetched so far.
rs | - Resultset handle |
Definition at line 1276 of file resultset.c.
OCI_EXPORT unsigned int OCI_API OCI_GetCurrentRow | ( | OCI_Resultset * | rs | ) |
Retrieve the current row number.
rs | - Resultset handle |
Definition at line 1292 of file resultset.c.
OCI_EXPORT unsigned int OCI_API OCI_GetColumnCount | ( | OCI_Resultset * | rs | ) |
Return the number of columns in the resultset.
rs | - Resultset handle |
Definition at line 1308 of file resultset.c.
OCI_EXPORT OCI_Column* OCI_API OCI_GetColumn | ( | OCI_Resultset * | rs, | |
unsigned int | index | |||
) |
Return the column object handle at the given index in the resultset.
rs | - Resultset handle | |
index | - Column position |
Definition at line 1324 of file resultset.c.
OCI_EXPORT OCI_Column* OCI_API OCI_GetColumn2 | ( | OCI_Resultset * | rs, | |
const mtext * | name | |||
) |
Return the column object handle from its name in the resultset.
rs | - Resultset handle | |
name | - Column name |
Definition at line 1348 of file resultset.c.
OCI_EXPORT unsigned int OCI_API OCI_GetColumnIndex | ( | OCI_Resultset * | rs, | |
const mtext * | name | |||
) |
Return the index of the column in the result from its name.
rs | - Resultset handle | |
name | - Column name |
Definition at line 1371 of file resultset.c.
OCI_EXPORT const mtext* OCI_API OCI_ColumnGetName | ( | OCI_Column * | col | ) |
OCI_EXPORT unsigned int OCI_API OCI_ColumnGetType | ( | OCI_Column * | col | ) |
Return the type of the given column.
col | - Column handle |
OCI_EXPORT unsigned int OCI_API OCI_ColumnGetCharsetForm | ( | OCI_Column * | col | ) |
Return the charset form of the given column.
col | - Column handle |
OCI_EXPORT const mtext* OCI_API OCI_ColumnGetSQLType | ( | OCI_Column * | col | ) |
OCI_EXPORT unsigned int OCI_API OCI_ColumnGetFullSQLType | ( | OCI_Column * | col, | |
mtext * | buffer, | |||
unsigned int | len | |||
) |
Return the Oracle SQL Full name including precision and size of the column datatype.
col | - Column handle | |
buffer | - buffer to store the full column type name and size | |
len | - max size of the buffer in characters |
OCI_EXPORT unsigned int OCI_API OCI_ColumnGetSize | ( | OCI_Column * | col | ) |
OCI_EXPORT int OCI_API OCI_ColumnGetScale | ( | OCI_Column * | col | ) |
OCI_EXPORT int OCI_API OCI_ColumnGetPrecision | ( | OCI_Column * | col | ) |
OCI_EXPORT int OCI_API OCI_ColumnGetFractionalPrecision | ( | OCI_Column * | col | ) |
OCI_EXPORT int OCI_API OCI_ColumnGetLeadingPrecision | ( | OCI_Column * | col | ) |
OCI_EXPORT boolean OCI_API OCI_ColumnGetNullable | ( | OCI_Column * | col | ) |
OCI_EXPORT boolean OCI_API OCI_ColumnGetCharUsed | ( | OCI_Column * | col | ) |
OCI_EXPORT OCI_TypeInfo* OCI_API OCI_ColumnGetTypeInfo | ( | OCI_Column * | col | ) |
OCI_EXPORT unsigned int OCI_API OCI_ColumnGetSubType | ( | OCI_Column * | col | ) |
Return the OCILIB object subtype of a column.
col | - Column handle |
This call is valid for the following OCILIB types:
For OCI_Long type the possible values are:
For OCI_Lob type the possible values are:
For OCI_File type the possible values are:
For OCI_Timestamp type the possible values are:
For OCI_Interval type the possible values are:
OCI_EXPORT boolean OCI_API OCI_SetStructNumericType | ( | OCI_Resultset * | rs, | |
unsigned int | index, | |||
unsigned int | type | |||
) |
set the numeric datatype of the given structure member (identified from position in the resultset) to retrieve when calling OCI_GetStruct()
rs | - Resultset handle | |
index | - Column position | |
type | - Numeric type |
Definition at line 1391 of file resultset.c.
Referenced by OCI_SetStructNumericType2().
OCI_EXPORT boolean OCI_API OCI_SetStructNumericType2 | ( | OCI_Resultset * | rs, | |
const mtext * | name, | |||
unsigned int | type | |||
) |
set the numeric datatype of the given structure member (identified from column name in the resultset) to retrieve when calling OCI_GetStruct()
rs | - Resultset handle | |
name | - Column name | |
type | - Numeric type |
Definition at line 1415 of file resultset.c.
References OCI_SetStructNumericType().
OCI_EXPORT boolean OCI_API OCI_GetStruct | ( | OCI_Resultset * | rs, | |
void * | row_struct, | |||
void * | row_struct_ind | |||
) |
Return the row columns values into a single structure.
rs | - Resultset handle | |
row_struct | - pointer to user row structure | |
row_struct_ind | - pointer to user indicator structure |
The user structure must have the same members than the resultset. Each column in the resulset must have its equivalent in the structure. Fields must be in the same order.
The mapping rules are :
The user structure pointer is not mandatory
This structure must have one boolean field per column in the resulset 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
Definition at line 1429 of file resultset.c.
References OCI_GetColl(), OCI_GetDate(), OCI_GetFile(), OCI_GetInterval(), OCI_GetLob(), OCI_GetLong(), OCI_GetObject(), OCI_GetRef(), OCI_GetStatement(), OCI_GetString(), and OCI_GetTimestamp().
OCI_EXPORT 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.
rs | - Resultset handle | |
index | - Column position |
Definition at line 1582 of file resultset.c.
Referenced by OCI_GetShort2().
OCI_EXPORT short OCI_API OCI_GetShort2 | ( | OCI_Resultset * | rs, | |
const mtext * | name | |||
) |
Return the current short value of the column from its name in the resultset.
rs | - Resultset handle | |
name | - Column name |
Definition at line 1599 of file resultset.c.
References OCI_GetShort().
OCI_EXPORT 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.
rs | - Resultset handle | |
index | - Column position |
Definition at line 1612 of file resultset.c.
Referenced by OCI_GetUnsignedShort2().
OCI_EXPORT unsigned short OCI_API OCI_GetUnsignedShort2 | ( | OCI_Resultset * | rs, | |
const mtext * | name | |||
) |
Return the current unsigned short value of the column from its name in the resultset.
rs | - Resultset handle | |
name | - Column name |
Definition at line 1629 of file resultset.c.
References OCI_GetUnsignedShort().
OCI_EXPORT 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.
rs | - Resultset handle | |
index | - Column position |
Definition at line 1642 of file resultset.c.
Referenced by OCI_GetInt2().
OCI_EXPORT int OCI_API OCI_GetInt2 | ( | OCI_Resultset * | rs, | |
const mtext * | name | |||
) |
Return the current integer value of the column from its name in the resultset.
rs | - Resultset handle | |
name | - Column name |
Definition at line 1659 of file resultset.c.
References OCI_GetInt().
OCI_EXPORT 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.
rs | - Resultset handle | |
index | - Column position |
Definition at line 1672 of file resultset.c.
Referenced by OCI_GetUnsignedInt2().
OCI_EXPORT unsigned int OCI_API OCI_GetUnsignedInt2 | ( | OCI_Resultset * | rs, | |
const mtext * | name | |||
) |
Return the current unsigned integer value of the column from its name in the resultset.
rs | - Resultset handle | |
name | - Column name |
Definition at line 1689 of file resultset.c.
References OCI_GetUnsignedInt().
OCI_EXPORT 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.
rs | - Resultset handle | |
index | - Column position |
Definition at line 1702 of file resultset.c.
Referenced by OCI_GetBigInt2().
OCI_EXPORT big_int OCI_API OCI_GetBigInt2 | ( | OCI_Resultset * | rs, | |
const mtext * | name | |||
) |
Return the current big integer value of the column from its name in the resultset.
rs | - Resultset handle | |
name | - Column name |
Definition at line 1719 of file resultset.c.
References OCI_GetBigInt().
OCI_EXPORT 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.
rs | - Resultset handle | |
index | - Column position |
Definition at line 1732 of file resultset.c.
Referenced by OCI_GetUnsignedBigInt2().
OCI_EXPORT big_uint OCI_API OCI_GetUnsignedBigInt2 | ( | OCI_Resultset * | rs, | |
const mtext * | name | |||
) |
Return the current unsigned big integer value of the column from its name in the resultset.
rs | - Resultset handle | |
name | - Column name |
Definition at line 1749 of file resultset.c.
References OCI_GetUnsignedBigInt().
OCI_EXPORT const dtext* 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.
rs | - Resultset handle | |
index | - Column position |
Definition at line 1762 of file resultset.c.
References OCI_DateToText(), OCI_FileGetSize(), OCI_FileRead(), OCI_FileSeek(), OCI_GetDate(), OCI_GetDefaultFormatDate(), OCI_GetDefaultFormatNumeric(), OCI_GetFile(), OCI_GetInterval(), OCI_GetLob(), OCI_GetLong(), OCI_GetRef(), OCI_GetTimestamp(), OCI_IntervalToText(), OCI_LobGetLength(), OCI_LobRead(), OCI_LobSeek(), OCI_LongGetBuffer(), OCI_RefToText(), and OCI_TimestampToText().
Referenced by OCI_GetString2(), and OCI_GetStruct().
OCI_EXPORT const dtext* OCI_API OCI_GetString2 | ( | OCI_Resultset * | rs, | |
const mtext * | name | |||
) |
Return the current string value of the column from its name in the resultset.
rs | - Resultset handle | |
name | - Column name |
Definition at line 2089 of file resultset.c.
References OCI_GetString().
OCI_EXPORT 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.
rs | - Resultset handle | |
index | - Column position | |
buffer | - Buffer that receive the raw value | |
len | - Max size of the input buffer in bytes |
Definition at line 2102 of file resultset.c.
Referenced by OCI_GetRaw2().
OCI_EXPORT unsigned int OCI_API OCI_GetRaw2 | ( | OCI_Resultset * | rs, | |
const mtext * | name, | |||
void * | buffer, | |||
unsigned int | len | |||
) |
Copy the current raw value of the column from its name into the specified buffer.
rs | - Resultset handle | |
name | - Column name | |
buffer | - Buffer that receive the raw value | |
len | - Max size of the input buffer |
Definition at line 2144 of file resultset.c.
References OCI_GetRaw().
OCI_EXPORT 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.
rs | - Resultset handle | |
index | - Column position |
Definition at line 2159 of file resultset.c.
Referenced by OCI_GetDouble2().
OCI_EXPORT double OCI_API OCI_GetDouble2 | ( | OCI_Resultset * | rs, | |
const mtext * | name | |||
) |
Return the current double value of the column from its name in the resultset.
rs | - Resultset handle | |
name | - Column name |
Definition at line 2176 of file resultset.c.
References OCI_GetDouble().
OCI_EXPORT 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.
rs | - Resultset handle | |
index | - Column position |
Definition at line 2189 of file resultset.c.
Referenced by OCI_GetDate2(), OCI_GetString(), and OCI_GetStruct().
OCI_EXPORT OCI_Date* OCI_API OCI_GetDate2 | ( | OCI_Resultset * | rs, | |
const mtext * | name | |||
) |
Return the current date value of the column from its name in the resultset.
rs | - Resultset handle | |
name | - Column name |
Definition at line 2215 of file resultset.c.
References OCI_GetDate().
OCI_EXPORT 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.
rs | - Resultset handle | |
index | - Column position |
Definition at line 2228 of file resultset.c.
Referenced by OCI_GetString(), OCI_GetStruct(), and OCI_GetTimestamp2().
OCI_EXPORT OCI_Timestamp* OCI_API OCI_GetTimestamp2 | ( | OCI_Resultset * | rs, | |
const mtext * | name | |||
) |
Return the current timestamp value of the column from its name in the resultset.
rs | - Resultset handle | |
name | - Column name |
Definition at line 2254 of file resultset.c.
References OCI_GetTimestamp().
OCI_EXPORT 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.
rs | - Resultset handle | |
index | - Column position |
Definition at line 2267 of file resultset.c.
Referenced by OCI_GetInterval2(), OCI_GetString(), and OCI_GetStruct().
OCI_EXPORT OCI_Interval* OCI_API OCI_GetInterval2 | ( | OCI_Resultset * | rs, | |
const mtext * | name | |||
) |
Return the current interval value of the column from its name in the resultset.
rs | - Resultset handle | |
name | - Column name |
Definition at line 2293 of file resultset.c.
References OCI_GetInterval().
OCI_EXPORT 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.
rs | - Resultset handle | |
index | - Column position |
Definition at line 2429 of file resultset.c.
Referenced by OCI_GetStatement2(), and OCI_GetStruct().
OCI_EXPORT OCI_Statement* OCI_API OCI_GetStatement2 | ( | OCI_Resultset * | rs, | |
const mtext * | name | |||
) |
Return the current cursor value of the column from its name in the resultset.
rs | - Resultset handle | |
name | - Column name |
Definition at line 2454 of file resultset.c.
References OCI_GetStatement().
OCI_EXPORT 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.
rs | - Resultset handle | |
index | - Column position |
Definition at line 2467 of file resultset.c.
Referenced by OCI_GetLob2(), OCI_GetString(), and OCI_GetStruct().
OCI_EXPORT OCI_Lob* OCI_API OCI_GetLob2 | ( | OCI_Resultset * | rs, | |
const mtext * | name | |||
) |
Return the current lob value of the column from its name in the resultset.
rs | - Resultset handle | |
name | - Column name |
Definition at line 2492 of file resultset.c.
References OCI_GetLob().
OCI_EXPORT 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.
rs | - Resultset handle | |
index | - Column position |
Definition at line 2505 of file resultset.c.
Referenced by OCI_GetFile2(), OCI_GetString(), and OCI_GetStruct().
OCI_EXPORT OCI_File* OCI_API OCI_GetFile2 | ( | OCI_Resultset * | rs, | |
const mtext * | name | |||
) |
Return the current File value of the column from its name in the resultset.
rs | - Resultset handle | |
name | - Column name |
Definition at line 2530 of file resultset.c.
References OCI_GetFile().
OCI_EXPORT 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.
rs | - Resultset handle | |
index | - Column position |
Definition at line 2306 of file resultset.c.
Referenced by OCI_GetObject2(), and OCI_GetStruct().
OCI_EXPORT OCI_Object* OCI_API OCI_GetObject2 | ( | OCI_Resultset * | rs, | |
const mtext * | name | |||
) |
Return the current Object value of the column from its name in the resultset.
rs | - Resultset handle | |
name | - Column name |
Definition at line 2332 of file resultset.c.
References OCI_GetObject().
OCI_EXPORT 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.
rs | - Resultset handle | |
index | - Column position |
Definition at line 2345 of file resultset.c.
Referenced by OCI_GetColl2(), and OCI_GetStruct().
OCI_EXPORT OCI_Coll* OCI_API OCI_GetColl2 | ( | OCI_Resultset * | rs, | |
const mtext * | name | |||
) |
Return the current Collection value of the column from its name in the resultset.
rs | - Resultset handle | |
name | - Column name |
Definition at line 2369 of file resultset.c.
References OCI_GetColl().
OCI_EXPORT 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.
rs | - Resultset handle | |
index | - Column position |
Definition at line 2382 of file resultset.c.
Referenced by OCI_GetRef2(), OCI_GetString(), and OCI_GetStruct().
OCI_EXPORT OCI_Ref* OCI_API OCI_GetRef2 | ( | OCI_Resultset * | rs, | |
const mtext * | name | |||
) |
Return the current Ref value of the column from its name in the resultset.
rs | - Resultset handle | |
name | - Column name |
Definition at line 2416 of file resultset.c.
References OCI_GetRef().
OCI_EXPORT 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.
rs | - Resultset handle | |
index | - Column position |
Definition at line 2543 of file resultset.c.
Referenced by OCI_GetLong2(), OCI_GetString(), and OCI_GetStruct().
OCI_EXPORT OCI_Long* OCI_API OCI_GetLong2 | ( | OCI_Resultset * | rs, | |
const mtext * | name | |||
) |
Return the current Long value of the column from its name in the resultset.
rs | - Resultset handle | |
name | - Column name |
Definition at line 2566 of file resultset.c.
References OCI_GetLong().
OCI_EXPORT 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.
rs | - Resultset handle | |
index | - Column position |
Definition at line 2579 of file resultset.c.
Referenced by OCI_IsNull2().
OCI_EXPORT boolean OCI_API OCI_IsNull2 | ( | OCI_Resultset * | rs, | |
const mtext * | name | |||
) |
Check if the current row value is null for the column of the given name in the resultset.
rs | - Resultset handle | |
name | - Column name |
Definition at line 2596 of file resultset.c.
References OCI_IsNull().
OCI_EXPORT OCI_Statement* OCI_API OCI_ResultsetGetStatement | ( | OCI_Resultset * | rs | ) |
Return the statement handle associated with a resultset handle.
rs | - resultset handle |
Definition at line 2609 of file resultset.c.
OCI_EXPORT 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.
rs | - Resultset handle | |
index | - Column position |
Definition at line 2625 of file resultset.c.