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
OCILIB main demo application code

OcilibCApiRawHandles

Portable Main demo application header

/*
* OCILIB - C Driver for Oracle (C Wrapper for Oracle OCI)
*
* Website: http://www.ocilib.net
*
* Copyright (c) 2007-2023 Vincent ROGIER <vince.rogier@ocilib.net>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* --------------------------------------------------------------------------------------------- *
*
* THIS DEMO RUNS ON ALL PLATFOMS AND OCILIB BUILDS.
*
* SO, WE NEED A LITTLE EFFORT TO KEEP THE SAME SOURCE CODE FOR :
*
* - MS WINDOWS AND UNIXES
* - ANSI / WIDE BUILDS
*
* SOME DEFINES FOLLOW IN ORDER TO HANDLE ALL THOSE STUFF
*
* --------------------------------------------------------------------------------------------- */
/* --------------------------------------------------------------------------------------------- *
* COMMON DEFINES
* --------------------------------------------------------------------------------------------- */
#define ARG_DB 1
#define ARG_USER 2
#define ARG_PWD 3
#define ARG_HOME 4
#define ARG_COUNT 5
#define SIZE_STR 260
#define SIZE_BUF 2048
#define SIZE_TAB 5
#define SIZE_ARRAY 100
#define NB_LOAD 10
#define SIZE_COL1 20
#define SIZE_COL2 30
#define SIZE_COL3 8
#define NUM_COLS 3
#define ARRAY_COUNT(t) (sizeof(t)/sizeof(t[0]))
typedef struct test_t
{
void (*proc)(void); /* test procedure */
int execute; /* do execute the procedure ? */
}test_t;
/* --------------------------------------------------------------------------------------------- *
* INCLUDES
* --------------------------------------------------------------------------------------------- */
#include "ocilib.h"
#include <stdio.h>
#include <wchar.h>
/* --------------------------------------------------------------------------------------------- *
* PLATFORMS
* --------------------------------------------------------------------------------------------- */
#ifdef _MSC_VER
#if defined(OCI_CHARSET_WIDE)
#pragma comment(lib, "ocilibw.lib")
#elif defined(OCI_CHARSET_ANSI)
#pragma comment(lib, "ociliba.lib")
#endif
#endif
#ifndef OCI_SHARED_LIB
#if defined(_WINDOWS)
#define OCI_SHARED_LIB "oci.dll"
#elif defined(__APPLE__)
#define OCI_SHARED_LIB "libclntsh.dylib"
#elif defined(__hppa)
#define OCI_SHARED_LIB "libclntsh.sl"
#else
#define OCI_SHARED_LIB "libclntsh.so"
#endif
#endif
/* --------------------------------------------------------------------------------------------- *
* STRING PRINTING
* --------------------------------------------------------------------------------------------- */
#define print_frmt(f, x) printf(f, x)
#define print_text(x) printf(x)
#if defined(OCI_CHARSET_WIDE)
#ifdef _WINDOWS
#define print_ostr(x) wprintf(OTEXT("%s"), x)
#else
#define print_ostr(x) printf("%ls", x)
#endif
#else
#define print_ostr(x) printf(OTEXT("%s"), x)
#endif
/* --------------------------------------------------------------------------------------------- *
* PROGRAM ARGUMENTS
* --------------------------------------------------------------------------------------------- */
#if defined(OCI_CHARSET_WIDE)
#if defined(_MSC_VER)
#define omain wmain
#define oarg otext
#define GET_ARG(s, i) wcsncat(s, argv[i], sizeof(s))
#else
#define omain main
#define oarg char
#define GET_ARG(s, i) mbstowcs(s, argv[i], sizeof(s))
#endif
#define ostrlen wcslen
#define osprintf swprintf
#else
#define omain main
#define oarg char
#define print_args(x) printf(x)
#define GET_ARG(s, i) strncat(s, argv[i], sizeof(s)-1)
#define ostrlen strlen
#define osprintf snprintf
#endif

Portable Main demo application source

/*
* OCILIB - C Driver for Oracle (C Wrapper for Oracle OCI)
*
* Website: http://www.ocilib.net
*
* Copyright (c) 2007-2023 Vincent ROGIER <vince.rogier@ocilib.net>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "ocilib_demo.h"
/* --------------------------------------------------------------------------------------------- *
* prototypes
* --------------------------------------------------------------------------------------------- */
void err_handler(OCI_Error *err);
void print_version(void);
void cleanup(void);
void disconnect(void);
void create_tables(void);
void drop_tables(void);
void test_format(void);
void test_immediate(void);
void test_immediate_format(void);
void test_fetch(void);
void test_bind1(void);
void test_bind2(void);
void test_piecewise_insert(void);
void test_piecewise_fetch(void);
void test_lob(void);
void test_nested_table(void);
void test_ref_cursor(void);
void test_plsql(void);
void test_dates(void);
void test_timestamp(void);
void test_describe(void);
void test_returning(void);
void test_returning_array(void);
void test_object_insert(void);
void test_object_fetch(void);
void test_object_fetch_string(void);
void test_scrollable_cursor(void);
void test_collection(void);
void test_ref(void);
void test_directpath(void);
void test_bigint(void);
void test_number(void);
/* ocilib test functions array */
test_t tab_test[] =
{
{test_format, TRUE},
{test_immediate, TRUE},
{test_immediate_format, TRUE},
{test_fetch, TRUE},
{test_bind1, TRUE},
{test_bind2, TRUE},
{test_piecewise_insert, TRUE},
{test_piecewise_fetch, TRUE},
{test_lob, TRUE},
{test_nested_table, TRUE},
{test_ref_cursor, TRUE},
{test_plsql, TRUE},
{test_dates, TRUE},
{test_timestamp, TRUE},
{test_describe, TRUE},
{test_returning, TRUE},
{test_returning_array, TRUE},
{test_object_insert, TRUE},
{test_object_fetch, TRUE},
{test_object_fetch_string, TRUE},
{test_scrollable_cursor, TRUE},
{test_collection, TRUE},
{test_ref, TRUE},
{test_directpath, TRUE},
{test_bigint, TRUE},
{test_number, TRUE}
};
/* --------------------------------------------------------------------------------------------- *
* variables
* --------------------------------------------------------------------------------------------- */
static OCI_Connection *cn = NULL;
static OCI_Statement *st = NULL;
static OCI_Resultset *rs = NULL;
static otext str[SIZE_STR+1];
static otext temp[SIZE_STR+1];
static int nb_err = 0;
static int nb_warn = 0;
/* --------------------------------------------------------------------------------------------- *
* err_handler
* --------------------------------------------------------------------------------------------- */
void err_handler(OCI_Error *err)
{
int err_type = OCI_ErrorGetType(err);
print_text("\n");
if (err_type == OCI_ERR_WARNING)
{
print_text("> WARNING : ");
nb_warn++;
}
else
{
print_text("> ERROR : ");
nb_err++;
}
print_ostr(OCI_ErrorGetString(err));
print_text("\n");
}
/* --------------------------------------------------------------------------------------------- *
* main
* --------------------------------------------------------------------------------------------- */
int omain(int argc, oarg* argv[])
{
otext home[SIZE_STR+1] = OTEXT("");
otext dbs [SIZE_STR+1] = OTEXT("");
otext usr [SIZE_STR+1] = OTEXT("");
otext pwd [SIZE_STR+1] = OTEXT("");
size_t i;
/* CHECK COMMAND LINE --------------------------------------------------- */
if (argc < (ARG_COUNT-1))
{
return EXIT_FAILURE;
}
/* GET ARGUMENTS ---------------------------------------------------------*/
GET_ARG(dbs, ARG_DB);
GET_ARG(usr, ARG_USER);
GET_ARG(pwd, ARG_PWD);
if(argc == ARG_COUNT)
GET_ARG(home, ARG_HOME);
/* INITIALIZE OCI ------------------------------------------------------- */
if (!OCI_Initialize(err_handler, home, OCI_ENV_DEFAULT | OCI_ENV_THREADED))
return EXIT_FAILURE;
/* CONNECTION TO SERVER ------------------------------------------------- */
print_text("Connecting to ");
print_ostr(usr);
print_text("/");
print_ostr(pwd);
print_text("@");
print_ostr(dbs);
print_text("\n\n");
cn = OCI_ConnectionCreate(dbs, usr, pwd, OCI_SESSION_DEFAULT);
if (cn)
{
print_version();
create_tables();
/* execute tests */
for (i = 0; i < ARRAY_COUNT(tab_test); i++)
{
if (tab_test[i].execute)
tab_test[i].proc();
}
drop_tables();
disconnect();
}
else
{
}
cleanup();
print_text("\npress any key to exit...");
return getchar() != 0;
}
/* --------------------------------------------------------------------------------------------- *
* cleanup
* --------------------------------------------------------------------------------------------- */
void cleanup(void)
{
print_frmt("\n%i errors \n", nb_err);
print_frmt("\n%i warnings \n\n", nb_warn);
}
/* --------------------------------------------------------------------------------------------- *
* disconnect
* --------------------------------------------------------------------------------------------- */
void disconnect(void)
{
}
/* --------------------------------------------------------------------------------------------- *
* print_version
* --------------------------------------------------------------------------------------------- */
void print_version(void)
{
print_text("\n>>>>> OCILIB BUILD INFORMATION \n\n");
if (OCI_GetImportMode() == OCI_IMPORT_MODE_LINKAGE)
print_text("OCI import mode : LINKAGE\n");
else
print_text("OCI import mode : RUNTIME\n");
if (OCI_GetCharset() == OCI_CHAR_ANSI)
print_text("char type : ANSI\n");
else
print_text("char type : WIDE\n");
print_text("\n>>>>> VERSIONS INFORMATION \n\n");
print_frmt("OCILIB major version : %i\n", OCILIB_MAJOR_VERSION);
print_frmt("OCILIB minor version : %i\n", OCILIB_MINOR_VERSION);
print_frmt("OCILIB revision version : %i\n\n", OCILIB_REVISION_VERSION);
/* print all versions */
print_frmt("OCI compile version : %u\n", OCI_VER_MAJ(OCI_GetOCICompileVersion()));
print_frmt("OCI runtime version : %u\n\n", OCI_VER_MAJ(OCI_GetOCIRuntimeVersion()));
print_frmt("Server major version : %u\n", OCI_GetServerMajorVersion(cn));
print_frmt("Server minor version : %u\n", OCI_GetServerMinorVersion(cn));
print_frmt("Server revision version : %u\n\n", OCI_GetServerRevisionVersion(cn));
print_frmt("Connection version : %u\n\n", OCI_GetVersionConnection(cn));
print_text("\n>>>>> SERVER VERSION BANNER \n\n");
/* print server string version */
print_ostr(OCI_GetVersionServer(cn));
print_text("\n\n");
}
/* --------------------------------------------------------------------------------------------- *
* create_tables
* --------------------------------------------------------------------------------------------- */
void create_tables(void)
{
print_text("\n>>>>> CREATE TABLES FOR DEMO \n\n");
/* create types for the demo */
OCI_ExecuteStmt(st, OTEXT("create type type_t as OBJECT (id int, name varchar2(50))"));
OCI_ExecuteStmt(st, OTEXT("create type test_t as object ")
OTEXT("( ")
OTEXT(" val_int number, ")
OTEXT(" val_flt float, ")
OTEXT(" val_dbl float, ")
OTEXT(" val_str varchar2(30), ")
OTEXT(" val_date date, ")
OTEXT(" val_lob clob, ")
OTEXT(" val_file bfile, ")
OTEXT(" val_obj type_t, ")
OTEXT(" val_raw raw(10) ")
OTEXT(")"));
OCI_ExecuteStmt(st, OTEXT("create type t_tab1_emp as VARRAY(100) of varchar2(50)"));
OCI_ExecuteStmt(st, OTEXT("create type t_tab2_emp as table of varchar2(50)"));
/* create table for the demo */
OCI_ExecuteStmt(st, OTEXT("create table test_fetch(code int, article ")
OTEXT("varchar2(30), price float, creation date)"));
OCI_ExecuteStmt(st, OTEXT("create table test_long_raw(code int, content long raw)"));
OCI_ExecuteStmt(st, OTEXT("create table test_long_str(code int, content long)"));
OCI_ExecuteStmt(st, OTEXT("create table test_lob(code int, content clob)"));
OCI_ExecuteStmt(st, OTEXT("create table test_object(val test_t)"));
OCI_ExecuteStmt(st, OTEXT("create table test_table_obj of type_t"));
OCI_ExecuteStmt(st, OTEXT("create table test_array ")
OTEXT("( ")
OTEXT(" val_int number, ")
OTEXT(" val_dbl float, ")
OTEXT(" val_flt float, ")
OTEXT(" val_str varchar2(30), ")
OTEXT(" val_date date, ")
OTEXT(" val_lob clob, ")
OTEXT(" val_file bfile ")
OTEXT(")")
);
OCI_ExecuteStmt(st, OTEXT("create table test_coll_varray ")
OTEXT("( ")
OTEXT(" departement number, ")
OTEXT(" employees t_tab1_emp ")
OTEXT(")")
);
OCI_ExecuteStmt(st, OTEXT("create table test_coll_nested ")
OTEXT("( ")
OTEXT(" departement number, ")
OTEXT(" employees t_tab2_emp ")
OTEXT(") nested table employees store as test_table_emp")
);
OCI_ExecuteStmt(st, OTEXT("create table test_directpath(val_int number(8,4), ")
OTEXT(" val_str varchar2(30), val_date date)"));
OCI_ExecuteStmt(st, OTEXT("create type test_num_coll_t as varray(10) of number"));
OCI_ExecuteStmt(st, OTEXT("create type test_num_t as object (value number)"));
OCI_ExecuteStmt(st, OTEXT("create table test_number (value number)"));
/* insert data into the demo tables */
OCI_ExecuteStmt(st, OTEXT("insert into test_fetch ")
OTEXT("(code, article, price, creation) ")
OTEXT("values (1, 'shoes', 3.14, to_date('1978-12-23', 'YYYY-MM-DD'))"));
OCI_ExecuteStmt(st, OTEXT("insert into test_fetch ")
OTEXT("(code, article, price, creation) ")
OTEXT("values (2, 'shirt', 5.99, to_date('1999-09-12', 'YYYY-MM-DD'))"));
OCI_ExecuteStmt(st, OTEXT("insert into test_lob(code,content) ")
OTEXT("values (1, EMPTY_CLOB())"));
OCI_ExecuteStmt(st, OTEXT("insert into test_long_str(code,content) ")
OTEXT("values (1, 'Rugby rocks !')"));
OCI_ExecuteStmt(st, OTEXT("insert into test_coll_varray(departement,employees) ")
OTEXT("values (1, t_tab1_emp('Peter', 'John', 'Paula', 'Gina'))"));
OCI_ExecuteStmt(st, OTEXT("insert into test_coll_varray(departement,employees) ")
OTEXT("values (2, t_tab1_emp('Ben', 'Alice', 'Joel', 'Maria'))"));
OCI_ExecuteStmt(st, OTEXT("insert into test_coll_nested(departement,employees) ")
OTEXT("values (1, t_tab2_emp('Vince', 'Richard', 'Rita', 'Sophia'))"));
OCI_ExecuteStmt(st, OTEXT("insert into test_coll_nested(departement,employees) ")
OTEXT("values (2, t_tab2_emp('Paul', 'Sarah', 'Robert', 'Zoe'))"));
OCI_ExecuteStmt(st, OTEXT("insert into test_table_obj values(type_t(1, 'shoes'))"));
OCI_ExecuteStmt(st, OTEXT("insert into test_table_obj values(type_t(2, 'pen'))"));
OCI_ExecuteStmt(st, OTEXT("insert into test_number values(3.14)"));
OCI_ExecuteStmt(st, OTEXT("insert into test_number values(5.28)"));
}
/* --------------------------------------------------------------------------------------------- *
* drop_tables
* --------------------------------------------------------------------------------------------- */
void drop_tables(void)
{
print_text("\n>>>>> DROPPING TABLES AND TYPES \n\n");
OCI_ExecuteStmt(st, OTEXT("drop table test_fetch"));
OCI_ExecuteStmt(st, OTEXT("drop table test_long_str"));
OCI_ExecuteStmt(st, OTEXT("drop table test_long_raw"));
OCI_ExecuteStmt(st, OTEXT("drop table test_lob"));
OCI_ExecuteStmt(st, OTEXT("drop table test_array"));
OCI_ExecuteStmt(st, OTEXT("drop table test_object"));
OCI_ExecuteStmt(st, OTEXT("drop table test_coll_varray"));
OCI_ExecuteStmt(st, OTEXT("drop table test_coll_nested"));
OCI_ExecuteStmt(st, OTEXT("drop table test_table_obj"));
OCI_ExecuteStmt(st, OTEXT("drop table test_directpath"));
OCI_ExecuteStmt(st, OTEXT("drop table test_number"));
OCI_ExecuteStmt(st, OTEXT("drop type test_t"));
OCI_ExecuteStmt(st, OTEXT("drop type type_t"));
OCI_ExecuteStmt(st, OTEXT("drop type t_tab1_emp"));
OCI_ExecuteStmt(st, OTEXT("drop type t_tab2_emp"));
OCI_ExecuteStmt(st, OTEXT("drop type test_num_coll_t"));
OCI_ExecuteStmt(st, OTEXT("drop type test_num_t"));
}
/* --------------------------------------------------------------------------------------------- *
* test_format
* --------------------------------------------------------------------------------------------- */
void test_format(void)
{
int code = 1;
print_text("\n>>>>> TEST FORMATTING \n\n");
OCI_ExecuteStmtFmt(st, OTEXT("select * from test_fetch where code = %i"), code);
rs = OCI_GetResultset(st);
while (OCI_FetchNext(rs))
{
print_frmt("> code : %i", OCI_GetInt(rs, 1));
print_text(", action : "); print_ostr(OCI_GetString(rs, 2));
print_frmt(", price : %g", OCI_GetDouble(rs,3));
print_text(", date : "); print_ostr(OCI_GetString(rs, 4));
print_text("\n");
}
print_frmt("\n%u row(s) fetched\n", OCI_GetRowCount(rs));
}
/* --------------------------------------------------------------------------------------------- *
* test_immediate
* --------------------------------------------------------------------------------------------- */
void test_immediate(void)
{
int code = 1;
print_text("\n>>>>> TEST IMMEDIATE \n\n");
OCI_Immediate(cn, OTEXT("select code, article from test_fetch where code = 1"),
OCI_ARG_INT, &code,
OCI_ARG_TEXT, temp);
print_frmt("> code : %i ", code);
print_text("- article : "); print_ostr(temp);
print_text("\n");
}
/* --------------------------------------------------------------------------------------------- *
* test_immediate_format
* --------------------------------------------------------------------------------------------- */
void test_immediate_format(void)
{
int code = 1;
print_text("\n>>>>> TEST IMMEDIATE FORMATTED\n\n");
OCI_ImmediateFmt(cn, OTEXT("select article from test_fetch where code = %i"),
code, OCI_ARG_TEXT, temp);
print_text("> article : "); print_ostr(temp); print_text("\n");
}
/* --------------------------------------------------------------------------------------------- *
* test_fetch
* --------------------------------------------------------------------------------------------- */
void test_fetch(void)
{
int i, n;
print_text("\n>>>>> SIMPLE TEST FETCH WITH META DATA\n\n");
/* execute query in one go */
OCI_ExecuteStmt(st, OTEXT("select * from test_fetch"));
rs = OCI_GetResultset(st);
/* print resultset columns info */
for(i = 1; i <= n; i++)
{
OCI_Column *col = OCI_GetColumn(rs, i);
print_frmt("> Field : #%i ", i);
print_text("- Name : "); print_ostr(OCI_ColumnGetName(col));
print_text("\n");
}
print_text("\n");
/* print resultset content */
while (OCI_FetchNext(rs))
{
print_frmt("> code : %i", OCI_GetInt(rs, 1));
print_text(", action : "); print_ostr(OCI_GetString(rs, 2));
print_frmt(", price : %g", OCI_GetDouble(rs,3));
print_text(", date : "); print_ostr(OCI_GetString(rs, 4));
print_text("\n");
}
print_frmt("\n%u row(s) fetched\n", OCI_GetRowCount(rs));
}
/* --------------------------------------------------------------------------------------------- *
* test_bind1
* --------------------------------------------------------------------------------------------- */
void test_bind1(void)
{
int code = 1;
print_text("\n>>>>> TEST BINDING \n\n");
/* execute query in three steps */
OCI_Prepare(st, OTEXT("select * from test_fetch where code = :code"));
OCI_BindInt(st, OTEXT(":code"), &code);
rs = OCI_GetResultset(st);
/* print resultset content */
while (OCI_FetchNext(rs))
{
print_frmt("> code : %i", OCI_GetInt(rs, 1));
print_text(", action : "); print_ostr(OCI_GetString(rs, 2));
print_frmt(", price : %g", OCI_GetDouble(rs,3));
print_text(", date : "); print_ostr(OCI_GetString(rs, 4));
print_text("\n");
}
print_frmt("\n%u row(s) fetched\n", OCI_GetRowCount(rs));
}
/* --------------------------------------------------------------------------------------------- *
* test_bind2
* --------------------------------------------------------------------------------------------- */
void test_bind2(void)
{
OCI_Lob *lob;
OCI_Date *date;
OCI_File *file;
int i;
double dbl;
float flt;
print_text("\n>>>>> SINGLE BINDING \n\n");
/* prepare SQL */
OCI_Prepare(st, OTEXT("insert into test_array ")
OTEXT("( ")
OTEXT(" val_int, val_dbl, val_flt, val_str, val_date, ")
OTEXT(" val_lob, val_file ")
OTEXT(") " )
OTEXT("values ")
OTEXT("( ")
OTEXT(" :val_int, :val_dbl, :val_flt, :val_str, :val_date, ")
OTEXT(" :val_lob, :val_file ")
OTEXT(") "));
/* create objects and set values */
/* date */
date = OCI_DateCreate(cn);
/* lob */
lob = OCI_LobCreate(cn, OCI_CLOB);
osprintf(temp, SIZE_STR+1, OTEXT("lob value00"));
OCI_LobWrite(lob, temp, (unsigned int) ostrlen(temp));
/* file */
file = OCI_FileCreate(cn, OCI_BFILE);
OCI_FileSetName(file, OTEXT("mydir"), OTEXT("file00.txt"));
/* scalar types */
i = 1;
dbl = 3.14;
flt = (float) 3.14;
osprintf(temp, SIZE_STR+1, OTEXT("Name00"));
/* bind scalar C types arrays */
OCI_BindInt(st, OTEXT(":val_int"), &i);
OCI_BindDouble(st, OTEXT(":val_dbl"), &dbl);
OCI_BindFloat(st, OTEXT(":val_flt"), &flt);
OCI_BindString(st, OTEXT(":val_str"), (otext*) temp, 30);
/* bind oracle types arrays */
OCI_BindDate(st, OTEXT(":val_date"), date);
OCI_BindLob(st, OTEXT(":val_lob"), lob);
OCI_BindFile(st, OTEXT(":val_file"), file);
/* do insert */
print_frmt("Row inserted : %u\n\n", OCI_GetAffectedRows(st));
/* free objets */
OCI_DateFree(date);
OCI_FileFree(file);
/* commit; */
}
/* --------------------------------------------------------------------------------------------- *
* test_piecewise_insert
* --------------------------------------------------------------------------------------------- */
void test_piecewise_insert(void)
{
FILE *f;
print_text("\n>>>>> TEST PIECEWISE INSERTING\n\n");
/* this code could have been used with a text file in a LONG column
as well... */
/* open the app file in for reading*/
f = fopen(OCI_SHARED_LIB, "rb");
if (f)
{
int n;
OCI_Long *lg;
unsigned char buffer[SIZE_BUF];
fseek (f , 0 , SEEK_END);
n = ftell(f);
rewind (f);
print_frmt("\n%d bytes to write\n", n);
lg = OCI_LongCreate(st, OCI_BLONG);
/* execute query in three steps */
OCI_Prepare(st, OTEXT("insert into test_long_raw(code, content) ")
OTEXT("values (1, :data)"));
OCI_BindLong(st, OTEXT(":data"), lg, n);
/* write data into table by chunks of 2048 bytes */
while ((n = (int) fread(buffer, 1, sizeof(buffer), f)))
{
OCI_LongWrite(lg, buffer, n);
}
print_frmt("\n%u bytes written\n", OCI_LongGetSize(lg));
fclose(f);
}
}
/* --------------------------------------------------------------------------------------------- *
* test_piecewise_fetch
* --------------------------------------------------------------------------------------------- */
void test_piecewise_fetch(void)
{
OCI_Long *lg;
unsigned char buffer[SIZE_BUF];
int n;
print_text("\n>>>>> TEST PIECEWISE FETCHING\n\n");
/* execute query in one go */
OCI_ExecuteStmt(st, OTEXT("select content from test_long_raw ")
OTEXT("where code = 1"));
rs = OCI_GetResultset(st);
/* read data by chunks of 2048 bytes*/
while (OCI_FetchNext(rs))
{
lg = OCI_GetLong(rs, 1);
while ((n = OCI_LongRead(lg, buffer, sizeof(buffer)))) {}
print_frmt("\n%u bytes read\n", OCI_LongGetSize(lg));
}
print_frmt("\n%u row(s) fetched\n", OCI_GetRowCount(rs));
print_text("\n>>>>> TEST LONG MAPPED TO STRING\n\n");
OCI_ExecuteStmt(st, OTEXT("select content from test_long_str ")
OTEXT("where code = 1"));
OCI_SetLongMode(st, OCI_LONG_IMPLICIT);
rs = OCI_GetResultset(st);
while (OCI_FetchNext(rs))
{
const otext *long_str = OCI_GetString(rs, 1);
print_ostr(long_str);
print_frmt("\n%d bytes read\n", (int) ostrlen(long_str));
}
print_frmt("\n%u row(s) fetched\n", OCI_GetRowCount(rs));
}
/* --------------------------------------------------------------------------------------------- *
* test_lob
* --------------------------------------------------------------------------------------------- */
void test_lob(void)
{
OCI_Lob *lob;
print_text("\n>>>>> TEST LOB MANIPULATION\n\n");
OCI_ExecuteStmt(st, OTEXT("select code, content from test_lob ")
OTEXT("where code=1 for update"));
rs = OCI_GetResultset(st);
while (OCI_FetchNext(rs))
{
lob = OCI_GetLob(rs, 2);
OCI_LobWrite(lob, OTEXT("today, "), 7);
OCI_LobAppend(lob, OTEXT("i'm going to the cinema ! "), 26);
OCI_LobSeek(lob, 0, OCI_SEEK_SET);
temp[OCI_LobRead(lob, temp, SIZE_STR)] = 0;
print_frmt("> code : %i", OCI_GetInt(rs, 1));
print_text(", content : "); print_ostr(temp);
print_text("\n");
}
print_frmt("\n%u row(s) fetched\n", OCI_GetRowCount(rs));
}
/* --------------------------------------------------------------------------------------------- *
* test_nested_table
* --------------------------------------------------------------------------------------------- */
void test_nested_table(void)
{
print_text("\n>>>>> TEST NESTED TABLE \n\n");
OCI_ExecuteStmt(st, OTEXT("select article, cursor(select sysdate ")
OTEXT("from dual) from test_fetch"));
rs = OCI_GetResultset(st);
while (OCI_FetchNext(rs))
{
while (OCI_FetchNext(rs2))
{
print_text("> article : "); print_ostr(OCI_GetString(rs, 1));
print_text(", date : "); print_ostr(OCI_GetString(rs2, 1));
print_text("\n");
}
}
}
/* --------------------------------------------------------------------------------------------- *
* test_ref_cursor
* --------------------------------------------------------------------------------------------- */
void test_ref_cursor(void)
{
print_text("\n>>>>> TEST REF CURSOR \n\n");
OCI_Prepare(st, OTEXT("begin open :c for select * from test_fetch; end;"));
OCI_BindStatement(st, OTEXT(":c"), st2);
rs = OCI_GetResultset(st2);
/* print resultset content */
while (OCI_FetchNext(rs))
{
print_frmt("> code : %i", OCI_GetInt(rs, 1));
print_text(", action : "); print_ostr(OCI_GetString(rs, 2));
print_frmt(", price : %g", OCI_GetDouble(rs,3));
print_text(", date : "); print_ostr(OCI_GetString(rs, 4));
print_text("\n");
}
print_frmt("\n%u row(s) fetched\n", OCI_GetRowCount(rs));
}
/* --------------------------------------------------------------------------------------------- *
* test_plsql
* --------------------------------------------------------------------------------------------- */
void test_plsql(void)
{
int res = 0;
const otext *p=NULL;
print_text("\n>>>>> TEST PL/SQL OUTPUT BIND\n\n");
OCI_Prepare(st, OTEXT("begin :res := trunc(sysdate+1)-trunc(sysdate-1); end;"));
OCI_BindInt(st, OTEXT(":res"), &res);
print_text("\nPL/SQL : trunc(sysdate+1)-trunc(sysdate-1)\n");
print_frmt("\nResult : %i\n", res);
#ifndef OCI_CHARSET_ANSI
{
unsigned int version = OCI_GetOCIRuntimeVersion();
/* Oracle 8i has some troubles with SERVER OUTPUT in unicode */
if (version < OCI_9_0)
return;
}
#endif
print_text("\n>>>>> TEST PL/SQL SERVER OUTPUT\n\n");
/* server output */
OCI_ServerEnableOutput(cn, 32000, 5, 255);
OCI_ExecuteStmt(st, OTEXT("begin ")
OTEXT(" dbms_output.put_line('First line'); ")
OTEXT(" dbms_output.put_line('Second line'); ")
OTEXT(" dbms_output.put_line('Third line'); ")
OTEXT("end;")
);
while ((p = OCI_ServerGetOutput(cn)))
{
print_ostr(p);
print_text("\n");
}
}
/* --------------------------------------------------------------------------------------------- *
* test_dates
* --------------------------------------------------------------------------------------------- */
void test_dates(void)
{
OCI_Date *date, *date2;
print_text("\n>>>>> TEST DATETIME MANIPULATION\n\n");
date = OCI_DateCreate(NULL);
date2 = OCI_DateCreate(NULL);
OCI_DateFromText(date, OTEXT("1978-04-13 20:20:12"), OTEXT("YYYY-MM-DD HH24:MI:SS"));
OCI_DateToText(date, OTEXT("YYYY-MM-DD HH24:MI:SS"), SIZE_STR, str);
print_text("\nDate : "); print_ostr(str);
OCI_DateToText(date, OTEXT("YYYY-MM-DD HH24:MI:SS"), SIZE_STR, str);
print_text("\nSysdate : "); print_ostr(str);
OCI_DateAddDays(date, 5);
OCI_DateToText(date, OTEXT("YYYY-MM-DD HH24:MI:SS"), SIZE_STR, str);
print_text("\nDate + 5 days + 2 months : "); print_ostr(str);
OCI_DateAssign(date2, date);
OCI_DateToText(date, OTEXT("YYYY-MM-DD"), SIZE_STR, str);
print_text("\nLast day of the month : "); print_ostr(str);
print_frmt("\nEnd of the month - date : %i days",
OCI_DateDaysBetween(date, date2));
print_text("\n");
OCI_DateFree(date);
OCI_DateFree(date2);
}
/* --------------------------------------------------------------------------------------------- *
* test_timestamp
* --------------------------------------------------------------------------------------------- */
void test_timestamp(void)
{
#ifndef OCI_CHARSET_ANSI
unsigned int version = OCI_GetOCIRuntimeVersion();
/* Oracle 9i has some troubles with formatting Intervals/timestamps in
an UTF16 context... */
if ((version >= OCI_9_0) || (version < OCI_10_1))
return;
#endif
if (OCI_GetOCIRuntimeVersion() >= OCI_9_0)
{
print_text("\n>>>>> TEST TIMESTAMP\n\n");
tmsp = OCI_TimestampCreate(NULL, OCI_TIMESTAMP);
OCI_TimestampToText(tmsp, OTEXT("YYYY-MM-DD HH24:MI:SS:FF\n"), SIZE_STR, str, 3);
print_text("Current timestamp : "); print_ostr(str);
/* intervals raw oci functions have some troubles with Oracle 9i. So let's
use it for the demo only if we're using 10g or above */
if (OCI_GetOCIRuntimeVersion() >= OCI_10_1)
{
print_text("\n>>>>> TEST INTERVAL \n\n");
itv = OCI_IntervalCreate(NULL, OCI_INTERVAL_DS);
OCI_IntervalSetDaySecond(itv, 1,1,1,1,0);
OCI_IntervalToText(itv, 3, 3, SIZE_STR, str);
print_text("Interval : "); print_ostr(str);
print_text("\n");
OCI_TimestampToText(tmsp, OTEXT("YYYY-MM-DD HH24:MI:SS:FF\n"), SIZE_STR, str, 3);
print_text("Current timestamp + Interval : "); print_ostr(str);
}
}
}
/* --------------------------------------------------------------------------------------------- *
* test_describe
* --------------------------------------------------------------------------------------------- */
void test_describe(void)
{
OCI_Column *col;
int i, n;
print_text("\n>>>>> TEST DESCRIBING TABLE \n\n");
tbl = OCI_TypeInfoGet(cn, OTEXT("test_fetch"), OCI_TIF_TABLE);
if (tbl)
{
print_text("Column Name NULL ? Type \n");
print_text("--------------------------------------------------------\n");
for(i = 1; i <= n; i++)
{
col = OCI_TypeInfoGetColumn(tbl, i);
OCI_ColumnGetFullSQLType(col, str, SIZE_STR);
#if defined(OCI_CHARSET_WIDE)
#if !defined(_WINDOWS)
printf("%-20ls%-8ls%-30ls\n",
#else
wprintf(OTEXT("%-20s%-8s%-30s\n"),
#endif
#else
printf("%-20s%-8s%-30s\n",
#endif
OCI_ColumnGetNullable(col) == TRUE ? OTEXT("Y") : OTEXT("N"),
str);
}
}
/* TEST DESCRIBING TYPE ------------------------------------------------- */
print_text("\n>>>>> TEST DESCRIBING TYPE \n\n");
tbl = OCI_TypeInfoGet(cn, OTEXT("test_t"), OCI_TIF_TYPE);
if (tbl)
{
print_text("Column Name Type \n");
print_text("---------------------------------------------------\n");
for(i = 1; i <= n; i++)
{
col = OCI_TypeInfoGetColumn(tbl, i);
OCI_ColumnGetFullSQLType(col, str, SIZE_STR);
#if defined(OCI_CHARSET_WIDE)
#if !defined(_WINDOWS)
printf("%-20ls%-30ls\n",
#else
wprintf(OTEXT("%-20s%-30s\n"),
#endif
#else
printf("%-20s%-30s\n",
#endif
OCI_ColumnGetName(col), str);
}
}
}
/* --------------------------------------------------------------------------------------------- *
* test_returning
* --------------------------------------------------------------------------------------------- */
void test_returning(void)
{
OCI_Lob *lob;
print_text("\n>>>>> TEST RETURNING CLAUSE \n\n");
OCI_Prepare(st, OTEXT("update test_lob set code = code + 1 returning code, content into :i, :l"));
OCI_RegisterLob(st, OTEXT(":l"), OCI_CLOB);
OCI_RegisterInt(st, OTEXT(":i"));
rs = OCI_GetResultset(st);
while (OCI_FetchNext(rs))
{
lob = OCI_GetLob(rs, 2);
OCI_LobAppend(lob, OTEXT("(modified)"), 10);
OCI_LobSeek(lob, 0, OCI_SEEK_SET);
temp[OCI_LobRead(lob, temp, SIZE_STR)] = 0;
print_frmt("> code : %i - ", OCI_GetInt(rs, 1));
print_ostr(temp);
print_text("\n");
}
print_frmt("\n%u row(s) fetched\n", OCI_GetRowCount(rs));
}
/* --------------------------------------------------------------------------------------------- *
* test_returning_array
* --------------------------------------------------------------------------------------------- */
void test_returning_array(void)
{
OCI_Lob *lob;
OCI_Date *date;
OCI_File *file;
int i;
/* arrays */
int tab_int [SIZE_TAB];
otext tab_str [SIZE_TAB][31];
float tab_flt [SIZE_TAB];
double tab_dbl [SIZE_TAB];
OCI_Date **tab_date = OCI_DateArrayCreate(cn, SIZE_TAB);
OCI_Lob **tab_lob = OCI_LobArrayCreate(cn, OCI_CLOB, SIZE_TAB);
OCI_File **tab_file = OCI_FileArrayCreate(cn, OCI_BFILE, SIZE_TAB);
print_text("\n>>>>> TEST ARRAY BINDING WITH RETURNING CLAUSE \n\n");
/* prepare SQL */
OCI_Prepare(st, OTEXT("insert into test_array ")
OTEXT("( ")
OTEXT(" val_int, val_dbl, val_flt, val_str, val_date, ")
OTEXT(" val_lob, val_file ")
OTEXT(") " )
OTEXT("values ")
OTEXT("( ")
OTEXT(" :val_int, :val_dbl, :val_flt, :val_str, :val_date, ")
OTEXT(" :val_lob, :val_file ")
OTEXT(") ")
OTEXT("returning")
OTEXT(" val_int, val_dbl, val_flt, val_str, val_date, ")
OTEXT(" val_lob, val_file ")
OTEXT("into " )
OTEXT(" :out_int, :out_dbl, :out_flt, :out_str, :out_date, ")
OTEXT(" :out_lob, :out_file "));
/* Set Array Size */
OCI_BindArraySetSize(st, SIZE_TAB);
/* bind scalar C types arrays */
OCI_BindArrayOfInts(st, OTEXT(":val_int"), tab_int, 0);
OCI_BindArrayOfDoubles(st, OTEXT(":val_dbl"), tab_dbl, 0);
OCI_BindArrayOfFloats(st, OTEXT(":val_flt"), tab_flt, 0);
OCI_BindArrayOfStrings(st, OTEXT(":val_str"), (otext*) tab_str, 30, 0);
/* bind oracle types arrays */
OCI_BindArrayOfDates(st, OTEXT(":val_date"), tab_date, 0);
OCI_BindArrayOfLobs(st, OTEXT(":val_lob"), tab_lob, OCI_CLOB, 0);
OCI_BindArrayOfFiles(st, OTEXT(":val_file"), tab_file, OCI_BFILE, 0);
/* register C scalar types output */
OCI_RegisterInt(st, OTEXT(":out_int"));
OCI_RegisterDouble(st, OTEXT(":out_dbl"));
OCI_RegisterFloat(st, OTEXT(":out_flt"));
OCI_RegisterString(st, OTEXT(":out_str"), 30);
/* bind oracle types outputs */
OCI_RegisterDate(st, OTEXT(":out_date"));
OCI_RegisterLob(st, OTEXT(":out_lob"), OCI_CLOB);
OCI_RegisterFile(st, OTEXT(":out_file"), OCI_BFILE);
/* create objects and set values */
for(i = 0; i < SIZE_TAB; i++)
{
/* scalar types */
tab_int[i] = i+1;
tab_dbl[i] = 3.14*(double)(i+1);
tab_flt[i] = (float) 3.14*(float)(i+1);
osprintf(tab_str[i], 31, OTEXT("Name%02i"), i+1);
/* date */
OCI_DateSysDate(tab_date[i]);
/* lob */
osprintf(temp, SIZE_STR+1, OTEXT("lob value%02i"), i+1);
OCI_LobWrite(tab_lob[i], temp, (unsigned int) ostrlen(temp));
/* file */
osprintf(str, SIZE_STR+1, OTEXT("file%02i.txt"), i+1);
OCI_FileSetName(tab_file[i], OTEXT("mydir"), str);
}
print_frmt("Row inserted : %u\n\n", OCI_GetAffectedRows(st));
/* free objects */
OCI_DateArrayFree(tab_date);
OCI_LobArrayFree(tab_lob);
OCI_FileArrayFree(tab_file);
/* Get back data from the returning clause
Obviously, each entry of the array will return a resultset containing
1 row only (DML insert)
*/
rs = OCI_GetResultset(st);
i = 1;
while (rs != NULL)
{
while (OCI_FetchNext(rs))
{
print_frmt("Row # %d-------------------\n", i);
print_frmt(".... val_int : %i\n", OCI_GetInt2(rs, OTEXT(":OUT_INT")));
print_frmt(".... val_dbl : %g\n", OCI_GetDouble2(rs, OTEXT(":OUT_DBL")));
print_frmt(".... val_flt : %g\n", OCI_GetFloat2(rs, OTEXT(":OUT_FLT")));
print_text(".... val_str : "); print_ostr(OCI_GetString2(rs, OTEXT(":OUT_STR")));
print_text("\n");
date = OCI_GetDate2(rs, OTEXT(":OUT_DATE"));
OCI_DateToText(date, OTEXT("YYYY-MM-DD HH24:MI:SS"), SIZE_STR, str);
print_text(".... val_date : "); print_ostr(str);
print_text("\n");
lob = OCI_GetLob2(rs, OTEXT(":OUT_LOB"));
temp[OCI_LobRead(lob, temp, 100)]=0;
print_text(".... val_lob : "); print_ostr(temp);
print_text("\n");
file = OCI_GetFile2(rs, OTEXT(":OUT_FILE"));
print_text(".... val_file : ");
print_ostr(OCI_FileGetDirectory(file));
print_text("/");
print_ostr(OCI_FileGetName(file));
print_text("\n");
print_text("\n");
i++;
}
}
}
/* --------------------------------------------------------------------------------------------- *
* test_object_insert
* --------------------------------------------------------------------------------------------- */
void test_object_insert(void)
{
OCI_Date *date;
OCI_File *file;
OCI_Lob *lob;
OCI_Object *obj;
OCI_Object *obj2;
char rawbuf[11];
strcpy(rawbuf, "0123456789");
print_text("\n>>>>> TEST OBJECT BINDING \n\n");
/* create types for the demo */
obj = OCI_ObjectCreate(cn, OCI_TypeInfoGet(cn, OTEXT("test_t"), OCI_TIF_TYPE));
OCI_ObjectSetInt(obj, OTEXT("VAL_INT"), 1);
OCI_ObjectSetDouble(obj, OTEXT("VAL_DBL"), 3.14);
OCI_ObjectSetFloat(obj, OTEXT("VAL_FLT"), (float) 3.14);
OCI_ObjectSetString(obj, OTEXT("VAL_STR"), OTEXT("USB KEY 2go"));
OCI_ObjectSetRaw(obj, OTEXT("VAL_RAW"), rawbuf, 10);
date = OCI_DateCreate(cn);
OCI_ObjectSetDate(obj, OTEXT("VAL_DATE"), date);
obj2 = OCI_ObjectCreate(cn, OCI_TypeInfoGet(cn, OTEXT("TYPE_T"), OCI_TIF_TYPE));
OCI_ObjectSetInt(obj2, OTEXT("ID"), 1);
OCI_ObjectSetString(obj2, OTEXT("NAME"), OTEXT("USB KEY 2go"));
OCI_ObjectSetObject(obj, OTEXT("VAL_OBJ"), obj2);
lob = OCI_LobCreate(cn, OCI_CLOB);
OCI_ObjectSetLob(obj, OTEXT("VAL_LOB"), lob);
file = OCI_FileCreate(cn, OCI_BFILE);
OCI_FileSetName(file, OTEXT("mydir"), OTEXT("myfile"));
OCI_ObjectSetFile(obj, OTEXT("VAL_FILE"), file);
OCI_Prepare(st, OTEXT("insert into test_object values(:obj)"));
OCI_BindObject(st, OTEXT(":obj"), obj);
print_frmt("\n%u row(s) inserted\n", OCI_GetAffectedRows(st));
OCI_DateFree(date);
OCI_FileFree(file);
}
/* --------------------------------------------------------------------------------------------- *
* test_object_fetch
* --------------------------------------------------------------------------------------------- */
void test_object_fetch(void)
{
OCI_Lob *lob;
OCI_Date *date;
OCI_File *file;
OCI_Object *obj;
OCI_Object *obj2;
char rawbuf[11] = "";
print_text("\n>>>>> TEST OBJECT FETCHING \n\n");
OCI_ExecuteStmt(st, OTEXT("select val from test_object for update"));
rs = OCI_GetResultset(st);
/* print resultset content */
while (OCI_FetchNext(rs))
{
obj = OCI_GetObject(rs, 1);
print_frmt("val_int : %i\n", OCI_ObjectGetInt(obj, OTEXT("VAL_INT")));
print_frmt("val_dbl : %g\n", OCI_ObjectGetFloat(obj, OTEXT("VAL_DBL")));
print_frmt("val_flt : %g\n", OCI_ObjectGetDouble(obj, OTEXT("VAL_FLT")));
print_text("val_str : "); print_ostr(OCI_ObjectGetString(obj, OTEXT("VAL_STR")));
print_text("\n");
temp[OCI_ObjectGetRaw(obj, OTEXT("VAL_RAW"), rawbuf, 10)] = 0;
print_text("val_raw : "); print_frmt("%s", rawbuf);
print_text("\n");
date = OCI_ObjectGetDate(obj, OTEXT("VAL_DATE"));
OCI_DateToText(date, OTEXT("YYYY-MM-DD HH24:MI:SS"), SIZE_STR, str);
print_text("val_date : "); print_ostr(str);
print_text("\n");
lob = OCI_ObjectGetLob(obj, OTEXT("VAL_LOB"));
OCI_LobWrite(lob, OTEXT("Hello from Mars !"), 17);
OCI_LobSeek(lob, 0, OCI_SEEK_SET);
temp[OCI_LobRead(lob, temp, SIZE_STR)]=0;
print_text("val_lob : "); print_ostr(temp);
print_text("\n");
file = OCI_ObjectGetFile(obj, OTEXT("VAL_FILE"));
print_text("val_file.dir : "); print_ostr(OCI_FileGetDirectory(file));
print_text("\n");
print_text("val_file.name : "); print_ostr(OCI_FileGetName(file));
print_text("\n");
obj2 = OCI_ObjectGetObject(obj, OTEXT("VAL_OBJ"));
print_frmt("val_obj.code : %i\n", OCI_ObjectGetInt(obj2, OTEXT("ID")));
print_text("val_obj.name : "); print_ostr(OCI_ObjectGetString(obj2, OTEXT("NAME")));
print_text("\n");
print_text("\n");;
}
}
/* --------------------------------------------------------------------------------------------- *
* test_object_string
* --------------------------------------------------------------------------------------------- */
void test_object_fetch_string(void)
{
print_text("\n>>>>> TEST OBJECT FETCHING AS STRING \n\n");
OCI_ExecuteStmt(st, OTEXT("select val from test_object"));
rs = OCI_GetResultset(st);
/* print resultset content */
while (OCI_FetchNext(rs))
{
print_ostr(OCI_GetString(rs, 1));
print_text("\n");
}
}
/* --------------------------------------------------------------------------------------------- *
* test_scrollable_cursor
* --------------------------------------------------------------------------------------------- */
void test_scrollable_cursor(void)
{
if (OCI_GetVersionConnection(cn) >= OCI_9_0)
{
print_text("\n>>>>> TEST SCROLLABLE CURSORS \n\n");
OCI_SetFetchMode(st, OCI_SFM_SCROLLABLE);
OCI_ExecuteStmt(st, OTEXT("select table_name from user_tables where ")
OTEXT("table_name like 'TEST_%' order by table_name"));
rs = OCI_GetResultset(st);
if (OCI_FetchLast(rs))
print_frmt("... Resultset contains %u rows\n\n", OCI_GetRowCount(rs));
print_text("... Go to row 1\n");
if (OCI_FetchFirst(rs))
{
print_ostr(OCI_GetString(rs, 1));
print_text("\n");
}
print_frmt("... Enumerate from row 2 to row %u\n", OCI_GetRowCount(rs));
while (OCI_FetchNext(rs))
{
print_ostr(OCI_GetString(rs, 1));
print_text("\n");
}
print_frmt("... Enumerate from row %u back to row 1\n", OCI_GetRowCount(rs)-1);
while (OCI_FetchPrev(rs))
{
print_ostr(OCI_GetString(rs, 1));
print_text("\n");
}
print_text("... Go to the 3th row\n");
if (OCI_FetchSeek(rs, OCI_SFD_ABSOLUTE, 3))
{
print_ostr(OCI_GetString(rs, 1));
print_text("\n");
}
print_text("... Fetch the next 2 rows\n");
while ((OCI_GetCurrentRow(rs) < 5) && OCI_FetchNext(rs))
{
print_ostr(OCI_GetString(rs, 1));
print_text("\n");
}
OCI_SetFetchMode(st, OCI_SFM_DEFAULT);
}
}
/* --------------------------------------------------------------------------------------------- *
* test_collection
* --------------------------------------------------------------------------------------------- */
void test_collection(void)
{
OCI_TypeInfo *type;
OCI_Coll *coll;
OCI_Iter *iter;
OCI_Elem *elem;
unsigned int i, n;
print_text("\n>>>>> TEST VARRAY BINDING \n\n");
type = OCI_TypeInfoGet(cn, OTEXT("T_TAB1_EMP"), OCI_TIF_TYPE);
coll = OCI_CollCreate(type);
OCI_Prepare(st, OTEXT("begin")
OTEXT(" select employees into :tab_emp ")
OTEXT(" from test_coll_varray ")
OTEXT(" where departement = :id; ")
OTEXT("end;"));
OCI_BindColl(st, OTEXT(":tab_emp"), coll);
OCI_BindUnsignedInt(st, OTEXT(":id"), &i);
i = 1;
iter = OCI_IterCreate(coll);
elem = OCI_IterGetNext(iter);
print_frmt("Department ID #%u\n\n", i);
while (elem != NULL)
{
print_text("... Employee : ");
print_ostr(OCI_ElemGetString(elem));
print_text("\n");
elem = OCI_IterGetNext(iter);
}
OCI_IterFree(iter);
OCI_CollFree(coll);
print_text("\n>>>>> TEST VARRAY FETCHING WITH ITERATOR \n\n");
OCI_ExecuteStmt(st, OTEXT("SELECT * from test_coll_varray"));
rs = OCI_GetResultset(st);
while (OCI_FetchNext(rs))
{
coll = OCI_GetColl(rs, 2);
iter = OCI_IterCreate(coll);
elem = OCI_IterGetNext(iter);
print_frmt("\nDepartment ID #%d\n\n", OCI_GetInt(rs, 1));
while (elem != NULL)
{
print_text("... Employee : ");
print_ostr(OCI_ElemGetString(elem));
print_text("\n");
elem = OCI_IterGetNext(iter);
}
OCI_IterFree(iter);
}
print_text("\n>>>>> TEST VARRAY PRINTING \n\n");
if (OCI_CollToText(coll, &n, NULL))
{
otext *tmp_str = (otext* ) calloc(n+1, sizeof(otext));
if (tmp_str)
{
OCI_CollToText(coll, &n, tmp_str);
print_ostr(tmp_str);
print_text("\n");
free(tmp_str);
}
}
print_text("\n>>>>> TEST NESTED TABLE FETCHING WITH INDEX ACCESS \n\n");
OCI_ExecuteStmt(st, OTEXT("SELECT * from test_coll_nested"));
rs = OCI_GetResultset(st);
while (OCI_FetchNext(rs))
{
coll = OCI_GetColl(rs, 2);
print_frmt("\nDepartment ID #%d\n\n", OCI_GetInt(rs, 1));
n = OCI_CollGetSize(coll);
for(i = 1; i <= n; i++)
{
elem = OCI_CollGetElem(coll, i);
print_text("... Employee : ");
print_ostr(OCI_ElemGetString(elem));
print_text("\n");
}
}
}
/* --------------------------------------------------------------------------------------------- *
* test_ref
* --------------------------------------------------------------------------------------------- */
void test_ref(void)
{
OCI_Ref *ref;
OCI_Object *obj;
print_text("\n>>>>> TEST REF FETCHING \n\n");
OCI_ExecuteStmt(st, OTEXT("select ref(e) from test_table_obj e"));
rs = OCI_GetResultset(st);
while (OCI_FetchNext(rs))
{
ref = OCI_GetRef(rs, 1);
obj = OCI_RefGetObject(ref);
print_frmt("%i - ", OCI_ObjectGetInt(obj, OTEXT("ID")));
print_ostr(OCI_ObjectGetString(obj, OTEXT("NAME")));
print_text("\n");
}
print_text("\n>>>>> TEST REF PL/SQL BINDING \n\n");
ref = OCI_RefCreate(cn, OCI_TypeInfoGet(cn, OTEXT("type_t"), OCI_TIF_TYPE));
OCI_Prepare(st, OTEXT("begin ")
OTEXT(" select ref(e) into :r from test_table_obj e where e.id = 1; ")
OTEXT("end; "));
OCI_BindRef(st, OTEXT(":r"), ref);
obj = OCI_RefGetObject(ref);
print_frmt("%i - ", OCI_ObjectGetInt(obj, OTEXT("ID")));
print_ostr(OCI_ObjectGetString(obj, OTEXT("NAME")));
print_text("\n");
}
/* --------------------------------------------------------------------------------------------- *
* test_directpath
* --------------------------------------------------------------------------------------------- */
void test_directpath(void)
{
/* Some OCI Direct path function fails (segfault) if the OCI version of the
client is different than the server one.
It happens with OCI 8i and 9i client. Apparently Oracle 10g and 11g seems to
have fixed these problems.
Anyway, we run this test case only if the major versions of client and server
match
*/
{
boolean res = TRUE;
otext val1[SIZE_COL1+1] = OTEXT("");
otext val2[SIZE_COL2+1] = OTEXT("");
otext val3[SIZE_COL3+1] = OTEXT("");
int i = 0, j = 0, nb_rows = SIZE_ARRAY;
int state;
/* commit any previous pending modifications */
print_text("\n>>>>> TEST DIRECT PATH (10 loads of 100 rows) \n\n");
tbl = OCI_TypeInfoGet(cn, OTEXT("test_directpath"), OCI_TIF_TABLE);
dp = OCI_DirPathCreate(tbl, NULL, NUM_COLS, nb_rows);
/* optional attributes to set */
res = res && OCI_DirPathSetBufferSize(dp, 64000);
res = res && OCI_DirPathSetNoLog(dp, TRUE);
res = res && OCI_DirPathSetParallel(dp, TRUE);
if(OCI_GetOCIRuntimeVersion() >= OCI_9_2)
{
res = res && OCI_DirPathSetCacheSize(dp, 100);
}
/* describe the target table */
res = res && OCI_DirPathSetColumn(dp, 1, OTEXT("VAL_INT"), SIZE_COL1, NULL);
res = res && OCI_DirPathSetColumn(dp, 2, OTEXT("VAL_STR"), SIZE_COL2, NULL);
res = res && OCI_DirPathSetColumn(dp, 3, OTEXT("VAL_DATE"), SIZE_COL3, OTEXT("YYYYMMDD"));
/* prepare the load */
res = res && OCI_DirPathPrepare(dp);
if (res)
{
nb_rows = OCI_DirPathGetMaxRows(dp);
for (i = 0; i < NB_LOAD ; i++)
{
for (j = 1; j <= nb_rows && res; j++)
{
/* fill test values */
osprintf(val1, SIZE_COL1+1, OTEXT("%04d"), i + (i*100));
osprintf(val2, SIZE_COL2+1, OTEXT("value %05d"), j + (i*100));
osprintf(val3, SIZE_COL3+1, OTEXT("%04d%02d%02d"), (j%23)+1 + 2000,
(j%11)+1,
(j%23)+1);
res = res && OCI_DirPathSetEntry(dp, j, 1, val1, (unsigned int) ostrlen(val1), TRUE);
res = res && OCI_DirPathSetEntry(dp, j, 2, val2, (unsigned int) ostrlen(val2), TRUE);
res = res && OCI_DirPathSetEntry(dp, j, 3, val3, (unsigned int) ostrlen(val3), TRUE);
}
/* load data to the server */
while (res == TRUE)
{
state = OCI_DirPathConvert(dp);
if ((state == OCI_DPR_FULL) || (state == OCI_DPR_COMPLETE))
res = OCI_DirPathLoad(dp);
if (state == OCI_DPR_COMPLETE || state == OCI_DPR_ERROR)
break;
}
}
/* commits changes */
res = res && OCI_DirPathFinish(dp);
if (res)
{
print_frmt("%04u row(s) loaded\n", OCI_DirPathGetRowCount(dp));
}
/* free direct path object */
}
}
}
/* --------------------------------------------------------------------------------------------- *
* test_bigint
* --------------------------------------------------------------------------------------------- */
void test_bigint(void)
{
big_int value1 = 12345, value2 = 0;
print_text("\n>>>>> TEST BINDING BIG INT \n\n");
OCI_Prepare(st, OTEXT("begin :value2 := :value1 * :value1; end;"));
OCI_BindBigInt(st, OTEXT(":value1"), &value1);
OCI_BindBigInt(st, OTEXT(":value2"), &value2);
printf("\n%lld * %lld = %lld \n", value1, value1, value2);
}
/* --------------------------------------------------------------------------------------------- *
* test_number
* --------------------------------------------------------------------------------------------- */
void test_number()
{
OCI_TypeInfo *tc = NULL;
OCI_TypeInfo *to = NULL;
OCI_Number *nm = NULL;
OCI_Coll *cl = NULL;
OCI_Elem *el = NULL;
OCI_Object *ob = NULL;
OCI_Number *no = NULL;
OCI_Number *nt = NULL;
OCI_Number **ar = NULL;
unsigned int i, n;
print_text("\n>>>>> TEST ORACLE NUMBER \n\n");
tc = OCI_TypeInfoGet(cn, OTEXT("test_num_coll_t"), OCI_TIF_TYPE);
to = OCI_TypeInfoGet(cn, OTEXT("test_num_t"), OCI_TIF_TYPE);
cl = OCI_CollCreate(tc);
ob = OCI_ObjectCreate(cn, to);
el = OCI_ElemCreate(tc);
nm = OCI_NumberCreate(cn);
ar = OCI_NumberArrayCreate(cn, 5);
// Testing fetching numbers (as number and using implicit conversion number to string)
OCI_Prepare(st, OTEXT("select value from test_number"));
rs = OCI_GetResultset(st);
while (OCI_FetchNext(rs))
{
OCI_Number *num = OCI_GetNumber(rs, 1);
const otext *buf = OCI_GetString(rs, 1);
OCI_NumberToText(num, NULL, SIZE_STR, str);
print_ostr(str);
print_text(" - ");
print_ostr(buf);
print_text("\n");
}
// Testing binding external single number
OCI_Prepare(st, OTEXT("begin :1 := :1 *2 ; end;"));
OCI_BindNumber(st, OTEXT(":1"), nm);
OCI_NumberFromText(nm, OTEXT("1234.4321"), NULL);
OCI_NumberToText(nm, NULL, SIZE_STR, str);
print_ostr(str);
print_text("\n");
// Testing binding internal single number
OCI_Prepare(st, OTEXT("begin :1 := :1 *2 ; end;"));
OCI_SetBindAllocation(st, OCI_BAM_INTERNAL);
OCI_BindNumber(st, OTEXT(":1"), NULL);
OCI_NumberFromText(nt, OTEXT("1234.4321"), NULL);
OCI_NumberToText(nt, NULL, SIZE_STR, str);
print_ostr(str);
print_text("\n");
OCI_SetBindAllocation(st, OCI_BAM_EXTERNAL);
// Testing registering number for a returning into statement
OCI_Prepare(st, OTEXT("update test_number set value = value *2 returning value into :1"));
OCI_RegisterNumber(st, OTEXT(":1"));
rs = OCI_GetResultset(st);
while (OCI_FetchNext(rs))
{
print_ostr(OCI_GetString(rs, 1));
print_text("\n");
}
// testing Collections
OCI_NumberFromText(nm, OTEXT("1111.2222"), NULL);
OCI_CollAppend(cl, el);
OCI_NumberFromText(nm, OTEXT("3333.4444"), NULL);
OCI_CollAppend(cl, el);
for (i = 1, n = OCI_CollGetCount(cl); i <= n; i++)
{
OCI_NumberToText(num, NULL, SIZE_STR, str);
print_ostr(str);
print_text("\n");
}
// Testing objects
OCI_NumberFromText(nm, OTEXT("5555.6666"), NULL);
OCI_NumberToText(nm, NULL, SIZE_STR, str);
print_ostr(str);
print_text("\n");
OCI_ObjectSetNumber(ob, OTEXT("value"), nm);
no = OCI_ObjectGetNumber(ob, OTEXT("value"));
OCI_NumberToText(no, NULL, SIZE_STR, str);
print_ostr(str);
print_text("\n");
// Testing fetching infinite values to string
OCI_Prepare(st, OTEXT("SELECT utl_raw.cast_to_number('FF65'), utl_raw.cast_to_number('00') from dual"));
rs = OCI_GetResultset(st);
while (OCI_FetchNext(rs))
{
print_text("pos infinite = ");
print_ostr(OCI_GetString(rs, 1));
print_text("\n");
print_text("neg infinite = ");
print_ostr(OCI_GetString(rs, 2));
print_text("\n");
}
// Testing formatting
OCI_NumberFromText(nm, OTEXT("1234.4321"), NULL);
OCI_ImmediateFmt(cn, OTEXT("select %n * 2 from dual"), nm, OCI_ARG_NUMBER, nm);
OCI_NumberToText(nm, NULL, SIZE_STR, str);
print_ostr(str);
print_text("\n");
// Testing array of numbers
OCI_NumberFromText(ar[0], OTEXT("1.2"), NULL);
OCI_NumberFromText(ar[1], OTEXT("~"), NULL);
OCI_NumberFromText(ar[2], OTEXT("5.6"), NULL);
OCI_NumberFromText(ar[3], OTEXT("-~"), NULL);
OCI_NumberFromText(ar[4], OTEXT("9.2"), NULL);
OCI_NumberToText(ar[0], NULL, SIZE_STR, str);
print_ostr(str);
print_text("\n");
OCI_NumberToText(ar[1], NULL, SIZE_STR, str);
print_ostr(str);
print_text("\n");
OCI_NumberToText(ar[2], NULL, SIZE_STR, str);
print_ostr(str);
print_text("\n");
OCI_NumberToText(ar[3], NULL, SIZE_STR, str);
print_ostr(str);
print_text("\n");
OCI_NumberToText(ar[4], NULL, SIZE_STR, str);
print_ostr(str);
print_text("\n");
}
OCI_SYM_PUBLIC boolean OCI_API OCI_BindArrayOfFloats(OCI_Statement *stmt, const otext *name, float *data, unsigned int nbelem)
Bind an array of floats.
OCI_SYM_PUBLIC boolean OCI_API OCI_BindBigInt(OCI_Statement *stmt, const otext *name, big_int *data)
Bind a big integer variable.
OCI_SYM_PUBLIC boolean OCI_API OCI_BindFloat(OCI_Statement *stmt, const otext *name, float *data)
Bind a float variable.
OCI_SYM_PUBLIC OCI_Bind *OCI_API OCI_GetBind(OCI_Statement *stmt, unsigned int index)
Return the bind handle at the given index in the internal array of bind handle.
OCI_SYM_PUBLIC void *OCI_API OCI_BindGetData(OCI_Bind *bnd)
Return the user defined data associated with a bind handle.
OCI_SYM_PUBLIC boolean OCI_API OCI_BindString(OCI_Statement *stmt, const otext *name, otext *data, unsigned int len)
Bind a string variable.
OCI_SYM_PUBLIC boolean OCI_API OCI_BindObject(OCI_Statement *stmt, const otext *name, OCI_Object *data)
Bind an object (named type) variable.
OCI_SYM_PUBLIC boolean OCI_API OCI_BindLob(OCI_Statement *stmt, const otext *name, OCI_Lob *data)
Bind a Lob variable.
OCI_SYM_PUBLIC boolean OCI_API OCI_BindArrayOfFiles(OCI_Statement *stmt, const otext *name, OCI_File **data, unsigned int type, unsigned int nbelem)
Bind an array of File handles.
OCI_SYM_PUBLIC boolean OCI_API OCI_BindFile(OCI_Statement *stmt, const otext *name, OCI_File *data)
Bind a File variable.
OCI_SYM_PUBLIC boolean OCI_API OCI_BindArrayOfDoubles(OCI_Statement *stmt, const otext *name, double *data, unsigned int nbelem)
Bind an array of doubles.
OCI_SYM_PUBLIC boolean OCI_API OCI_BindArrayOfLobs(OCI_Statement *stmt, const otext *name, OCI_Lob **data, unsigned int type, unsigned int nbelem)
Bind an array of Lob handles.
OCI_SYM_PUBLIC boolean OCI_API OCI_BindArrayOfInts(OCI_Statement *stmt, const otext *name, int *data, unsigned int nbelem)
Bind an array of integers.
OCI_SYM_PUBLIC boolean OCI_API OCI_BindRef(OCI_Statement *stmt, const otext *name, OCI_Ref *data)
Bind a Ref variable.
OCI_SYM_PUBLIC boolean OCI_API OCI_BindInt(OCI_Statement *stmt, const otext *name, int *data)
Bind an integer variable.
OCI_SYM_PUBLIC boolean OCI_API OCI_BindLong(OCI_Statement *stmt, const otext *name, OCI_Long *data, unsigned int size)
Bind a Long variable.
OCI_SYM_PUBLIC boolean OCI_API OCI_BindArrayOfDates(OCI_Statement *stmt, const otext *name, OCI_Date **data, unsigned int nbelem)
Bind an array of dates.
OCI_SYM_PUBLIC boolean OCI_API OCI_BindArrayOfStrings(OCI_Statement *stmt, const otext *name, otext *data, unsigned int len, unsigned int nbelem)
Bind an array of strings.
OCI_SYM_PUBLIC boolean OCI_API OCI_BindDate(OCI_Statement *stmt, const otext *name, OCI_Date *data)
Bind a date variable.
OCI_SYM_PUBLIC boolean OCI_API OCI_BindArraySetSize(OCI_Statement *stmt, unsigned int size)
Set the input array size for bulk operations.
OCI_SYM_PUBLIC boolean OCI_API OCI_BindColl(OCI_Statement *stmt, const otext *name, OCI_Coll *data)
Bind a Collection variable.
OCI_SYM_PUBLIC boolean OCI_API OCI_BindUnsignedInt(OCI_Statement *stmt, const otext *name, unsigned int *data)
Bind an unsigned integer variable.
OCI_SYM_PUBLIC boolean OCI_API OCI_BindStatement(OCI_Statement *stmt, const otext *name, OCI_Statement *data)
Bind a Statement variable (PL/SQL Ref Cursor)
OCI_SYM_PUBLIC boolean OCI_API OCI_BindDouble(OCI_Statement *stmt, const otext *name, double *data)
Bind a double variable.
OCI_SYM_PUBLIC boolean OCI_API OCI_BindNumber(OCI_Statement *stmt, const otext *name, OCI_Number *data)
Bind an Number variable.
OCI_SYM_PUBLIC boolean OCI_API OCI_ElemSetNumber(OCI_Elem *elem, OCI_Number *value)
Set a number value to a collection element.
OCI_SYM_PUBLIC boolean OCI_API OCI_CollAppend(OCI_Coll *coll, OCI_Elem *elem)
Append the given element at the end of the collection.
OCI_SYM_PUBLIC unsigned int OCI_API OCI_CollGetSize(OCI_Coll *coll)
Returns the total number of elements of the given collection.
OCI_SYM_PUBLIC OCI_Iter *OCI_API OCI_IterCreate(OCI_Coll *coll)
Create an iterator handle to iterate through a collection.
OCI_SYM_PUBLIC boolean OCI_API OCI_ElemFree(OCI_Elem *elem)
Free a local collection element.
OCI_SYM_PUBLIC boolean OCI_API OCI_CollFree(OCI_Coll *coll)
Free a local collection.
OCI_SYM_PUBLIC boolean OCI_API OCI_IterFree(OCI_Iter *iter)
Free an iterator handle.
OCI_SYM_PUBLIC unsigned int OCI_API OCI_CollGetCount(OCI_Coll *coll)
Returns the current number of elements of the given collection.
OCI_SYM_PUBLIC OCI_Elem *OCI_API OCI_CollGetElem(OCI_Coll *coll, unsigned int index)
Return the element at the given position in the collection.
OCI_SYM_PUBLIC OCI_Elem *OCI_API OCI_IterGetNext(OCI_Iter *iter)
Get the next element in the collection.
OCI_SYM_PUBLIC boolean OCI_API OCI_CollToText(OCI_Coll *coll, unsigned int *size, otext *str)
Convert a collection handle value to a string.
OCI_SYM_PUBLIC OCI_Elem *OCI_API OCI_ElemCreate(OCI_TypeInfo *typinf)
Create a local collection element instance based on a collection type descriptor.
OCI_SYM_PUBLIC OCI_Number *OCI_API OCI_ElemGetNumber(OCI_Elem *elem)
Return the number value of the given collection element.
OCI_SYM_PUBLIC const otext *OCI_API OCI_ElemGetString(OCI_Elem *elem)
Return the String value of the given collection element.
OCI_SYM_PUBLIC OCI_Coll *OCI_API OCI_CollCreate(OCI_TypeInfo *typinf)
Create a local collection instance.
OCI_SYM_PUBLIC unsigned int OCI_API OCI_GetServerRevisionVersion(OCI_Connection *con)
Return the revision version number of the connected database server.
OCI_SYM_PUBLIC unsigned int OCI_API OCI_GetServerMinorVersion(OCI_Connection *con)
Return the minor version number of the connected database server.
OCI_SYM_PUBLIC boolean OCI_API OCI_ConnectionFree(OCI_Connection *con)
Close a physical connection to an Oracle database server.
OCI_SYM_PUBLIC const otext *OCI_API OCI_GetVersionServer(OCI_Connection *con)
Return the connected database server version string (aka server banner version) as reported by SQL*Pl...
OCI_SYM_PUBLIC unsigned int OCI_API OCI_GetVersionConnection(OCI_Connection *con)
Return the highest Oracle version is supported by the connection.
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.
OCI_SYM_PUBLIC unsigned int OCI_API OCI_GetServerMajorVersion(OCI_Connection *con)
Return the major version number of the connected database server.
struct OCI_Ref OCI_Ref
Oracle REF type representation.
Definition: types.h:356
struct OCI_Elem OCI_Elem
Oracle Collection item representation.
Definition: types.h:329
struct OCI_Connection OCI_Connection
Oracle physical connection.
Definition: types.h:124
struct OCI_Object OCI_Object
Oracle Named types representation.
Definition: types.h:309
struct OCI_Statement OCI_Statement
Oracle SQL or PL/SQL statement.
Definition: types.h:136
struct OCI_Timestamp OCI_Timestamp
Oracle internal timestamp representation.
Definition: types.h:289
struct OCI_Date OCI_Date
Oracle internal date representation.
Definition: types.h:279
struct OCI_Coll OCI_Coll
Oracle Collections (VARRAYs and Nested Tables) representation.
Definition: types.h:319
struct OCI_DirPath OCI_DirPath
OCILIB encapsulation of OCI Direct Path handle.
Definition: types.h:420
struct OCI_Error OCI_Error
Encapsulates an Oracle or OCILIB exception.
Definition: types.h:390
long long big_int
big_int is a C scalar integer (32 or 64 bits) depending on compiler support for 64bits integers....
Definition: platform.h:281
struct OCI_Lob OCI_Lob
Oracle Internal Large objects:
Definition: types.h:198
struct OCI_Long OCI_Long
Oracle Long data type.
Definition: types.h:260
struct OCI_Column OCI_Column
Oracle SQL Column and Type member representation.
Definition: types.h:175
struct OCI_Interval OCI_Interval
Oracle internal interval representation.
Definition: types.h:299
struct OCI_Number OCI_Number
Oracle NUMBER representation.
Definition: types.h:269
struct OCI_TypeInfo OCI_TypeInfo
Type info metadata handle.
Definition: types.h:366
struct OCI_File OCI_File
Oracle External Large objects:
Definition: types.h:223
struct OCI_Resultset OCI_Resultset
Collection of output columns from a select statement.
Definition: types.h:163
struct OCI_Iter OCI_Iter
Oracle Collection iterator representation.
Definition: types.h:338
OCI_SYM_PUBLIC boolean OCI_API OCI_DateFromText(OCI_Date *date, const otext *str, const otext *fmt)
Convert a string to a date and store it in the given date handle.
OCI_SYM_PUBLIC OCI_Date *OCI_API OCI_DateCreate(OCI_Connection *con)
Create a local date object.
OCI_SYM_PUBLIC boolean OCI_API OCI_DateLastDay(OCI_Date *date)
Place the last day of month (from the given date) into the given date.
OCI_SYM_PUBLIC OCI_Date **OCI_API OCI_DateArrayCreate(OCI_Connection *con, unsigned int nbelem)
Create an array of date object.
OCI_SYM_PUBLIC int OCI_API OCI_DateDaysBetween(OCI_Date *date, OCI_Date *date2)
Return the number of days betWeen two dates.
OCI_SYM_PUBLIC int OCI_API OCI_DateAssign(OCI_Date *date, OCI_Date *date_src)
Assign the value of a date handle to another one.
OCI_SYM_PUBLIC boolean OCI_API OCI_DateFree(OCI_Date *date)
Free a date object.
OCI_SYM_PUBLIC boolean OCI_API OCI_DateAddMonths(OCI_Date *date, int nb)
Add or subtract months to a date handle.
OCI_SYM_PUBLIC boolean OCI_API OCI_DateAddDays(OCI_Date *date, int nb)
Add or subtract days to a date handle.
OCI_SYM_PUBLIC boolean OCI_API OCI_DateToText(OCI_Date *date, const otext *fmt, int size, otext *str)
Convert a Date value from the given date handle to a string.
OCI_SYM_PUBLIC boolean OCI_API OCI_DateArrayFree(OCI_Date **dates)
Free an array of date objects.
OCI_SYM_PUBLIC boolean OCI_API OCI_DateSysDate(OCI_Date *date)
Return the current system date/time into the date handle.
OCI_SYM_PUBLIC boolean OCI_API OCI_DirPathSetParallel(OCI_DirPath *dp, boolean value)
Set the parallel loading mode.
OCI_SYM_PUBLIC boolean OCI_API OCI_DirPathSetColumn(OCI_DirPath *dp, unsigned int index, const otext *name, unsigned int maxsize, const otext *format)
Describe a column to load into the given table.
OCI_SYM_PUBLIC boolean OCI_API OCI_DirPathFinish(OCI_DirPath *dp)
Terminate a direct path operation and commit changes into the database.
OCI_SYM_PUBLIC unsigned int OCI_API OCI_DirPathConvert(OCI_DirPath *dp)
Convert provided user data to the direct path stream format.
OCI_SYM_PUBLIC boolean OCI_API OCI_DirPathSetCacheSize(OCI_DirPath *dp, unsigned int size)
Set number of elements in the date cache.
OCI_SYM_PUBLIC boolean OCI_API OCI_DirPathSetBufferSize(OCI_DirPath *dp, unsigned int size)
Set the size of the internal stream transfer buffer.
OCI_SYM_PUBLIC OCI_DirPath *OCI_API OCI_DirPathCreate(OCI_TypeInfo *typinf, const otext *partition, unsigned int nb_cols, unsigned int nb_rows)
Create a direct path object.
OCI_SYM_PUBLIC boolean OCI_API OCI_DirPathSetNoLog(OCI_DirPath *dp, boolean value)
Set the logging mode for the loading operation.
OCI_SYM_PUBLIC boolean OCI_API OCI_DirPathSetEntry(OCI_DirPath *dp, unsigned int row, unsigned int index, void *value, unsigned size, boolean complete)
Set the value of the given row/column array entry.
OCI_SYM_PUBLIC boolean OCI_API OCI_DirPathPrepare(OCI_DirPath *dp)
Prepares the OCI direct path load interface before any rows can be converted or loaded.
OCI_SYM_PUBLIC boolean OCI_API OCI_DirPathFree(OCI_DirPath *dp)
Free an OCI_DirPath handle.
OCI_SYM_PUBLIC unsigned int OCI_API OCI_DirPathGetRowCount(OCI_DirPath *dp)
Return the number of rows successfully loaded into the database so far.
OCI_SYM_PUBLIC unsigned int OCI_API OCI_DirPathGetMaxRows(OCI_DirPath *dp)
Return the maximum number of rows allocated in the OCI and OCILIB internal arrays of rows.
OCI_SYM_PUBLIC boolean OCI_API OCI_DirPathReset(OCI_DirPath *dp)
Reset internal arrays and streams to prepare another load.
OCI_SYM_PUBLIC unsigned int OCI_API OCI_DirPathLoad(OCI_DirPath *dp)
Loads the data converted to direct path stream format.
OCI_SYM_PUBLIC unsigned int OCI_API OCI_ErrorGetType(OCI_Error *err)
Retrieve the type of error from error handle.
OCI_SYM_PUBLIC const otext *OCI_API OCI_ErrorGetString(OCI_Error *err)
Retrieve error message from error handle.
OCI_SYM_PUBLIC OCI_Error *OCI_API OCI_GetLastError(void)
Retrieve the last error or warning occurred within the last OCILIB call.
OCI_SYM_PUBLIC boolean OCI_API OCI_RegisterLob(OCI_Statement *stmt, const otext *name, unsigned int type)
Register a lob output bind placeholder.
OCI_SYM_PUBLIC boolean OCI_API OCI_RegisterInt(OCI_Statement *stmt, const otext *name)
Register an integer output bind placeholder.
OCI_SYM_PUBLIC boolean OCI_API OCI_RegisterDouble(OCI_Statement *stmt, const otext *name)
Register a double output bind placeholder.
OCI_SYM_PUBLIC OCI_Resultset *OCI_API OCI_GetNextResultset(OCI_Statement *stmt)
Retrieve the next available resultset.
OCI_SYM_PUBLIC boolean OCI_API OCI_RegisterDate(OCI_Statement *stmt, const otext *name)
Register a date output bind placeholder.
OCI_SYM_PUBLIC boolean OCI_API OCI_RegisterString(OCI_Statement *stmt, const otext *name, unsigned int len)
Register a string output bind placeholder.
OCI_SYM_PUBLIC boolean OCI_API OCI_RegisterNumber(OCI_Statement *stmt, const otext *name)
Register a register output bind placeholder.
OCI_SYM_PUBLIC boolean OCI_API OCI_RegisterFile(OCI_Statement *stmt, const otext *name, unsigned int type)
Register a file output bind placeholder.
OCI_SYM_PUBLIC boolean OCI_API OCI_RegisterFloat(OCI_Statement *stmt, const otext *name)
Register a float output bind placeholder.
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_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_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 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 boolean OCI_API OCI_ColumnGetNullable(OCI_Column *col)
Return the nullable attribute of the column.
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_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 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 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 boolean OCI_API OCI_FetchLast(OCI_Resultset *rs)
Fetch the last row of 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 boolean OCI_API OCI_FetchNext(OCI_Resultset *rs)
Fetch the next row of 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 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_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_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_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 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 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 OCI_Resultset *OCI_API OCI_GetResultset(OCI_Statement *stmt)
Retrieve the resultset handle from an executed statement.
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 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_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 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 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 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 const otext *OCI_API OCI_FileGetName(OCI_File *file)
Return the name of the given file.
OCI_SYM_PUBLIC OCI_File *OCI_API OCI_FileCreate(OCI_Connection *con, unsigned int type)
Create a file object instance.
OCI_SYM_PUBLIC OCI_File **OCI_API OCI_FileArrayCreate(OCI_Connection *con, unsigned int type, unsigned int nbelem)
Create an array of file object.
OCI_SYM_PUBLIC const otext *OCI_API OCI_FileGetDirectory(OCI_File *file)
Return the directory of the given file.
OCI_SYM_PUBLIC boolean OCI_API OCI_FileSetName(OCI_File *file, const otext *dir, const otext *name)
Set the directory and file name of FILE handle.
OCI_SYM_PUBLIC boolean OCI_API OCI_FileFree(OCI_File *file)
Free a local File object.
OCI_SYM_PUBLIC boolean OCI_API OCI_FileArrayFree(OCI_File **files)
Free an array of file objects.
OCI_SYM_PUBLIC boolean OCI_Immediate(OCI_Connection *con, const otext *sql,...)
Perform 3 calls (prepare+execute+fetch) in 1 call.
OCI_SYM_PUBLIC boolean OCI_ExecuteStmtFmt(OCI_Statement *stmt, const otext *sql,...)
Execute a formatted SQL statement or PL/SQL block.
OCI_SYM_PUBLIC boolean OCI_ImmediateFmt(OCI_Connection *con, const otext *sql,...)
Performs 4 call (prepare+bind+execute+fetch) in 1 call.
OCI_SYM_PUBLIC boolean OCI_API OCI_Cleanup(void)
Clean up all resources allocated by the library.
OCI_SYM_PUBLIC unsigned int OCI_API OCI_GetOCICompileVersion(void)
Return the version of OCI used for compilation.
OCI_SYM_PUBLIC unsigned int OCI_API OCI_GetCharset(void)
Return the OCILIB charset type.
OCI_SYM_PUBLIC boolean OCI_API OCI_EnableWarnings(boolean value)
Enable or disable Oracle warning notifications.
OCI_SYM_PUBLIC unsigned int OCI_API OCI_GetOCIRuntimeVersion(void)
Return the version of OCI used at runtime.
OCI_SYM_PUBLIC unsigned int OCI_API OCI_GetImportMode(void)
Return the Oracle shared library import mode.
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 unsigned int OCI_API OCI_LobWrite(OCI_Lob *lob, void *buffer, unsigned int len)
[OBSOLETE] Write a buffer into a LOB
OCI_SYM_PUBLIC boolean OCI_API OCI_LobFree(OCI_Lob *lob)
Free a local temporary lob.
OCI_SYM_PUBLIC OCI_Lob *OCI_API OCI_LobCreate(OCI_Connection *con, unsigned int type)
Create a local temporary Lob instance.
OCI_SYM_PUBLIC unsigned int OCI_API OCI_LobRead(OCI_Lob *lob, void *buffer, unsigned int len)
[OBSOLETE] Read a portion of a lob into the given buffer
OCI_SYM_PUBLIC boolean OCI_API OCI_LobArrayFree(OCI_Lob **lobs)
Free an array of lob objects.
OCI_SYM_PUBLIC OCI_Lob **OCI_API OCI_LobArrayCreate(OCI_Connection *con, unsigned int type, unsigned int nbelem)
Create an array of lob object.
OCI_SYM_PUBLIC boolean OCI_API OCI_LobSeek(OCI_Lob *lob, big_uint offset, unsigned int mode)
Perform a seek operation on the OCI_lob content buffer.
OCI_SYM_PUBLIC unsigned int OCI_API OCI_LobAppend(OCI_Lob *lob, void *buffer, unsigned int len)
Append a buffer at the end of a LOB.
OCI_SYM_PUBLIC boolean OCI_API OCI_LongFree(OCI_Long *lg)
Free a local temporary long.
OCI_SYM_PUBLIC unsigned int OCI_API OCI_LongGetSize(OCI_Long *lg)
Return the buffer size of a long object in bytes (OCI_BLONG) or character (OCI_CLONG)
OCI_SYM_PUBLIC unsigned int OCI_API OCI_LongRead(OCI_Long *lg, void *buffer, unsigned int len)
Read a portion of a long into the given buffer [Obsolete].
OCI_SYM_PUBLIC unsigned int OCI_API OCI_LongWrite(OCI_Long *lg, void *buffer, unsigned int len)
Write a buffer into a Long.
OCI_SYM_PUBLIC OCI_Long *OCI_API OCI_LongCreate(OCI_Statement *stmt, unsigned int type)
Create a local temporary Long instance.
OCI_SYM_PUBLIC OCI_TypeInfo *OCI_API OCI_TypeInfoGet(OCI_Connection *con, const otext *name, unsigned int type)
Retrieve the available type info information.
OCI_SYM_PUBLIC OCI_Column *OCI_API OCI_TypeInfoGetColumn(OCI_TypeInfo *typinf, unsigned int index)
Return the column object handle at the given index in the table.
OCI_SYM_PUBLIC boolean OCI_API OCI_TypeInfoFree(OCI_TypeInfo *typinf)
Free a type info object.
OCI_SYM_PUBLIC unsigned int OCI_API OCI_TypeInfoGetColumnCount(OCI_TypeInfo *typinf)
Return the number of columns of a table/view/object.
OCI_SYM_PUBLIC boolean OCI_API OCI_NumberArrayFree(OCI_Number **numbers)
Free an array of number objects.
OCI_SYM_PUBLIC OCI_Number **OCI_API OCI_NumberArrayCreate(OCI_Connection *con, unsigned int nbelem)
Create an array of number object.
OCI_SYM_PUBLIC boolean OCI_API OCI_NumberFree(OCI_Number *number)
Free a number object.
OCI_SYM_PUBLIC boolean OCI_API OCI_NumberFromText(OCI_Number *number, const otext *str, const otext *fmt)
Convert a string to a number and store it in the given number handle.
OCI_SYM_PUBLIC boolean OCI_API OCI_NumberToText(OCI_Number *number, const otext *fmt, int size, otext *str)
Convert a number value from the given number handle to a string.
OCI_SYM_PUBLIC OCI_Number *OCI_API OCI_NumberCreate(OCI_Connection *con)
Create a local number object.
OCI_SYM_PUBLIC const otext *OCI_API OCI_ServerGetOutput(OCI_Connection *con)
Retrieve one line of the server buffer.
OCI_SYM_PUBLIC boolean OCI_API OCI_ServerDisableOutput(OCI_Connection *con)
Disable the server output.
OCI_SYM_PUBLIC boolean OCI_API OCI_ServerEnableOutput(OCI_Connection *con, unsigned int bufsize, unsigned int arrsize, unsigned int lnsize)
Enable the server output.
OCI_SYM_PUBLIC boolean OCI_API OCI_SetFetchMode(OCI_Statement *stmt, unsigned int mode)
Set the fetch mode of a SQL statement.
OCI_SYM_PUBLIC boolean OCI_API OCI_SetBindAllocation(OCI_Statement *stmt, unsigned int mode)
Set the current bind allocation mode that will be used for subsequent binding calls.
OCI_SYM_PUBLIC boolean OCI_API OCI_SetLongMode(OCI_Statement *stmt, unsigned int mode)
Set the long data type handling mode of a SQL statement.
OCI_SYM_PUBLIC unsigned int OCI_API OCI_GetAffectedRows(OCI_Statement *stmt)
Return the number of rows affected by the SQL statement.
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 ...)
OCI_SYM_PUBLIC boolean OCI_API OCI_Prepare(OCI_Statement *stmt, const otext *sql)
Prepare a SQL statement or PL/SQL block.
OCI_SYM_PUBLIC boolean OCI_API OCI_Execute(OCI_Statement *stmt)
Execute a prepared SQL statement or PL/SQL block.
OCI_SYM_PUBLIC OCI_Interval *OCI_API OCI_IntervalCreate(OCI_Connection *con, unsigned int type)
Create a local interval object.
OCI_SYM_PUBLIC boolean OCI_API OCI_IntervalFree(OCI_Interval *itv)
Free an OCI_Interval handle.
OCI_SYM_PUBLIC boolean OCI_API OCI_TimestampIntervalAdd(OCI_Timestamp *tmsp, OCI_Interval *itv)
Add an interval value to a timestamp value of a timestamp handle.
OCI_SYM_PUBLIC boolean OCI_API OCI_TimestampFree(OCI_Timestamp *tmsp)
Free an OCI_Timestamp handle.
OCI_SYM_PUBLIC OCI_Timestamp *OCI_API OCI_TimestampCreate(OCI_Connection *con, unsigned int type)
Create a local Timestamp instance.
OCI_SYM_PUBLIC boolean OCI_API OCI_TimestampSysTimestamp(OCI_Timestamp *tmsp)
Stores the system current date and time as a timestamp value with time zone into the timestamp handle...
OCI_SYM_PUBLIC boolean OCI_API OCI_TimestampToText(OCI_Timestamp *tmsp, const otext *fmt, int size, otext *str, int precision)
Convert a timestamp value from the given timestamp handle to a string.
OCI_SYM_PUBLIC boolean OCI_API OCI_IntervalToText(OCI_Interval *itv, int leading_prec, int fraction_prec, int size, otext *str)
Convert an interval value from the given interval handle to a string.
OCI_SYM_PUBLIC boolean OCI_API OCI_IntervalSetDaySecond(OCI_Interval *itv, int day, int hour, int min, int sec, int fsec)
Set the day / time portion if the given interval handle.
OCI_SYM_PUBLIC boolean OCI_API OCI_Commit(OCI_Connection *con)
Commit current pending changes.
OCI_SYM_PUBLIC boolean OCI_API OCI_ObjectSetRaw(OCI_Object *obj, const otext *attr, void *value, unsigned int len)
Set an object attribute of type RAW.
OCI_SYM_PUBLIC OCI_Object *OCI_API OCI_RefGetObject(OCI_Ref *ref)
Returns the object pointed by the Ref handle.
OCI_SYM_PUBLIC boolean OCI_API OCI_ObjectSetString(OCI_Object *obj, const otext *attr, const otext *value)
Set an object attribute of type string.
OCI_SYM_PUBLIC boolean OCI_API OCI_ObjectFree(OCI_Object *obj)
Free a local object.
OCI_SYM_PUBLIC boolean OCI_API OCI_ObjectSetDouble(OCI_Object *obj, const otext *attr, double value)
Set an object attribute of type double.
OCI_SYM_PUBLIC int OCI_API OCI_ObjectGetInt(OCI_Object *obj, const otext *attr)
Return the integer value of the given object attribute.
OCI_SYM_PUBLIC boolean OCI_API OCI_ObjectSetInt(OCI_Object *obj, const otext *attr, int value)
Set an object attribute of type int.
OCI_SYM_PUBLIC const otext *OCI_API OCI_ObjectGetString(OCI_Object *obj, const otext *attr)
Return the string value of the given object attribute.
OCI_SYM_PUBLIC OCI_Object *OCI_API OCI_ObjectGetObject(OCI_Object *obj, const otext *attr)
Return the object value of the given object attribute.
OCI_SYM_PUBLIC boolean OCI_API OCI_ObjectSetObject(OCI_Object *obj, const otext *attr, OCI_Object *value)
Set an object attribute of type Object.
OCI_SYM_PUBLIC OCI_File *OCI_API OCI_ObjectGetFile(OCI_Object *obj, const otext *attr)
Return the file value of the given object attribute.
OCI_SYM_PUBLIC float OCI_API OCI_ObjectGetFloat(OCI_Object *obj, const otext *attr)
Return the float value of the given object attribute.
OCI_SYM_PUBLIC boolean OCI_API OCI_ObjectSetDate(OCI_Object *obj, const otext *attr, OCI_Date *value)
Set an object attribute of type Date.
OCI_SYM_PUBLIC boolean OCI_API OCI_ObjectSetFile(OCI_Object *obj, const otext *attr, OCI_File *value)
Set an object attribute of type File.
OCI_SYM_PUBLIC boolean OCI_API OCI_ObjectSetNumber(OCI_Object *obj, const otext *attr, OCI_Number *value)
Set an object attribute of type number.
OCI_SYM_PUBLIC boolean OCI_API OCI_RefFree(OCI_Ref *ref)
Free a local Ref.
OCI_SYM_PUBLIC OCI_Object *OCI_API OCI_ObjectCreate(OCI_Connection *con, OCI_TypeInfo *typinf)
Create a local object instance.
OCI_SYM_PUBLIC OCI_Ref *OCI_API OCI_RefCreate(OCI_Connection *con, OCI_TypeInfo *typinf)
Create a local Ref instance.
OCI_SYM_PUBLIC int OCI_API OCI_ObjectGetRaw(OCI_Object *obj, const otext *attr, void *value, unsigned int len)
Return the raw attribute value of the given object attribute into the given buffer.
OCI_SYM_PUBLIC OCI_Lob *OCI_API OCI_ObjectGetLob(OCI_Object *obj, const otext *attr)
Return the lob value of the given object attribute.
OCI_SYM_PUBLIC OCI_Date *OCI_API OCI_ObjectGetDate(OCI_Object *obj, const otext *attr)
Return the date value of the given object attribute.
OCI_SYM_PUBLIC double OCI_API OCI_ObjectGetDouble(OCI_Object *obj, const otext *attr)
Return the double value of the given object attribute.
OCI_SYM_PUBLIC OCI_Number *OCI_API OCI_ObjectGetNumber(OCI_Object *obj, const otext *attr)
Return the number value of the given object attribute.
OCI_SYM_PUBLIC boolean OCI_API OCI_ObjectSetFloat(OCI_Object *obj, const otext *attr, float value)
Set an object attribute of type float.
OCI_SYM_PUBLIC boolean OCI_API OCI_ObjectSetLob(OCI_Object *obj, const otext *attr, OCI_Lob *value)
Set an object attribute of type Lob.