From: Tang Cheng Date: Mon, 20 Oct 2014 08:14:41 +0000 (+0800) Subject: 增加oracle 11g x86版 instantclient X-Git-Url: https://source.supwisdom.com/gerrit/gitweb?a=commitdiff_plain;h=37650ea22f69f073251ce42b1753ed0e43120d5e;p=common%2Foracle_instantclient.git 增加oracle 11g x86版 instantclient --- 37650ea22f69f073251ce42b1753ed0e43120d5e diff --git a/BASIC_README b/BASIC_README new file mode 100644 index 0000000..32290bb --- /dev/null +++ b/BASIC_README @@ -0,0 +1,16 @@ +Basic Package Information +========================= + +Sat Aug 24 17:30:44 GMT 2013 + +Client Shared Library 64-bit - 11.2.0.4.0 + +System name: Linux +Release: 2.6.9-103.0.0.0.1.ELxenU +Version: #1 SMP Thu Dec 8 11:00:30 EST 2011 +Machine: x86_64 + +Operating in ORACLE_HOME environment. +Small timezone file = /ade/b/2960201551/oracle/oracore/zoneinfo/timezone_14.dat +Large timezone file = /ade/b/2960201551/oracle/oracore/zoneinfo/timezlrg_14.dat + diff --git a/PRECOMP_README b/PRECOMP_README new file mode 100644 index 0000000..cd96695 --- /dev/null +++ b/PRECOMP_README @@ -0,0 +1,80 @@ +PRECOMP Package Information +=========================== + +Sat Aug 24 17:31:03 GMT 2013 + +Client Shared Library 64-bit - 11.2.0.4.0 + +System name: Linux +Release: 2.6.9-103.0.0.0.1.ELxenU +Version: #1 SMP Thu Dec 8 11:00:30 EST 2011 +Machine: x86_64 + +Operating in ORACLE_HOME environment. +Small timezone file = /ade/b/2960201551/oracle/oracore/zoneinfo/timezone_14.dat +Large timezone file = /ade/b/2960201551/oracle/oracore/zoneinfo/timezlrg_14.dat + +============================================================================== + +PRECOMP Instant Client (IC) Package (precomp.zip) contains following +components: + i) "proc" binary and related files to precompile a Pro*C application + ii) "procob" binary and related files to precompile a Pro*COBOL application +iii) sample configuration files, demo programs and demo make files for building + proc and procob demos and in general any Pro*C/Pro*COBOL application. + +Installing PRECOMP IC Package: +------------------------------ +Prerequisites: +Please unzip following .zip files before unzipping precomp.zip: + + a) For runtime support (running Pro*C/Pro*COBOL applications) + - Unzip basic.zip (not required if installed instantclient through + Oracle Universal Installer) + + b) For developing Pro*C/Pro*COBOL applications + - Unzip basic.zip (not required if installed instantclient through + Oracle Universal Installer) + - Unzip sdk.zip + +Notes: + 1) Runtime libraries are available in + instantclient<_VV_v>/ + 2) proc binary is available in + instantclient<_VV_v>/sdk/ + 3) procob binary is available in + instantclient<_VV_v>/sdk/ + 4) ott binary is available in + instantclient<_VV_v>/sdk/ + 5) rtsora binary is available in + instantclient<_VV_v>/sdk/ + 6) All header files required for precompilation are available at + instantclient<_VV_v>/sdk/include/ + 7) Sample configuration files (pcscfg.cfg & pcbcfg.cfg) are available at + instantclient<_VV_v>/precomp/admin + 8) Pro*C demo makefile and sample Pro*C application are available at + instantclient<_VV_v>/sdk/demo/ + 9) Pro*COBOL demo makefile and sample Pro*COBOL application are available at + instantclient<_VV_v>/sdk/demo/ + 10) Please ensure that ICSDKHOME & ICLIBHOME defined in the demo makefiles + point to appropiate locations on your machine before putting them + to use. + +Legend: + VV - Major Oracle version number + v - Minor Oracle version number + (Ex: For the release 11.1, VV = 11 and v = 1) + + +Configurations Supported: +------------------------- + Platforms Runtime Precompile + ~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~ ~~~~~~~~~~~~ + Linux 32bit (RHEL-4) Proc: Yes proc: Yes + procob: Yes procob: Yes + + Windows 32bit Proc: Yes proc: Yes + procob: Yes procob: Yes + + +============================================================================== diff --git a/adrci b/adrci new file mode 100755 index 0000000..af3a140 Binary files /dev/null and b/adrci differ diff --git a/cobsqlintf.o b/cobsqlintf.o new file mode 100644 index 0000000..fce7600 Binary files /dev/null and b/cobsqlintf.o differ diff --git a/genezi b/genezi new file mode 100755 index 0000000..3ef4e70 Binary files /dev/null and b/genezi differ diff --git a/libclntsh.so.11.1 b/libclntsh.so.11.1 new file mode 100755 index 0000000..101a99b Binary files /dev/null and b/libclntsh.so.11.1 differ diff --git a/libnnz11.so b/libnnz11.so new file mode 100755 index 0000000..220239b Binary files /dev/null and b/libnnz11.so differ diff --git a/libocci.so.11.1 b/libocci.so.11.1 new file mode 100755 index 0000000..c2c7adf Binary files /dev/null and b/libocci.so.11.1 differ diff --git a/libociei.so b/libociei.so new file mode 100755 index 0000000..cad010e Binary files /dev/null and b/libociei.so differ diff --git a/libocijdbc11.so b/libocijdbc11.so new file mode 100755 index 0000000..27864e3 Binary files /dev/null and b/libocijdbc11.so differ diff --git a/ojdbc5.jar b/ojdbc5.jar new file mode 100644 index 0000000..8236296 Binary files /dev/null and b/ojdbc5.jar differ diff --git a/ojdbc6.jar b/ojdbc6.jar new file mode 100644 index 0000000..b663cd2 Binary files /dev/null and b/ojdbc6.jar differ diff --git a/precomp/admin/pcbcfg.cfg b/precomp/admin/pcbcfg.cfg new file mode 100644 index 0000000..1ae99d6 --- /dev/null +++ b/precomp/admin/pcbcfg.cfg @@ -0,0 +1,3 @@ +define=bit64 +comp5=yes +define=comp5 diff --git a/precomp/admin/pcscfg.cfg b/precomp/admin/pcscfg.cfg new file mode 100644 index 0000000..b099f69 --- /dev/null +++ b/precomp/admin/pcscfg.cfg @@ -0,0 +1,5 @@ +sys_include=($ORACLE_HOME/sdk/include,/usr/include,/usr/lib/gcc-lib/x86_64-redhat-linux/3.2.3/include,/usr/lib/gcc/x86_64-redhat-linux/4.1.1/include,/usr/lib64/gcc/x86_64-suse-linux/4.1.2/include,/usr/lib64/gcc/x86_64-suse-linux/4.3/include,/usr/lib/gcc/x86_64-redhat-linux/4.4.4/include) +sys_include=/usr/lib/gcc/i686-redhat-linux/4.4.6/include +sys_include=/usr/lib/gcc/i686-redhat-linux/4.4.7/include +ltype=short +define=__x86_64__ diff --git a/sdk/SDK_README b/sdk/SDK_README new file mode 100644 index 0000000..177f5d9 --- /dev/null +++ b/sdk/SDK_README @@ -0,0 +1,16 @@ +SDK Package Information +======================= + +Sat Aug 24 17:31:06 GMT 2013 + +Client Shared Library 64-bit - 11.2.0.4.0 + +System name: Linux +Release: 2.6.9-103.0.0.0.1.ELxenU +Version: #1 SMP Thu Dec 8 11:00:30 EST 2011 +Machine: x86_64 + +Operating in ORACLE_HOME environment. +Small timezone file = /ade/b/2960201551/oracle/oracore/zoneinfo/timezone_14.dat +Large timezone file = /ade/b/2960201551/oracle/oracore/zoneinfo/timezlrg_14.dat + diff --git a/sdk/demo/cdemo81.c b/sdk/demo/cdemo81.c new file mode 100755 index 0000000..f9db754 --- /dev/null +++ b/sdk/demo/cdemo81.c @@ -0,0 +1,445 @@ +#ifdef RCSID +static char *RCSid = + "$Header: cdemo81.c 14-apr-2006.10:55:52 lburgess Exp $ "; +#endif /* RCSID */ + +/* Copyright (c) 1996, 2006, Oracle. All rights reserved. +*/ + +/* + + NAME + cdemo81.c - Basic OCI V8 functionality + + DESCRIPTION + + * An example program which adds new employee + * records to the personnel data base. Checking + * is done to insure the integrity of the data base. + * The employee numbers are automatically selected using + * the current maximum employee number as the start. + * + * The program queries the user for data as follows: + * + * Enter employee name: + * Enter employee job: + * Enter employee salary: + * Enter employee dept: + * + * The program terminates if return key (CR) is entered + * when the employee name is requested. + * + * If the record is successfully inserted, the following + * is printed: + * + * "ename" added to department "dname" as employee # "empno" + + Demonstrates creating a connection, a session and executing some SQL. + Also shows the usage of allocating memory for application use which has the + life time of the handle. + + MODIFIED (MM/DD/YY) + lburgess 04/14/06 - lowercase passwords + aliu 04/21/06 - use OCIEnvCreate and exit if it fails + mjaeger 07/14/99 - bug 808870: OCCS: convert tabs, no long lines + dchatter 10/14/98 - add the usage of xtrmemsz and usrmempp + azhao 06/23/97 - Use OCIBindByPos, OCIBindByName; clean up + echen 12/17/96 - OCI beautification + dchatter 07/18/96 - delete spurious header files + dchatter 07/15/96 - hda is a ub4 array to prevent bus error + mgianata 06/17/96 - change ociisc() to OCISessionBegin() + aroy 04/26/96 - change OCITransCommitt -> OCITransCommit + slari 04/24/96 - use OCITransCommitt + aroy 02/21/96 - fix bug in get descriptor handle call + lchidamb 02/20/96 - cdemo81.c converted for v8 OCI + lchidamb 02/20/96 - Creation + +*/ + + +#include +#include +#include +#include + +static text *username = (text *) "SCOTT"; +static text *password = (text *) "tiger"; + +/* Define SQL statements to be used in program. */ +static text *insert = (text *)"INSERT INTO emp(empno, ename, job, sal, deptno)\ + VALUES (:empno, :ename, :job, :sal, :deptno)"; +static text *seldept = (text *)"SELECT dname FROM dept WHERE deptno = :1"; +static text *maxemp = (text *)"SELECT NVL(MAX(empno), 0) FROM emp"; +static text *selemp = (text *)"SELECT ename, job FROM emp"; + +static OCIEnv *envhp; +static OCIError *errhp; + +static void checkerr(/*_ OCIError *errhp, sword status _*/); +static void cleanup(/*_ void _*/); +static void myfflush(/*_ void _*/); +int main(/*_ int argc, char *argv[] _*/); + +static sword status; + +int main(argc, argv) +int argc; +char *argv[]; +{ + + sword empno, sal, deptno; + sword len, len2, rv, dsize, dsize2; + sb4 enamelen = 10; + sb4 joblen = 9; + sb4 deptlen = 14; + sb2 sal_ind, job_ind; + sb2 db_type, db2_type; + sb1 name_buf[20], name2_buf[20]; + text *cp, *ename, *job, *dept; + + sb2 ind[2]; /* indicator */ + ub2 alen[2]; /* actual length */ + ub2 rlen[2]; /* return length */ + + OCIDescribe *dschndl1 = (OCIDescribe *) 0, + *dschndl2 = (OCIDescribe *) 0, + *dschndl3 = (OCIDescribe *) 0; + + OCISession *authp = (OCISession *) 0; + OCIServer *srvhp; + OCISvcCtx *svchp; + OCIStmt *inserthp, + *stmthp, + *stmthp1; + OCIDefine *defnp = (OCIDefine *) 0; + + OCIBind *bnd1p = (OCIBind *) 0; /* the first bind handle */ + OCIBind *bnd2p = (OCIBind *) 0; /* the second bind handle */ + OCIBind *bnd3p = (OCIBind *) 0; /* the third bind handle */ + OCIBind *bnd4p = (OCIBind *) 0; /* the fourth bind handle */ + OCIBind *bnd5p = (OCIBind *) 0; /* the fifth bind handle */ + OCIBind *bnd6p = (OCIBind *) 0; /* the sixth bind handle */ + + sword errcode = 0; + + errcode = OCIEnvCreate((OCIEnv **) &envhp, (ub4) OCI_DEFAULT, + (dvoid *) 0, (dvoid * (*)(dvoid *,size_t)) 0, + (dvoid * (*)(dvoid *, dvoid *, size_t)) 0, + (void (*)(dvoid *, dvoid *)) 0, (size_t) 0, (dvoid **) 0); + + if (errcode != 0) { + (void) printf("OCIEnvCreate failed with errcode = %d.\n", errcode); + exit(1); + } + + (void) OCIHandleAlloc( (dvoid *) envhp, (dvoid **) &errhp, OCI_HTYPE_ERROR, + (size_t) 0, (dvoid **) 0); + + /* server contexts */ + (void) OCIHandleAlloc( (dvoid *) envhp, (dvoid **) &srvhp, OCI_HTYPE_SERVER, + (size_t) 0, (dvoid **) 0); + + (void) OCIHandleAlloc( (dvoid *) envhp, (dvoid **) &svchp, OCI_HTYPE_SVCCTX, + (size_t) 0, (dvoid **) 0); + + (void) OCIServerAttach( srvhp, errhp, (text *)"", strlen(""), 0); + + /* set attribute server context in the service context */ + (void) OCIAttrSet( (dvoid *) svchp, OCI_HTYPE_SVCCTX, (dvoid *)srvhp, + (ub4) 0, OCI_ATTR_SERVER, (OCIError *) errhp); + + (void) OCIHandleAlloc((dvoid *) envhp, (dvoid **)&authp, + (ub4) OCI_HTYPE_SESSION, (size_t) 0, (dvoid **) 0); + + (void) OCIAttrSet((dvoid *) authp, (ub4) OCI_HTYPE_SESSION, + (dvoid *) username, (ub4) strlen((char *)username), + (ub4) OCI_ATTR_USERNAME, errhp); + + (void) OCIAttrSet((dvoid *) authp, (ub4) OCI_HTYPE_SESSION, + (dvoid *) password, (ub4) strlen((char *)password), + (ub4) OCI_ATTR_PASSWORD, errhp); + + checkerr(errhp, OCISessionBegin ( svchp, errhp, authp, OCI_CRED_RDBMS, + (ub4) OCI_DEFAULT)); + + (void) OCIAttrSet((dvoid *) svchp, (ub4) OCI_HTYPE_SVCCTX, + (dvoid *) authp, (ub4) 0, + (ub4) OCI_ATTR_SESSION, errhp); + + checkerr(errhp, OCIHandleAlloc( (dvoid *) envhp, (dvoid **) &stmthp, + OCI_HTYPE_STMT, (size_t) 0, (dvoid **) 0)); + + checkerr(errhp, OCIHandleAlloc( (dvoid *) envhp, (dvoid **) &stmthp1, + OCI_HTYPE_STMT, (size_t) 0, (dvoid **) 0)); + + /* Retrieve the current maximum employee number. */ + checkerr(errhp, OCIStmtPrepare(stmthp, errhp, maxemp, + (ub4) strlen((char *) maxemp), + (ub4) OCI_NTV_SYNTAX, (ub4) OCI_DEFAULT)); + + /* bind the input variable */ + checkerr(errhp, OCIDefineByPos(stmthp, &defnp, errhp, 1, (dvoid *) &empno, + (sword) sizeof(sword), SQLT_INT, (dvoid *) 0, (ub2 *)0, + (ub2 *)0, OCI_DEFAULT)); + + /* execute and fetch */ + if (status = OCIStmtExecute(svchp, stmthp, errhp, (ub4) 1, (ub4) 0, + (CONST OCISnapshot *) NULL, (OCISnapshot *) NULL, OCI_DEFAULT)) + { + if (status == OCI_NO_DATA) + empno = 10; + else + { + checkerr(errhp, status); + cleanup(); + return OCI_ERROR; + } + } + + + /* + * When we bind the insert statement we also need to allocate the storage + * of the employee name and the job description. + * Since the lifetime of these buffers are the same as the statement, we + * will allocate it at the time when the statement handle is allocated; this + * will get freed when the statement disappears and there is less + * fragmentation. + * + * sizes required are enamelen+2 and joblen+2 to allow for \n and \0 + * + */ + + + checkerr(errhp, OCIHandleAlloc( (dvoid *) envhp, (dvoid **) &inserthp, + OCI_HTYPE_STMT, (size_t) enamelen + 2 + joblen + 2, + (dvoid **) &ename)); + job = (text *) (ename+enamelen+2); + + + checkerr(errhp, OCIStmtPrepare(stmthp, errhp, insert, + (ub4) strlen((char *) insert), + (ub4) OCI_NTV_SYNTAX, (ub4) OCI_DEFAULT)); + + checkerr(errhp, OCIStmtPrepare(stmthp1, errhp, seldept, + (ub4) strlen((char *) seldept), + (ub4) OCI_NTV_SYNTAX, (ub4) OCI_DEFAULT)); + + + /* Bind the placeholders in the INSERT statement. */ + if ((status = OCIBindByName(stmthp, &bnd1p, errhp, (text *) ":ENAME", + -1, (dvoid *) ename, + enamelen+1, SQLT_STR, (dvoid *) 0, + (ub2 *) 0, (ub2 *) 0, (ub4) 0, (ub4 *) 0, OCI_DEFAULT)) || + (status = OCIBindByName(stmthp, &bnd2p, errhp, (text *) ":JOB", + -1, (dvoid *) job, + joblen+1, SQLT_STR, (dvoid *) &job_ind, + (ub2 *) 0, (ub2 *) 0, (ub4) 0, (ub4 *) 0, OCI_DEFAULT)) || + (status = OCIBindByName(stmthp, &bnd3p, errhp, (text *) ":SAL", + -1, (dvoid *) &sal, + (sword) sizeof(sal), SQLT_INT, (dvoid *) &sal_ind, + (ub2 *) 0, (ub2 *) 0, (ub4) 0, (ub4 *) 0, OCI_DEFAULT)) || + (status = OCIBindByName(stmthp, &bnd4p, errhp, (text *) ":DEPTNO", + -1, (dvoid *) &deptno, + (sword) sizeof(deptno), SQLT_INT, (dvoid *) 0, + (ub2 *) 0, (ub2 *) 0, (ub4) 0, (ub4 *) 0, OCI_DEFAULT)) || + (status = OCIBindByName(stmthp, &bnd5p, errhp, (text *) ":EMPNO", + -1, (dvoid *) &empno, + (sword) sizeof(empno), SQLT_INT, (dvoid *) 0, + (ub2 *) 0, (ub2 *) 0, (ub4) 0, (ub4 *) 0, OCI_DEFAULT))) + { + checkerr(errhp, status); + cleanup(); + return OCI_ERROR; + } + + /* Bind the placeholder in the "seldept" statement. */ + if (status = OCIBindByPos(stmthp1, &bnd6p, errhp, 1, + (dvoid *) &deptno, (sword) sizeof(deptno),SQLT_INT, + (dvoid *) 0, (ub2 *) 0, (ub2 *) 0, (ub4) 0, (ub4 *) 0, OCI_DEFAULT)) + { + checkerr(errhp, status); + cleanup(); + return OCI_ERROR; + } + + /* Allocate the dept buffer now that you have length. */ + /* the deptlen should eventually get from dschndl3. */ + deptlen = 14; + dept = (text *) malloc((size_t) deptlen + 1); + + /* Define the output variable for the select-list. */ + if (status = OCIDefineByPos(stmthp1, &defnp, errhp, 1, + (dvoid *) dept, deptlen+1, SQLT_STR, + (dvoid *) 0, (ub2 *) 0, (ub2 *) 0, OCI_DEFAULT)) + { + checkerr(errhp, status); + cleanup(); + return OCI_ERROR; + } + + for (;;) + { + /* Prompt for employee name. Break on no name. */ + printf("\nEnter employee name (or CR to EXIT): "); + fgets((char *) ename, (int) enamelen+1, stdin); + cp = (text *) strchr((char *) ename, '\n'); + if (cp == ename) + { + printf("Exiting... "); + cleanup(); + return OCI_SUCCESS; + } + if (cp) + *cp = '\0'; + else + { + printf("Employee name may be truncated.\n"); + myfflush(); + } + /* Prompt for the employee's job and salary. */ + printf("Enter employee job: "); + job_ind = 0; + fgets((char *) job, (int) joblen + 1, stdin); + cp = (text *) strchr((char *) job, '\n'); + if (cp == job) + { + job_ind = -1; /* make it NULL in table */ + printf("Job is NULL.\n");/* using indicator variable */ + } + else if (cp == 0) + { + printf("Job description may be truncated.\n"); + myfflush(); + } + else + *cp = '\0'; + + printf("Enter employee salary: "); + scanf("%d", &sal); + myfflush(); + sal_ind = (sal <= 0) ? -2 : 0; /* set indicator variable */ + + /* + * Prompt for the employee's department number, and verify + * that the entered department number is valid + * by executing and fetching. + */ + do + { + printf("Enter employee dept: "); + scanf("%d", &deptno); + myfflush(); + if ((status = OCIStmtExecute(svchp, stmthp1, errhp, (ub4) 1, (ub4) 0, + (CONST OCISnapshot *) NULL, (OCISnapshot *) NULL, OCI_DEFAULT)) + && (status != OCI_NO_DATA)) + { + checkerr(errhp, status); + cleanup(); + return OCI_ERROR; + } + if (status == OCI_NO_DATA) + printf("The dept you entered doesn't exist.\n"); + } while (status == OCI_NO_DATA); + + /* + * Increment empno by 10, and execute the INSERT + * statement. If the return code is 1 (duplicate + * value in index), then generate the next + * employee number. + */ + empno += 10; + if ((status = OCIStmtExecute(svchp, stmthp, errhp, (ub4) 1, (ub4) 0, + (CONST OCISnapshot *) NULL, (OCISnapshot *) NULL, OCI_DEFAULT)) + && status != 1) + { + checkerr(errhp, status); + cleanup(); + return OCI_ERROR; + } + while (status == 1) + { + empno += 10; + if ((status = OCIStmtExecute(svchp, stmthp, errhp, (ub4) 1, (ub4) 0, + (CONST OCISnapshot *) NULL, (OCISnapshot *) NULL, OCI_DEFAULT)) + && status != 1) + { + checkerr(errhp, status); + cleanup(); + return OCI_ERROR; + } + } /* end for (;;) */ + + /* Commit the change. */ + if (status = OCITransCommit(svchp, errhp, 0)) + { + checkerr(errhp, status); + cleanup(); + return OCI_ERROR; + } + printf("\n\n%s added to the %s department as employee number %d\n", + ename, dept, empno); + } +} + + +void checkerr(errhp, status) +OCIError *errhp; +sword status; +{ + text errbuf[512]; + sb4 errcode = 0; + + switch (status) + { + case OCI_SUCCESS: + break; + case OCI_SUCCESS_WITH_INFO: + (void) printf("Error - OCI_SUCCESS_WITH_INFO\n"); + break; + case OCI_NEED_DATA: + (void) printf("Error - OCI_NEED_DATA\n"); + break; + case OCI_NO_DATA: + (void) printf("Error - OCI_NODATA\n"); + break; + case OCI_ERROR: + (void) OCIErrorGet((dvoid *)errhp, (ub4) 1, (text *) NULL, &errcode, + errbuf, (ub4) sizeof(errbuf), OCI_HTYPE_ERROR); + (void) printf("Error - %.*s\n", 512, errbuf); + break; + case OCI_INVALID_HANDLE: + (void) printf("Error - OCI_INVALID_HANDLE\n"); + break; + case OCI_STILL_EXECUTING: + (void) printf("Error - OCI_STILL_EXECUTE\n"); + break; + case OCI_CONTINUE: + (void) printf("Error - OCI_CONTINUE\n"); + break; + default: + break; + } +} + + +/* + * Exit program with an exit code. + */ +void cleanup() +{ + if (envhp) + (void) OCIHandleFree((dvoid *) envhp, OCI_HTYPE_ENV); + return; +} + + +void myfflush() +{ + eb1 buf[50]; + + fgets((char *) buf, 50, stdin); +} + + +/* end of file cdemo81.c */ + diff --git a/sdk/demo/demo.mk b/sdk/demo/demo.mk new file mode 100755 index 0000000..78dfb0c --- /dev/null +++ b/sdk/demo/demo.mk @@ -0,0 +1,153 @@ +#/bin/make +############################################################################### +# Make file for OCI and OCCI demos +############################################################################### +# Usage : +# For compiling & linking the cdemo81.c file +# make -f demo.mk buildoci EXE=cdemo81 OBJS=cdemo81.o +# +# For compiling & linking the occidml.cpp +# make -f demo.mk buildocci EXE=occidml OBJS=occidml.o +# +# For compiling & linking the occiobj.cpp +# make -f demo.mk occiobj +# +# In general, for any occi program +# make -f demo.mk buildocci EXE= OBJS="" +# +# For compiling all demos +# make -f demo.mk +# +# NOTE: Please change cc and CC to point to the appropiate location on your +# machine. +# +############################################################################### + +.SUFFIXES: .o .c .cpp + +CC=/opt/SunProd/SUNWspro6.1/bin/CC +cc=/opt/SunProd/SUNWspro6.1/bin/cc + +ICINCHOME=../ +ICLIBHOME=../../ +ICLIBPATH=-L$(ICLIBHOME) +THREADLIBS=-lthread +CCLIB=$(ICLIBPATH) -locci -lclntsh $(THREADLIBS) + +CCINCLUDES = -I$(ICINCHOME)include + +CCFLAGS=$(CCINCLUDES) -D_REENTRANT -g -xs +LDFLAGS= +SO_EXT=.so + +REMOVE=rm -rf +MKLINK=ln +MAKE=make +MAKEFILE=demo.mk +CLNCACHE=cleancache +CACHEDIR=SunWS_cache + +CDEMOEXE=cdemo81 +CDEMOOBJS=cdemo81.o +OCCIDEMO=occidml +OCCIOBJDEMO=occiobj +OTT=../ott +OCCIOTTUSR=hr +OCCIOTTPWD=hr + +.cpp.o: + $(CC) -c -I$(ICINCHOME)include $(CCFLAGS) $< + +.c.o: + $(cc) -c -I$(ICINCHOME)include $(CCFLAGS) $< + +all: clean buildoci $(OCCIDEMO) $(OCCIOBJDEMO) + +buildoci: $(CLNCACHE) $(LIBCLNT) $(CDEMOOBJS) + $(MKLINK) $(ICLIBHOME)libclntsh$(SO_EXT).11.1 $(ICLIBHOME)libclntsh$(SO_EXT) + $(MKLINK) $(ICLIBHOME)libocci$(SO_EXT).11.1 $(ICLIBHOME)libocci$(SO_EXT) + $(CC) -o $(CDEMOEXE) $(LDFLAGS) $(CDEMOOBJS) $(CCLIB) + $(REMOVE) $(ICLIBHOME)libclntsh$(SO_EXT) + $(REMOVE) $(ICLIBHOME)libocci$(SO_EXT) + +buildocci: $(CLNCACHE) $(LIBCLNT) $(OBJS) + $(MKLINK) $(ICLIBHOME)libclntsh$(SO_EXT).11.1 $(ICLIBHOME)libclntsh$(SO_EXT) + $(MKLINK) $(ICLIBHOME)libocci$(SO_EXT).11.1 $(ICLIBHOME)libocci$(SO_EXT) + $(CC) -o $(EXE) $(LDFLAGS) $(OBJS) $(CCLIB) + $(REMOVE) $(ICLIBHOME)libclntsh$(SO_EXT) + $(REMOVE) $(ICLIBHOME)libocci$(SO_EXT) + +$(OCCIDEMO): + $(MAKE) -f $(MAKEFILE) buildocci OBJS=$@.o EXE=$@ + +$(OCCIOBJDEMO): + $(OTT) userid=$(OCCIOTTUSR)/$(OCCIOTTPWD) \ + intype=$@.typ \ + outtype=$@out.type \ + code=cpp \ + hfile=$@.h \ + cppfile=$@o.cpp \ + attraccess=private \ + unicode=none + $(MAKE) -f $(MAKEFILE) buildocci OBJS="$@.o $@m.o $@o.o" EXE=$@ + +cleancache: + $(REMOVE) $(CACHEDIR) + $(REMOVE) $(ICLIBHOME)libclntsh$(SO_EXT) + $(REMOVE) $(ICLIBHOME)libocci$(SO_EXT) + +clean: $(CLNCACHE) + $(REMOVE) cdemo81 cdemo81.o occidml occidml.o occiobj occiobj.o occiobjo* occiobjm* occiobj.h occiobjout.type + + + +# +# This port-specific file is currently empty on Solaris. Product +# lines may use this file to override compiler definitions and +# flags used in occi.mk. +# + +# Linux compiler definitions +CC=/usr/bin/gcc +cc=/usr/bin/gcc + +ifeq ($(BUILD32),T) +CCFLAGS=$(CCINCLUDES) -DLINUX -D_GNU_SOURCE -D_REENTRANT -g -m32 +LDFLAGS=-g -m32 +else +CCFLAGS=$(CCINCLUDES) -DLINUX -D_GNU_SOURCE -D_REENTRANT -g +LDFLAGS=-g +endif +CLNCACHE= + +# This macro CCINCLUDES has to be redefined on Linux because of +# the existence of the 'new' directory in t_work. The name new +# clashes with a system header file. +CCINCLUDES = -I$(SRCHOME)/rdbms/public/ \ +-I$(SRCHOME)/oracore/include -I$(SRCHOME)/oracore/public \ +-I$(SRCHOME)/oracore/port/include \ +-I$(SRCHOME)/nlsrtl/include -I$(SRCHOME)/plsql/public \ +-I$(SRCHOME)/plsql/include -I$(SRCHOME)/network/public \ +-I$(SRCHOME)/network/include -I$(SRCHOME)/otrace/public \ +-I$(SRCHOME)/otrace/include/ -I$(SRCHOME)/precomp/public \ +-I$(SRCHOME)/precomp/include/ -I$(SRCHOME)/slax/include \ +-I$(SRCHOME)/ordts/public -I$(SRCHOME)/ordts/include \ +-I$(SRCHOME)/javavm/include \ +-I$(SRCHOME)/javavm/include/osds/unix/solaris \ +-I$(SRCHOME)/ctx/public -I$(SRCHOME)/ordvir/public \ +-I$(SRCHOME)/ordvir/include -I$(SRCHOME)/rdbms/src/hdir \ +-idirafter . + +THREADLIBS=-lpthread + +ifdef BUILD_CCC296 +CC=/usr/bin/g++296 +CCFLAGS = -include /ee/dev/bastring.h $(CCINCLUDES) -wchar-stdc++ -DLINUX -D_GNU_SOURCE -D_REENTRANT -g +endif + +ifdef BUILD_ICC +COMPDIR=/usr/local/packages/icc_remote/10.1.022 +CC=$(COMPDIR)/bin/icpc +CCFLAGS += -DOCCI_NO_WSTRING=1 +endif + diff --git a/sdk/demo/demo_proc_ic.mk b/sdk/demo/demo_proc_ic.mk new file mode 100755 index 0000000..107f6a9 --- /dev/null +++ b/sdk/demo/demo_proc_ic.mk @@ -0,0 +1,128 @@ +#/bin/make +############################################################################### +# Make file for PROC demos +############################################################################### +# Usage : +# For compiling proc demos +# make -f demo_proc_ic.mk +# +# For precompiling, compiling & linking the procdemo.pc file +# make -f demo_proc_ic.mk build EXE=procdemo OBJS=procdemo.o +# +# In general, for any proc program +# make -f demo_proc_ic.mk build EXE= OBJS="" +# +# To make use of any PROC options during precompilation, +# make -f demo_proc_ic.mk build PROCFLAGS="" +# EXE= OBJS="" +# +# NOTES: +# 1. Please change "cc/CC" and the "InstantClient directories" to point to +# appropiate locations on your machine before using this makefile. +# 2. In case of RPM installation, please change the following variables +# as mentioned below: +# PROC=/usr/lib/oracle/VV.v/client/bin/proc +# CCINCLUDES=$(I_SYM)/usr/include/oracle/VV.v/client +# PRECOMPPUBH=/usr/include/oracle/VV.v/client +# ICLIBHOME=/usr/lib/oracle/VV.v/client/lib/ +# Legend: +# VV - Major Oracle version number +# v - Minor Oracle version number +# (Ex: For the release 11.2, VV = 11 and v = 2) +# +############################################################################### + + +CC=/usr/bin/gcc +cc=/usr/bin/gcc + +# InstantClient Directories. +ICSDKHOME=../ +ICLIBHOME=../../ + +MKLINK=ln +REMOVE=rm -rf +CLNCACHE=cleancache +CACHEDIR=SunWS_cachea +MAKE=make +MAKEFILE=demo_proc_ic.mk +PROCDEMO=procdemo + +PROC=$(ICSDKHOME)proc +SO_EXT=.so +I_SYM=-I + +CCINCLUDES= $(I_SYM)$(ICSDKHOME)include + +# Pre-compiler Flags. +PRECOMP_INCLUDE=$(I_SYM). $(SYS_INCLUDE) +PRECOMPPUBH=$(ICSDKHOME)include +SYS_INCLUDE=sys_include=\($(PRECOMPPUBH),/usr/include,/usr/lib/gcc-lib/x86_64-redhat-linux/3.2.3/include,/usr/lib/gcc/x86_64-redhat-linux/4.1.1/include,/usr/lib64/gcc/x86_64-suse-linux/4.1.2/include,/usr/lib64/gcc/x86_64-suse-linux/4.3/include,/usr/lib/gcc/x86_64-redhat-linux/4.4.6/include,/usr/lib/gcc/x86_64-redhat-linux/4.4.7/include\) + +# Compiler Flags. +OPTIMIZE=-O2 +LDPATHFLAG=-L +SPFLAGS=-DLINUX -D_GNU_SOURCE -D_LARGEFILE64_SOURCE=1 -D_LARGEFILE_SOURCE=1 -DSLTS_ENABLE -DSLMXMX_ENABLE -D_REENTRANT -DNS_THREADS +CCFLAGS= -fPIC -DPRECOMP +LDFLAGS=-g +LPFLAGS= +GFLAG= +CDEBUG= +USRFLAGS= +ICLIBPATH=$(LDPATHFLAG)$(ICLIBHOME) +PFLAGS=$(CCINCLUDES) $(SPFLAGS) $(LPFLAGS) +CFLAGS=$(GFLAG) $(OPTIMIZE) $(CDEBUG) $(CCFLAGS) $(PFLAGS) $(USRFLAGS) + +# Libraries. +PROLDLIBS=$(LDCLIENTLIBS) $(THREADLIBS) +LDCLIENTLIBS=$(ICLIBPATH) $(LLIBCLNTSH) $(LDLIBS) +LLIBCLNTSH=$(LDLIBFLAG)$(LIBCLNTSHNAME) +LDLIBFLAG=-l +LIBCLNTSHNAME=clntsh +LDLIBS=$(EXSYSLIBS) $(MATHLIB) $(USRLIBS) +EXSYSLIBS=-ldl +MATHLIB=-lm +THREADLIBS=-lpthread + +C2O=$(CC) $(CFLAGS) -c $*.c +PCC2C=$(PROC) $(PROCFLAGS) iname=$(PCCSRC) $(PRECOMP_INCLUDE) +DEMO_PROC_BUILD=$(CC) -o $(EXE) $(OBJS) $(LDFLAGS) $(PROLDLIBS) + +#----------------------------------------------------------------------------- +# Targets for building the proc sample programs. +all: clean $(PROCDEMO) + +$(PROCDEMO): + $(MAKE) -f $(MAKEFILE) build OBJS=$@.o EXE=$@ + +build: $(CLNCACHE) $(OBJS) + $(MKLINK) $(ICLIBHOME)libclntsh$(SO_EXT).11.1 $(ICLIBHOME)libclntsh$(SO_EXT) + $(DEMO_PROC_BUILD) + $(REMOVE) $(ICLIBHOME)libclntsh$(SO_EXT) + +#----------------------------------------------------------------------------- +# Here are some rules for converting .pc -> .c -> .o +.SUFFIXES: .pc .c .o + +pc1: + $(PCC2C) + +.pc.c: + $(MAKE) -f $(MAKEFILE) PROCFLAGS="$(PROCFLAGS)" PCCSRC=$* I_SYM=include= pc1 + +.pc.o: + $(MAKE) -f $(MAKEFILE) PROCFLAGS="$(PROCFLAGS)" PCCSRC=$* I_SYM=include= pc1 + $(C2O) + +.c.o: + $(C2O) + +#----------------------------------------------------------------------------- +# Clean up all executables, *.o and generated *.c files +clean: $(CLNCACHE) + $(REMOVE) $(PROCDEMO) $(PROCDEMO).o $(PROCDEMO).c $(PROCDEMO).lis + +cleancache: + $(REMOVE) $(CACHEDIR) + $(REMOVE) $(ICLIBHOME)libclntsh$(SO_EXT) + diff --git a/sdk/demo/demo_procob_ic.mk b/sdk/demo/demo_procob_ic.mk new file mode 100755 index 0000000..25723ed --- /dev/null +++ b/sdk/demo/demo_procob_ic.mk @@ -0,0 +1,99 @@ + +############################################################################### +# Make file for PROCOB demos +############################################################################### +# Usage : +# For compiling procob demos +# make -f demo_procob_ic.mk +# +# For precompiling, compiling & linking the procobdemo.pco file +# make -f demo_procob_ic.mk build EXE=procobdemo COBS=procobdemo.cob +# +# In general, for any procob program +# make -f demo_procob_ic.mk build EXE= COBS="" +# To make use of any PROCOB options during precompilation, +# make -f demo_procob_ic.mk build PROCOBFLAGS="" +# EXE= COBS="" +# +# NOTES: +# 1. Please change "COB" and the "InstantClient directories" to point to +# appropiate locations on your machine before using this makefile. +# 2. In case of RPM installation, please change the following variables +# as mentioned below: +# PROCOB=/usr/lib/oracle/VV.v/client/bin/procob +# ICLIBHOME=/usr/lib/oracle/VV.v/client/lib/ +# Legend: +# VV - Major Oracle version number +# v - Minor Oracle version number +# (Ex: For the release 11.2, VV = 11 and v = 2) +# +############################################################################### + +COB=cob + +# InstantClient Directories. +ICSDKHOME=../ +ICLIBHOME=../../ + +MKLINK=ln +REMOVE=rm -rf +CLNCACHE=cleancache +CACHEDIR=SunWS_cachea +MAKE=make +MAKEFILE=demo_procob_ic.mk +PROCOBDEMO=procobdemo + +PROCOB=$(ICSDKHOME)/procob +ICLIBPATH=$(LDPATHFLAG)$(ICLIBHOME) +SO_EXT=.so +COBFLAGS=-C IBMCOMP -C NESTCALL -t -x +LDPATHFLAG=-L +COBSQLINTF=$(ICLIBHOME)cobsqlintf.o +LDLIBS=$(EXSYSLIBS) $(MATHLIB) $(USRLIBS) +EXSYSLIBS=-ldl +MATHLIB=-lm +COBOL_PROLDLIBS=$(SHARED_CLIENTLIBS) $(LDLIBS) +SHARED_CLIENTLIBS=$(LLIBCLNTSH) $(LDFLAGS) +LLIBCLNTSH=$(LDLIBFLAG)$(LIBCLNTSHNAME) +LDLIBFLAG=-l +LIBCLNTSHNAME=clntsh +LDFLAGS=-g + +DEMO_PROCOB_BUILD=$(COB) $(COBFLAGS) -o $(EXE) $(COBS) $(ICLIBPATH) $(COBSQLINTF) $(COBOL_PROLDLIBS) + +#----------------------------------------------------------------------------- +# Targets for building the procob sample programs. +# +# The target 'build' puts together an executable $(EXE) from the cobol +# sources in $(COBS) and the libraries in $(COBOL_PROLDLIBS). +# The rules to make .cob files from .pco files are later in this file. +# +all: clean $(PROCOBDEMO) + +$(PROCOBDEMO): + $(MAKE) -f $(MAKEFILE) build COBS=$@.cob EXE=$@ + +build: $(CLNCACHE) $(COBS) + $(MKLINK) $(ICLIBHOME)libclntsh$(SO_EXT).11.1 $(ICLIBHOME)libclntsh$(SO_EXT) + $(DEMO_PROCOB_BUILD) + $(REMOVE) $(ICLIBHOME)libclntsh$(SO_EXT) + +#----------------------------------------------------------------------------- +# Here are some rules for converting .pco -> .cob -> .o and for .cob -> .gnt. +# +.SUFFIXES: .cob .cbl .o .pco $(GNT) + +.pco.cob: + $(PROCOB) $(PROCOBFLAGS) iname=$*.pco + +.cob$(GNT): + $(COB2GNT) + +#----------------------------------------------------------------------------- +# Clean up all executables, *.o and generated *.cob files +clean: $(CLNCACHE) + $(REMOVE) $(PROCOBDEMO) $(PROCOBDEMO).o $(PROCOBDEMO).cob $(PROCDEMO).lis $(PROCOBDEMO).int $(PROCOBDEMO).idy + +cleancache: + $(REMOVE) $(CACHEDIR) + $(REMOVE) $(ICLIBHOME)libclntsh$(SO_EXT) diff --git a/sdk/demo/occidemo.sql b/sdk/demo/occidemo.sql new file mode 100755 index 0000000..6d1c6a8 --- /dev/null +++ b/sdk/demo/occidemo.sql @@ -0,0 +1,344 @@ +/* Copyright (c) 2002, 2004, Oracle. All rights reserved. */ + +/* + NAME + occidemo.sql - Create OCCI demo objects + + DESCRIPTION + SQL Script to create OCCI demo objects + Assumes HR schema is setup + Assumes system's account passwd to be manager + Execute this before any of the OCCI demos are run + To drop the objects created by this SQL use occidemod.sql + + MODIFIED + sudsrini 03/06/03 - sudsrini_occi_10ir1_demos (include occidemod) + idcqe 03/13/01 - Created + +*/ + + +/* Drop objects before creating them */ + +@occidemod.sql + +connect hr/hr + +CREATE TABLE elements ( + element_name VARCHAR2(25), + molar_volume BINARY_FLOAT, + atomic_weight BINARY_DOUBLE +); + +CREATE TABLE author_tab ( + author_id NUMBER, + author_name VARCHAR2(25) +); + +INSERT INTO author_tab (author_id, author_name) VALUES (333, 'JOE'); +INSERT INTO author_tab (author_id, author_name) VALUES (444, 'SMITH'); + +CREATE OR REPLACE TYPE publ_address AS OBJECT ( + street_no NUMBER, + city VARCHAR2(25) +) +/ + +CREATE TABLE publisher_tab ( + publisher_id NUMBER, + publisher_add publ_address +); + +INSERT INTO publisher_tab (publisher_id, publisher_add) VALUES +(11, publ_address (121, 'NEW YORK')); + +CREATE TABLE publ_address_tab OF publ_address; + +INSERT INTO publ_address_tab VALUES (22, 'BOSTON'); +INSERT INTO publ_address_tab VALUES (33, 'BUFFALO'); +INSERT INTO publ_address_tab VALUES (44, 'CALIFORNIA'); + + +CREATE OR REPLACE TYPE journal AS TABLE OF VARCHAR2(50) +/ +CREATE TABLE journal_tab (jid NUMBER, jname journal) +NESTED TABLE jname STORE AS journal_store; + +INSERT INTO journal_tab (jid, jname) VALUES (22, journal ('NATION', 'TIMES')); +INSERT INTO journal_tab (jid, jname) VALUES (33, journal ('CRICKET', 'ALIVE')); + +CREATE OR REPLACE TYPE people_obj AS OBJECT ( + ssn NUMBER, + name VARCHAR2(25) +) NOT FINAL; +/ + +CREATE OR REPLACE TYPE librarian UNDER people_obj( + empno NUMBER, + sal NUMBER(7,2), + dob DATE, + photo BLOB +) +/ + +CREATE TABLE librarian_tab OF librarian; + +INSERT INTO librarian_tab VALUES +(101, 'DAVE', 1001, 10000, '12-Jan-1970', empty_blob()); +INSERT INTO librarian_tab VALUES +(102, 'BOB', 1002, 12000, '17-Jan-1970', empty_blob()); + +CREATE TABLE article_tab ( + artid NUMBER, + artdesc VARCHAR2(4000), + artsummary LONG, + artfeedbk VARCHAR2(2000) +); + +CREATE OR REPLACE PROCEDURE demo_proc (col1 IN NUMBER, col2 IN OUT VARCHAR2, +col3 OUT CHAR) AS +BEGIN + col2 := col1 || ' ' || col2 || ' ' || 'IN-OUT'; + col3 := 'OUT'; +END; +/ + +CREATE OR REPLACE FUNCTION demo_fun (col1 IN NUMBER, +col2 IN OUT VARCHAR2, col3 OUT CHAR) RETURN CHAR AS +BEGIN + col2 := col1 || ' ' || col2 || ' ' || 'IN-OUT'; + col3 := 'OUT'; + RETURN 'abcd'; +END; +/ + +CREATE TABLE book (bookid NUMBER, summary VARCHAR2(4000)); + +CREATE TABLE cover (c1 NUMBER(5), c2 VARCHAR2(20)); + +DECLARE +ch1 VARCHAR2(4000) := 'aa'; +ch2 VARCHAR2(4000):= ''; +nu NUMBER := 0; +BEGIN + FOR nu IN 1..11 LOOP + ch2 := ch1 || ch2; ch1 := ch2; + END LOOP; + INSERT INTO book (bookid, summary) VALUES (11, ch1); +END; +/ + +CREATE TYPE elecdoc_typ AS OBJECT + ( document_typ VARCHAR2(32) + , formatted_doc BLOB + ) ; +/ +CREATE TYPE elecdoc_tab AS TABLE OF elecdoc_typ; +/ + +CREATE TYPE elheader_typ AS OBJECT + ( header_name VARCHAR2(256) + , creation_date DATE + , header_text VARCHAR2(1024) + , logo BLOB + ); +/ + +CREATE TABLE electronic_media + ( product_id NUMBER(6) + , ad_id NUMBER(6) + , ad_composite BLOB + , ad_sourcetext CLOB + , ad_finaltext CLOB + , ad_fltextn NCLOB + , ad_elecdocs_ntab elecdoc_tab + , ad_photo BLOB + , ad_graphic BFILE + , ad_header elheader_typ + , press_release LONG + ) NESTED TABLE ad_elecdocs_ntab STORE AS elecdocs_nestedtab; +CREATE UNIQUE INDEX printmedia_pk + ON electronic_media (product_id, ad_id); + +ALTER TABLE electronic_media +ADD ( CONSTRAINT printmedia__pk + PRIMARY KEY (product_id, ad_id) + ) ; + + + +CREATE TYPE people_typ AS OBJECT +( + name VARCHAR2(30), + ssn NUMBER, + dob DATE +) not final; +/ + +CREATE TABLE people_tab OF people_typ; + +INSERT INTO people_tab VALUES (people_typ('john', 111, '01-Jan-1970')); +INSERT INTO people_tab VALUES (people_typ('jill', 666, '06-Jan-1976')); + +CREATE TYPE student UNDER people_typ +( + stud_id NUMBER, + teammate REF people_typ +) NOT FINAL; +/ + +CREATE TABLE student_tab OF student; +INSERT INTO student_tab VALUES ('jimmy',222,'02-Feb-1976',200, +(SELECT REF(a) FROM people_tab a where name='john')); + +CREATE TYPE parttime_stud UNDER student +( + course_id NUMBER, + partner REF student +)NOT FINAL; +/ +CREATE TABLE parttime_stud_tab OF parttime_stud; + +INSERT INTO parttime_stud_tab VALUES ('james',333,'03-Feb-1976',300, +(SELECT REF(a) FROM people_tab a where name='john'),3000, +(SELECT REF(a) FROM student_tab a)); + + +CREATE TYPE foreign_student UNDER parttime_stud +( + country VARCHAR2(30), + leader REF parttime_stud +); +/ +CREATE TABLE foreign_student_tab OF foreign_student; + +COMMIT; + + +/* OCCI AQ Objects */ + + +connect system/manager + +grant aq_administrator_role, aq_user_role to hr; +grant execute on dbms_aq to hr; +grant execute on dbms_aqadm to hr; + +BEGIN + dbms_aqadm.grant_system_privilege('ENQUEUE_ANY','hr',FALSE); + dbms_aqadm.grant_system_privilege('DEQUEUE_ANY','hr',FALSE); +END; +/ + +connect hr/hr + +CREATE OR REPLACE TYPE hr_obj AS OBJECT +(a1 NUMBER, a2 VARCHAR2(25)); +/ + +BEGIN + dbms_aqadm.create_queue_table ( + queue_table => 'hr.table01', + queue_payload_type => 'RAW', + comment => 'single-consumer', + multiple_consumers => false, + compatible => '8.1.0' +); +END; +/ + +BEGIN + dbms_aqadm.create_queue ( + queue_name => 'queue01', + queue_table=> 'hr.table01' +); +END; +/ +BEGIN + dbms_aqadm.start_queue(queue_name => 'queue01'); +END; +/ + +BEGIN + dbms_aqadm.create_queue_table ( + queue_table => 'hr.table02', + queue_payload_type => 'SYS.ANYDATA', + comment => 'multi-consumer', + multiple_consumers => true, + compatible => '8.1.0' +); +END; +/ + +BEGIN + dbms_aqadm.create_queue ( + queue_name => 'queue02', + queue_table=> 'hr.table02' +); +END; +/ +BEGIN + dbms_aqadm.start_queue(queue_name => 'queue02'); +END; +/ + +BEGIN + dbms_aqadm.create_queue_table ( + queue_table => 'hr.table03', + queue_payload_type => 'hr_obj', + comment => 'multi-consumer', + multiple_consumers => true, + compatible => '8.1.0' +); +END; +/ + +BEGIN + dbms_aqadm.create_queue ( + queue_name => 'queue03', + queue_table=> 'hr.table03' +); +END; +/ +BEGIN + dbms_aqadm.start_queue(queue_name => 'queue03'); +END; +/ + +BEGIN + dbms_aqadm.create_queue_table ( + queue_table => 'hr.table04', + queue_payload_type => 'RAW', + comment => 'multiple-consumer', + multiple_consumers => true, + compatible => '8.1.0' +); +END; +/ + +BEGIN + dbms_aqadm.create_queue ( + queue_name => 'queue04', + queue_table=> 'hr.table04' +); +END; +/ +BEGIN + dbms_aqadm.start_queue(queue_name => 'queue04'); +END; +/ + +Rem Add default local subscribers to the queues + +BEGIN + dbms_aqadm.add_subscriber( queue_name=> 'queue03', + subscriber=> sys.aq$_agent('AGT1','hr.queue03', 0)); +END; +/ + +BEGIN + dbms_aqadm.add_subscriber( queue_name=> 'queue04', + subscriber=> sys.aq$_agent('AGT1','hr.queue04', 0)); +END; +/ + diff --git a/sdk/demo/occidemod.sql b/sdk/demo/occidemod.sql new file mode 100755 index 0000000..d5d4ce7 --- /dev/null +++ b/sdk/demo/occidemod.sql @@ -0,0 +1,121 @@ +/* Copyright (c) 2002, 2003, Oracle Corporation. All rights reserved. */ + +/* + NAME + occidemod - SQL Script to drop OCCI demo objects + + DESCRIPTION + SQL Script to drop OCCI demo objects created by occidemo.sql + To be run in the end to drop OCCI demo objects from HR schema + + MODIFIED + sudsrini 03/06/03 - sudsrini_occi_10ir1_demos + sudsrini 02/21/03 - Created + +*/ + +connect hr/hr + +DROP PROCEDURE demo_proc; +DROP FUNCTION demo_fun; + +DROP TABLE elements; +DROP TABLE author_tab; +DROP TABLE publisher_tab; +DROP TABLE publ_address_tab; +DROP TABLE journal_tab; +DROP TABLE article_tab; +DROP TABLE librarian_tab; +DROP TABLE book; +DROP TABLE cover; + +DROP TYPE journal; +DROP TYPE publ_address; +DROP TYPE librarian; +DROP TYPE people_obj; + + +DROP TABLE electronic_media; +DROP TYPE elheader_typ; +DROP TYPE elecdoc_tab; +DROP TYPE elecdoc_typ; + +DROP TABLE foreign_student_tab; +DROP TABLE parttime_stud_tab; +DROP TABLE student_tab; +DROP TABLE people_tab; +DROP TYPE foreign_student; +DROP TYPE parttime_stud; +DROP TYPE student; +DROP TYPE people_typ; + +/* OCCI AQ Object */ + +connect system/manager + +revoke aq_administrator_role from hr; + +connect hr/hr + +BEGIN + dbms_aqadm.stop_queue(queue_name => 'queue01'); +END; +/ + +BEGIN + dbms_aqadm.drop_queue('queue01'); +END; +/ + +BEGIN + dbms_aqadm.drop_queue_table('hr.table01'); +END; +/ + +BEGIN + dbms_aqadm.stop_queue(queue_name => 'queue02'); +END; +/ + +BEGIN + dbms_aqadm.drop_queue('queue02'); +END; +/ + +BEGIN + dbms_aqadm.drop_queue_table('hr.table02'); +END; +/ + +BEGIN + dbms_aqadm.stop_queue(queue_name => 'queue03'); +END; +/ + +BEGIN + dbms_aqadm.drop_queue('queue03'); +END; +/ + +BEGIN + dbms_aqadm.drop_queue_table('hr.table03'); +END; +/ + +BEGIN + dbms_aqadm.stop_queue(queue_name => 'queue04'); +END; +/ + +BEGIN + dbms_aqadm.drop_queue('queue04'); +END; +/ + +BEGIN + dbms_aqadm.drop_queue_table('hr.table04'); +END; +/ + +DROP TYPE hr_obj; + diff --git a/sdk/demo/occidml.cpp b/sdk/demo/occidml.cpp new file mode 100755 index 0000000..ec5381c --- /dev/null +++ b/sdk/demo/occidml.cpp @@ -0,0 +1,292 @@ +/* Copyright (c) 2001, 2008, Oracle. All rights reserved. */ +/* + NAME + occidml.cpp - Basic DML Operations demo + + DESCRIPTION + To exhibit the insertion, selection, updating and deletion of + a row using OCCI interface + + MODIFIED (MM/DD/YY) + mvasudev 05/22/08 - Add try/catch blocks + sudsrini 10/22/06 - Username/Password lower case + lburgess 04/14/06 - lowercase passwords + sudsrini 07/23/04 - Copyright Info + idcqe 03/05/01 - Creation + +*/ + +#include +#include +using namespace oracle::occi; +using namespace std; + +class occidml +{ + private: + + Environment *env; + Connection *conn; + Statement *stmt; + public: + + occidml (string user, string passwd, string db) + { + env = Environment::createEnvironment (Environment::DEFAULT); + conn = env->createConnection (user, passwd, db); + } + + ~occidml () + { + env->terminateConnection (conn); + Environment::terminateEnvironment (env); + } + + /** + * Insertion of a row with dynamic binding, PreparedStatement functionality. + */ + void insertBind (int c1, string c2) + { + string sqlStmt = "INSERT INTO author_tab VALUES (:x, :y)"; + stmt=conn->createStatement (sqlStmt); + try{ + stmt->setInt (1, c1); + stmt->setString (2, c2); + stmt->executeUpdate (); + cout << "insert - Success" << endl; + }catch(SQLException ex) + { + cout<<"Exception thrown for insertBind"<terminateStatement (stmt); + } + + /** + * Inserting a row into the table. + */ + void insertRow () + { + string sqlStmt = "INSERT INTO author_tab VALUES (111, 'ASHOK')"; + stmt = conn->createStatement (sqlStmt); + try{ + stmt->executeUpdate (); + cout << "insert - Success" << endl; + }catch(SQLException ex) + { + cout<<"Exception thrown for insertRow"<terminateStatement (stmt); + } + + /** + * updating a row + */ + void updateRow (int c1, string c2) + { + string sqlStmt = + "UPDATE author_tab SET author_name = :x WHERE author_id = :y"; + stmt = conn->createStatement (sqlStmt); + try{ + stmt->setString (1, c2); + stmt->setInt (2, c1); + stmt->executeUpdate (); + cout << "update - Success" << endl; + }catch(SQLException ex) + { + cout<<"Exception thrown for updateRow"<terminateStatement (stmt); + } + + + /** + * deletion of a row + */ + void deleteRow (int c1, string c2) + { + string sqlStmt = + "DELETE FROM author_tab WHERE author_id= :x AND author_name = :y"; + stmt = conn->createStatement (sqlStmt); + try{ + stmt->setInt (1, c1); + stmt->setString (2, c2); + stmt->executeUpdate (); + cout << "delete - Success" << endl; + }catch(SQLException ex) + { + cout<<"Exception thrown for deleteRow"<terminateStatement (stmt); + } + + /** + * displaying all the rows in the table + */ + void displayAllRows () + { + string sqlStmt = "SELECT author_id, author_name FROM author_tab \ + order by author_id"; + stmt = conn->createStatement (sqlStmt); + ResultSet *rset = stmt->executeQuery (); + try{ + while (rset->next ()) + { + cout << "author_id: " << rset->getInt (1) << " author_name: " + << rset->getString (2) << endl; + } + }catch(SQLException ex) + { + cout<<"Exception thrown for displayAllRows"<closeResultSet (rset); + conn->terminateStatement (stmt); + } + + /** + * Inserting a row into elements table. + * Demonstrating the usage of BFloat and BDouble datatypes + */ + void insertElement (string elm_name, float mvol=0.0, double awt=0.0) + { + BFloat mol_vol; + BDouble at_wt; + + if (!(mvol)) + mol_vol.isNull = TRUE; + else + mol_vol.value = mvol; + + if (!(awt)) + at_wt.isNull = TRUE; + else + at_wt.value = awt; + + string sqlStmt = "INSERT INTO elements VALUES (:v1, :v2, :v3)"; + stmt = conn->createStatement (sqlStmt); + + try{ + stmt->setString(1, elm_name); + stmt->setBFloat(2, mol_vol); + stmt->setBDouble(3, at_wt); + stmt->executeUpdate (); + cout << "insertElement - Success" << endl; + }catch(SQLException ex) + { + cout<<"Exception thrown for insertElement"<terminateStatement (stmt); + } + + /** + * displaying rows from element table + */ + void displayElements () + { + string sqlStmt = + "SELECT element_name, molar_volume, atomic_weight FROM elements \ + order by element_name"; + stmt = conn->createStatement (sqlStmt); + ResultSet *rset = stmt->executeQuery (); + try{ + cout.precision(7); + while (rset->next ()) + { + string elem_name = rset->getString(1); + BFloat mol_vol = rset->getBFloat(2); + BDouble at_wt = rset->getBDouble(3); + + cout << "Element Name: " << elem_name << endl; + + if ( mol_vol.isNull ) + cout << "Molar Volume is NULL" << endl; + else + cout << "Molar Volume: " << mol_vol.value << " cm3 mol-1" << endl; + + if ( at_wt.isNull ) + cout << "Atomic Weight is NULL" << endl; + else + cout << "Atomic Weight: " << at_wt.value << " g/mole" << endl; + } + }catch(SQLException ex) + { + cout<<"Exception thrown for displayElements"<closeResultSet (rset); + conn->terminateStatement (stmt); + } + +}; // end of class occidml + + +int main (void) +{ + string user = "hr"; + string passwd = "hr"; + string db = ""; + try{ + cout << "occidml - Exhibiting simple insert, delete & update operations" + << endl; + occidml *demo = new occidml (user, passwd, db); + cout << "Displaying all records before any operation" << endl; + demo->displayAllRows (); + + cout << "Inserting a record into the table author_tab " + << endl; + demo->insertRow (); + + cout << "Displaying the records after insert " << endl; + demo->displayAllRows (); + + cout << "Inserting a records into the table author_tab using dynamic bind" + << endl; + demo->insertBind (222, "ANAND"); + + cout << "Displaying the records after insert using dynamic bind" << endl; + demo->displayAllRows (); + + cout << "deleting a row with author_id as 222 from author_tab table" << endl; + demo->deleteRow (222, "ANAND"); + + cout << "updating a row with author_id as 444 from author_tab table" << endl; + demo->updateRow (444, "ADAM"); + + cout << "displaying all rows after all the operations" << endl; + demo->displayAllRows (); + + cout << "inserting radio active element properties" << endl; + demo->insertElement ("Uranium", 12.572, 238.0289 ); + demo->insertElement ("Plutonium", 12.12, 244.0642 ); + demo->insertElement ("Curium", 18.17, 247.0703 ); + demo->insertElement ("Thorium"); + demo->insertElement ("Radium", 41.337, 226.0254); + + cout << "displaying all radio active element properties" << endl; + demo->displayElements (); + + delete (demo); + } + catch (SQLException ex){ + cout << ex.getMessage() << endl; + } + cout << "occidml - done" << endl; +} diff --git a/sdk/demo/occiobj.cpp b/sdk/demo/occiobj.cpp new file mode 100755 index 0000000..499595a --- /dev/null +++ b/sdk/demo/occiobj.cpp @@ -0,0 +1,196 @@ +/* Copyright (c) 2001, 2006, Oracle. All rights reserved. */ +/* + NAME + occiobj.cpp - OCCI Embedded Object demo + + DESCRIPTION + This demo performs all DML operations using OCCI interface + on embedded object column of table + + + MODIFIED (MM/DD/YY) + sudsrini 10/22/06 - Username/Password lower case + lburgess 04/14/06 - lowercase passwords + sudsrini 07/23/04 - Copyright Info + idcqe 03/05/01 - Creation + +*/ + +#include +#include "occiobjm.h" + +using namespace oracle::occi; +using namespace std; + +class occiobj +{ + private: + + Environment *env; + Connection *con; + Statement *stmt; + public: + + occiobj (string user, string passwd, string db) + { + env = Environment::createEnvironment (Environment::OBJECT); + occiobjm (env); + con = env->createConnection (user, passwd, db); + } + + ~occiobj () + { + env->terminateConnection (con); + Environment::terminateEnvironment (env); + } + + /** + * Insertion of a row + */ + void insertRow (int c1, int a1, string a2) + { + cout << "Inserting record - Publisher id :" << c1 << + ", Publisher address :" << a1 << ", " << a2 <createStatement (sqlStmt); + stmt->setInt (1, c1); + address *o = new address (); + o->setStreet_no (Number (a1)); + o->setCity (a2); + stmt->setObject (2, o); + stmt->executeUpdate (); + cout << "Insert - Success" << endl; + delete (o); + }catch(SQLException ex) + { + cout<<"Exception thrown for insertRow"<terminateStatement (stmt); + } + + + /** + * updating a row + */ + void updateRow (int c1, int a1, string a2) + { + cout << "Upadating record with publisher id :"<< c1 << endl; + string sqlStmt = + "UPDATE publisher_tab SET publisher_add= :x WHERE publisher_id = :y"; + try{ + stmt = con->createStatement (sqlStmt); + address *o = new address (); + o->setStreet_no (Number (a1)); + o->setCity (a2); + stmt->setObject (1, o); + stmt->setInt (2, c1); + stmt->executeUpdate (); + cout << "Update - Success" << endl; + delete (o); + }catch(SQLException ex) + { + cout<<"Exception thrown for updateRow"<terminateStatement (stmt); + } + + + /** + * deletion of a row + */ + void deleteRow (int c1, int a1, string a2) + { + cout << "Deletion of record where publisher id :" << c1 <createStatement (sqlStmt); + stmt->setInt (1, c1); + + address *o = new address (); + o->setStreet_no (Number (a1)); + o->setCity (a2); + stmt->setObject (2, o); + stmt->executeUpdate (); + cout << "Delete - Success" << endl; + delete (o); + }catch(SQLException ex) + { + cout<<"Exception thrown for deleteRow"<terminateStatement (stmt); + } + + /** + * displaying all the rows in the table + */ + void displayAllRows () + { + string sqlStmt = "SELECT publisher_id, publisher_add FROM publisher_tab \ + order by publisher_id"; + try{ + stmt = con->createStatement (sqlStmt); + ResultSet *rset = stmt->executeQuery (); + + while (rset->next ()) + { + cout << "publisher id: " << rset->getInt (1) + << " publisher address: address (" ; + address *o = (address *)rset->getObject (2); + cout << (int)o->getStreet_no () << ", " << o->getCity () << ")" << endl; + } + + stmt->closeResultSet (rset); + }catch(SQLException ex) + { + cout<<"Exception thrown for displayAllRows"<terminateStatement (stmt); + } + +};//end of class occiobj; + + +int main (void) +{ + string user = "hr"; + string passwd = "hr"; + string db = ""; + + try + { + cout << "occiobj - Exhibiting simple insert, delete & update operations" + " on Oracle objects" << endl; + occiobj *demo = new occiobj (user, passwd, db); + + cout << "displaying all rows before operations" << endl; + demo->displayAllRows (); + + demo->insertRow (12, 122, "MIKE"); + + demo->deleteRow (11, 121, "ANNA"); + + demo->updateRow (23, 123, "KNUTH"); + + cout << "displaying all rows after all operations" << endl; + demo->displayAllRows (); + + delete (demo); + cout << "occiobj - done" << endl; + }catch (SQLException ea) + { + cerr << "Error running the demo: " << ea.getMessage () << endl; + } +} diff --git a/sdk/demo/occiobj.typ b/sdk/demo/occiobj.typ new file mode 100755 index 0000000..dd788cd --- /dev/null +++ b/sdk/demo/occiobj.typ @@ -0,0 +1,3 @@ +CASE=SAME +MAPFILE=occiobjm.cpp +TYPE publ_address as address diff --git a/sdk/demo/procdemo.pc b/sdk/demo/procdemo.pc new file mode 100755 index 0000000..a9175cf --- /dev/null +++ b/sdk/demo/procdemo.pc @@ -0,0 +1,118 @@ +/* + * procdemo.pc + * + * This program connects to ORACLE, declares and opens a cursor, + * fetches the names, salaries, and commissions of all + * salespeople, displays the results, then closes the cursor. + */ + +#include +#include +#include +#include +#include +#include + +#define UNAME_LEN 20 +#define PWD_LEN 11 + +/* + * Use the precompiler typedef'ing capability to create + * null-terminated strings for the authentication host + * variables. (This isn't really necessary--plain char *'s + * would work as well. This is just for illustration.) + */ +typedef char asciiz[PWD_LEN]; + +EXEC SQL TYPE asciiz IS CHARZ(PWD_LEN) REFERENCE; +asciiz username; +asciiz password; + +struct emp_info +{ + asciiz emp_name; + float salary; + float commission; +}; + +void sql_error(msg) + char *msg; +{ + char err_msg[512]; + size_t buf_len, msg_len; + + EXEC SQL WHENEVER SQLERROR CONTINUE; + + printf("\n%s\n", msg); + +/* Call sqlglm() to get the complete text of the + * error message. + */ + buf_len = sizeof (err_msg); + sqlglm(err_msg, &buf_len, &msg_len); + printf("%.*s\n", msg_len, err_msg); + + EXEC SQL ROLLBACK RELEASE; + exit(EXIT_FAILURE); +} + +void main() +{ + struct emp_info *emp_rec_ptr; + +/* Allocate memory for emp_info struct. */ + if ((emp_rec_ptr = + (struct emp_info *) malloc(sizeof(struct emp_info))) == 0) + { + fprintf(stderr, "Memory allocation error.\n"); + exit(EXIT_FAILURE); + } + +/* Connect to ORACLE. */ + strcpy(username, "scott"); + strcpy(password, "tiger"); + + EXEC SQL WHENEVER SQLERROR DO sql_error("ORACLE error--"); + + EXEC SQL CONNECT :username IDENTIFIED BY :password; + printf("\nConnected to ORACLE as user: %s\n", username); + +/* Declare the cursor. All static SQL explicit cursors + * contain SELECT commands. 'salespeople' is a SQL identifier, + * not a (C) host variable. + */ + EXEC SQL DECLARE salespeople CURSOR FOR + SELECT ENAME, SAL, COMM + FROM EMP + WHERE JOB LIKE 'SALES%'; + +/* Open the cursor. */ + EXEC SQL OPEN salespeople; + +/* Get ready to print results. */ + printf("\n\nThe company's salespeople are--\n\n"); + printf("Salesperson Salary Commission\n"); + printf("----------- ------ ----------\n"); + +/* Loop, fetching all salesperson's statistics. + * Cause the program to break the loop when no more + * data can be retrieved on the cursor. + */ + EXEC SQL WHENEVER NOT FOUND DO break; + + for (;;) + { + EXEC SQL FETCH salespeople INTO :emp_rec_ptr; + printf("%s %9.2f %12.2f\n", emp_rec_ptr->emp_name, + emp_rec_ptr->salary, emp_rec_ptr->commission); + } + +/* Close the cursor. */ + EXEC SQL CLOSE salespeople; + + printf("\nGOOD-BYE!!\n\n"); + + EXEC SQL COMMIT WORK RELEASE; + exit(EXIT_SUCCESS); +} + diff --git a/sdk/demo/procobdemo.pco b/sdk/demo/procobdemo.pco new file mode 100755 index 0000000..245a69e --- /dev/null +++ b/sdk/demo/procobdemo.pco @@ -0,0 +1,90 @@ + ***************************************************************** + * procobdemo.pco - Pro*COBOL demo file for Instant Client. * + * * + * This program logs on to ORACLE, declares and opens a cursor, * + * fetches the names, salaries, and commissions of all * + * salespeople, displays the results, then closes the cursor. * + ***************************************************************** + + IDENTIFICATION DIVISION. + PROGRAM-ID. CURSOR-OPS. + ENVIRONMENT DIVISION. + DATA DIVISION. + WORKING-STORAGE SECTION. + + EXEC SQL BEGIN DECLARE SECTION END-EXEC. + 01 USERNAME PIC X(10) VARYING. + 01 PASSWD PIC X(10) VARYING. + 01 EMP-REC-VARS. + 05 EMP-NAME PIC X(10) VARYING. + 05 SALARY PIC S9(6)V99 + DISPLAY SIGN LEADING SEPARATE. + 05 COMMISSION PIC S9(6)V99 + DISPLAY SIGN LEADING SEPARATE. + EXEC SQL VAR SALARY IS DISPLAY(8,2) END-EXEC. + EXEC SQL VAR COMMISSION IS DISPLAY(8,2) END-EXEC. + EXEC SQL END DECLARE SECTION END-EXEC. + + EXEC SQL INCLUDE SQLCA END-EXEC. + + 01 DISPLAY-VARIABLES. + 05 D-EMP-NAME PIC X(10). + 05 D-SALARY PIC Z(4)9.99. + 05 D-COMMISSION PIC Z(4)9.99. + + PROCEDURE DIVISION. + + BEGIN-PGM. + EXEC SQL WHENEVER SQLERROR + DO PERFORM SQL-ERROR END-EXEC. + PERFORM LOGON. + EXEC SQL DECLARE SALESPEOPLE CURSOR FOR + SELECT ENAME, SAL, COMM + FROM EMP + WHERE JOB LIKE 'SALES%' + END-EXEC. + EXEC SQL OPEN SALESPEOPLE END-EXEC. + DISPLAY " ". + DISPLAY "SALESPERSON SALARY COMMISSION". + DISPLAY "----------- ---------- ----------". + + FETCH-LOOP. + EXEC SQL WHENEVER NOT FOUND + DO PERFORM SIGN-OFF END-EXEC. + EXEC SQL FETCH SALESPEOPLE + INTO :EMP-NAME, :SALARY, :COMMISSION + END-EXEC. + MOVE EMP-NAME-ARR TO D-EMP-NAME. + MOVE SALARY TO D-SALARY. + MOVE COMMISSION TO D-COMMISSION. + DISPLAY D-EMP-NAME, " ", D-SALARY, " ", D-COMMISSION. + MOVE SPACES TO EMP-NAME-ARR. + GO TO FETCH-LOOP. + + LOGON. + MOVE "scott" TO USERNAME-ARR. + MOVE 5 TO USERNAME-LEN. + MOVE "tiger" TO PASSWD-ARR. + MOVE 5 TO PASSWD-LEN. + EXEC SQL + CONNECT :USERNAME IDENTIFIED BY :PASSWD + END-EXEC. + DISPLAY " ". + DISPLAY "CONNECTED TO ORACLE AS USER: ", USERNAME-ARR. + + SIGN-OFF. + EXEC SQL CLOSE SALESPEOPLE END-EXEC. + DISPLAY " ". + DISPLAY "HAVE A GOOD DAY.". + DISPLAY " ". + EXEC SQL COMMIT WORK RELEASE END-EXEC. + STOP RUN. + + SQL-ERROR. + EXEC SQL WHENEVER SQLERROR CONTINUE END-EXEC. + DISPLAY " ". + DISPLAY "ORACLE ERROR DETECTED:". + DISPLAY " ". + DISPLAY SQLERRMC. + EXEC SQL ROLLBACK WORK RELEASE END-EXEC. + STOP RUN. diff --git a/sdk/include/ldap.h b/sdk/include/ldap.h new file mode 100755 index 0000000..cae4635 --- /dev/null +++ b/sdk/include/ldap.h @@ -0,0 +1,1178 @@ +/* + * $Header: ldap/public/ldap.h /main/28 2008/09/26 16:32:41 vmedam Exp $ + */ + +/* Copyright (c) 1998, 2008, Oracle and/or its affiliates. All rights reserved.*/ +/* + NAME + ldap.h - Used by clients. + DESCRIPTION + + PUBLIC FUNCTION(S) + + PRIVATE FUNCTION(S) + + RETURNS + + NOTES + + MODIFIED (MM/DD/YY) + vmedam 09/25/08 - + ******** 09/17/08 - bug#7312369 + ******** 03/20/08 - bug#5743318 + ******** 03/17/08 - Bug 6838567 + ******** 09/16/05 - fix bug#3935094 + ******** 05/09/05 - Bug 4288744 + ******** 06/11/04 - Bug 3512354 + ******** 02/12/04 - Removing data type mismatch with internal definitions + ****** 10/22/03 - fix bug 1869186 + ****** 10/01/03 - Add ora_ldap_init_clientctx + ****** 08/11/03 - Add new option for sasl credentials + ******** 02/22/03 - bugfix #2802996 + ****** 02/02/03 - Add SASL interfaces + ******** 10/15/02 - client side referral cache changes + ******** 10/12/02 - change in discovery api's + ******** 04/30/01 - fix compilation errors + ******* 04/13/01 - add normalize DN protos + ****** 04/07/01 - v3 Modifications + ***** 06/02/00 - fix bug 1294614 + ***** 03/31/00 - fix porting except. # 1234272 + ****** 05/19/98 - Initial Creation +*/ +/* + * Copyright (c) 1990, 2008, Oracle and/or its affiliates. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that this notice is preserved and that due credit is given + * to the University of Michigan at Ann Arbor. The name of the University + * may not be used to endorse or promote products derived from this + * software without specific prior written permission. This software + * is provided ``as is'' without express or implied warranty. + */ + +#ifndef GSLC_ORACLE +#define GSLC_ORACLE + +#ifdef __cplusplus +extern "C" { +#endif + + +#ifdef WINSOCK +#include "msdos.h" +#include +#endif + +/* BER classes and mask */ +#define LBER_CLASS_UNIVERSAL 0x00 +#define LBER_CLASS_APPLICATION 0x40 +#define LBER_CLASS_CONTEXT 0x80 +#define LBER_CLASS_PRIVATE 0xc0 +#define LBER_CLASS_MASK 0xc0 + +/* BER encoding type and mask */ +#define LBER_PRIMITIVE 0x00 +#define LBER_CONSTRUCTED 0x20 +#define LBER_ENCODING_MASK 0x20 + +#define LBER_BIG_TAG_MASK 0x1f +#define LBER_MORE_TAG_MASK 0x80 + +/* + * Note that LBER_ERROR and LBER_DEFAULT are values that can never appear + * as valid BER tags, and so it is safe to use them to report errors. In + * fact, any tag for which the following is true is invalid: + * (( tag & 0x00000080 ) != 0 ) && (( tag & 0xFFFFFF00 ) != 0 ) + */ +#define LBER_ERROR -1 +#define LBER_DEFAULT -1 + +/* general BER types we know about */ +#define LBER_BOOLEAN 0x01L +#define LBER_INTEGER 0x02L +#define LBER_BITSTRING 0x03L +#define LBER_OCTETSTRING 0x04L +#define LBER_NULL 0x05L +#define LBER_ENUMERATED 0x0aL +#define LBER_SEQUENCE 0x30L /* constructed */ +#define LBER_SET 0x31L /* constructed */ + +#define OLD_LBER_SEQUENCE 0x10L /* w/o constructed bit - broken */ +#define OLD_LBER_SET 0x11L /* w/o constructed bit - broken */ + +typedef int (*BERTranslateProc)( char **bufp, unsigned int *buflenp, + int free_input ); + +typedef struct seqorset { + unsigned int sos_clen; + unsigned int sos_tag; + char *sos_first; + char *sos_ptr; + struct seqorset *sos_next; +} Seqorset; +#define NULLSEQORSET ((Seqorset *) 0) + +#define SOS_STACK_SIZE 8 /* depth of the pre-allocated sos structure stack */ + +typedef struct berelement { + char *ber_buf; + char *ber_ptr; + char *ber_end; + struct seqorset *ber_sos; + unsigned int ber_tag; + unsigned int ber_len; + int ber_usertag; + char ber_options; +#define LBER_USE_DER 0x01 +#define LBER_USE_INDEFINITE_LEN 0x02 +#define LBER_TRANSLATE_STRINGS 0x04 + char *ber_rwptr; + BERTranslateProc ber_encode_translate_proc; + BERTranslateProc ber_decode_translate_proc; + int ber_flags; + int ber_sos_stack_posn; + Seqorset ber_sos_stack[SOS_STACK_SIZE]; +} BerElement; +#define NULLBER ((BerElement *) 0) + +/* sgsluns - private network endpoint type + */ +struct sgsluns +{ + int sock_sgsluns; /* socket identifier */ + long state_sgsluns; /* sgsluns state flag (SGSLUNS_STATE_xxx) */ + char saddr_sgsluns[32]; /* inet address of other end of this connection + * in the form A.B.C.D where A,B,C, and D are + * base 256 notation integers. eg. "192.0.0.1" + */ +}; +typedef struct sgsluns sgsluns; + +typedef struct sockbuf { +#ifndef MACOS + int sb_sd; +#else /* MACOS */ + void *sb_sd; +#endif /* MACOS */ + BerElement sb_ber; + + int sb_naddr; /* > 0 implies using CLDAP (UDP) */ + void *sb_useaddr; /* pointer to sockaddr to use next */ + void *sb_fromaddr; /* pointer to message source sockaddr */ + void **sb_addrs; /* actually an array of pointers to + sockaddrs */ + + int sb_options; /* to support copying ber elements */ +#define LBER_TO_FILE 0x01 /* to a file referenced by sb_fd */ +#define LBER_TO_FILE_ONLY 0x02 /* only write to file, not network */ +#define LBER_MAX_INCOMING_SIZE 0x04 /* impose limit on incoming stuff */ +#define LBER_NO_READ_AHEAD 0x08 /* read only as much as requested */ + int sb_fd; + int sb_max_incoming; + void *sb_nzenv; /* nzos environment pointer */ + void *sb_sslContext; + int sb_sslauth; /* type of ssl authentication */ + int sb_sslflag; + int ssl_sd; + sgsluns *sb_endp; /* socket end point */ +} Sockbuf; +#define READBUFSIZ 8192 + +/* structure for returning a sequence of octet strings + length */ +struct berval { + unsigned int bv_len; + char *bv_val; +}; + +#define LDAP_PORT 389 +#define LDAP_SSL_PORT 636 + +#ifndef DEF_SSL_PORT +extern int sslmodeenabled ; +#endif + +#define LDAP_VERSION1 1 +#define LDAP_VERSION2 2 +#define LDAP_VERSION3 3 + +#define LDAP_VERSION LDAP_VERSION2 /*default should stay as LDAPv2*/ + +#define LDAP_VERSION_MAX LDAP_VERSION3 + +#define COMPAT20 +#define COMPAT30 +#if defined(COMPAT20) || defined(COMPAT30) +#define COMPAT +#endif + +#define LDAP_MAX_ATTR_LEN 256 + +/* various options that can be set/unset */ +#define LDAP_OPT_DESC 1 +#define LDAP_OPT_DEREF 2 +#define LDAP_OPT_SIZELIMIT 3 +#define LDAP_OPT_TIMELIMIT 4 +#define LDAP_OPT_THREAD_FN_PTRS 5 +#define LDAP_OPT_REBIND_FN 6 +#define LDAP_OPT_REBIND_ARG 7 +#define LDAP_OPT_REFERRALS 8 +#define LDAP_OPT_RESTART 9 +#define LDAP_OPT_SSL 10 +#define LDAP_OPT_IO_FN_PTRS 11 +#define LDAP_OPT_CACHE_FN_PTRS 13 +#define LDAP_OPT_CACHE_STRATEGY 14 +#define LDAP_OPT_CACHE_ENABLE 15 +#define LDAP_OPT_REFERRAL_HOP_LIMIT 16 +#define LDAP_OPT_PROTOCOL_VERSION 17 +#define LDAP_OPT_SERVER_CONTROLS 18 +#define LDAP_OPT_CLIENT_CONTROLS 19 +#define LDAP_OPT_PREFERRED_LANGUAGE 20 +#define LDAP_OPT_ERROR_NUMBER 49 +#define LDAP_OPT_ERROR_STRING 50 + +/* client side referral cache enable option */ +#define ORA_LDAP_OPT_RFRL_CACHE 200 + +/* ldap connect timeout */ +#define ORA_LDAP_OPT_CONNECT_TIMEOUT 210 + +/* directory server types */ +#define LDAP_DIRTYPE_OID 1 /* Oracle Internet Directory */ +#define LDAP_DIRTYPE_AD 2 /* Microsoft Active Directory */ +#define LDAP_DIRTYPE_NETSCAPE 4 /* Netscape Directory Server */ +#define LDAP_DIRTYPE_NDS 8 /* Novell Directory Service */ +#define LDAP_DIRTYPE_UNKNOWN 4096 /* Unknown */ + +/* for on/off options */ +#define LDAP_OPT_ON ((void *)1) +#define LDAP_OPT_OFF ((void *)0) + + +/* SSL Authentication modes */ +#define GSLC_SSL_NO_AUTH 1 +#define GSLC_SSL_ONEWAY_AUTH 32 +#define GSLC_SSL_TWOWAY_AUTH 64 + + +/* Abandon support */ +#define ABANDONorTL(op) ((op)->o_abandon == 1) + +/* debugging stuff */ +#ifdef LDAP_DEBUG +extern int ldap_debug; +extern unsigned int debug_flag; +#define LDAP_DEBUG_TRACE 0x001 +#define LDAP_DEBUG_PACKETS 0x002 +#define LDAP_DEBUG_ARGS 0x004 +#define LDAP_DEBUG_CONNS 0x008 +#define LDAP_DEBUG_BER 0x010 +#define LDAP_DEBUG_FILTER 0x020 +#define LDAP_DEBUG_CONFIG 0x040 +#define LDAP_DEBUG_ACL 0x080 +#define LDAP_DEBUG_STATS 0x100 +#define LDAP_DEBUG_STATS2 0x200 +#define LDAP_DEBUG_SHELL 0x400 +#define LDAP_DEBUG_PARSE 0x800 +#define LDAP_DEBUG_PROCESS 0x2000 +#define LDAP_DEBUG_MUST 0x4000 +#ifndef LDAP_DEBUG_ANY +# define LDAP_DEBUG_ANY 0xffff +#endif /* LDAP_DEBUG_ANY */ + +#ifdef LDAP_SYSLOG +#define Debug( level, fmt, arg1, arg2, arg3 ) \ + { \ + if ( ldap_debug & level ) \ + fprintf( stderr, fmt, arg1, arg2, arg3 ); \ + } +#else /* LDAP_SYSLOG */ +#ifndef WINSOCK +#define Debug( level, fmt, arg1, arg2, arg3 ) \ + if ( ldap_debug & level ) \ + fprintf( stderr, fmt, arg1, arg2, arg3 ); +#else /* !WINSOCK */ +extern void Debug( int level, char* fmt, ... ); +#endif /* !WINSOCK */ +#endif /* LDAP_SYSLOG */ +#else /* LDAP_DEBUG */ +#define Debug( level, fmt, arg1, arg2, arg3 ) +#endif /* LDAP_DEBUG */ + +/* + * specific LDAP instantiations of BER types we know about + */ + +/* general stuff */ +#define LDAP_TAG_MESSAGE 0x30L /* tag is 0x10 + constructed bit */ +#define OLD_LDAP_TAG_MESSAGE 0x10L /* forgot the constructed bit */ +#define LDAP_TAG_MSGID 0x02L /* INTEGER */ +#define LDAP_TAG_LDAPDN 0x04L /* OCTET STRING */ +#define LDAP_TAG_CONTROLS 0xa0L /* context specific + constructed + 0 */ +#define LDAP_TAG_REFERRAL 0xa3L /* context specific + constructed + 3 */ +#define LDAP_TAG_NEWSUPERIOR 0x80L /* context specific + primitive */ +#define LDAP_TAG_MRA_OID 0x81L /* context specific + primitive */ +#define LDAP_TAG_MRA_TYPE 0x82L /* context specific + primitive */ +#define LDAP_TAG_MRA_VALUE 0x83L /* context specific + primitive */ +#define LDAP_TAG_MRA_DNATTRS 0x84L /* context specific + primitive */ +#define LDAP_TAG_EXOP_REQ_OID 0x80L /* context specific + primitive */ +#define LDAP_TAG_EXOP_REQ_VALUE 0x81L /* context specific + primitive */ +#define LDAP_TAG_EXOP_RES_OID 0x8aL /* context specific + primitive */ +#define LDAP_TAG_EXOP_RES_VALUE 0x8bL /* context specific + primitive */ +#define LDAP_TAG_SK_MATCHRULE 0x80L /* context specific + primitive */ +#define LDAP_TAG_SK_REVERSE 0x81L /* context specific + primitive */ +#define LDAP_TAG_SR_ATTRTYPE 0x80L /* context specific + primitive */ +#define LDAP_TAG_SASL_RES_CREDS 0x87L /* context specific + primitive */ +#define LDAP_TAG_VLV_BY_INDEX 0xa0L /* context specific + constructed + 0 */ +#define LDAP_TAG_VLV_BY_VALUE 0x81L /* context specific + primitive + 1 */ + +/* possible operations a client can invoke */ +#define LDAP_REQ_BIND 0x60L /* application + constructed */ +#define LDAP_REQ_UNBIND 0x42L /* application + primitive */ +#define LDAP_REQ_SEARCH 0x63L /* application + constructed */ +#define LDAP_REQ_MODIFY 0x66L /* application + constructed */ +#define LDAP_REQ_ADD 0x68L /* application + constructed */ +#define LDAP_REQ_DELETE 0x4aL /* application + primitive */ +#define LDAP_REQ_MODRDN 0x6cL /* application + constructed */ +#define LDAP_REQ_MODDN 0x6cL /* application + constructed */ +#define LDAP_REQ_COMPARE 0x6eL /* application + constructed */ +#define LDAP_REQ_ABANDON 0x50L /* application + primitive */ + +/* New defs added for LDAP V3 support */ +#define LDAP_REQ_EXTENDED 0x77L /* application + constructed */ +/* version 3.0 compatibility stuff */ +#define LDAP_REQ_UNBIND_30 0x62L +#define LDAP_REQ_DELETE_30 0x6aL +#define LDAP_REQ_ABANDON_30 0x70L + +/* + * old broken stuff for backwards compatibility - forgot application tag + * and constructed/primitive bit + */ +#define OLD_LDAP_REQ_BIND 0x00L +#define OLD_LDAP_REQ_UNBIND 0x02L +#define OLD_LDAP_REQ_SEARCH 0x03L +#define OLD_LDAP_REQ_MODIFY 0x06L +#define OLD_LDAP_REQ_ADD 0x08L +#define OLD_LDAP_REQ_DELETE 0x0aL +#define OLD_LDAP_REQ_MODRDN 0x0cL +#define OLD_LDAP_REQ_COMPARE 0x0eL +#define OLD_LDAP_REQ_ABANDON 0x10L + +/* possible result types a server can return */ +#define LDAP_RES_BIND 0x61L /* application+constructed+1 */ +#define LDAP_RES_SEARCH_ENTRY 0x64L /* 100 */ +#define LDAP_RES_SEARCH_RESULT 0x65L /* 101 */ +#define LDAP_RES_MODIFY 0x67L /* 103 */ +#define LDAP_RES_ADD 0x69L /* 105 */ +#define LDAP_RES_DELETE 0x6bL /* 107 */ +#define LDAP_RES_MODRDN 0x6dL /* 109 */ +#define LDAP_RES_RENAME 0x6dL /* same as LDAP_RES_MODRDN */ +#define LDAP_RES_COMPARE 0x6fL /* 111 */ +#define LDAP_RES_SEARCH_REFERENCE 0x73L /* 115 */ +#define LDAP_RES_EXTENDED 0x78L /* 120 */ +#define LDAP_RES_ANY (-1L) + +/* old broken stuff for backwards compatibility */ +#define OLD_LDAP_RES_BIND 0x01L +#define OLD_LDAP_RES_SEARCH_ENTRY 0x04L +#define OLD_LDAP_RES_SEARCH_RESULT 0x05L +#define OLD_LDAP_RES_MODIFY 0x07L +#define OLD_LDAP_RES_ADD 0x09L +#define OLD_LDAP_RES_DELETE 0x0bL +#define OLD_LDAP_RES_MODRDN 0x0dL +#define OLD_LDAP_RES_COMPARE 0x0fL + +/* authentication methods available */ +#define LDAP_AUTH_NONE 0x00L /* no authentication */ +#define LDAP_AUTH_SIMPLE 0x80L /* context specific + primitive */ +#define LDAP_AUTH_SASL 0xa3L /* context specific + constructed */ + +/* supported SASL methods */ +#define LDAP_SASL_SIMPLE 0 /* special value used for simple bind */ +#define LDAP_SASL_EXTERNAL "EXTERNAL" + +/* authentication methods supported in v2 */ +#define LDAP_AUTH_KRBV4 0xffL /* means do both of the following */ +#define LDAP_AUTH_KRBV41 0x81L /* context specific + primitive */ +#define LDAP_AUTH_KRBV42 0x82L /* context specific + primitive */ +#define LDAP_AUTH_SASL_V2 0x83L /* context specific + primitive */ +#define LDAP_AUTH_REPL 0x90L /* replication specific */ + + +/* 3.0 compatibility auth methods */ +#define LDAP_AUTH_SIMPLE_30 0xa0L /* context specific + constructed */ +#define LDAP_AUTH_KRBV41_30 0xa1L /* context specific + constructed */ +#define LDAP_AUTH_KRBV42_30 0xa2L /* context specific + constructed */ +#define LDAP_AUTH_SASL_30 0xa3L /* context specific + constructed */ +/* old broken stuff */ +#define OLD_LDAP_AUTH_SIMPLE 0x00L +#define OLD_LDAP_AUTH_KRBV4 0x01L +#define OLD_LDAP_AUTH_KRBV42 0x02L + +/* filter types */ +#define LDAP_FILTER_AND 0xa0L /* context specific + constructed */ +#define LDAP_FILTER_OR 0xa1L /* context specific + constructed */ +#define LDAP_FILTER_NOT 0xa2L /* context specific + constructed */ +#define LDAP_FILTER_EQUALITY 0xa3L /* context specific + constructed */ +#define LDAP_FILTER_SUBSTRINGS 0xa4L /* context specific + constructed */ +#define LDAP_FILTER_GE 0xa5L /* context specific + constructed */ +#define LDAP_FILTER_LE 0xa6L /* context specific + constructed */ +#define LDAP_FILTER_PRESENT 0x87L /* context specific + primitive */ +#define LDAP_FILTER_APPROX 0xa8L /* context specific + constructed */ + +/* 3.0 compatibility filter types */ +#define LDAP_FILTER_PRESENT_30 0xa7L /* context specific + constructed */ + +/* old broken stuff */ +#define OLD_LDAP_FILTER_AND 0x00L +#define OLD_LDAP_FILTER_OR 0x01L +#define OLD_LDAP_FILTER_NOT 0x02L +#define OLD_LDAP_FILTER_EQUALITY 0x03L +#define OLD_LDAP_FILTER_SUBSTRINGS 0x04L +#define OLD_LDAP_FILTER_GE 0x05L +#define OLD_LDAP_FILTER_LE 0x06L +#define OLD_LDAP_FILTER_PRESENT 0x07L +#define OLD_LDAP_FILTER_APPROX 0x08L + +/* substring filter component types */ +#define LDAP_SUBSTRING_INITIAL 0x80L /* context specific */ +#define LDAP_SUBSTRING_ANY 0x81L /* context specific */ +#define LDAP_SUBSTRING_FINAL 0x82L /* context specific */ + +/* 3.0 compatibility substring filter component types */ +#define LDAP_SUBSTRING_INITIAL_30 0xa0L /* context specific */ +#define LDAP_SUBSTRING_ANY_30 0xa1L /* context specific */ +#define LDAP_SUBSTRING_FINAL_30 0xa2L /* context specific */ + +/* old broken stuff */ +#define OLD_LDAP_SUBSTRING_INITIAL 0x00L +#define OLD_LDAP_SUBSTRING_ANY 0x01L +#define OLD_LDAP_SUBSTRING_FINAL 0x02L + +/* search scopes */ +#define LDAP_SCOPE_BASE 0x00 +#define LDAP_SCOPE_ONELEVEL 0x01 +#define LDAP_SCOPE_SUBTREE 0x02 + +/* for modifications */ +typedef struct ldapmod { + int mod_op; +#define LDAP_MOD_ADD 0x00 +#define LDAP_MOD_DELETE 0x01 +#define LDAP_MOD_REPLACE 0x02 +#define LDAP_MOD_BVALUES 0x80 + char *mod_type; + int mod_ver; + char mod_time[48]; + char mod_server[128]; + union { + char **modv_strvals; + struct berval **modv_bvals; + } mod_vals; + struct berval **modv_nvals; +#define mod_values mod_vals.modv_strvals +#define mod_bvalues mod_vals.modv_bvals +#ifdef ONLDAPD + struct ldapmod *mod_next; + int createTombstone; +#endif +} LDAPMod; + +/* + * possible error codes we can return + */ + +#define LDAP_SUCCESS 0x00 +#define GSL_SUCCESS LDAP_SUCCESS +#define LDAP_OPERATIONS_ERROR 0x01 +#define LDAP_PROTOCOL_ERROR 0x02 +#define LDAP_TIMELIMIT_EXCEEDED 0x03 +#define LDAP_SIZELIMIT_EXCEEDED 0x04 +#define LDAP_COMPARE_FALSE 0x05 +#define LDAP_COMPARE_TRUE 0x06 +#define LDAP_STRONG_AUTH_NOT_SUPPORTED 0x07 +#define LDAP_STRONG_AUTH_REQUIRED 0x08 +#define LDAP_PARTIAL_RESULTS 0x09 +#define LDAP_REFERRAL 0x0A +#define LDAP_ADMINLIMIT_EXCEEDED 0x0B +#define LDAP_UNAVAILABLE_CRITICALEXTENSION 0x0C +#define LDAP_CONFIDENTIALITY_REQUIRED 0x0D +#define LDAP_SASL_BIND_IN_PROGRESS 0x0E + +#define LDAP_NO_SUCH_ATTRIBUTE 0x10 +#define LDAP_UNDEFINED_TYPE 0x11 +#define LDAP_INAPPROPRIATE_MATCHING 0x12 +#define LDAP_CONSTRAINT_VIOLATION 0x13 +#define LDAP_TYPE_OR_VALUE_EXISTS 0x14 +#define LDAP_INVALID_SYNTAX 0x15 + +#define LDAP_NO_SUCH_OBJECT 0x20 +#define LDAP_ALIAS_PROBLEM 0x21 +#define LDAP_INVALID_DN_SYNTAX 0x22 +#define LDAP_IS_LEAF 0x23 +#define LDAP_ALIAS_DEREF_PROBLEM 0x24 + +#define NAME_ERROR(n) ((n & 0xf0) == 0x20) + +#define LDAP_INAPPROPRIATE_AUTH 0x30 +#define LDAP_INVALID_CREDENTIALS 0x31 +#define LDAP_INSUFFICIENT_ACCESS 0x32 +#define LDAP_BUSY 0x33 +#define LDAP_UNAVAILABLE 0x34 +#define LDAP_UNWILLING_TO_PERFORM 0x35 +#define LDAP_LOOP_DETECT 0x36 + +#define LDAP_NAMING_VIOLATION 0x40 +#define LDAP_OBJECT_CLASS_VIOLATION 0x41 +#define LDAP_NOT_ALLOWED_ON_NONLEAF 0x42 +#define LDAP_NOT_ALLOWED_ON_RDN 0x43 +#define LDAP_ALREADY_EXISTS 0x44 +#define LDAP_NO_OBJECT_CLASS_MODS 0x45 +#define LDAP_RESULTS_TOO_LARGE 0x46 +#define LDAP_AFFECT_MULTIPLE_DSAS 0x47 + +#define LDAP_OTHER 0x50 +#define LDAP_SERVER_DOWN 0x51 +#define LDAP_LOCAL_ERROR 0x52 +#define LDAP_ENCODING_ERROR 0x53 +#define LDAP_DECODING_ERROR 0x54 +#define LDAP_TIMEOUT 0x55 +#define LDAP_AUTH_UNKNOWN 0x56 +#define LDAP_FILTER_ERROR 0x57 +#define LDAP_USER_CANCELLED 0x58 +#define LDAP_PARAM_ERROR 0x59 +#define LDAP_NO_MEMORY 0x5a +#define LDAP_CONNECT_ERROR 0x5b /* 91 */ +#define LDAP_NOT_SUPPORTED 0x5c /* 92 - LDAPv3 */ +#define LDAP_CONTROL_NOT_FOUND 0x5d /* 93 - LDAPv3 */ +#define LDAP_NO_RESULTS_RETURNED 0x5e /* 94 - LDAPv3 */ +#define LDAP_MORE_RESULTS_TO_RETURN 0x5f /* 95 - LDAPv3 */ +#define LDAP_CLIENT_LOOP 0x60 /* 96 - LDAPv3 */ +#define LDAP_REFERRAL_LIMIT_EXCEEDED 0x61 /* 97 - LDAPv3 */ + + +/* discover server related error codes */ +#define ORA_LDAP_INFO_NOT_FOUND 500 /* oracle specific error codes */ +#define ORA_LDAP_LOOKUP_ERROR 501 +#define ORA_LDAP_DNS_ADDR_NOT_FOUND 502 +#define ORA_LDAP_FILE_NOT_FOUND 503 +#define ORA_LDAP_FILE_PARSE_ERROR 504 + +/* SSL bind related error codes */ +#define ORA_LDAP_SSL_INITIALIZE_ERROR 550 +#define ORA_LDAP_SSL_CTXCONFIG_ERROR 551 +#define ORA_LDAP_SSL_OPENWALLET_ERROR 552 +#define ORA_LDAP_SSL_CTXCREATE_ERROR 553 +#define ORA_LDAP_SSL_HANDSHAKE_ERROR 554 +#define ORA_LDAP_SSL_PEERCRED_ERROR 555 + + +/* default limit on nesting of referrals */ +#define LDAP_DEFAULT_REFHOPLIMIT 5 + +/* discover server related structs and declarations */ + +/* source from where information can be discovered */ +#define ORA_DNS_DISCOVER 1 +#define ORA_CFGFILE_DISCOVER 2 +#define ORA_AUTO_DISCOVER 3 + +/* method to be applied for obtaining hostname info from DNS */ +#define ORA_USE_INPUT_DN_METHOD 1 +#define ORA_USE_MC_DOMAIN_METHOD 2 +#define ORA_USE_DFLT_LOOKUP_METHOD 4 +#define ORA_USE_ALL_METHODS (ORA_USE_INPUT_DN_METHOD + \ + ORA_USE_MC_DOMAIN_METHOD + \ + ORA_USE_DFLT_LOOKUP_METHOD) + +/* result types */ +#define ORA_DEF_ADMIN_CTXT 1 +#define ORA_DIR_SERVERS 2 +#define ORA_DIR_SERVER_TYPE 3 +#define ORA_ALTDIR_SERVERS 4 +#define ORA_ORCLCOMMCTXMAP 5 +#define ORA_DIRSRVR_CONN_SEC 6 +#define ORA_CFGFL_PATH 7 + +/* properties that can be set in the discovery handle */ +#define ORA_DNS_DN 1 +#define ORA_DNS_DISCOVER_METHOD 2 +#define ORA_SSLMODE 3 + +typedef void * OraLdapHandle; +typedef void * OraResultHandle; + +typedef void OraLdapClientCtx; + +/* Options for SASL credential functions */ +#define ORA_LDAP_SASL_MECH_DIGEST_MD5 "DIGEST-MD5" /* SASL Mechanism : + Digest MD5 */ +#define ORA_LDAP_CRED_HANDLE_SASL_MD5 1 + +/* properties that can be set in Credential handle */ +#define ORA_LDAP_CRED_SASL_REALM 1 +#define ORA_LDAP_CRED_SASL_AUTH_PASSWORD 2 +#define ORA_LDAP_CRED_SASL_AUTHORIZATION_ID 3 +#define ORA_LDAP_CRED_SASL_SECURITY_PROPERTIES 4 +#define ORA_LDAP_CRED_SASL_NORM_AUTHDN 5 + +#define ora_ldap_init_clientctx(ctxptr) ((OraLdapClientCtx **)NULL != (ctxptr) && (*((OraLdapClientCtx **)(ctxptr)) = (OraLdapClientCtx *)NULL,1)) ? LDAP_SUCCESS : LDAP_PARAM_ERROR + +#define ora_ldap_free_clientctx(ctxptr) ((OraLdapClientCtx **)NULL != (ctxptr) && (*((OraLdapClientCtx **)(ctxptr)) = (OraLdapClientCtx *)NULL,1)) ? LDAP_SUCCESS : LDAP_PARAM_ERROR + +/* + * This structure represents both ldap messages and ldap responses. + * These are really the same, except in the case of search responses, + * where a response has multiple messages. + */ + +typedef struct ldapmsg { + int lm_msgid; /* the message id */ + int lm_msgtype; /* the message type */ + BerElement *lm_ber; /* the ber encoded message contents */ + struct ldapmsg *lm_chain; /* for search - next msg in the resp */ + struct ldapmsg *lm_next; /* next response */ + unsigned int lm_time; /* used to maintain cache */ +} LDAPMessage; +#define NULLMSG ((LDAPMessage *) NULL) + + +#ifdef LDAP_REFERRALS +/* + * structure for tracking LDAP server host, ports, DNs, etc. + */ +typedef struct ldap_server { + char *lsrv_host; + char *lsrv_dn; /* if NULL, use default */ + int lsrv_port; + unsigned int lsrv_options; /* boolean options */ +#define LDAP_SRV_OPT_SECURE 0x01 + struct ldap_server *lsrv_next; +} LDAPServer; + + +/* + * structure for representing an LDAP server connection + */ +typedef struct ldap_conn { + Sockbuf *lconn_sb; + BerElement *lconn_ber; /* non-NULL if in midst of msg. */ + int lconn_version; /* LDAP protocol version */ + int lconn_refcnt; + char *lconn_lastused; /* time */ + int lconn_status; +#define LDAP_CONNST_NEEDSOCKET 1 +#define LDAP_CONNST_CONNECTING 2 +#define LDAP_CONNST_CONNECTED 3 +#define LDAP_CONNST_DEAD 4 + LDAPServer *lconn_server; + char *lconn_binddn; /* DN of last successful bind */ + int lconn_bound; /* has a bind been done? */ + char *lconn_krbinstance; + struct ldap_conn *lconn_next; +} LDAPConn; + + +/* + * structure used to track outstanding requests + */ +typedef struct ldapreq { + int lr_msgid; /* the message id */ + int lr_status; /* status of request */ +#define LDAP_REQST_INPROGRESS 1 +#define LDAP_REQST_CHASINGREFS 2 +#define LDAP_REQST_NOTCONNECTED 3 +#define LDAP_REQST_WRITING 4 + int lr_outrefcnt; /* count of outstanding referrals */ + int lr_origid; /* original request's message id */ + int lr_parentcnt; /* count of parent requests */ + int lr_res_msgtype; /* result message type */ + int lr_res_errno; /* result LDAP errno */ + char *lr_res_error; /* result error string */ + char *lr_res_matched;/* result matched DN string */ + BerElement *lr_ber; /* ber encoded request contents */ + LDAPConn *lr_conn; /* connection used to send request */ + char *lr_binddn; /* request is a bind for this DN */ + struct ldapreq *lr_parent; /* request that spawned this referral */ + struct ldapreq *lr_refnext; /* next referral spawned */ + struct ldapreq *lr_prev; /* previous request */ + struct ldapreq *lr_next; /* next request */ +} LDAPRequest; +#endif /* LDAP_REFERRALS */ + + +/* + * structure for client cache + */ +#define LDAP_CACHE_BUCKETS 31 /* cache hash table size */ +typedef struct ldapcache { + LDAPMessage *lc_buckets[LDAP_CACHE_BUCKETS];/* hash table */ + LDAPMessage *lc_requests; /* unfulfilled reqs */ + int lc_timeout; /* request timeout */ + int lc_maxmem; /* memory to use */ + int lc_memused; /* memory in use */ + int lc_enabled; /* enabled? */ + unsigned int lc_options; /* options */ +#define LDAP_CACHE_OPT_CACHENOERRS 0x00000001 +#define LDAP_CACHE_OPT_CACHEALLERRS 0x00000002 +} LDAPCache; +#define NULLLDCACHE ((LDAPCache *)NULL) + +/* + * structures for ldap getfilter routines + */ + +typedef struct ldap_filt_info { + char *lfi_filter; + char *lfi_desc; + int lfi_scope; /* LDAP_SCOPE_BASE, etc */ + int lfi_isexact; /* exact match filter? */ + struct ldap_filt_info *lfi_next; +} LDAPFiltInfo; + +typedef struct ldap_filt_list { + char *lfl_tag; + char *lfl_pattern; + char *lfl_delims; + LDAPFiltInfo *lfl_ilist; + struct ldap_filt_list *lfl_next; +} LDAPFiltList; + + +#define LDAP_FILT_MAXSIZ 1024 + +typedef struct ldap_filt_desc { + LDAPFiltList *lfd_filtlist; + LDAPFiltInfo *lfd_curfip; + LDAPFiltInfo lfd_retfi; + char lfd_filter[ LDAP_FILT_MAXSIZ ]; + char *lfd_curval; + char *lfd_curvalcopy; + char **lfd_curvalwords; + char *lfd_filtprefix; + char *lfd_filtsuffix; +} LDAPFiltDesc; + + +typedef struct ldapcontrol { + char *ldctl_oid; + struct berval ldctl_value; + char ldctl_iscritical; +} LDAPControl, *PLDAPControl; + +/* some common controls */ +#define LDAP_CONTROL_MANAGEDSAIT "2.16.840.1.113730.3.4.2" + +typedef struct ldappend { + void *lp_sema; /* semaphore to post */ + int lp_msgid; /* message id */ + LDAPMessage *lp_result; /* result storage */ + struct ldappend *lp_prev; /* previous pending */ + struct ldappend *lp_next; /* next pending */ +} LDAPPend; + +/* structure for holding credential information - used + * to bind to referred server when chasing referrals + */ +typedef struct ldapcreds { + char *binddn; + char *passwd; + int authmethod; + char *proxyDN; +} LDAPCreds; + +/* + * structure representing an ldap connection + */ + +typedef struct ldap { + Sockbuf ld_sb; /* socket descriptor & buffer */ + char *ld_host; + int ld_version; + char ld_lberoptions; + int ld_deref; +#define LDAP_DEREF_NEVER 0 +#define LDAP_DEREF_SEARCHING 1 +#define LDAP_DEREF_FINDING 2 +#define LDAP_DEREF_ALWAYS 3 + + int ld_timelimit; + int ld_sizelimit; +#define LDAP_NO_LIMIT 0 + + LDAPFiltDesc *ld_filtd; /* from getfilter for ufn searches */ + char *ld_ufnprefix; /* for incomplete ufn's */ + + int ld_errno; + char *ld_error; + char *ld_matched; + int ld_msgid; + + /* do not mess with these */ +#ifdef LDAP_REFERRALS + LDAPRequest *ld_requests; /* list of outstanding requests */ +#else /* LDAP_REFERRALS */ + LDAPMessage *ld_requests; /* list of outstanding requests */ +#endif /* LDAP_REFERRALS */ + LDAPMessage *ld_responses; /* list of outstanding responses */ + int *ld_abandoned; /* array of abandoned requests */ + char ld_attrbuffer[100]; + LDAPCache *ld_cache; /* non-null if cache is initialized */ + char *ld_cldapdn; /* DN used in connectionless search */ + + /* it is OK to change these next four values directly */ + int ld_cldaptries; /* connectionless search retry count */ + int ld_cldaptimeout;/* time between retries */ + int ld_refhoplimit; /* limit on referral nesting */ + unsigned int ld_options; /* boolean options */ +#ifdef LDAP_DNS +#define LDAP_OPT_DNS 0x00000001 /* use DN & DNS */ +#endif /* LDAP_DNS */ + +#define LDAP_BITOPT_REFERRALS 0x80000000 +#define LDAP_BITOPT_SSL 0x40000000 +#define LDAP_BITOPT_DNS 0x20000000 +#define LDAP_BITOPT_RESTART 0x10000000 +#define LDAP_BITOPT_RECONNECT 0x08000000 +#define LDAP_BITOPT_ASYNC 0x04000000 + + /* do not mess with the rest though */ + char *ld_defhost; /* full name of default server */ + int ld_defport; /* port of default server */ + BERTranslateProc ld_lber_encode_translate_proc; + BERTranslateProc ld_lber_decode_translate_proc; +#ifdef LDAP_REFERRALS + LDAPConn *ld_defconn; /* default connection */ + LDAPConn *ld_conns; /* list of server connections */ + void *ld_selectinfo; /* platform specifics for select */ + int (*ld_rebindproc)( struct ldap *ld, char **dnp, + char **passwdp, int *authmethodp, int freeit ); + /* routine to get info needed for re-bind */ +#endif /* LDAP_REFERRALS */ + + /* V3 ldap controls */ + LDAPControl **ld_servercontrol; + LDAPControl **ld_clientcontrol; + + /* Pending results */ + LDAPPend *ld_pend; /* list of pending results */ + + void *gsluctx; /* gslu context handle */ + /* client side referral cache-usage enable/disable option */ + int ld_refcache_enabled; + /* current status of the refcache */ + int ld_refcache_status; + void *ld_refcache; /* client side referral cache */ + void *ld_wrk_selectinfo; + LDAPCreds *ld_creds; /* credential information */ +} LDAP; + +/* + * structure for ldap friendly mapping routines + */ + +typedef struct friendly { + char *f_unfriendly; + char *f_friendly; +} FriendlyMap; + + +/* + * handy macro to check whether LDAP struct is set up for CLDAP or not + */ +#define LDAP_IS_CLDAP( ld ) ( ld->ld_sb.sb_naddr > 0 ) + + +/* + * types for ldap URL handling + */ +typedef struct ldap_url_desc { + char *lud_host; + int lud_port; + char *lud_dn; + char **lud_attrs; + int lud_scope; + char *lud_filter; + char *lud_string; /* for internal use only */ +} LDAPURLDesc; +#define NULLLDAPURLDESC ((LDAPURLDesc *)NULL) + +#define LDAP_URL_ERR_NOTLDAP 1 /* URL doesn't begin with "ldap://" */ +#define LDAP_URL_ERR_NODN 2 /* URL has no DN (required) */ +#define LDAP_URL_ERR_BADSCOPE 3 /* URL scope string is invalid */ +#define LDAP_URL_ERR_MEM 4 /* can't allocate memory space */ + +/* General Purpose Defines */ +#define GSL_ERR_GENERAL (int)-1 +#define GSL_NULL_TEXT (char *)NULL + +#ifndef LDAPFUNCDECL +#ifdef _WIN32 +#define LDAPFUNCDECL __declspec( dllexport ) +#else /* _WIN32 */ +#define LDAPFUNCDECL +#endif /* _WIN32 */ +#endif /* LDAPFUNCDECL */ + +#if !defined(MACOS) && !defined(DOS) && !defined(_WIN32) && !defined(WINSOCK) +#include +#endif +LDAPFUNCDECL LDAP *ldap_open( char *host, int port ); +LDAPFUNCDECL LDAP *ldap_init( char *defhost, int defport ); +LDAPFUNCDECL int ldap_init_SSL( Sockbuf *,char *, char *,int); + +LDAPFUNCDECL LDAPMessage *ldap_first_entry( LDAP *ld, LDAPMessage *chain ); +LDAPFUNCDECL LDAPMessage *ldap_next_entry( LDAP *ld, LDAPMessage *entry ); +LDAPFUNCDECL int ldap_count_entries( LDAP *ld, LDAPMessage *chain ); + +LDAPFUNCDECL char *ldap_get_dn( LDAP *ld, LDAPMessage *entry ); +LDAPFUNCDECL char *ldap_dn2ufn( char *dn ); +LDAPFUNCDECL char **ldap_explode_dn( char *dn, int notypes ); +LDAPFUNCDECL char **ldap_explode_dns( char *dn ); + +LDAPFUNCDECL char *ldap_first_attribute( LDAP *ld, LDAPMessage *entry, + BerElement **ber ); +LDAPFUNCDECL char *ldap_next_attribute( LDAP *ld, LDAPMessage *entry, + BerElement *ber ); + +LDAPFUNCDECL char **ldap_get_values( LDAP *ld, LDAPMessage *entry, char *target +); +LDAPFUNCDECL struct berval **ldap_get_values_len( LDAP *ld, LDAPMessage *entry, + char *target ); +LDAPFUNCDECL int ldap_count_values( char **vals ); +LDAPFUNCDECL int ldap_count_values_len( struct berval **vals ); +LDAPFUNCDECL void ldap_value_free( char **vals ); +LDAPFUNCDECL void ldap_value_free_len( struct berval **vals ); + +LDAPFUNCDECL int ldap_result2error( LDAP *ld, LDAPMessage *r, int freeit ); +LDAPFUNCDECL char *ldap_err2string( int err ); +LDAPFUNCDECL void ldap_perror( LDAP *ld, char *s ); + +LDAPFUNCDECL void ldap_mods_free( LDAPMod **mods, int freemods ); + +LDAPFUNCDECL void ldap_free_friendlymap( FriendlyMap **map ); + +LDAPFUNCDECL int ldap_sort_entries( LDAP *ld, LDAPMessage **chain, char *attr, + int (*cmp)() ); + +LDAPFUNCDECL int ldap_is_ldap_url( char *url ); +LDAPFUNCDECL int ldap_url_parse( char *url, LDAPURLDesc **ludpp ); +LDAPFUNCDECL void ldap_free_urldesc( LDAPURLDesc *ludp ); +LDAPFUNCDECL int ldap_url_search( LDAP *ld, char *url, int attrsonly ); +LDAPFUNCDECL int ldap_url_search_s( LDAP *ld, char *url, int attrsonly, + LDAPMessage **res ); +LDAPFUNCDECL int ldap_url_search_st( LDAP *ld, char *url, int attrsonly, + struct timeval *timeout, LDAPMessage **res ); + +LDAPFUNCDECL int ldap_bind( LDAP *ld, char *who, char *passwd, int authmethod ); +LDAPFUNCDECL int ldap_bind_s( LDAP *ld, char *who, char *cred, int method ); + +LDAPFUNCDECL int ldap_simple_bind( LDAP *ld, char *who, char *passwd ); +LDAPFUNCDECL int ldap_simple_bind_s( LDAP *ld, char *who, char *passwd ); + +LDAPFUNCDECL int ldap_compare( LDAP *ld, char *dn, char *attr, char *value ); +LDAPFUNCDECL int ldap_compare_s( LDAP *ld, char *dn, char *attr, char *value ); + +LDAPFUNCDECL int ldap_delete( LDAP *ld, char *dn ); +LDAPFUNCDECL int ldap_delete_s( LDAP *ld, char *dn ); + +LDAPFUNCDECL int ldap_modify( LDAP *ld, char *dn, LDAPMod **mods ); +LDAPFUNCDECL int ldap_modify_s( LDAP *ld, char *dn, LDAPMod **mods ); + +LDAPFUNCDECL int ldap_modrdn( LDAP *ld, char *dn, char *newrdn ); +LDAPFUNCDECL int ldap_modrdn_s( LDAP *ld, char *dn, char *newrdn ); +LDAPFUNCDECL int ldap_modrdn2( LDAP *ld, char *dn, char *newrdn, + int deleteoldrdn ); +LDAPFUNCDECL int ldap_modrdn2_s( LDAP *ld, char *dn, char *newrdn, + int deleteoldrdn); + +LDAPFUNCDECL int ldap_result( LDAP *ld, int msgid, int all, + struct timeval *timeout, LDAPMessage **result ); +LDAPFUNCDECL int ldap_msgfree( LDAPMessage *lm ); +LDAPFUNCDECL int ldap_msgdelete( LDAP *ld, int msgid ); +LDAPFUNCDECL void ldap_memfree( void *p ); +LDAPFUNCDECL void ber_free( BerElement *ber, int freebuf ); + +LDAPFUNCDECL int ldap_search( LDAP *ld, char *base, int scope, char *filter, + char **attrs, int attrsonly ); +LDAPFUNCDECL int ldap_search_s( LDAP *ld, char *base, int scope, char *filter, + char **attrs, int attrsonly, LDAPMessage **res ); +LDAPFUNCDECL int ldap_search_st( LDAP *ld, char *base, int scope, char *filter, + char **attrs, int attrsonly, struct timeval *timeout, LDAPMessage **res ); + +LDAPFUNCDECL int ldap_unbind( LDAP *ld ); +LDAPFUNCDECL int ldap_unbind_s( LDAP *ld ); + +LDAPFUNCDECL int ldap_abandon( LDAP *ld, int msgid ); + +LDAPFUNCDECL int ldap_add( LDAP *ld, char *dn, LDAPMod **attrs ); +LDAPFUNCDECL int ldap_add_s( LDAP *ld, char *dn, LDAPMod **attrs ); + +LDAPFUNCDECL int ldap_rename( LDAP *ld, char *dn, char *newrdn, char *newparent, + int deleteoldrdn, LDAPControl **serverctrls, + LDAPControl **clientctrls, int *msgidp); +LDAPFUNCDECL int ldap_rename_s(LDAP *ld,char *dn,char *newrdn,char *newparent, + int deleteoldrdn,PLDAPControl *serverctrls, + PLDAPControl *clientctrls); + +LDAPFUNCDECL void ldap_getfilter_free(LDAPFiltDesc *lfdp); +LDAPFUNCDECL int ldap_abandon_ext( LDAP *ld, int msgid, + LDAPControl **serverctrls, LDAPControl **clientctrls ); + +LDAPFUNCDECL int ldap_add_ext( LDAP *ld, char *dn, LDAPMod **attrs, + LDAPControl **serverctrls, LDAPControl **clientctrls, + int *msgidp ); +LDAPFUNCDECL int ldap_add_ext_s( LDAP *ld, char *dn, LDAPMod **attrs, + LDAPControl **serverctrls, LDAPControl **clientctrls); + +LDAPFUNCDECL int ldap_replic_bind( LDAP *ld, char *dn, char *passwd ); +LDAPFUNCDECL int ldap_replic_bind_s( LDAP *ld, char *dn, char *passwd ); + +LDAPFUNCDECL int ldap_kerberos_bind_s( LDAP *ld, char *who ); +LDAPFUNCDECL int ldap_kerberos_bind1( LDAP *ld, char *who ); +LDAPFUNCDECL int ldap_kerberos_bind1_s( LDAP *ld, char *who ); +LDAPFUNCDECL int ldap_kerberos_bind2( LDAP *ld, char *who ); +LDAPFUNCDECL int ldap_kerberos_bind2_s( LDAP *ld, char *who ); + +LDAPFUNCDECL int ldap_sasl_bind(LDAP * ld, char * dn, char * mechanism, + struct berval * cred, + LDAPControl ** serverctrls, + LDAPControl ** clientctrls, + int * msgidp); +LDAPFUNCDECL int ldap_sasl_bind_s(LDAP * ld, char * dn, char * mechanism, + struct berval * cred, + LDAPControl ** serverctrls, + LDAPControl ** clientctrls); + +LDAPFUNCDECL int ldap_parse_sasl_bind_result(LDAP * ld, LDAPMessage * res, + struct berval ** servercredp, + int freeit); + +LDAPFUNCDECL int ldap_native_bind_s(LDAP * ld,char * dn,char * mechanism, + struct berval * cred, + unsigned int dir_type); + +LDAPFUNCDECL int ldap_compare_ext( LDAP *ld, char *dn, char *attr, + struct berval *value, LDAPControl **serverctrls, + LDAPControl **clientctrls, int *msgidp ); +LDAPFUNCDECL int ldap_compare_ext_s( LDAP *ld, char *dn, char *attr, + struct berval *value, LDAPControl **serverctrls, + LDAPControl **clientctrls ); + +LDAPFUNCDECL int ldap_delete_ext( LDAP *ld, char *dn, + LDAPControl **serverctrls, LDAPControl **clientctrls, + int *msgidp ); +LDAPFUNCDECL int ldap_delete_ext_s( LDAP *ld, char *dn, + LDAPControl **serverctrls, LDAPControl **clientctrls ); + +LDAPFUNCDECL int ldap_modify_ext( LDAP *ld, char *dn, LDAPMod **mods, + LDAPControl **serverctrls, LDAPControl **clientctrls, + int *msgidp ); +LDAPFUNCDECL int ldap_modify_ext_s( LDAP *ld, char *dn, LDAPMod **mods, + LDAPControl **serverctrls, LDAPControl **clientctrls ); + + +LDAPFUNCDECL int ldap_get_entry_controls( LDAP *ld, LDAPMessage *entry, + LDAPControl ***serverctrlsp); + +LDAPFUNCDECL char **ldap_explode_rdn( char *dn, int notypes ); + +LDAPFUNCDECL int ldap_search_ext ( LDAP *ld, char *base, int scope, + char *filter, char **attrs, int attrsonly, + LDAPControl **serverctrls, LDAPControl **clientctrls, + struct timeval *timeoutp, int sizelimit, int *msgidp ); +LDAPFUNCDECL int ldap_search_ext_s ( LDAP *ld, char *base, int scope, + char *filter, char **attrs, int attrsonly, + LDAPControl **serverctrls, LDAPControl **clientctrls, + struct timeval *timeoutp, int sizelimit, + LDAPMessage **res); + +LDAPFUNCDECL int ldap_set_option( LDAP *ld, int option, void *optdata ); +LDAPFUNCDECL int ldap_get_option( LDAP *ld, int option, void *optdata ); + +LDAPFUNCDECL void ldap_control_free( LDAPControl *ctrl ); +LDAPFUNCDECL void ldap_controls_free( LDAPControl **ctrl ); + +LDAPFUNCDECL int ldap_msgid( LDAPMessage *lm ); +LDAPFUNCDECL int ldap_msgtype( LDAPMessage *lm ); + +LDAPFUNCDECL LDAPMessage* ldap_next_reference( LDAP *ld, LDAPMessage *res ); +LDAPFUNCDECL LDAPMessage* ldap_first_reference( LDAP *ld, LDAPMessage *res ); +LDAPFUNCDECL int ldap_count_references( LDAP *ld, LDAPMessage *res ); + +LDAPFUNCDECL LDAPMessage* ldap_first_message( LDAP *ld, LDAPMessage *chain ); +LDAPFUNCDECL LDAPMessage* ldap_next_message( LDAP *ld, LDAPMessage *chain ); +LDAPFUNCDECL int ldap_count_messages( LDAP *ld, LDAPMessage *chain ); + +LDAPFUNCDECL int ora_ldap_normalize_dn( char *dn, char *normDn); +LDAPFUNCDECL int ora_ldap_normalize_dn_with_case( char *dn, char *normDn, + int lower_case); + +#ifdef LDAP_REFERRALS +LDAPFUNCDECL void ldap_set_rebind_proc(LDAP * ld, int (*rebindproc) (LDAP * ld, + char **dnp, char **passwdp, int *authmethodp, int freeit)); +LDAPFUNCDECL void ora_ldap_set_rebind_proc(OraLdapClientCtx * clientCtx, + LDAP * ld, int (*rebindproc) (LDAP * ld, char **dnp, + char **passwdp, int *authmethodp, int freeit)); +#endif /*LDAP_REFERRALS*/ + + + +/* SASL functions */ + +LDAPFUNCDECL int ora_ldap_init_SASL (OraLdapClientCtx *clientCtx, LDAP *ld, + char * dn, char * mech, void * cred, + LDAPControl **serverctrls, + LDAPControl **clientctrls); + +LDAPFUNCDECL OraLdapHandle ora_ldap_create_cred_hdl (OraLdapClientCtx *clientCtx,int credType); + +LDAPFUNCDECL int ora_ldap_set_cred_props (OraLdapClientCtx * clientCtx, OraLdapHandle cred, + int propType, void *inProperty); + +LDAPFUNCDECL int ora_ldap_get_cred_props (OraLdapClientCtx * clientCtx, OraLdapHandle cred, + int propType, void *outProperty); + +LDAPFUNCDECL int ora_ldap_free_cred_hdl (OraLdapClientCtx * clientCtx, OraLdapHandle cred); + +/* LDAP Client Context Functions */ + +LDAPFUNCDECL int ora_ldap_create_clientctx(OraLdapClientCtx ** clientCtx); + +LDAPFUNCDECL int ora_ldap_set_clientctx(OraLdapClientCtx * clientCtx, + int property_type, + void * property); + +LDAPFUNCDECL int ora_ldap_destroy_clientctx(OraLdapClientCtx ** clientCtx); + +/* + * discover server functions + */ +LDAPFUNCDECL int ora_ldap_discover ( OraLdapHandle hdl, + OraResultHandle * reshdl); +LDAPFUNCDECL LDAP *ora_ldap_discover_open( OraLdapHandle hdl); + +LDAPFUNCDECL OraLdapHandle ora_create_discov_hdl(int discoveryType); + +LDAPFUNCDECL int ora_free_discov_hdl(OraLdapHandle hdl); +LDAPFUNCDECL int ora_free_result_hdl(OraResultHandle reshdl); + +LDAPFUNCDECL int ora_get_result( OraResultHandle reshdl, + int resType, char *** result); + +LDAPFUNCDECL int ora_set_discov_prop( OraLdapHandle hdl, + int prop, void * inval); + +LDAPFUNCDECL int ora_get_discov_prop( OraLdapHandle hdl, + int prop, void * outval); + + +#if defined(ultrix) || defined( nextstep ) +extern char *strdup(); +#endif + +#ifdef __cplusplus +} +#endif +#endif diff --git a/sdk/include/nzerror.h b/sdk/include/nzerror.h new file mode 100755 index 0000000..3ba15e3 --- /dev/null +++ b/sdk/include/nzerror.h @@ -0,0 +1,686 @@ +/* DISABLE check_long_lines */ + +/* + * $Header: security_src/public/nzerror.h /st_ldap_db11.2/3 2011/04/29 12:36:28 rchahal Exp $ + * +* Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved. + */ + +/* ENABLE check_long_lines */ +/* + NAME + nzerror.h - error numbers for the Oracle Security Server + DESCRIPTION + None. + PUBLIC FUNCTION(S) + None. + PRIVATE FUNCTION(S) + None. + NOTES + A pragma is used to silence olint about the enum value names not being + unique within 7 characters. This limit is being changed to 30. + MODIFIED + rchahal 06/12/06 - + skalyana 01/30/05 - + rchahal 07/16/04 - add cert label + rchahal 07/06/04 - + rchahal 10/15/03 - bug 2513821 + rchahal 08/14/03 - new error range (43000 - 43499) + skalyana 08/25/03 - Error changes + rchahal 06/27/03 - RSA errors + rchahal 05/27/03 - convert wallet + skalyana 03/07/03 - Move FIPS errors + rchahal 02/28/03 - bug 2648177 + rchahal 01/20/03 - use sltsky + rchahal 11/11/02 - pkcs11 support + skalyana 11/29/02 - Add mutex errors + akoyfman 11/01/02 - adding crl cache + rchahal 10/23/02 - crldp error + rchahal 10/15/02 - fetch crl from ldap + rchahal 10/07/02 - crl support + akoyfman 10/16/02 - Update with SSL PLus 4.2 errors + skalyana 10/04/02 - Certicom SSL Plus 4.2 Upgrade changes + akoyfman 08/06/02 - adding sso wallet errors + akoyfman 07/12/02 - adding secret store errors + skalyana 07/07/02 - Add more errors for FIPS self tests + skalyana 07/01/02 - Add more errors + skalyana 06/03/02 - Add NZ error for self test failure. + ajacobs 02/22/01 - Add some entrust errors + vle 02/09/01 - add error mesg + lkethana 08/11/00 - Extension Errors + lkethana 07/30/00 - add pkcs12 errors + lkethana 06/17/00 - mult cert errors + lkethana 06/11/00 - multiple cert support + rturlapa 03/29/00 - Add error meesage for Entrust Login failure. + rwessman 07/07/99 - Deleted include of sslerrs.h. It caused the RDBMS bu + rwessman 07/02/99 - fixed merge errors + rwessman 07/01/99 - moved NZOS errors to nzerror to make them visible + supriya 12/16/98 - add new error for cert chain. + arswamin 12/04/98 - add NZERROR_NO_MATCHING_PRIVATE_KEY + qdinh 11/12/98 - add NZERROR_VALIDITY_EXPIRED. + arswamin 06/17/98 - add INIT_FAILED + sdange 06/10/98 - change wrong password to bad password + amthakur 06/09/98 - adding error messages + wliau 03/10/97 - Add new error message for snzdfo.c. + rwessman 03/14/97 - Consolidated PL/SQL toolkit errors into generic erro + rwessman 02/26/97 - Added NZERROR_UNSUPPORTED. Corrected values of + errors outside the valid range. + asriniva 03/02/97 - Fix olint warning + rwessman 02/26/97 - Added NZERROR_UNSUPPORTED + rwessman 01/02/97 - Changed PLSQL package errors to be TK_PLSQL to + separate them from the errors generated by the + Oracle interface. + rwessman 12/30/96 - Merged in PL/SQL toolkit errors + sdange 11/14/96 - (Added NZERROR_DECRYPT_FAILED to the enum list) + rwessman 12/02/96 - + rwessman 11/25/96 - Added error messages for PL/SQL functions. + asriniva 10/31/96 - Include oratypes.h + asriniva 10/29/96 - Fix numbering. + asriniva 10/29/96 - Fix error numbers + asriniva 10/29/96 - Correct type-o + asriniva 10/28/96 - Add more TK errors + asriniva 10/28/96 - Convert OKAPI errors to TK errors. + rwessman 10/17/96 - still more OSS TK errors + asriniva 10/16/96 - OKAPI errors + asriniva 10/15/96 - OSSTK errors + rwessman 10/15/96 - Added more OSS TK errors + asriniva 10/09/96 - Add OSSTK errors. + rwessman 09/05/96 - Added errors for PL/SQL functions. + wliau 09/05/96 - correct error numbers. + $Log: $ + * Revision 1.26 1996/07/15 23:07:23 wliau + * Added NZERROR_AUTH_SHARED_MEMORY + * + * Revision 1.25 1996/07/01 20:40:15 asriniva + * Finished RSA verify/sign. + * + * Revision 1.24 1996/06/27 20:39:41 rwessman + * Added more errors. + * + * Revision 1.23 1996/05/31 17:33:40 rwessman + * Updated nzerror.h to contain bug # for olint enum bug. + * + * Revision 1.22 1996/05/31 17:12:30 rwessman + * Assigned values to the various errors. + * + * Revision 1.21 1996/05/13 20:46:58 ggilchri + * Added more attribute related error conditions + * +*/ + +#ifndef NZERROR_ORACLE +# define NZERROR_ORACLE + +#ifndef ORATYPES +# include +#endif /* ORATYPES */ + +/* +** Errors - when an error is added here, a message corresponding to the +** error number must be added to the message file. +** New errors must be assigned numbers, otherwise the compiler can assign any +** value that it wants, which may lead to invalid error numbers being +** generated. +** The number range currently assigned to the OSS is 28750 - 29249 +** New number range 43000 - 43499 +*/ + +typedef enum nzerror +{ + NZERROR_OK = 0, + NZERROR_GENERIC = 28750, /* A catchall for errors */ + NZERROR_NO_MEMORY = 28751, /* No more memory */ + NZERROR_DATA_SOURCE_INIT_FAILED = 28752, /* Failed to init data source */ + NZERROR_DATA_SOURCE_TERM_FAILED = 28753,/* Failed to terminate data source */ + NZERROR_OBJECT_STORE_FAILED = 28754, /* Store object in data source failed */ + NZERROR_OBJECT_GET_FAILED = 28755, + /* Failed to obtain object from data source */ + NZERROR_MEMORY_ALLOC_FAILED = 28756, + /* Callback failed to allocate memory */ + NZERROR_MEMORY_ALLOC_0_BYTES = 28757, + /* Attempted to ask for 0 bytes of memory */ + NZERROR_MEMORY_FREE_FAILED = 28758, + /* Callback failed to free memory */ + NZERROR_FILE_OPEN_FAILED = 28759, + /* Open of file failed */ + NZERROR_LIST_CREATION_FAILED = 28760, + /* Creation of list failed */ + NZERROR_NO_ELEMENT = 28761, + /* No list element found */ + NZERROR_ELEMENT_ADD_FAILED = 28762, + /* Addition of list element failed */ + NZERROR_PARAMETER_BAD_TYPE = 28763, + /* Retrieval of an unknown parameter type */ + NZERROR_PARAMETER_RETRIEVAL = 28764, /* Retrieval of parameter failed */ + + NZERROR_NO_LIST = 28765, /* Data method list does not exist */ + NZERROR_TERMINATE_FAIL = 28766, /* Failed to terminate */ + NZERROR_BAD_VERSION_NUMBER = 28767, /* Bad version number */ + NZERROR_BAD_MAGIC_NUMBER = 28768, /* Bad magic number */ + NZERROR_METHOD_NOT_FOUND = 28769, + /* Data retrieval method specified does not exist */ + NZERROR_ALREADY_INITIALIZED = 28770, + /*The data source is already initialized */ + NZERROR_NOT_INITIALIZED = 28771, /* The data source is not initialized */ + NZERROR_BAD_FILE_ID = 28772, /* File ID is bad */ + NZERROR_WRITE_MAGIC_VERSION = 28773, /* Failed to write magic and version */ + NZERROR_FILE_WRITE_FAILED = 28774, /* Failed to write to file */ + NZERROR_FILE_CLOSE_FAILED = 28775, /* Failed to close file */ + NZERROR_OUTPUT_BUFFER_TOO_SMALL = 28776, + /* The buffer supplied by the caller is too small */ + NZERROR_BINDING_CREATION_FAILED = 28777,/* NL failed in creating a binding */ + NZERROR_PARAMETER_MALFORMED = 28778, /* A parameter was in a bad format */ + NZERROR_PARAMETER_NO_METHOD = 28779, + /* No method was specified for a data type */ + NZERROR_BAD_PARAMETER_METHOD = 28780, /* Illegal method for data type */ + NZERROR_PARAMETER_NO_DATA = 28781, /* No method specified when required */ + NZERROR_NOT_ALLOCATED = 28782, /* Data source is not allocated */ + NZERROR_INVALID_PARAMETER = 28783, /* Invalid parameter name */ + NZERROR_FILE_NAME_TRANSLATION = 28784,/* Could not translate OSD file name */ + NZERROR_NO_SUCH_PARAMETER = 28785, /* Selected parameter is non-existent */ + + NZERROR_DECRYPT_FAILED = 28786, + /* Encrypted private key decryption failure */ + NZERROR_ENCRYPT_FAILED = 28787, /* Private key encryption failed */ + + NZERROR_INVALID_INPUT = 28788, /* Incorrect input or unknown error */ + + NZERROR_NAME_TYPE_NOT_FOUND = 28789, + /* Type of name requested is not available */ + NZERROR_NLS_STRING_OPEN_FAILED = 28790, + /* Failure to generate an NLS string */ + NZERROR_CERTIFICATE_VERIFY = 28791, /* Failed to verify a certificate */ + NZERROR_OCI_PLSQL_FAILED = 28792, + /* an OCI call to process some plsql failed */ + NZERROR_OCI_BIND_FAILED = 28793, + /* an OCI call to bind an internal var. failed */ + NZERROR_ATTRIBUTE_INIT = 28794, /* failed to init role retrieval */ + NZERROR_ATTRIBUTE_FINISH_FAILED = 28795,/* Did not complete role retrieval */ + NZERROR_UNSUPPORTED_METHOD = 28796, /* Data method specified not supported */ + NZERROR_INVALID_KEY_DATA_TYPE = 28797, + /* Invalid data type specified for key */ + NZEROR_BIND_SUBKEY_COUNT = 28798, + /* Number of sub-keys to bind does not match count in initialized key */ + NZERROR_AUTH_SHARED_MEMORY = 28799, + /* Failed to retreieve authentication information from the shared memory */ + NZERROR_RIO_OPEN = 28800, /* RIO Open Failed */ + NZERROR_RIO_OBJECT_TYPE = 28801, /* RIO object type invalid */ + NZERROR_RIO_MODE = 28802, /* RIO mode invalid */ + NZERROR_RIO_IO = 28803, /* RIO io set or numberinvalid */ + NZERROR_RIO_CLOSE = 28804, /* RIO close failed */ + NZERROR_RIO_RETRIEVE = 28805, /* RIO retrieve failed */ + NZERROR_RIO_STORE = 28806, /* RIO store failed */ + NZERROR_RIO_UPDATE = 28807, /* RIO update failed */ + NZERROR_RIO_INFO = 28808, /* RIO info failed */ + NZERROR_RIO_DELETE = 28809, /* RIO delete failed */ + NZERROR_KD_CREATE = 28810, /* Key descriptor create failed */ + NZERROR_RIO_ACCESS_DESCRIPTOR = 28811, /* access descriptor invalid */ + NZERROR_RIO_RECORD = 28812, /* record invalid */ + NZERROR_RIO_RECORD_TYPE = 28813, /* record type and AD type not matched */ + NZERROR_PLSQL_ORACLE_TO_REAL = 28814, + /* A number passed to PL/SQL could not be converted to real format */ + NZERROR_PLSQL_REAL_TO_ORACLE = 28815, + /* A number in machine format could not be converted to Oracle format */ + NZERROR_TK_PLSQL_NO_PASSWORD = 28816, + /* A password was not provided to a PL/SQL function */ + NZERROR_TK_PLSQL_GENERIC = 28817, + /* A PL/SQL function returned an error */ + NZERROR_TK_PLSQL_NO_CONTEXT = 28818, + /* The package context was not specified to a PL/SQL function */ + NZERROR_TK_PLSQL_NO_DIST_NAME = 28819, + /* The user's distinguished name was not provided to a PL/SQL function */ + NZERROR_TK_PLSQL_NO_STATE = 28820, +/* The state of either a signature or decryption/encryption was not provided */ + NZERROR_TK_PLSQL_NO_INPUT = 28821, + /* An input buffer was specified to a PL/SQL function */ + NZERROR_TK_PLSQL_NO_SEED = 28822, + /* No seed was specified to the PL/SQL seed initialization function */ + NZERROR_TK_PLSQL_NO_BYTES = 28823, + /* Number of bytes was not specified to the PL/SQL random number generator */ + NZERROR_TK_INVALID_STATE = 28824, + /* Invalid encryption/decryption/signature state passed */ + NZERROR_TK_PLSQL_NO_ENG_FUNC = 28825, + /* No crypto engine function was passed in */ + NZERROR_TK_INV_ENG_FUNC = 28826, + /* An invalid crypto engine function was passed in */ + NZERROR_TK_INV_CIPHR_TYPE = 28827, + /* An invalid cipher type was passed in */ + NZERROR_TK_INV_IDENT_TYPE = 28828, + /* An invalid identity type was specified */ + NZERROR_TK_PLSQL_NO_CIPHER_TYPE = 28829, + /* No cipher type was specified */ + NZERROR_TK_PLSQL_NO_IDENT_TYPE = 28830, + /* No identity type was specified */ + NZERROR_TK_PLSQL_NO_DATA_FMT = 28831, + /* No data unit format was specified */ + NZERROR_TK_INV_DATA_FMT = 28832, + /* Invalid data unit format was provided to function */ + NZERROR_TK_PLSQL_INSUFF_INFO = 28833, + /* Not enough info (usually parameters) provided to a PL/SQL function */ + NZERROR_TK_PLSQL_BUF_TOO_SMALL = 28834, + /* Buffer provided by PL/SQL is too small for data to be returned */ + NZERROR_TK_PLSQL_INV_IDENT_DESC = 28835, + /* Identity descriptor not present or too small */ + NZERROR_TK_PLSQL_WALLET_NOTOPEN = 28836, + /* Wallet has not been opened yet */ + NZERROR_TK_PLSQL_NO_WALLET = 28837, + /* No wallet descriptor specified to PL/SQL function */ + NZERROR_TK_PLSQL_NO_IDENTITY = 28838, + /* No identity descriptor specified to PL/SQL function */ + NZERROR_TK_PLSQL_NO_PERSONA = 28839, + /* No persona descriptor was specified to PL/SQL function */ + NZERROR_TK_PLSQL_WALLET_OPEN = 28840, + /* Wallet was already opened */ + NZERROR_UNSUPPORTED = 28841, /* Operation is not supported */ + NZERROR_FILE_BAD_PERMISSION = 28842, /* Bad file permission specified */ + NZERROR_FILE_OSD_ERROR = 28843, /* OSD error when opening file */ + NZERROR_NO_WALLET = 28844, /* cert + privkey + tp files do not exist */ + NZERROR_NO_CERTIFICATE_ALERT = 28845, /* no certificate */ + NZERROR_NO_PRIVATE_KEY = 28846, /* no private-key */ + NZERROR_NO_CLEAR_PRIVATE_KEY_FILE = 28847, /* no clear key-file */ + NZERROR_NO_ENCRYPTED_PRIVATE_KEY_FILE = 28848, /* no encrypted priv key */ + NZERROR_NO_TRUSTPOINTS = 28849, /* no trustpoints */ + NZERROR_NO_CLEAR_TRUSTPOINT_FILE = 28850, /* no clear trustpoints */ + NZERROR_NO_ENCRYPTED_TRUSTPOINT_FILE = 28851, /* no encrypted trustpoints */ + NZERROR_BAD_PASSWORD = 28852, /* bad password */ + NZERROR_INITIALIZATION_FAILED = 28853, /* init failed or + module loading failed */ + /******************************* SSL ERRORS ********************************/ + /* + * In order to allow SSL errors to be mapped to Oracle errors, space is + * provided here. One Oracle error is provided for each SSL error to make + * error handling easier. A macro is provided to do the conversion. + * NOTE: ANY CHANGE IN SSL ERRORS MUST BE REFLECTED HERE. + * To add an SSL error, use the following formula to calculate the Oracle + * error: + * new_oracle_error = (new_ssl_error - SSLMemoryError) + NZERROR_SSLMemoryErr + * or numerically: + * new_oracle_error = (new_ssl_error - -7000) + 28854 + */ + NZERROR_SSLMemoryErr = 28854, + NZERROR_SSLUnsupportedErr = 28855, + NZERROR_SSLOverflowErr = 28856, + NZERROR_SSLUnknownErr = 28857, + NZERROR_SSLProtocolErr = 28858, + NZERROR_SSLNegotiationErr = 28859, + NZERROR_SSLFatalAlert = 28860, + NZERROR_SSLWouldBlockErr = 28861, + NZERROR_SSLIOErr = 28862, + NZERROR_SSLSessionNotFoundErr = 28863, + NZERROR_SSLConnectionClosedGraceful = 28864, + NZERROR_SSLConnectionClosedError = 28865, + NZERROR_ASNBadEncodingErr = 28866, + NZERROR_ASNIntegerTooBigErr = 28867, + NZERROR_X509CertChainInvalidErr = 28868, + NZERROR_X509CertExpiredErr = 28869, + NZERROR_X509NamesNotEqualErr = 28870, + NZERROR_X509CertChainIncompleteErr = 28871, + NZERROR_X509DataNotFoundErr = 28872, + NZERROR_SSLBadParameterErr = 28873, + NZERROR_SSLIOClosedOverrideGoodbyeKiss = 28874, + NZERROR_X509MozillaSGCErr = 28875, + NZERROR_X509IESGCErr = 28876, + NZERROR_ImproperServerCredentials = 28877, + NZERROR_ImproperClientCredentials = 28878, + NZERROR_NoProtocolSideSet = 28879, + NZERROR_setPersonaFailed = 28880, + NZERROR_setCertFailed = 28881, + NZERROR_setVKeyFailed = 28882, + NZERROR_setTPFailed = 28883, + NZERROR_BadCipherSuite = 28884, + NZERROR_NoKeyPairForKeyUsage = 28885, + +/* ============>>> ENTRUST ERRORS */ + NZERROR_EntrustLoginFailed = 28890, + NZERROR_EntrustGetInfoFailed = 28891, + NZERROR_EntrustLoadCertificateFailed = 28892, + NZERROR_EntrustGetNameFailed = 28893, + +/* ============>>> NZERRORS CONTINUED */ + NZERROR_CertNotInstalled = 29000, + NZERROR_ServerDNMisMatched = 29002, + NZERROR_ServerDNMisConfigured = 29003, + +/* ============>>> PKI VENDORS ERRORS 29050 - 29099 */ + +/* ============>>> SSL Errors CONTINUED */ + NZERROR_CIC_ERR_SSL_ALERT_CB_FAILURE = 29004, + NZERROR_CIC_ERR_SSL_BAD_CERTIFICATE = 29005, + NZERROR_CIC_ERR_SSL_BAD_CERTIFICATE_REQUEST = 29006, + NZERROR_CIC_ERR_SSL_BAD_CLEAR_KEY_LEN = 29007, + NZERROR_CIC_ERR_SSL_BAD_DHPARAM_KEY_LENGTH = 29008, + NZERROR_CIC_ERR_SSL_BAD_ENCRYPTED_KEY_LEN = 29009, + NZERROR_CIC_ERR_SSL_BAD_EXPORT_KEY_LENGTH = 29010, + NZERROR_CIC_ERR_SSL_BAD_FINISHED_MESSAGE = 29011, + NZERROR_CIC_ERR_SSL_BAD_KEY_ARG_LEN = 29012, + NZERROR_CIC_ERR_SSL_BAD_MAC = 29013, + NZERROR_CIC_ERR_SSL_BAD_MAX_FRAGMENT_LENGTH_EXTENSION = 29014, + NZERROR_CIC_ERR_SSL_BAD_MESSAGE_LENGTH = 29015, + NZERROR_CIC_ERR_SSL_BAD_PKCS1_PADDING = 29016, + NZERROR_CIC_ERR_SSL_BAD_PREMASTER_SECRET_LENGTH = 29017, + NZERROR_CIC_ERR_SSL_BAD_PREMASTER_SECRET_VERSION = 29018, + NZERROR_CIC_ERR_SSL_BAD_PROTOCOL_VERSION = 29019, + NZERROR_CIC_ERR_SSL_BAD_RECORD_LENGTH = 29020, + NZERROR_CIC_ERR_SSL_BAD_SECRET_KEY_LEN = 29021, + NZERROR_CIC_ERR_SSL_BAD_SIDE = 29022, + NZERROR_CIC_ERR_SSL_BUFFERS_NOT_EMPTY = 29023, + NZERROR_CIC_ERR_SSL_CERTIFICATE_VALIDATE_FAILED = 29024, + NZERROR_CIC_ERR_SSL_CERT_CHECK_CALLBACK = 29025, + NZERROR_CIC_ERR_SSL_DECRYPT_FAILED = 29026, + NZERROR_CIC_ERR_SSL_ENTROPY_COLLECTION = 29027, + NZERROR_CIC_ERR_SSL_FAIL_SERVER_VERIFY = 29028, + NZERROR_CIC_ERR_SSL_HANDSHAKE_ALREADY_COMPLETED = 29029, + NZERROR_CIC_ERR_SSL_HANDSHAKE_REQUESTED = 29030, + NZERROR_CIC_ERR_SSL_HANDSHAKE_REQUIRED = 29031, + NZERROR_CIC_ERR_SSL_INCOMPLETE_IDENTITY = 29032, + NZERROR_CIC_ERR_SSL_INVALID_PFX = 29033, + NZERROR_CIC_ERR_SSL_NEEDS_CIPHER_OR_CLIENTAUTH = 29034, + NZERROR_CIC_ERR_SSL_NEEDS_PRNG = 29035, + NZERROR_CIC_ERR_SSL_NOT_SUPPORTED = 29036, + NZERROR_CIC_ERR_SSL_NO_CERTIFICATE = 29037, + NZERROR_CIC_ERR_SSL_NO_MATCHING_CERTIFICATES = 29038, + NZERROR_CIC_ERR_SSL_NO_MATCHING_CIPHER_SUITES = 29039, + NZERROR_CIC_ERR_SSL_NO_SUPPORTED_CIPHER_SUITES = 29040, + NZERROR_CIC_ERR_SSL_NULL_CB = 29041, + NZERROR_CIC_ERR_SSL_READ_BUFFER_NOT_EMPTY = 29042, + NZERROR_CIC_ERR_SSL_READ_REQUIRED = 29043, + NZERROR_CIC_ERR_SSL_RENEGOTIATION_ALREADY_REQUESTED = 29044, + NZERROR_CIC_ERR_SSL_RENEGOTIATION_REFUSED = 29045, + NZERROR_CIC_ERR_SSL_RESUMABLE_SESSION = 29046, + NZERROR_CIC_ERR_SSL_TLS_EXTENSION_MISMATCH = 29047, + NZERROR_CIC_ERR_SSL_UNEXPECTED_MSG = 29048, + NZERROR_CIC_ERR_SSL_UNKNOWN_RECORD = 29049, + NZERROR_CIC_ERR_SSL_UNSUPPORTED_CLIENT_AUTH_MODE = 29050, + NZERROR_CIC_ERR_SSL_UNSUPPORTED_PUBKEY_TYPE = 29051, + NZERROR_CIC_ERR_SSL_WRITE_BUFFER_NOT_EMPTY = 29052, + NZERROR_CIC_ERR_PKCS12_MISSING_ALG = 29053, + NZERROR_CIC_ERR_PKCS_AUTH_FAILED = 29054, + NZERROR_CIC_ERR_PKCS_BAD_CONTENT_TYPE = 29055, + NZERROR_CIC_ERR_PKCS_BAD_INPUT = 29056, + NZERROR_CIC_ERR_PKCS_BAD_PADDING = 29057, + NZERROR_CIC_ERR_PKCS_BAD_SN = 29058, + NZERROR_CIC_ERR_PKCS_BAD_SN_LENGTH = 29059, + NZERROR_CIC_ERR_PKCS_BAD_VERSION = 29060, + NZERROR_CIC_ERR_PKCS_BASE = 29061, + NZERROR_CIC_ERR_PKCS_FIELD_NOT_PRESENT = 29062, + NZERROR_CIC_ERR_PKCS_NEED_CERTVAL = 29063, + NZERROR_CIC_ERR_PKCS_NEED_PASSWORD = 29064, + NZERROR_CIC_ERR_PKCS_NEED_PKC = 29065, + NZERROR_CIC_ERR_PKCS_NEED_PRV_KEY = 29066, + NZERROR_CIC_ERR_PKCS_NEED_TRUSTED = 29067, + NZERROR_CIC_ERR_PKCS_UNSUPPORTED_CERT_FORMAT = 29068, + NZERROR_CIC_ERR_PKCS_UNSUP_PRVKEY_TYPE = 29069, + NZERROR_CIC_ERR_CODING_BAD_PEM = 29070, + NZERROR_CIC_ERR_CODING_BASE = 29071, + NZERROR_CIC_ERR_DER_BAD_ENCODING = 29072, + NZERROR_CIC_ERR_DER_BAD_ENCODING_LENGTH = 29073, + NZERROR_CIC_ERR_DER_BASE = 29074, + NZERROR_CIC_ERR_DER_ELEMENT_TOO_LONG = 29075, + NZERROR_CIC_ERR_DER_INDEFINITE_LENGTH = 29076, + NZERROR_CIC_ERR_DER_NO_MORE_ELEMENTS = 29077, + NZERROR_CIC_ERR_DER_OBJECT_TOO_LONG = 29078, + NZERROR_CIC_ERR_DER_TAG_SIZE = 29079, + NZERROR_CIC_ERR_DER_TIME_OUT_OF_RANGE = 29080, + NZERROR_CIC_ERR_DER_UNUSED_BITS_IN_BIT_STR = 29081, + NZERROR_CIC_ERR_GENERAL_BASE = 29082, + NZERROR_CIC_ERR_HASH_BASE = 29083, + NZERROR_CIC_ERR_ILLEGAL_PARAM = 29084, + NZERROR_CIC_ERR_MEM_NOT_OURS = 29085, + NZERROR_CIC_ERR_MEM_OVERRUN = 29086, + NZERROR_CIC_ERR_MEM_UNDERRUN = 29087, + NZERROR_CIC_ERR_MEM_WAS_FREED = 29088, + NZERROR_CIC_ERR_NOT_FOUND = 29090, + NZERROR_CIC_ERR_NO_PTR = 29091, + NZERROR_CIC_ERR_TIMEOUT = 29092, + NZERROR_CIC_ERR_UNIT_MASK = 29093, + NZERROR_CIC_ERR_BAD_CTX = 29094, + NZERROR_CIC_ERR_BAD_INDEX = 29095, + NZERROR_CIC_ERR_BAD_LENGTH = 29096, + NZERROR_CIC_ERR_CODING_BAD_ENCODING = 29097, + NZERROR_CIC_ERR_SSL_NO_CLIENT_AUTH_MODES = 29098, + + /* ============>>> PKCS12 error 29100 - 29149 */ + + NZERROR_LOCKEYID_CREATE_FAILED = 29100, + NZERROR_P12_ADD_PVTKEY_FAILED = 29101, + NZERROR_P12_ADD_CERT_FAILED = 29102, + NZERROR_P12_WLT_CREATE_FAILED = 29103, + NZERROR_P12_ADD_CERTREQ_FAILED = 29104, + NZERROR_P12_WLT_EXP_FAILED = 29105, + NZERROR_P12_WLT_IMP_FAILED = 29106, + NZERROR_P12_CREATE_FAILED = 29107, + NZERROR_P12_DEST_FAILED = 29107, + NZERROR_P12_RAND_ERROR = 29108, + NZERROR_P12_PVTKEY_CRT_FAILED = 29109, + NZERROR_P12_INVALID_BAG = 29110, + NZERROR_P12_INVALID_INDEX = 29111, + NZERROR_P12_GET_CERT_FAILED = 29112, + NZERROR_P12_GET_PVTKEY_FAILED = 29113, + NZERROR_P12_IMP_PVTKEY_FAILED = 29114, + NZERROR_P12_EXP_PVTKEY_FAILED = 29115, + NZERROR_P12_GET_ATTRIB_FAILED = 29116, + NZERROR_P12_ADD_ATTRIB_FAILED = 29117, + NZERROR_P12_CRT_ATTRIB_FAILED = 29118, + NZERROR_P12_IMP_CERT_FAILED = 29119, + NZERROR_P12_EXP_CERT_FAILED = 29120, + NZERROR_P12_ADD_SECRET_FAILED = 29121, + NZERROR_P12_ADD_PKCS11INFO_FAILED = 29122, + NZERROR_P12_GET_PKCS11INFO_FAILED = 29123, + NZERROR_P12_MULTIPLE_PKCS11_LIBNAME = 29124, + NZERROR_P12_MULTIPLE_PKCS11_TOKENLABEL = 29125, + NZERROR_P12_MULTIPLE_PKCS11_TOKENPASSPHRASE = 29126, + NZERROR_P12_UNKNOWN_PKCS11INFO = 29127, + NZERROR_P12_PKCS11_LIBNAME_NOT_SET = 29128, + NZERROR_P12_PKCS11_TOKENLABEL_NOT_SET = 29129, + NZERROR_P12_PKCS11_TOKENPASSPHRASE_NOT_SET = 29130, + NZERROR_P12_MULTIPLE_PKCS11_CERTLABEL = 29131, + +/* ===========>>> SSL Errors CONTINUED 29135 - 29139 */ + NZERROR_CIC_ERR_RANDOM = 29135, + NZERROR_CIC_ERR_SMALL_BUFFER = 29136, + NZERROR_CIC_ERR_SSL_BAD_CONTEXT = 29137, + +/* ==========>>> Mutex Errors 29138 - 29139 */ + NZERROR_MUTEX_INITIALIZE_FAILED = 29138, + NZERROR_MUTEX_DESTROY_FAILED = 29139, + + +/* ============>>> EXTENSIONS Errors 29140 - 29149 */ + NZERROR_BS_CERTOBJ_CREAT_FAILED = 29140, + NZERROR_BS_DER_IMP_FAILED = 29141, + + +/* ============>>> FIPS ERRORS 29150 - 29175 */ + NZERROR_DES_SELF_TEST_FAILED = 29150, + NZERROR_3DES_SELF_TEST_FAILED = 29151, + NZERROR_SHA_SELF_TEST_FAILED = 29152, + NZERROR_RSA_SELF_TEST_FAILED = 29153, + NZERROR_DRNG_SELF_TEST_FAILED = 29154, + NZERROR_CKEYPAIR_SELF_TEST_FAILED = 29155, + NZERROR_CRNG_SELF_TEST_FAILED = 29156, + NZERROR_FIPS_PATHNAME_ERROR = 29157, + NZERROR_FIPS_LIB_OPEN_FAILED = 29158, + NZERROR_FIPS_LIB_READ_ERROR = 29159, + NZERROR_FIPS_LIB_DIFFERS = 29160, + NZERROR_DAC_SELF_TEST_FAILED = 29161, + NZERROR_NONFIPS_CIPHERSUITE = 29162, + NZERROR_VENDOR_NOT_SUPPORTED_FIPS_MODE = 29163, + NZERROR_EXTERNAL_PKCS12_NOT_SUPPORTED_FIPS_MODE = 29164, + NZERROR_AES_SELF_TEST_FAILED = 29165, + +/* ============>>> CRL ERRORS 29176 - 29200 */ + NZERROR_CRL_SIG_VERIFY_FAILED = 29176, /*CRL signature verification failed*/ + NZERROR_CERT_NOT_IN_CRL = 29177, + /*Cert is not in CRL - cert is not revoked*/ + NZERROR_CERT_IN_CRL = 29178, /*Cert is in CRL - cert is revoked*/ + NZERROR_CERT_IN_CRL_CHECK_FAILED = 29179, /*Cert revocation check failed */ + NZERROR_INVALID_CERT_STATUS_PROTOCOL = 29180, + NZERROR_LDAP_OPEN_FAILED = 29181, /* ldap_open failed */ + NZERROR_LDAP_BIND_FAILED = 29182, /* ldap_bind failed */ + NZERROR_LDAP_SEARCH_FAILED = 29183, /* ldap_search failed */ + NZERROR_LDAP_RESULT_FAILED = 29184, /* ldap_result failed */ + NZERROR_LDAP_FIRSTATTR_FAILED = 29185, /* ldap_first_attribute failed */ + NZERROR_LDAP_GETVALUESLEN_FAILED = 29186, /* ldap_get_values_len failed */ + NZERROR_LDAP_UNSUPPORTED_VALMEC = 29187, + /* unsupported validation mechanism */ + NZERROR_LDAP_COUNT_ENTRIES_FAILED = 29188,/* ldap_count_entries failed */ + NZERROR_LDAP_NO_ENTRY_FOUND = 29189, /* No entry found in OID */ + NZERROR_LDAP_MULTIPLE_ENTRIES_FOUND = 29190, /* Multiple entries in OID*/ + NZERROR_OID_INFO_NOT_SET = 29191, + NZERROR_LDAP_VALMEC_NOT_SET = 29192, + /* Validation mechanism not set in OID*/ + NZERROR_CRLDP_NO_CRL_FOUND = 29193, + /* No CRL found using CRLDP mechanism */ + NZERROR_CRL_NOT_IN_CACHE = 29194, /* No CRL found in the cache*/ + NZERROR_CRL_EXPIRED = 29195, /* CRL nextUpdate time is in the past */ + +/* ============>>> ADD ERRORS HERE -- NOTE DECREASING numbers */ + NZERROR_DN_MATCH = 29222, /* for nztCompareDN */ + NZERROR_CERT_CHAIN_CREATION = 29223, /* unable to create a cert chain + * with the existing TPs for the + * cert to be installed. + */ + NZERROR_NO_MATCHING_CERT_REQ = 29224, /* No matching cert_req was + * found the corresponding to + * the privatekey which + * matches the cert to be + * installed */ + NZERROR_CERT_ALREADY_INSTALLED = 29225, /* we are attempting to + * install a cert again into + * a persona which already + * has it installed. + */ + NZERROR_NO_MATCHING_PRIVATE_KEY = 29226, /* could not find a matching + * persona-private(privatekey) in + * the Persona, for the given + * cert(public key). + */ + NZERROR_VALIDITY_EXPIRED = 29227, /* certificate validity date expired */ + NZERROR_TK_BYTES_NEEDED = 29228, /* Couldn't determine # of bytes needed */ + NZERROR_TK_BAD_MAGIC_NUMBER = 29229, + /* Magic number found in header does not match expected */ + NZERROR_TK_BAD_HEADER_LENGTH = 29230, + /* Header length passed in not sufficient for message header */ + NZERROR_TK_CE_INIT = 29231, /* Crypto engine failed to initialize */ + NZERROR_TK_CE_KEYINIT = 29232, /* Crypto engine key initialization failed */ + NZERROR_TK_CE_ENCODE_KEY = 29233, /* Count not encode key object */ + NZERROR_TK_CE_DECODE_KEY = 29234, /* Could not decode key into object */ + NZERROR_TK_CE_GEYKEYINFO = 29235, /* Crypto engine failed to get key info */ + NZERROR_TK_SEED_RANDOM = 29236, /* Couldn't seed random number generator */ + NZERROR_TK_CE_ALGFINISH = 29237, /* Couldn't finish algorithm */ + NZERROR_TK_CE_ALGAPPLY = 29238, /* Couldn't apply algorithm to data */ + NZERROR_TK_CE_ALGINIT = 29239, /* Couldn't init CE for algorithm */ + NZERROR_TK_ALGORITHM = 29240, /* Have no idea what algorithm you want */ + NZERROR_TK_CANNOT_GROW = 29241, /* Cannot grow output buffer block */ + NZERROR_TK_KEYSIZE = 29242, /* Key not large enough for data */ + NZERROR_TK_KEYTYPE = 29243, /* Unknown key type. */ + + NZERROR_TK_PLSQL_NO_WRL = 29244, + /* Wallet resource locator not specified to PL/SQL function */ + + NZERROR_TK_CE_FUNC = 29245, /* Unknown crypto engine function */ + NZERROR_TK_TDU_FORMAT = 29246, /* Unknown TDU format */ + NZERROR_TK_NOTOPEN = 29247, /* Object must be open */ + NZERROR_TK_WRLTYPE = 29248, /* Bad WRL type */ + NZERROR_TK_CE_STATE = 29249, /* Bad state specified for the crypto engine */ + + /* After 29249, use error numbers in block 43000 - 43499 */ + NZERROR_PKCS11_LIBRARY_NOT_FOUND = 43000, /* PKCS #11 library not found */ + NZERROR_PKCS11_TOKEN_NOT_FOUND = 43001, + /* can't find token with given label*/ + NZERROR_PKCS11_BAD_PASSPHRASE = 43002, /* passphrase is incorrect/expired */ + NZERROR_PKCS11_GET_FUNC_LIST = 43003, /* C_GetFunctionList returned error */ + NZERROR_PKCS11_INITIALIZE = 43004, /* C_Initialize returned error */ + NZERROR_PKCS11_NO_TOKENS_PRESENT = 43005, /* No tokens present */ + NZERROR_PKCS11_GET_SLOT_LIST = 43006, /* C_GetSlotList returned error */ + + NZERROR_PKCS11_GET_TOKEN_INFO = 43008, /* C_GetTokenInfo returned error */ + NZERROR_PKCS11_SYMBOL_NOT_FOUND = 43009, /* Symbol not found in PKCS11 lib */ + + NZERROR_PKCS11_TOKEN_LOGIN_FAILED = 43011, /* Token login failed */ + + NZERROR_PKCS11_CHANGE_PROVIDERS_ERROR = 43013, /* Change providers error */ + NZERROR_PKCS11_GET_PRIVATE_KEY_ERROR = 43014, + /* Error trying to find private key on token */ + NZERROR_PKCS11_CREATE_KEYPAIR_ERROR = 43015, /* Key pair gen error */ + NZERROR_PKCS11_WALLET_CONTAINS_P11_INFO = 43016, /* Wallet already contains + pkcs11 info */ + NZERROR_PKCS11_NO_CERT_ON_TOKEN = 43017, /* No cert found on token */ + NZERROR_PKCS11_NO_USER_CERT_ON_TOKEN = 43018, /*No user cert found on token*/ + NZERROR_PKCS11_NO_CERT_ON_TOKEN_WITH_GIVEN_LABEL = 43019, /*No cert found on token with given certificate label.*/ + NZERROR_PKCS11_MULTIPLE_CERTS_ON_TOKEN_WITH_GIVEN_LABEL = 43020, /*Multiple certs found on token with given certificate label.*/ + NZERROR_PKCS11_CERT_WITH_LABEL_NOT_USER_CERT = 43021, /*Cert with given cert is not a user cert because no corresponding pvt key found on token */ + + /* RSA ERRORS 43050 - 43059 */ + NZERROR_BIND_SERVICE_ERROR = 43050, /* C_BindService returned error */ + NZERROR_CREATE_KEY_OBJ_ERROR = 43051, /* B_CreateKeyObject returned error */ + NZERROR_GET_CERT_FIELDS = 43052, /* C_GetCertFields returned error */ + NZERROR_CREATE_PKCS10_OBJECT = 43053, + /* C_CreatePKCS10Object returned error */ + NZERROR_SET_PKCS10_FIELDS = 43054, /* C_SetPKCS10Fields returned error */ + NZERROR_SIGN_CERT_REQUEST = 43055, /* C_SignCertRequest returned error */ + NZERROR_GET_PKCS10_DER = 43056, /* C_GetPKCS10DER returned error */ + NZERROR_INITIALIZE_CERTC = 43057, /* C_InitializeCertC returned error */ + NZERROR_INSERT_PRIVATE_KEY = 43058, /* C_InsertPrivateKey returned error */ + NZERROR_RSA_ERROR = 43059, /* RSA error. See trace output */ + + /* slts ERRORS 43060 - 43069 */ + NZERROR_SLTSCTX_INIT_FAILED = 43060, /* sltsini() returned error */ + NZERROR_SLTSKYC_FAILED = 43061, /* sltskyc() returned error */ + NZERROR_SLTSCTX_TERM_FAILED = 43062, /* sltster() returned error */ + NZERROR_SLTSKYS_FAILED = 43063, /* sltskys() returned error */ + + NZERROR_INVALID_HEADER_LENGTH = 43070, /* bad sso header length */ + NZERROR_WALLET_CONTAINS_USER_CREDENTIALS = 43071, /* wallet not empty */ + NZERROR_CANNOT_MODIFY_AL = 43072, /* Cannot modify AL wallet */ + NZERROR_FILE_LOCK_FAILED = 43073, /* Cannot lock wallet file */ + + /* Certificate selection errors 43080 - 43099 */ + NZERROR_MULTIPLE_MATCHING_CREDENTIALS = 43080, /* Multiple matching certs */ + + + NZERROR_CSF_ALIAS_INVALID = 43100, /* alias is invalid */ + NZERROR_CSF_KEY_INVALID = 43101, /* key invalid */ + NZERROR_CSF_CRED_NOT_SUPPORTED = 43102, /* only pwd cred supported */ + NZERROR_CSF_HOSTNAME = 43103, /* hostname error */ + NZERROR_CSF_XML = 43104, /* XmlCreate error. See trace */ + NZERROR_CSF_WALLET_NOT_SPECIFIED = 43105, /* no wallet specified */ + NZERROR_CSF_MAP_NOT_IN_STORE = 43106, /* map does not exist in store */ + NZERROR_CSF_KEY_NOT_IN_STORE = 43107, /* key does not exist in store */ + NZERROR_CSF_ENTRY_EXISTS = 43108, /* entry with map/key exists */ + NZERROR_CSF_BTSTRP_WLT_PATH_NOT_SET = 43109, /* bootWallet Path not set */ + NZERROR_CSF_BTSTRP_WLT_MAP_NOT_SET = 43110, /* bootWallet map (alias) not set */ + NZERROR_CSF_BTSTRP_WLT_KEY_NOT_SET = 43111, /* bootWallet key not set */ + NZERROR_CSF_LDAP_USERNAME_NOT_SET = 43112, /* ldap username not set */ + NZERROR_CSF_LDAP_PWD_NOT_SET = 43113, /* ldap password not set */ + NZERROR_CSF_LDAP_URL_NOT_SET = 43114, /* ldap url not set */ + NZERROR_CSF_LDAP_PORT_NOT_SET = 43115, /* ldap port not set */ + NZERROR_CSF_LDAP_FARMNAME_NOT_SET = 43116, /* ldap farmname not set */ + NZERROR_CSF_LDAP_ROOTNAME_NOT_SET = 43117, /* ldap rootname not set */ + + NZERROR_LX_ERROR = 43120, /* lx api returned error */ + + NZERROR_LAST_ERROR = 43499, /* Last available error */ + /* MAXIMUM ERROR NUMBER IS 43499 */ + + /* + * DO NOT JUST INSERT NEW ERRORS IN ANY OLD PLACE. New errors should be + * added such the current error retains their integer values. Duplicate + * values will cause compiler errors. + */ + NZERROR_THIS_MUST_BE_LAST + +} nzerror; + +/* + * Macro to convert SSL errors to Oracle errors. As SSL errors are negative + * and Oracle numbers are positive, the following needs to be done. + * 1. The base error number, which is the highest, is added to the + * SSL error to get the index into the number range. + * 2. The result is added to the base Oracle number to get the Oracle error. + */ +#define NZERROR_SSL_TO_ORACLE(ssl_error_) \ + ((ssl_error_ == SSLNoErr) \ + ? NZERROR_OK \ + : (nzerror) ((ssl_error_ - SSLMemoryErr) + (uword) NZERROR_SSLMemoryErr)) +#endif /* NZERROR_ORACLE */ diff --git a/sdk/include/nzt.h b/sdk/include/nzt.h new file mode 100755 index 0000000..42fec33 --- /dev/null +++ b/sdk/include/nzt.h @@ -0,0 +1,2387 @@ +/* DISABLE check_long_lines */ + +/* Copyright (c) 1996, 2007, Oracle. All rights reserved. */ +/* Copyright (c) 1996, 2007, Oracle. All rights reserved. */ + +/* + * + */ + +/* + * NAME + * nzt.h + * + * DESCRIPTION + * Toolkit public declarations. + * + * PUBLIC FUNCTIONS + * nztwOpenWallet - Open a wallet based on a WRL and pwd. + * nztwCloseWallet - Close a wallet. + * + nztwCreateWallet - Create a new wallet. + * + nztwDestroyWallet - Destroy an existing wallet. + * nztwRetrievePersonaCopy - Retieve a copy of a particular persona. + * + nzteStorePersona - Store a persona in the wallet. + * nzteOpenPersona - Open a persona. + * nzteClosePersona - Close a persona. + * + nzteRemovePersona - Remove a persona from a wallet. + * + nzteCreatePersona - Create a persona. + * nzteDestroyPersona - Destroy a persona. + * nztiStoreTrustedIdentity - Store an identity with associated trust. + * nzteRetrieveTrustedIdentCopy - Retrieves a trusted identity from persona + * + nzteSetProtection - Modify the protection set in a persona. + * + nzteGetProtection - Get the protection set in a persona + * nztePriKey - Get the Private Key (X509 Only) + * nzteMyCert - Get the Certificate (X509 only) + * nzteX509CreatePersona - Create a persona given an X509 Certificate. + * + nztiRemoveIdentity - Remove an identity from a persona. + * nztiCreateIdentity - Create an identity. + * nztiDuplicateIdentity - Create a complete copy of an identity. + * nztiAbortIdentity - Discard an unstored identity. + * nztidGetIdentityDesc - Gets Identity Description from Identity. + * nztidFreeIdentityDesc - Frees memory for Identity Desc object. + * nztSign - Generate an attached signature. + * + nztxSignExpansion - Determine size of signature. + * nztVerify - Verify an attached signature. + * nztValidate - Validate an identity. + * nztsd_SignDetached - Generate a detached signature. + * + nztxsd_SignDetachedExpansion - Determine size of detached signature. + * nztved_VerifyDetached - Verify a detached signature. + * + nztEncrypt - Symmetric key encryption. + * + nztxEncryptExpansion - Determine the tdu length for encryption. + * + nztDecrypt - Symmetric key decryption. + * + nztEnvelope - Sign then encrypt data for recipient(s). + * + nztDeEnvelope - Reverse nztEnvelope. + * + nztKeyedHash - Generate keyed hash. + * + nztxKeyedHashExpansion - Determine size of TDU for keyed hash. + * nztHash - Generate hash. + * + nztxHashExpansion - Determine the size of the TDU for a hash. + * nztSeedRandom - See the random number generator. + * nztrb_RandomBytes - Generate a series of random bytes. + * nztrn_RandomNumber - Generate a random number. + * nztbbInitBlock - Initialize a buffer block. + * nztbbReuseBlock - Reuse a buffer block. + * nztbbSizeBlock - Find the size of the buffer block. + * nztbbGrowBlock - Grow initialized buffer block by 'inc' bytes. + * nztbbPurgeBlock - Purge the memory used within a buffer block. + * nztbbSetBlock - Set block to known state. + * nztkec_PKEncrypt - Encrypt data then encrypt key for recipient. + * nztkdc_PKDecrypt - Decrypt PKEncrypt'ed data. + * nztific_FreeIdentityContent - Free the contents of an identity. + * nztifdn - Create an identity from a distinguished name + * nztcts_CipherSpecToStr - Converts the Cipher Spec Code To String + * nztiae_IsAuthEnabled - Checks to see if Authentication is Enabled + * in the current Cipher Spec. + * nztiae_IsEncrEnabled - Checks to see if Encryption is Enabled + * in the current Cipher Spec. + * nztiae_IsHashEnabled - Checks to see if Hashing is Enabled + * in the current Cipher Spec. + * nztwGetCertInfo - Get peer certificate info + * + * NOTE: the '+' indicates that these functions are UNSUPPORTED at this time. + * + * NOTES + * + * MODIFIED + * shiahuan 11/28/07 - + * skalyana 08/15/07 - + * pkale 09/28/06 - Bug 5565668: Removed __STDC__ + * tnallath 09/22/05 - + * rchahal 07/27/04 - add keyusage + * srtata 11/10/03 - fix nztSetAppDefaultLocation header + * rchahal 10/15/03 - bug 2513821 + * rchahal 11/11/02 - pkcs11 support + * akoyfman 07/05/02 - adding secret store to persona + * supriya 10/11/01 - Fix for bug # 2015732 + * ajacobs 04/04/01 - make NZT_REGISTRY_WRL always available + * ajacobs 03/06/01 - olint fix + * ajacobs 03/02/01 - Add GetCertInfo + * supriya 02/23/01 - Move nzttKPUsage from nzt0.h + * rchahal 01/26/01 - olint fixes + * supriya 12/07/00 - Change fn name + * supriya 12/01/00 - Certificate API's needed for iAS + * supriya 06/19/00 - Adding definitions for MCS and ENTR + * lkethana 05/31/00 - multiple cert support + * skanjila 06/25/99 - Remove nztcts_CipherSpecToStr() to NZOS. + * skanjila 06/23/99 - Change API of nztcts_CipherSpecToStr. + * lkethana 06/18/99 - rem nztIPrivateAlloc, etc + * lkethana 06/10/99 - changing size_t to ub4 + * lkethana 06/02/99 - add api for getting auth/encry/hash capability of c + * arswamin 12/28/98 - add NZT_MAX_MD5. + * arswamin 12/21/98 - change signature of compareDN + * qdinh 12/21/98 - change size_t to ub4. + * inetwork 11/22/98 - Removing NZDEPRECATED definition + * amthakur 09/14/98 - deprecating and updating the c-structures. + * arswamin 09/24/98 - adding NZTTWRL_NULL for SSO support. + * amthakur 07/30/98 - changing the prototype of nztGetCertChain. + * qdinh 05/01/98 - add NZTTIDENTTYPE_INVALID_TYPE + * qdinh 04/17/98 - add NZTTWRL_ORACLE. + * ascott 10/08/97 - implement nztiStoreTrustedIdentity + * ascott 10/07/97 - add nztiGetIdentityDesc + * ascott 09/28/97 - clarify prototype comments and error codes + * ascott 09/05/97 - update identity: create, destroy, duplicate + * ascott 08/21/97 - add GetCert and GetPriKey + * ascott 08/07/97 - add other WRL settings + * asriniva 03/25/97 - Add ANSI prototypes + * rwessman 03/19/97 - Added prototypes for nztific_FreeIdentityContent() + * asriniva 03/11/97 - Fix olint errors + * sdange 02/28/97 - Removed inclusion of nz0decl.h + * sdange 02/18/97 - Moved nzt specific declarations from nz0decl.h + * asriniva 01/21/97 - Remove prototypes. + * asriniva 10/31/96 - Include oratypes.h + * asriniva 10/15/96 - Declare buffer block helper functions + * asriniva 10/08/96 - First pass at wallet open/close + * asriniva 10/04/96 - Add random number seed function + * asriniva 10/03/96 - Reorder parameters in nztbbSetBlock + * asriniva 10/03/96 - Keep editing. + * asriniva 10/03/96 - Continued edits. + * asriniva 10/02/96 - Continue editing. + * asriniva 09/26/96 - + */ + +/* ENABLE check_long_lines */ + +#ifndef NZT_ORACLE +#define NZT_ORACLE + +#ifndef ORATYPES +# include +#endif /* ORATYPES */ + +#ifndef NZERROR_ORACLE +# include /* NZ error type */ +#endif /* NZERROR_ORACLE */ + + +#define NZT_MAX_SHA1 20 +#define NZT_MAX_MD5 16 + +/***************************************/ +/* PUBLIC CONSTANTS, MACROS, AND TYPES */ +/***************************************/ + +/* + * Wallet Resource Locator Type Strings + * + * WRL TYPE PARAMETERS BEHAVIOR + * ======== ========== ===================================== + * default: Uses directory defined by the parameter + * SNZD_DEFAULT_FILE_DIRECTORY which in + * unix is "$HOME/oracle/oss" + * + * file: file path Find the Oracle wallet in this directory. + * example: file: + * + * sqlnet: In this case, the directory path will be + * retrieved from the sqlnet.ora file under + * the oss.source.my_wallet parameter. + * + * mcs: Microsoft WRL. + * + * entr: dir path Entrust WRL. eg: ENTR: + * + */ +/* Note that there is no NZT_NULL_WRL. Instead look in snzd.h for DEFAULT_WRP + * which is used in our new defaulting mechanism. The NZT_DEFAULT_WRL + * should be deprecated. + */ +#define NZT_DEFAULT_WRL ((text *)"default:") +#define NZT_SQLNET_WRL ((text *)"sqlnet:") +#define NZT_FILE_WRL ((text *)"file:") +#define NZT_ENTR_WRL ((text *)"entr:") +#define NZT_MCS_WRL ((text *)"mcs:") +#define NZT_ORACLE_WRL ((text *)"oracle:") +#define NZT_REGISTRY_WRL ((text *)"reg:") + +enum nzttwrl +{ + NZTTWRL_DEFAULT = 1, /* Default, use SNZD_DEFAULT_FILE_DIRECTORY */ + NZTTWRL_SQLNET, /* Use oss.source.my_wallet in sqlnet.ora file */ + NZTTWRL_FILE, /* Find the oracle wallet in this directory */ + NZTTWRL_ENTR, /* Find the entrust profile in this directory */ + NZTTWRL_MCS, /* WRL for Microsoft */ + NZTTWRL_ORACLE, /* Get the wallet from OSS db */ + NZTTWRL_NULL, /* New SSO defaulting mechanism */ + NZTTWRL_REGISTRY /* Find the wallet in Windows Registry */ +}; +typedef enum nzttwrl nzttwrl; + +#ifndef NZ0DECL_ORACLE + /* + * With the elimination of nz0decl.h from public, we need this + * redundant typedef. + */ + typedef struct nzctx nzctx; + typedef struct nzstrc nzstrc; + typedef struct nzosContext nzosContext; +#endif /* NZ0DECL_ORACLE */ + +/* Moved from nz0decl.h */ + +typedef struct nzttIdentity nzttIdentity; +typedef struct nzttIdentityPrivate nzttIdentityPrivate; +typedef struct nzttPersona nzttPersona; +typedef struct nzttPersonaPrivate nzttPersonaPrivate; +typedef struct nzttWallet nzttWallet; +typedef struct nzttWalletPrivate nzttWalletPrivate; +typedef struct nzttWalletObj nzttWalletObj; /* For wallet object */ +typedef struct nzssEntry nzssEntry; /* For secretstore */ +typedef struct nzpkcs11_Info nzpkcs11_Info; + +/* + * Crypto Engine State + * + * Once the crypto engine (CE) has been initialized for a particular + * cipher, it is either at the initial state, or it is continuing to + * use the cipher. NZTCES_END is used to change the state back to + * initialized and flush any remaining output. NZTTCES_RESET can be + * used to change the state back to initialized and throw away any + * remaining output. + */ +enum nzttces +{ + NZTTCES_CONTINUE = 1, /* Continue processing input */ + NZTTCES_END, /* End processing input */ + NZTTCES_RESET /* Reset processing and skip generating output */ +}; +typedef enum nzttces nzttces; + +/* + * Crypto Engine Functions + * + * List of crypto engine categories; used to index into protection + * vector. + */ +enum nzttcef +{ + NZTTCEF_DETACHEDSIGNATURE = 1, /* Signature, detached from content */ + NZTTCEF_SIGNATURE, /* Signature combined with content */ + NZTTCEF_ENVELOPING, /* Signature and encryption with content */ + NZTTCEF_PKENCRYPTION, /* Encryption for one or more recipients */ + NZTTCEF_ENCRYPTION, /* Symmetric encryption */ + NZTTCEF_KEYEDHASH, /* Keyed hash/checkusm */ + NZTTCEF_HASH, /* Hash/checsum */ + NZTTCEF_RANDOM, /* Random byte generation */ + + NZTTCEF_LAST /* Used for array size */ +}; +typedef enum nzttcef nzttcef; + +/* + * State of the persona. + */ +enum nzttState +{ + NZTTSTATE_EMPTY = 0, /* is not in any state(senseless???) */ + NZTTSTATE_REQUESTED, /* cert-request */ + NZTTSTATE_READY, /* certificate */ + NZTTSTATE_INVALID, /* certificate */ + NZTTSTATE_RENEWAL /* renewal-requested */ +}; +typedef enum nzttState nzttState; + +/* + * Cert-version types + * + * This is used to quickly look-up the cert-type + */ +enum nzttVersion +{ + NZTTVERSION_X509v1 = 1, /* X.509v1 */ + NZTTVERSION_X509v3, /* X.509v3 */ +#ifdef NZDEPRECATED + NZTTVERSION_SYMMETRIC, /* Symmetric */ +#endif + NZTTVERSION_INVALID_TYPE /* For Initialization */ +}; +typedef enum nzttVersion nzttVersion; + +/* + * Cipher Types + * + * List of all cryptographic algorithms, some of which may not be + * available. + */ +enum nzttCipherType +{ + NZTTCIPHERTYPE_RSA = 1, /* RSA public key */ + NZTTCIPHERTYPE_DES, /* DES */ + NZTTCIPHERTYPE_RC4, /* RC4 */ + NZTTCIPHERTYPE_MD5DES, /* DES encrypted MD5 with salt (PBE) */ + NZTTCIPHERTYPE_MD5RC2, /* RC2 encrypted MD5 with salt (PBE) */ + NZTTCIPHERTYPE_MD5, /* MD5 */ + NZTTCIPHERTYPE_SHA /* SHA */ +}; +typedef enum nzttCipherType nzttCipherType; + +/* + * TDU Formats + * + * List of possible toolkit data unit (TDU) formats. Depending on the + * function and cipher used some may be not be available. + */ +enum nztttdufmt +{ + NZTTTDUFMT_PKCS7 = 1, /* PKCS7 format */ + NZTTTDUFMT_RSAPAD, /* RSA padded format */ + NZTTTDUFMT_ORACLEv1, /* Oracle v1 format */ + NZTTTDUFMT_LAST /* Used for array size */ +}; +typedef enum nztttdufmt nztttdufmt; + +/* + * Validate State + * + * Possible validation states an identity can be in. + */ +enum nzttValState +{ + NZTTVALSTATE_NONE = 1, /* Needs to be validated */ + NZTTVALSTATE_GOOD, /* Validated */ + NZTTVALSTATE_REVOKED /* Failed to validate */ +}; +typedef enum nzttValState nzttValState; + +/* + * Policy Fields <----NEW (09/14/98) + * + * Policies enforced + */ +enum nzttPolicy +{ + NZTTPOLICY_NONE = 0, + NZTTPOLICY_RETRY_1, /* number of retries for decryption = 1 */ + NZTTPOLICY_RETRY_2, /* number of retries for decryption = 2 */ + NZTTPOLICY_RETRY_3 /* number of retries for decryption = 3 */ +}; +typedef enum nzttPolicy nzttPolicy; + +/* + * Persona Usage <----NEW (09/14/98) + * + * what a persona will be used for? + */ + +#ifdef NZDEPRECATED_MULTIPLECERTS +enum nzttUsage +{ + NZTTUSAGE_NONE = 0, + NZTTUSAGE_SSL /* persona for SSL usage */ +}; +typedef enum nzttUsage nzttUsage; +#endif + +/* + * Personas and identities have unique id's that are represented with + * 128 bits. + */ +typedef ub1 nzttID[16]; + +/* + * Identity Types + * + * List of all Identity types.. + */ +enum nzttIdentType +{ + NZTTIDENTITYTYPE_INVALID_TYPE = 0, + NZTTIDENTITYTYPE_CERTIFICTAE, + NZTTIDENTITYTYPE_CERT_REQ, + NZTTIDENTITYTYPE_RENEW_CERT_REQ, + NZTTIDENTITYTYPE_CLEAR_ETP, + NZTTIDENTITYTYPE_CLEAR_UTP, + NZTTIDENTITYTYPE_CLEAR_PTP +}; +typedef enum nzttIdentType nzttIdentType; + +typedef ub4 nzttKPUsage; +/* IF new types are added nztiMUS should be changed */ +#define NZTTKPUSAGE_NONE 0 +#define NZTTKPUSAGE_SSL 1 /* SSL Server */ +#define NZTTKPUSAGE_SMIME_ENCR 2 +#define NZTTKPUSAGE_SMIME_SIGN 4 +#define NZTTKPUSAGE_CODE_SIGN 8 +#define NZTTKPUSAGE_CERT_SIGN 16 +#define NZTTKPUSAGE_SSL_CLIENT 32 /* SSL Client */ +#define NZTTKPUSAGE_INVALID_USE 0xffff + + +/* + * Timestamp as 32 bit quantity in UTC. + */ +typedef ub1 nzttTStamp[4]; + +/* + * Buffer Block + * + * A function that needs to fill (and possibly grow) an output buffer + * uses an output parameter block to describe each buffer. + * + * The flags_nzttBufferBlock member tells the function whether the + * buffer can be grown or not. If flags_nzttBufferBlock is 0, then + * the buffer will be realloc'ed automatically. + * + * The buflen_nzttBufferBLock member is set to the length of the + * buffer before the function is called and will be the length of the + * buffer when the function is finished. If buflen_nzttBufferBlock is + * 0, then the initial pointer stored in pobj_nzttBufferBlock is + * ignored. + * + * The objlen_nzttBufferBlock member is set to the length of the + * object stored in the buffer when the function is finished. If the + * initial buffer had a non-0 length, then it is possible that the + * object length is shorter than the buffer length. + * + * The pobj_nzttBufferBlock member is a pointer to the output object. + */ +struct nzttBufferBlock +{ +# define NZT_NO_AUTO_REALLOC 0x1 + + uword flags_nzttBufferBlock; /* Flags */ + ub4 buflen_nzttBufferBlock; /* Total length of buffer */ + ub4 usedlen_nzttBufferBlock; /* Length of used buffer part */ + ub1 *buffer_nzttBufferBlock; /* Pointer to buffer */ +}; +typedef struct nzttBufferBlock nzttBufferBlock; + +/* + * Wallet. + */ +struct nzttWallet +{ + ub1 *ldapName_nzttWallet; /* user's LDAP Name */ + ub4 ldapNamelen_nzttWallet; /* len of user's LDAP Name */ + nzttPolicy securePolicy_nzttWallet; /* secured-policy of the wallet */ + nzttPolicy openPolicy_nzttWallet; /* open-policy of the wallet */ + nzttPersona *persona_nzttWallet; /* List of personas in wallet */ + nzttWalletPrivate *private_nzttWallet; /* Private wallet information */ +#ifdef NZDEPRECATED + ub4 npersona_nzttWallet; /* Number of personas */ +#endif +}; + +/* + * The wallet contains, one or more personas. A persona always + * contains its private key and its identity. It may also contain + * other 3rd party identites. All identities qualified with trust + * where the qualifier can indicate anything from untrusted to trusted + * for specific operations. + */ + +/* + * Persona + * + * Structure containing information about a persona. + */ +struct nzttPersona +{ + ub1 *genericName_nzttPersona; /* user-friendly persona name */ + ub4 genericNamelen_nzttPersona; /* persona-name length */ + nzttPersonaPrivate *private_nzttPersona; /* Opaque part of persona */ + nzttIdentity *mycertreqs_nzttPersona; /* My cert-requests */ + nzttIdentity *mycerts_nzttPersona; /* My certificates */ + nzttIdentity *mytps_nzttPersona; /* List of trusted identities */ + nzssEntry *mystore_nzttPersona; /* List of secrets */ + nzpkcs11_Info *mypkcs11Info_nzttPersona; /* PKCS11 token info */ + struct nzttPersona *next_nzttPersona; /* Next persona */ +#ifdef NZDEPRECATED_MULTIPLECERTS + /* As Persona has multiple certs for different + usages, Persona Usage does not mean anything. Similarly + each key pair has its own state and Persona state itself + does not mean anything. - lk 5/31/00 + */ + nzttUsage usage_nzttPersona; /* persona usage; SSL/SET/.. */ + nzttState state_nzttPersona; /* persona state-requested/ready */ + ub4 ntps_nzttPersona; /* Num of trusted identities */ +#endif +}; + +/* + * Identity + * + * Structure containing information about an identity. + * + * NOTE + * -- the next_trustpoint field only applies to trusted identities and + * has no meaning (i.e. is NULL) for self identities. + */ +struct nzttIdentity +{ + text *dn_nzttIdentity; /* Alias */ + ub4 dnlen_nzttIdentity; /* Length of alias */ + text *comment_nzttIdentity; /* Comment */ + ub4 commentlen_nzttIdentity; /* Length of comment */ + nzttIdentityPrivate *private_nzttIdentity; /* Opaque part of identity */ + nzttIdentity *next_nzttIdentity; /* next identity in list */ +}; + +struct nzttB64Cert +{ + ub1 *b64Cert_nzttB64Cert; + ub4 b64Certlen_nzttB64Cert; + struct nzttB64Cert *next_nzttB64Cert; +}; +typedef struct nzttB64Cert nzttB64Cert; + + +struct nzttPKCS7ProtInfo +{ + nzttCipherType mictype_nzttPKCS7ProtInfo; /* Hash cipher */ + nzttCipherType symmtype_nzttPKCS7ProtInfo; /* Symmetric cipher */ + ub4 keylen_nzttPKCS7ProtInfo; /* Length of key to use */ +}; +typedef struct nzttPKCS7ProtInfo nzttPKCS7ProtInfo; + +/* + * Protection Information. + * + * Information specific to a type of protection. + */ +union nzttProtInfo +{ + nzttPKCS7ProtInfo pkcs7_nzttProtInfo; +}; +typedef union nzttProtInfo nzttProtInfo; + +/* + * A description of a persona so that the toolkit can create one. A + * persona can be symmetric or asymmetric and both contain an + * identity. The identity for an asymmetric persona will be the + * certificate and the identity for the symmetric persona will be + * descriptive information about the persona. In either case, an + * identity will have been created before the persona is created. + * + * A persona can be stored separately from the wallet that references + * it. By default, a persona is stored with the wallet (it inherits + * with WRL used to open the wallet). If a WRL is specified, then it + * is used to store the actuall persona and the wallet will have a + * reference to it. + */ +struct nzttPersonaDesc +{ + ub4 privlen_nzttPersonaDesc; /* Length of private info (key)*/ + ub1 *priv_nzttPersonaDesc; /* Private information */ + ub4 prllen_nzttPersonaDesc; /* Length of PRL */ + text *prl_nzttPersonaDesc; /* PRL for storage */ + ub4 aliaslen_nzttPersonaDesc; /* Length of alias */ + text *alias_nzttPersonaDesc; /* Alias */ + ub4 longlen_nzttPersonaDesc; /* Length of longer description*/ + text *long_nzttPersonaDesc; /* Longer persona description */ +}; +typedef struct nzttPersonaDesc nzttPersonaDesc; + +/* + * A description of an identity so that the toolkit can create one. + * Since an identity can be symmetric or asymmetric, the asymmetric + * identity information will not be used when a symmetric identity is + * created. This means the publen_nzttIdentityDesc and + * pub_nzttIdentityDesc members will not be used when creating a + * symmetric identity. + */ +struct nzttIdentityDesc +{ + ub4 publen_nzttIdentityDesc; /* Length of identity */ + ub1 *pub_nzttIdentityDesc; /* Type specific identity */ + ub4 dnlen_nzttIdentityDesc; /* Length of alias */ + text *dn_nzttIdentityDesc; /* Alias */ + ub4 longlen_nzttIdentityDesc; /* Length of longer description */ + text *long_nzttIdentityDesc; /* Longer description */ + ub4 quallen_nzttIdentityDesc; /* Length of trust qualifier */ + text *trustqual_nzttIdentityDesc; /* Trust qualifier */ +}; +typedef struct nzttIdentityDesc nzttIdentityDesc; + +/********************************/ +/* PUBLIC FUNCTION DECLARATIONS */ +/********************************/ + +/*---------------------- nztwOpenWallet ----------------------*/ + +/* + * NAME + * nztwOpenWallet - Open a wallet based on a wallet Resource Locator (WRL). + * + * PARAMETERS + * osscntxt {IN} OSS context. + * wrllen {IN} Length of WRL. + * wrl {IN} WRL. + * pwdlen {IN} Length of password. + * pwd {IN} Password. + * wallet {IN/OUT} Initialized wallet structure. + * + * NOTES + * The syntax for a WRL is :. + * + * Wallet Type Wallet Type Parameters. + * ----------- ---------------------- + * File Pathname (e.g. "file:/home/asriniva") + * Oracle Connect string (e.g. "oracle:scott/tiger@oss") + * + * There are also defaults. If the WRL is NZT_DEFAULT_WRL, then + * the platform specific WRL default is used. If only the wallet + * type is specified, then the WRL type specific default is used + * (e.g. "oracle:") + * + * There is an implication with Oracle that should be stated: An + * Oracle based wallet can be implemented in a user's private space + * or in world readable space. + * + * When the wallet is opened, the password is verified by hashing + * it and comparing against the password hash stored with the + * wallet. The list of personas (and their associated identities) + * is built and stored into the wallet structure. + * + * RETURNS + * NZERROR_OK Success. + * NZERROR_RIO_OPEN RIO could not open wallet (see network trace file). + * NZERROR_TK_PASSWORD Password verification failed. + * NZERROR_TK_WRLTYPE WRL type is not known. + * NZERROR_TK_WRLPARM WRL parm does not match type. + */ +nzerror nztwOpenWallet( nzctx *, ub4, text *, ub4, text *, + nzttWallet * ); + + +/*---------------------- nztwCloseWallet ----------------------*/ + +/* + * NAME + * nztwCloseWallet - Close a wallet + * + * PARAMETERS + * osscntxt {IN} OSS context. + * wallet {IN/OUT} Wallet. + * + * NOTES + * Closing a wallet also closes all personas associated with that + * wallet. It does not cause a persona to automatically be saved + * if it has changed. The implication is that a persona can be + * modified by an application but if it is not explicitly saved it + * reverts back to what was in the wallet. + * + * RETURNS + * NZERROR_OK Success. + * NZERROR_RIO_CLOSE RIO could not close wallet (see network trace file). + */ +nzerror nztwCloseWallet( nzctx *, nzttWallet * ); + +/*--------------------nztwGetCertInfo----------------------------*/ +/****NOTE: This function is a temporary hack.****/ +/****DO NOT CALL. It will soon disappear.****/ +nzerror nztwGetCertInfo( nzctx *nz_context, + nzosContext *nzosCtx, + nzttWallet *walletRef, + void *peerCert ); + + +/*------------------------ nztwConstructWallet -----------------------*/ +/* + * + * nzerror nztwConstructWallet( nzctx *oss_context, + * nzttPolicy openPolicy, + * nzttPolicy securePolicy, + * ub1 *ldapName, + * ub4 ldapNamelen, + * nzstrc *wrl, + * nzttPersona *personas, + * nzttWallet **wallet ); + */ + +/*---------------------- nztwRetrievePersonaCopy ----------------------*/ + +/* + * NAME + * nztwRetrievePersonaCopy - Retrieves a persona based from wallet + * + * PARAMETERS + * osscntxt {IN} OSS context. + * wallet {IN} Wallet. + * index {IN} Which wallet index to remove (first persona is zero). + * persona {OUT} Persona found. + * + * NOTES + * Retrieves a persona from the wallet based on the index number passed + * in. This persona is a COPY of the one stored in the wallet, therefore + * it is perfectly fine for the wallet to be closed after this call is + * made. + * + * The caller is responsible for disposing of the persona when completed. + * + * RETURNS + * NZERROR_OK Success. + */ +nzerror nztwRetrievePersonaCopy( nzctx *, nzttWallet *, ub4, + nzttPersona ** ); + + +/*---------------------- nztwRetrievePersonaCopyByName ----------------------*/ + +/* + * NAME + * nztwRetrievePersonaCopyByName - Retrieves a persona based on its name. + * + * PARAMETERS + * osscntxt {IN} OSS context. + * wallet {IN} Wallet. + * name {IN} Name of the persona + * persona {OUT} Persona found. + * + * NOTES + * Retrieves a persona from the wallet based on the name of the persona. + * This persona is a COPY of the one stored in the wallet, therefore + * it is perfectly fine for the wallet to be closed after this call is + * made. + * + * The caller is responsible for disposing of the persona when completed. + * + * RETURNS + * NZERROR_OK Success. + */ +nzerror nztwRetrievePersonaCopyByName( nzctx *, nzttWallet *, char *, + nzttPersona ** ); + +/*---------------------- nzteOpenPersona ----------------------*/ + +/* + * NAME + * nzteOpenPersona - Open a persona. + * + * PARAMETERS + * osscntxt {IN} OSS context. + * persona {IN/OUT} Persona. + * + * NOTES + * + * RETURNS + * NZERROR_OK Success. + * NZERROR_TK_PASSWORD Password failed to decrypt persona. + * NZERROR_TK_BADPRL Persona resource locator did not work. + * NZERROR_RIO_OPEN Could not open persona (see network trace file). + */ +nzerror nzteOpenPersona( nzctx *, nzttPersona * ); + +/*--------------------- nzteClosePersona ---------------------*/ + +/* + * NAME + * nzteClosePersona - Close a persona. + * + * PARAMETERS + * osscntxt {IN} OSS context. + * persona {IN/OUT} Persona. + * + * NOTES + * Closing a persona does not store the persona, it simply releases + * the memory associated with the crypto engine. + * + * RETURNS + * NZERROR_OK Success. + */ +nzerror nzteClosePersona( nzctx *, nzttPersona * ); + +/*--------------------- nzteDestroyPersona ---------------------*/ + +/* + * NAME + * nzteDestroyPersona - Destroy a persona. + * + * PARAMETERS + * osscntxt {IN} OSS context. + * persona {IN/OUT} Persona. + * + * NOTES + * The persona is destroyd in the open state, but it will + * not be associated with a wallet. + * + * The persona parameter is doubly indirect so that at the + * conclusion of the function, the pointer can be set to NULL. + * + * + * RETURNS + * NZERROR_OK Success. + * NZERROR_TK_TYPE Unsupported itype/ctype combination. + * NZERROR_TK_PARMS Error in persona description. + */ +nzerror nzteDestroyPersona( nzctx *, nzttPersona ** ); + +/*---------------------- nzteRetrieveTrustedIdentCopy ----------------------*/ + +/* + * NAME + * nzteRetrieveTrustedIdentCopy - Retrieves a trusted identity from persona + * + * PARAMETERS + * osscntxt {IN} OSS context. + * persona {IN} Persona. + * index {IN} Which wallet index to remove (first element is zero). + * identity {OUT} Trusted Identity from this persona. + * + * NOTES + * Retrieves a trusted identity from the persona based on the index + * number passed in. This identity is a COPY of the one stored in + * the persona, therefore it is perfectly fine to close the persona + * after this call is made. + * + * The caller is responsible for freeing the memory of this object + * by calling nztiAbortIdentity it is no longer needed + * + * RETURNS + * NZERROR_OK Success. + */ +nzerror nzteRetrieveTrustedIdentCopy( nzctx *, nzttPersona *, ub4, + nzttIdentity ** ); + +/*--------------------- nztePriKey ---------------------*/ + +/* + * NAME + * nztePriKey - Get the decrypted Private Key for the Persona + * + * PARAMETERS + * osscntxt {IN} OSS context. + * persona {IN} Persona. + * vkey {OUT} Private Key [B_KEY_OBJ] + * vkey_len {OUT} Private Key Length + * + * NOTES + * This funiction will only work for X.509 based persona which contain + * a private key. + * A copy of the private key is returned to the caller so that they do not + * have to worry about the key changeing "underneath them". + * Memory will be allocated for the vkey and therefore, the CALLER + * will be responsible for freeing this memory. + * + * RETURNS + * NZERROR_OK Success. + * NZERROR_NO_MEMORY ossctx is null. + * NZERROR_TK_BADPRL Persona resource locator did not work. + */ +nzerror nztePriKey( nzctx *, nzttPersona *, ub1 **, ub4 * ); + +/*--------------------- nzteMyCert ---------------------*/ + +/* + * NAME + * nzteMyCert - Get the X.509 Certificate for a persona + * + * PARAMETERS + * osscntxt {IN} OSS context. + * persona {IN} Persona. + * cert {OUT} X.509 Certificate [BER encoded] + * cert_len {OUT} Certificate length + * + * NOTES + * This funiction will only work for X.509 based persona which contain + * a certificate for the self identity. + * A copy of the certificate is returned to the caller so that they do not + * have to worry about the certificate changeing "underneath them". + * Memory will be allocated for the cert and therefore, the CALLER + * will be responsible for freeing this memory. + * + * RETURNS + * NZERROR_OK Success. + * NZERROR_NO_MEMORY ossctx is null. + */ +nzerror nzteMyCert( nzctx *, nzttPersona *, ub1 **, ub4 * ); + +/*--------------------- nzteX509CreatePersona ---------------------*/ + +/* + * NAME + * nzteX509CreatePersona - Given a BER X.509 cert, create a persona + * + * PARAMETERS + * osscntxt {IN} OSS context. + * cert {IN} X.509 Certificate [BER encoded] + * cert_len {IN} Certificate length + * persona {OUT} Persona. + * + * NOTES + * Memory will be allocated for the persona and therefore, the CALLER + * will be responsible for freeing this memory. + * + * RETURNS + * NZERROR_OK Success. + * NZERROR_NO_MEMORY ossctx is null. + */ +nzerror nzteX509CreatePersona( nzctx *, ub1 *, ub4, nzttPersona ** ); + +/*-------------------- nztiCreateIdentity --------------------*/ + +/* + * NAME + * nztiCreateIdentity - Create an identity. + * + * PARAMETERS + * osscntxt {IN} OSS context. + * itype {IN} Identity type. + * desc {IN} Description of identity. + * identity {IN/OUT} Identity. + * + * NOTES + * Memory is only allocated for the identity structure. The elements in + * the description struct are not copied. Rather their pointers are copied + * into the identity structure. Therefore, the caller should not free + * the elements referenced by the desc. These elements will be freed + * when the nztiDestroyIdentity is called. + * + * RETURNS + * NZERROR_OK Success. + * NZERROR_PARMS Error in description. + */ +nzerror nztiCreateIdentity( nzctx *, nzttVersion, nzttIdentityDesc *, + nzttIdentity ** ); + +#ifdef NZ_OLD_TOOLS +/*-------------------- nztiDuplicateIdentity --------------------*/ + +/* + * NAME + * nztiDuplicateIdentity - Duplicate an identity. + * + * PARAMETERS + * osscntxt {IN} OSS context. + * identity {IN} Target Identity. + * new_identity {IN} New Identity. + * + * NOTES + * Memory for the identity is allocated inside the function, and all + * internal identity elements as well. + * + * RETURNS + * NZERROR_OK Success. + * NZERROR_TK_NOTFOUND Identity not found. + * NZERROR_PARMS Error in description. + */ +nzerror nztiDuplicateIdentity( nzctx *, nzttIdentity *, + nzttIdentity ** ); +#endif /* NZ_OLD_TOOLS */ + +/*--------------------- nztiAbortIdentity ---------------------*/ + +/* + * NAME + * nztiAbortIdentity - Abort an unassociated identity. + * + * PARAMETERS + * osscntxt {IN} OSS context. + * identity {IN/OUT} Identity. + * + * NOTES + * It is an error to try to abort an identity that can be + * referenced through a persona. + * + * The identity pointer is set to NULL at the conclusion. + * + * RETURNS + * NZERROR_OK Success. + * NZERROR_CANTABORT Identity is associated with persona. + */ +nzerror nztiAbortIdentity( nzctx *, nzttIdentity ** ); + +#ifdef NZ_OLD_TOOLS +/*----------------- nztidGetIdentityDesc -----------------*/ + +/* + * NAME + * nztidGetIdentityDesc - Gets an Identity Description from the identity + * + * PARAMETERS + * osscntxt {IN} Success. + * identity {IN} Identity. + * description {IN/OUT} Identity Description. + * + * NOTES + * Memory is allocated for the Identity Description. It + * is the callers responsibility to free this memory by calling + * nztiFreeIdentityDesc. + * + * RETURNS + * NZERROR_OK Success. + */ +nzerror nztidGetIdentityDesc( nzctx *, nzttIdentity *, + nzttIdentityDesc ** ); + +/*----------------- nztidFreeIdentityDesc -----------------*/ + +/* + * NAME + * nztidFreeIdentityDesc - Frees memory for Identity Desc object. + * + * PARAMETERS + * osscntxt {IN} oss context. + * description {IN/OUT} Identity Description. + * + * NOTES + * Memory is freed for all Identity description elements. Pointer is + * then set to null. + * + * RETURNS + * NZERROR_OK Success. + */ +nzerror nztidFreeIdentityDesc( nzctx *, nzttIdentityDesc ** ); +#endif /* NZ_OLD_TOOLS */ + +/*---------------- nztific_FreeIdentityContent ----------------*/ + +/* + * NAME + * nztific_FreeIdentityContent - free the contents of an identity. + * + * PARAMETERS + * osscntxt {IN} OSS context. + * identity {IN/OUT} freed identity + * + * NOTES + * Free a created identity. + * + * RETURNS + * NZERROR_OK Success. + */ +/* + * Free the identity content. + */ +nzerror nztific_FreeIdentityContent( nzctx *ossctx, + nzttIdentity *identity ); + + +/*-------------------------- nztSign --------------------------*/ + +/* + * NAME + * nztSign - Create an attached signature. + * + * PARAMETERS + * osscntxt {IN} OSS context. + * persona {IN} Open persona acting as signer. + * state {IN} State of signature. + * inlen {IN} Length of this input part. + * in {IN} This input part. + * tdubuf {IN/OUT} TDU buffer. + * + * NOTES + * + * RETURNS + * NZERROR_OK Success. + * NZERROR_TK_CANTGROW Needed to grow output buffer but could not. + * NZERROR_TK_NOTOPEN Persona is not open. + * NZERROR_TK_NOTSUPP Function not supported with persona. + */ +nzerror nztSign( nzctx *, nzttPersona *, nzttces, ub4, ub1 *, + nzttBufferBlock * ); + +/*------------------------- nztVerify -------------------------*/ + +/* + * NAME + * nztVerify - Verify an attached signature. + * + * PARAMETERS + * osscntxt {IN} OSS context. + * persona {IN} Persona. + * state {IN} State of verification. + * intdulen {IN} TDU length. + * intdu {IN} TDU. + * out {IN/OUT} Extracted message. + * verified {OUT} TRUE if signature verified. + * validated{OUT} TRUE if signing identity validated. + * identity {OUT} Identity of signing party. + * + * NOTES + * + * RETURNS + * NZERROR_OK Success. + * NZERROR_TK_CANTGROW Needed to grow outptu buffer but could not. + * NZERROR_TK_NOTOPEN Persona is not open. + * NZERROR_TK_NOTSUPP Function not supported with persona. + */ +nzerror nztVerify( nzctx *, nzttPersona *, nzttces, ub4, ub1 *, + nzttBufferBlock *, boolean *, boolean *, + nzttIdentity ** ); + +/*------------------------ nztValidate ------------------------*/ + +/* + * NAME + * nztValidate - Validate an identity. + * + * PARAMETERS + * osscntxt {IN} OSS context. + * persona {IN} Persona. + * identity {IN} Identity. + * validated{OUT} TRUE if identity was validated. + * + * NOTES + * + * RETURNS + * NZERROR_OK Success. + * NZERROR_TK_NOTOPEN Persona is not open. + * NZERROR_TK_NOTSUPP Function not supported with persona. + */ +nzerror nztValidate( nzctx *, nzttPersona *, nzttIdentity *, boolean * ); + +/*-------------------- nztsd_SignDetached --------------------*/ + +/* + * NAME + * nztsd_SignDetached - Generate a detached signature. + * + * PARAMETERS + * osscntxt {IN} OSS context. + * persona {IN} Persona. + * state {IN} State of signature. + * inlen {IN} Length of this input part. + * in {IN} This input part. + * tdubuf {IN/OUT} TDU buffer. + * + * NOTES + * + * RETURNS + * NZERROR_OK Success. + * NZERROR_TK_CANTGROW Needed to grow output buffer but could not. + * NZERROR_TK_NOTOPEN Persona is not open. + * NZERROR_TK_NOTSUPP Function not supported with persona. + */ +nzerror nztsd_SignDetached( nzctx *, nzttPersona *, nzttces, ub4, ub1 *, + nzttBufferBlock * ); + +/*------------------- nztved_VerifyDetached -------------------*/ + +/* + * NAME + * nztved_VerifyDetached - Verify a detached signature. + * + * PARAMETERS + * osscntxt {IN} OSS context. + * persona {IN} Persona. + * state {IN} State of verification. + * inlen {IN} Length of data. + * in {IN} Data. + * intdulen {IN} Input TDU length. + * tdu {IN} Input TDU. + * verified {OUT} TRUE if signature verified. + * validated{OUT} TRUE if signing identity validated. + * identity {OUT} Identity of signing party. + * + * NOTES + * + * RETURNS + * NZERROR_OK Success. + * NZERROR_TK_NOTOPEN Persona is not open. + * NZERROR_TK_NOTSUPP Function not supported with persona. + */ +nzerror nztved_VerifyDetached( nzctx *, nzttPersona *, nzttces, ub4, + ub1 *, ub4, ub1 *, boolean *, boolean *, + nzttIdentity ** ); + +/*--------------------- nztkec_PKEncrypt ---------------------*/ + +/* + * NAME + * nztkec_PKEncrypt - Encrypt data symmetrically, encrypt key asymmetrically + * + * PARAMETERS + * osscntxt {IN} OSS context. + * persona {IN} Persona. + * nrecipients {IN} Number of recipients for this encryption. + * recipients {IN} List of recipients. + * state {IN} State of encryption. + * inlen {IN} Length of this input part. + * in {IN} This input part. + * tdubuf {IN/OUT} TDU buffer. + * + * NOTES + * There is a limitation of 1 recipient (nrecipients = 1) at this + * time. + * + * RETURNS + * NZERROR_OK Success. + * NZERROR_TK_CANTGROW Needed to grow output buffer but could not. + * NZERROR_TK_NOTOPEN Persona is not open. + * NZERROR_TK_NOTSUPP Function not supported with persona. + */ +nzerror nztkec_PKEncrypt( nzctx *, nzttPersona *, ub4, nzttIdentity *, + nzttces, ub4, ub1 *, nzttBufferBlock * ); + +/*---------------- nztxkec_PKEncryptExpansion ----------------*/ + +/* + * NAME + * nztxkec_PKEncryptExpansion - Determine the buffer needed for PKEncrypt + * + * PARAMETERS + * osscntxt {IN} OSS context. + * persona {IN} Persona. + * nrecipients {IN} Number of recipients. + * inlen {IN} Length of input. + * tdulen {out} Length of buffer need. + * + * NOTES + * + * RETURNS + * NZERROR_OK Success. + * NZERROR_TK_NOTOPEN Persona is not open. + * NZERROR_TK_NOTSUPP Function not supported with persona. + */ +nzerror nztxkec_PKEncryptExpansion( nzctx *, nzttPersona *, ub4, ub4, + ub4 * ); + +/*--------------------- nztkdc_PKDecrypt ---------------------*/ + +/* + * NAME + * nztkdc_PKDecrypt - Decrypt a PKEncrypted message. + * + * PARAMETERS + * osscntxt {IN} OSS context. + * persona {IN} Persona. + * state {IN} State of encryption. + * inlen {IN} Length of this input part. + * in {IN} This input part. + * tdubuf {IN/OUT} TDU buffer. + * + * NOTES + * + * RETURNS + * NZERROR_OK Success. + * NZERROR_TK_CANTGROW Needed to grow output buffer but could not. + * NZERROR_TK_NOTOPEN Persona is not open. + * NZERROR_TK_NOTSUPP Function not supported with persona. + */ +nzerror nztkdc_PKDecrypt( nzctx *, nzttPersona *, nzttces, ub4, ub1 *, + nzttBufferBlock * ); + +/*-------------------------- nztHash --------------------------*/ + +/* + * NAME + * nztHash - Generate a hash. + * + * PARAMETERS + * osscntxt {IN} OSS context. + * persona {IN} Persona. + * state {IN} State of hash. + * inlen {IN} Length of this input. + * in {IN} This input. + * tdu {IN/OUT} Output tdu. + * + * NOTES + * + * RETURNS + * NZERROR_OK Success. + * NZERROR_TK_CANTGROW Needed to grow TDU buffer but could not. + * NZERROR_TK_NOTOPEN Persona is not open. + * NZERROR_TK_NOTSUPP Function not supported with persona. + */ +nzerror nztHash( nzctx *, nzttPersona *, nzttces, ub4, ub1 *, + nzttBufferBlock * ); + +/*----------------------- nztSeedRandom -----------------------*/ + +/* + * NAME + * nztSeedRandom - Seed the random function + * + * PARAMETERS + * osscntxt {IN} OSS context. + * persona {IN} Persona. + * seedlen {IN} Length of seed. + * seed {IN} Seed. + * + * NOTES + * + * RETURNS + * NZERROR_OK Success. + * NZERROR_TK_NOTOPEN Persona is not open. + * NZERROR_TK_NOTSUPP Function not supported with persona. + */ +nzerror nztSeedRandom( nzctx *, nzttPersona *, ub4, ub1 * ); + +/*--------------------- nztrb_RandomBytes ---------------------*/ + +/* + * NAME + * nztrb_RandomBytes - Generate a buffer random bytes. + * + * PARAMETERS + * osscntxt {IN} OSS context. + * persona {IN} Persona. + * nbytes {IN} Number of bytes desired. + * out {IN/OUT} Buffer block for bytes. + * + * NOTES + * + * RETURNS + * NZERROR_OK Success. + * NZERROR_TK_CANTGROW Needed to grow TDU buffer but could not. + * NZERROR_TK_NOTOPEN Persona is not open. + * NZERROR_TK_NOTSUPP Function not supported with persona. + */ +nzerror nztrb_RandomBytes( nzctx *, nzttPersona *, ub4, + nzttBufferBlock * ); + +/*-------------------- nztrn_RandomNumber --------------------*/ + +/* + * NAME + * nztrn_RandomNumber - Generate a random number + * + * PARAMETERS + * osscntxt {IN} OSS context. + * persona {IN} Persona. + * num {OUT} Number. + * + * NOTES + * + * RETURNS + * NZERROR_OK Success. + * NZERROR_TK_NOTOPEN Persona is not open. + * NZERROR_TK_NOTSUPP Function not supported with persona. + */ +nzerror nztrn_RandomNumber( nzctx *, nzttPersona *, uword * ); + +/*---------------------- nztbbInitBlock ----------------------*/ + +/* + * NAME + * nztbbInitBlock - Initialize a buffer block. + * + * PARAMETERS + * osscntxt {IN} OSS context. + * block {IN/OUT} Buffer block. + * + * NOTES + * The buffer block is initialized to be empty (all members are set + * to 0/NULL). Such a block will be allocated memory as needed. + * + * RETURNS + * NZERROR_OK Success. + */ +nzerror nztbbInitBlock( nzctx *, nzttBufferBlock * ); + +/*---------------------- nztbbReuseBlock ----------------------*/ + +/* + * NAME + * nztbbReuseBlock - Reuse an already initialized and possibly used block. + * + * PARAMETERS + * osscntxt {IN} OSS context. + * block {IN/OUT} Buffer block. + * + * NOTES + * This function simply sets the used length member of the buffer + * block to 0. If the block already has memory allocated to it, + * this will cause it to be reused. + * + * RETURNS + * NZERROR_OK Success. + */ +nzerror nztbbReuseBlock( nzctx *, nzttBufferBlock * ); + +/*---------------------- nztbbSizeBlock ----------------------*/ + +/* + * NAME + * nztbbSizeBlock - Size an initialized block to a particular size. + * + * PARAMETERS + * osscntxt {IN} OSS context. + * len {IN} Minimum number of unused bytes desired. + * block {IN/OUT} Buffer block. + * + * NOTES + * + * RETURNS + * NZERROR_OK Success. + */ +nzerror nztbbSizeBlock( nzctx *, ub4, nzttBufferBlock * ); + +/*----------------------- nztbbGrowBlock -----------------------*/ + +/* + * NAME + * nzbbGrowBlock - Increase the size of the buffer block. + * + * PARAMETERS + * osscntxt {IN} OSS context. + * inc {IN} Number of bytes to increase. + * block {IN/OUT} Buffer block. + * + * NOTES + * + * RETURNS + * NZERROR_OK Success. + */ +nzerror nztbbGrowBlock( nzctx *, ub4, nzttBufferBlock * ); + +/*---------------------- nztbbPurgeBlock ----------------------*/ + +/* + * NAME + * nztbbPurgeBlock - Purge a buffer block of its memory. + * + * PARAMETERS + * osscntxt {IN} OSS context. + * block {IN/OUT} Buffer block. + * + * NOTES + * The memory used by the buffer block as the buffer is released. + * The buffer block itself is not affected. + * + * RETURNS + * NZERROR_OK Success. + */ +nzerror nztbbPurgeBlock( nzctx *, nzttBufferBlock * ); + +/*----------------------- nztbbSetBlock -----------------------*/ + +/* + * NAME + * nztbbSetBlock - Set a buffer block to a known state. + * + * PARAMETERS + * osscntxt {IN} OSS context. + * flags {IN} Flags to set. + * buflen {IN} Length of buffer. + * usedlen {IN} Used length. + * buffer {IN} Buffer. + * block {IN/OUT} Buffer block + * + * NOTES + * If buflen > 0, objlen == 0, and obj == NULL, then buflen bytes + * of memory is allocated and a pointer is stored in the buffer + * block. + * + * The buffer parameter remains unchanged. + * + * RETURNS + * NZERROR_OK Success. + */ +nzerror nztbbSetBlock( nzctx *, uword, ub4, ub4, ub1 *, + nzttBufferBlock * ); + + +/*--------------------- nztiGetSecInfo ---------------------*/ + +/* + * NAME + * nztiGetSecInfo - Get some security information for SSL + * + * PARAMETERS + * Name {IN/OUT} Description + * osscntxt {IN} OSS context. + * persona {IN} persona + * dname {OUT} distinguished name of the certificate + * dnamelen {OUT} length of the distinguished name + * issuername {OUT} issuer name of the certificate + * certhash {OUT} SHA1 hash of the certificate + * certhashlen{OUT} length of the hash + * NOTES + * This function allocate memories for issuername, certhash, and dname. + * To deallocate memory for those params, you should call nztdbuf_DestroyBuf. + * RETURNS + * + */ +nzerror nztiGetSecInfo( nzctx *, nzttPersona *, text **, ub4 *, + text **, ub4 *, ub1 **, ub4 * ); + + +/*---------------------- nztiGetDName ----------------------*/ + +/* + * NAME + * nztiGetDName - Get the distinguished name for the given identity + * + * PARAMETERS + * Name {IN/OUT} Description + * osscntxt {IN} OSS context. + * identity {IN} identity need to get dname from + * dn {OUT} distinguished name + * dnlen {OUT} length of the dname + * + * NOTES + * + * RETURNS + * + */ + +nzerror nztiGetDName( nzctx *, nzttIdentity *, + text **, ub4 * ); + +/*------------------- nztiGetIssuerName -------------------*/ + +/* + * NAME + * nztiGetIssuerName - Get IssuerName for the given identity + * + * PARAMETERS + * Name {IN/OUT} Description + * osscntxt {IN} OSS context. + * identity {IN} identity need to get issuername from + * issuername {OUT} issuer's name + * issuernamelen {OUT} length of the issuer's name + * + * NOTES + * + * RETURNS + * + */ +nzerror nztiGetIssuerName( nzctx *, nzttIdentity *, + text **, ub4 * ); + + +/*-------------------- nztgch_GetCertHash --------------------*/ + +/* + * NAME + * nztgch_GetCertHash - Get SHA1 hash for the certificate of the identity + * + * PARAMETERS + * Name {IN/OUT} Description + * osscntxt {IN} OSS context. + * identity {IN} identity need to get issuername from + * certHash {OUT} certHash buffer + * hashLen {OUT} length of the certHash + * + * NOTES + * Need to call nztdbuf_DestroyBuf to deallocate memory for certHash. + * RETURNS + * + */ +nzerror nztgch_GetCertHash( nzctx *, nzttIdentity *, + ub1 **, ub4 * ); + +/*-------------------- nztdbuf_DestroyBuf --------------------*/ + +/* + * NAME + * nztdbuf_DestroyBuf - Deallocation funtions for ub1 and text buffer + * + * PARAMETERS + * Name {IN/OUT} Description + * osscntxt {IN} OSS context. + * buf {IN} Allocated buffer to be destroyed. + * + * NOTES + * + * RETURNS + * + */ +nzerror nztdbuf_DestroyBuf( nzctx *, void ** ); + + +/*----------------------- nztGetCertChain -----------------------*/ + +/* + * NAME + * nztGetCertChain - + * + * PARAMETERS + * Name {IN/OUT} Description + * osscntxt {IN} OSS context. + * + * NOTES + * + * RETURNS + * + */ +nzerror nztGetCertChain( nzctx *, nzttWallet * ); + +/*----------------------- nztCompareDN -----------------------*/ + +/* + * NAME + * nztCompareDN - + * + * PARAMETERS + * Name {IN/OUT} Description + * osscntxt {IN} OSS context. + * dn1 {IN} distinguished name 1 + * dn2 {IN} distinguished name 2 + * + * NOTES + * + * RETURNS + * NZERROR_OK succeeded + * others failed + * + */ +nzerror nztCompareDN( nzctx *, ub1 *,ub4 , ub1 *, ub4, boolean * ); + + +#ifdef NZ_OLD_TOOLS +/*--------------------- nztIdentityAlloc ---------------------*/ + +/* + * NAME + * nztIdentityAlloc - Allocate memory for nzttIdentity context + * + * PARAMETERS + * Name {IN/OUT} Description + * osscntxt {IN} OSS context. + * identity {OUT} nzttIdentity context + * + * NOTES + * + * RETURNS + * NZERROR_OK succeeded + * others failed + * + */ +nzerror nztIdentityAlloc( nzctx *, nzttIdentity ** ); + +/*--------------------- nztIPrivateAlloc ---------------------*/ + +/* + * NAME + * nztIPrivateAlloc - Allocate memory for nzttIdentityPrivate + * + * PARAMETERS + * Name {IN/OUT} Description + * + * osscntxt {IN} OSS context. + * ipriv {OUT} identityPrivate structure + * NOTES + * + * RETURNS + * NZERROR_OK succeeded + * others failed + * + */ + +nzerror nztIPrivateAlloc( nzctx *, nzttIdentityPrivate **); + + +/*---------------------- nztIDupContent ----------------------*/ + +/* + * NAME + * nztIDupContent - + * + * PARAMETERS + * Name {IN/OUT} Description + * osscntxt {IN} OSS context. + * targetIdentity{OUT} target identity + * sourceIdentity {IN} source identity + * NOTES + * + * RETURNS + * NZERROR_OK succeeded + * others failed + * + */ + +nzerror nztIDupContent( nzctx *, nzttIdentity *, nzttIdentity * ); +/*---------------------- nztIPDuplicate ----------------------*/ + +/* + * NAME + * nztIPDuplicate - + * + * PARAMETERS + * Name {IN/OUT} Description + * osscntxt {IN} OSS context. + * target_ipriv {OUT} target identityPrivate + * source_ipriv {IN} source identityPrivate + * + * NOTES + * + * RETURNS + * NZERROR_OK succeeded + * others failed + * + */ +nzerror nztIPDuplicate( nzctx *, nzttIdentityPrivate **, + nzttIdentityPrivate * ); + +/*--------------------- nztiDupIdentList ---------------------*/ + +/* + * NAME + * nztiDupIdentList - + * + * PARAMETERS + * Name {IN/OUT} Description + * osscntxt {IN} OSS context. + * source_identities {IN} source identity list + * numIdent {OUT} number of identity in the list + * ppidentity {OUT} Target of identity + * + * NOTES + * + * RETURNS + * NZERROR_OK succeeded + * others failed + * + */ +nzerror nztiDupIdentList( nzctx *, nzttIdentity *, ub4 *, + nzttIdentity ** ); + +/*--------------------- nztFreeIdentList ---------------------*/ + +/* + * NAME + * nztFreeIdentList - Free memory for a list of Identities + * + * PARAMETERS + * Name {IN/OUT} Description + * osscntxt {IN} OSS context. + * identity {IN} identity context + * + * NOTES + * + * RETURNS + * NZERROR_OK succeeded + * others failed + * + */ +nzerror nztFreeIdentList( nzctx *, nzttIdentity ** ); +#endif /* NZ_OLD_TOOLS */ + +/*--------------------- nztCheckVaLidity ---------------------*/ + +/* + * NAME + * nztCheckVaLidity - Check the validity of certificate + * + * PARAMETERS + * Name {IN/OUT} Description + * osscntxt {IN} OSS context. + * start_time Start time of the certificate + * end_time End time of the certificate + * + * NOTES + * + * RETURNS + * NZERROR_OK succeeded + * others failed + * + */ +nzerror nztCheckValidity( nzctx *, ub4 , ub4 ); + +/*--------------------- nztwCreateWallet ---------------------*/ + +/* + * NAME + * nztwCreateWallet - Create a new wallet. + * + * PARAMETERS + * osscntxt {IN} OSS context. + * wrllen {IN} Length of wallet resource locator. + * wrl {IN} WRL. + * pwdlen {IN} Length of password (see notes below). + * pwd {IN} Password. + * wallet {IN/OUT} Wallet. + * + * NOTES + * It is an error to try to create a wallet that already exists. + * The previously existing wallet must be destroyed first. + * + * The wallet itself is not encrypted. Rather, all the personas in + * the wallet are encrypted under the same password. A hash of the + * password is stored in the wallet. + * + * Upon success, an empty open wallet is stored in the wallet + * parameter. + * + * RETURNS + * NZERROR_OK Sucess. + * NZERROR_TK_WALLET_EXISTS Wallet already exists. + * NZERROR_RIO_OPEN RIO could not create wallet (see trace file). + */ +nzerror nztwCreateWallet( nzctx *, ub4, text *, ub4, text *, + nzttWallet * ); + + +/*--------------------- nztwDestroyWallet ---------------------*/ + +/* + * NAME + * nztwDestroyWallet - Destroy an existing wallet. + * + * PARAMETERS + * osscntxt {IN} OSS context. + * wrllen {IN} Length of wallet resource locator. + * wrl {IN} WRL. + * pwdlen {IN} Length of password. + * pwd {IN} Password. + * NOTES + * + * RETURNS + * NZERROR_OK Success. + * NZERROR_TK_PASSWORD Password verification failed. + * NZERROR_RIO_OPEN RIO could not open wallet (see trace file). + * NZERROR_RIO_DELETE Delete failed (see trace file). + */ +nzerror nztwDestroyWallet( nzctx *, ub4, text *, ub4, text * ); + +/*--------------------- nzteStorePersona ---------------------*/ + +/* + * NAME + * nzteStorePersona - Store an open persona in a wallet. + * + * PARAMETERS + * osscntxt {IN} OSS context. + * persona {IN/OUT} Persona. + * wallet {IN/OUT} Wallet. + * + * NOTES + * If the open persona is not associated with any wallet (it was + * created via the nzteClosePersona function), then storing the + * persona creates that association. The wallet will also have an + * updated persona list that reflects this association. + * + * If the open persona was associated with wallet 'A' (it was + * opened via the nztwOpenWallet function), and is stored back into + * wallet 'A', then then the old persona is overwritten by the new + * persona if the password can be verified. Recall that all + * personas have a unique identity id. If that id changes then + * storing the persona will put a new persona in the wallet. + * + * If the open persona was associated with wallet 'A' and is stored + * into wallet 'B', and if wallet 'B' does not contain a persona + * with that unique identity id, then the persona will be copied + * into wallet 'B', wallet 'B''s persona list will be updated, and + * the persona structure will be updated to be associated with + * wallet 'B'. If wallet 'B' already contained the persona, it + * would be overwritten by the new persona. + * + * The persona parameter is doubly indirect so that at the + * conclusion of the function call, the pointer can be directed to + * the persona in the wallet. + * + * RETURNS + * NZERROR_OK Success. + * NZERROR_TK_PASSWORD Password verification failed. + * NZERROR_RIO_STORE Store failed (see network trace file). + */ +nzerror nzteStorePersona( nzctx *, nzttPersona **, nzttWallet * ); + +/*--------------------- nzteRemovePersona ---------------------*/ + +/* + * NAME + * nzteRemovePersona - Remove a persona from the wallet. + * + * PARAMETERS + * osscntxt {IN} OSS context. + * persona {IN/OUT} Persona. + * + * NOTES + * The password is verified before trying to remove the persona. + * + * If the persona is open, it is closed. The persona is removed + * from the wallet list and the persona pointer is set to NULL. + * + * A double indirect pointer to the persona is required so that the + * persona pointer can be set to NULL upon completion. + * + * RETURNS + * NZERROR_OK Success. + * NZERROR_TK_PASSWORD Password verification failed. + * NZERROR_RIO_DELETE Delete failed. + */ +nzerror nzteRemovePersona( nzctx *, nzttPersona ** ); + +/*--------------------- nzteCreatePersona ---------------------*/ + +/* + * NAME + * nzteCreatePersona - Create a persona. + * + * PARAMETERS + * osscntxt {IN} OSS context. + * itype {IN} Identity type. + * ctype {IN} Cipher type. + * desc {IN} Persona description. + * persona {OUT} Persona. + * + * NOTES + * The resulting persona is created in the open state, but it will + * not be associated with a wallet. + * + * The memory for the persona is allocated by the function. + * + * RETURNS + * NZERROR_OK Success. + * NZERROR_TK_TYPE Unsupported itype/ctype combination. + * NZERROR_TK_PARMS Error in persona description. + */ +nzerror nzteCreatePersona( nzctx *, nzttVersion, nzttCipherType, + nzttPersonaDesc *, nzttPersona ** ); + + +/*----------------- nztiStoreTrustedIdentity -----------------*/ + +/* + * NAME + * nztiStoreTrustedIdentity - Store an identity into a persona. + * + * PARAMETERS + * osscntxt {IN} Success. + * identity {IN/OUT} Trusted Identity. + * persona {IN/OUT} Persona. + * + * NOTES + * The identity is not saved with the persona in the wallet until + * the persona is stored. + * + * The identity parameter is double indirect so that it can point + * into the persona at the conclusion of the call. + * + * RETURNS + * NZERROR_OK Success. + */ +nzerror nztiStoreTrustedIdentity( nzctx *, nzttIdentity **, + nzttPersona * ); + +/*--------------------- nzteSetProtection ---------------------*/ + +/* + * NAME + * nzteSetProtection - Set the protection type for a CE function. + * + * PARAMETERS + * osscntxt {IN} OSS context. + * persona {IN/OUT} Persona. + * func {IN} CE function. + * tdufmt {IN} TDU Format. + * protinfo {IN} Protection information specific to this format. + * + * NOTES + * + * RETURNS + * NZERROR_OK Success. + * NZERROR_TK_PROTECTION Unsupported protection. + * NZERROR_TK_PARMS Error in protection info. + */ +nzerror nzteSetProtection( nzctx *, nzttPersona *, nzttcef, nztttdufmt, + nzttProtInfo * ); + +/*--------------------- nzteGetProtection ---------------------*/ + +/* + * NAME + * nzteGetProtection - Get the protection type for a CE function. + * + * PARAMETERS + * osscntxt {IN} OSS context. + * persona {IN} Persona. + * func {IN} CE function. + * tdufmt {OUT} TDU format. + * protinfo {OUT} Protection information. + * + * NOTES + * + * RETURNS + * NZERROR_OK Success. + */ +nzerror nzteGetProtection( nzctx *, nzttPersona *, nzttcef, nztttdufmt *, + nzttProtInfo * ); + +/*-------------------- nztiRemoveIdentity --------------------*/ + +/* + * NAME + * nztiRemoveIdentity - Remove an identity from an open persona. + * + * PARAMETERS + * osscntxt {IN} OSS context. + * identity {IN/OUT} Identity. + * + * NOTES + * If the persona is not stored, this identity will still be in the + * persona stored in the wallet. + * + * The identity parameter is doubly indirect so that at the + * conclusion of the function, the pointer can be set to NULL. + * + * RETURNS + * NZERROR_OK Success. + * NZERROR_TK_NOTFOUND Identity not found. + * NZERROR_TK_NOTOPEN Persona is not open. + */ +nzerror nztiRemoveIdentity( nzctx *, nzttIdentity ** ); + +/*----------------- nztifdn -----------------*/ + +/* + * NAME + * nztifdn - create an Identity From a Distinguished Name + * + * PARAMETERS + * osscntxt {IN} OSS context. + * length {IN} Length of the distinguished name + * distinguished_name {IN} distinguished name string + * ppidentity {OUT} created identity + * + * NOTES + * Given a distinguished name, return the identity that corresponds to it. + * + * RETURNS + * NZERROR_OK Success. + */ +nzerror nztifdn( nzctx *ossctx, + ub4 length, + text *distinguished_name, + nzttIdentity **ppidentity ); + +/*--------------------- nztxSignExpansion ---------------------*/ + +/* + * NAME + * nztxSignExpansion - Determine the size of the attached signature buffer. + * + * PARAMETERS + * osscntxt {IN} OSS context. + * persona {IN} Persona. + * inlen {IN} Length of input. + * tdulen {OUT} Buffer needed for signature. + * + * NOTES + * + * RETURNS + * NZERROR_OK Success. + * NZERROR_TK_NOTOPEN Persona is not open. + * NZERROR_TK_NOTSUPP Function not supported with persona. + */ +nzerror nztxSignExpansion( nzctx *, nzttPersona *, ub4, ub4 * ); + +/*--------------- nztxsd_SignDetachedExpansion ---------------*/ + +/* + * NAME + * nztxsd_SignDetachedExpansion - Determine the size of buffer needed. + * + * PARAMETERS + * osscntxt {IN} OSS context. + * persona {IN} Persona. + * inlen {IN} Length of input. + * tdulen {OUT} Buffer needed for signature. + * + * NOTES + * + * RETURNS + * NZERROR_OK Success. + * NZERROR_TK_NOTOPEN Persona is not open. + * NZERROR_TK_NOTSUPP Function not supported with persona. + */ +nzerror nztxsd_SignDetachedExpansion( nzctx *, nzttPersona *, ub4, + ub4 * ); + +/*------------------------ nztEncrypt ------------------------*/ + +/* + * NAME + * nztEncrypt - Symmetrically encrypt + * + * PARAMETERS + * osscntxt {IN} OSS context. + * persona {IN} Persona. + * inlen {IN} Length of this input part. + * in {IN} This input part. + * tdubuf {IN/OUT} TDU buffer. + * + * NOTES + * + * RETURNS + * NZERROR_OK Success. + * NZERROR_TK_CANTGROW Needed to grow TDU buffer but could not. + * NZERROR_TK_NOTOPEN Persona is not open. + * NZERROR_TK_NOTSUPP Function not supported with persona. + */ +nzerror nztEncrypt( nzctx *, nzttPersona *, nzttces, ub4, ub1 *, + nzttBufferBlock * ); + +/*------------------- nztxEncryptExpansion -------------------*/ + +/* + * NAME + * nztxEncryptExpansion - Determine the size of the TDU to encrypt. + * + * PARAMETERS + * osscntxt {IN} OSS context. + * persona {IN} Persona. + * inlen {IN} Length of this input part. + * tdulen {OUT} Length of TDU. + * + * NOTES + * + * RETURNS + * NZERROR_OK Success. + * NZERROR_TK_NOTOPEN Persona is not open. + * NZERROR_TK_NOTSUPP Function not supported with persona. + */ +nzerror nztxEncryptExpansion( nzctx *, nzttPersona *, ub4, ub4 * ); + +/*------------------------ nztDecrypt ------------------------*/ + +/* + * NAME + * nztDecrypt - Decrypt an Encrypted message. + * + * PARAMETERS + * osscntxt {IN} OSS context. + * persona {IN} Persona. + * state {IN} State of decryption. + * inlen {IN} Length of this input part. + * in {IN} This input part. + * out {IN/OUT} Cleartext message. + * + * NOTES + * + * RETURNS + * NZERROR_OK Success. + * NZERROR_TK_CANTGROW Needed to grow TDU buffer but could not. + * NZERROR_TK_NOTOPEN Persona is not open. + * NZERROR_TK_NOTSUPP Function not supported with persona. + */ +nzerror nztDecrypt( nzctx *, nzttPersona *, nzttces, ub4, ub1 *, + nzttBufferBlock * ); + +/*------------------------ nztEnvelope ------------------------*/ + +/* + * NAME + * nztEnvelope - Sign and PKEncrypt a message. + * + * PARAMETERS + * osscntxt {IN} OSS context. + * persona {IN} Persona. + * nrecipients {IN} Number of recipients for this encryption. + * recipients {IN} List of recipients. + * state {IN} State of encryption. + * inlen {IN} Length of this input part. + * in {IN} This input part. + * tdubuf {IN/OUT} TDU buffer. + * + * NOTES + * + * RETURNS + * NZERROR_OK Success. + * NZERROR_TK_CANTGROW Needed to grow output buffer but could not. + * NZERROR_TK_NOTOPEN Persona is not open. + * NZERROR_TK_NOTSUPP Function not supported with persona. + */ +nzerror nztEnvelope( nzctx *, nzttPersona *, ub4, nzttIdentity *, + nzttces, ub4, ub1 *, nzttBufferBlock * ); + +/*----------------------- nztDeEnvelope -----------------------*/ + +/* + * NAME + * nztDeEnvelope - PKDecrypt and verify a message. + * + * PARAMETERS + * osscntxt {IN} OSS context. + * persona {IN} Persona. + * state {IN} State of encryption. + * inlen {IN} Length of this input part. + * in {IN} This input part. + * out {OUT} Message from TDU. + * verified {OUT} TRUE if verified. + * validated {OUT} TRUE if validated. + * sender {OUT} Identity of sender. + * + * NOTES + * + * RETURNS + * NZERROR_OK Success. + * NZERROR_TK_CANTGROW Needed to grow TDU buffer but could not. + * NZERROR_TK_NOTOPEN Persona is not open. + * NZERROR_TK_NOTSUPP Function not supported with persona. + */ +nzerror nztDeEnvelope( nzctx *, nzttPersona *, nzttces, ub4, ub1 *, + nzttBufferBlock *, boolean *, boolean *, + nzttIdentity ** ); + +/*----------------------- nztKeyedHash -----------------------*/ + +/* + * NAME + * nztKeyedHash - Generate a keyed hash. + * + * PARAMETERS + * osscntxt {IN} OSS context. + * persona {IN} Persona. + * state {IN} State of hash. + * inlen {IN} Length of this input. + * in {IN} This input. + * tdu {IN/OUT} Output tdu. + * + * NOTES + * + * RETURNS + * NZERROR_OK Success. + * NZERROR_TK_CANTGROW Needed to grow TDU buffer but could not. + * NZERROR_TK_NOTOPEN Persona is not open. + * NZERROR_TK_NOTSUPP Function not supported with persona. + */ +nzerror nztKeyedHash( nzctx *, nzttPersona *, nzttces, ub4, ub1 *, + nzttBufferBlock * ); + +/*------------------ nztxKeyedHashExpansion ------------------*/ + +/* + * NAME + * nztxKeyedHashExpansion - Determine the space needed for a keyed hash. + * + * PARAMETERS + * osscntxt {IN} OSS context. + * persona {IN} Persona. + * inlen {IN} Length of this input. + * tdulen {OUT} TDU length. + * + * NOTES + * + * RETURNS + * NZERROR_OK Success. + * NZERROR_TK_NOTOPEN Persona is not open. + * NZERROR_TK_NOTSUPP Function not supported with persona. + */ +nzerror nztxKeyedHashExpansion( nzctx *, nzttPersona *, ub4, + ub4 * ); + +/*--------------------- nztxHashExpansion ---------------------*/ + +/* + * NAME + * nztxHashExpansion - Determine the size of the TDU for a hash. + * + * PARAMETERS + * osscntxt {IN} OSS context. + * persona {IN} Persona. + * inlen {IN} Length of this input. + * tdulen {OUT} TDU length. + * + * NOTES + * + * RETURNS + * NZERROR_OK Success. + * NZERROR_TK_NOTOPEN Persona is not open. + * NZERROR_TK_NOTSUPP Function not supported with persona. + */ +nzerror nztxHashExpansion( nzctx *, nzttPersona *, ub4, ub4 * ); + +/*---------------- nztiae_IsAuthEnabled ----------------*/ + +/* + * NAME + * nztiae_IsAuthEnabled - Checks to see if Authentication is Enabled + * in the current Cipher Spec. + * + * PARAMETERS + * ctx {IN} Oracle SSL Context + * ncipher {IN} CipherSuite + * authEnabled {OUT} Boolean for is Auth Enabled? + * + * NOTES + * + * RETURNS + * NZERROR_OK on success. + * NZERROR_TK_INV_CIPHR_TYPE if Cipher Spec is not Recognized. + */ + +nzerror nztiae_IsAuthEnabled( nzctx *ctx, + ub2 ncipher, + boolean *authEnabled ); + +/*---------------- nztiee_IsEncrEnabled ----------------*/ +/* + * NAME + * nztiee_IsEncrEnabled - Checks to see if Encryption is Enabled + * in the current Cipher Spec. + * + * PARAMETERS + * ctx {IN} Oracle SSL Context + * ncipher {IN} CipherSuite + * EncrEnabled {OUT} Boolean for is Auth Enabled? + * + * NOTES + * + * RETURNS + * NZERROR_OK on success. + * NZERROR_TK_INV_CIPHR_TYPE if Cipher Spec is not Recognized. + */ + +nzerror nztiee_IsEncrEnabled( nzctx *ctx, + ub2 ncipher, + boolean *EncrEnabled ); + +/*---------------- nztihe_IsHashEnabled ----------------*/ +/* + * NAME + * nztihe_IsHashEnabled - Checks to see if HAshing is Enabled + * in the current Cipher Spec. + * + * PARAMETERS + * ctx {IN} Oracle SSL Context + * ncipher {IN} CipherSuite + * hashEnabled {OUT} Boolean for is Auth Enabled? + * + * NOTES + * + * RETURNS + * NZERROR_OK on success. + * NZERROR_TK_INV_CIPHR_TYPE if Cipher Spec is not Recognized. + */ + +nzerror nztihe_IsHashEnabled( nzctx *ctx, + ub2 ncipher, + boolean *hashEnabled ); + +/* + * + */ + +nzerror nztGetIssuerName( nzctx *ctx, + nzttIdentity *identity, + ub1 **issuername, + ub4 *issuernamelen ); + +nzerror nztGetSubjectName( nzctx *ctx, + nzttIdentity *identity, + ub1 **subjectname, + ub4 *subjectnamelen ); + +nzerror nztGetBase64Cert( nzctx *ctx, + nzttIdentity *identity, + ub1 **b64cert, + ub4 *b64certlen ); + +nzerror nztGetSerialNumber( nzctx *ctx, + nzttIdentity *identity, + ub1 **serialnum, + ub4 *serialnumlen ); + +nzerror nztGetValidDate( nzctx *ctx, + nzttIdentity *identity, + ub4 *startdate, + ub4 *enddate ); + +nzerror nztGetVersion( nzctx *ctx, + nzttIdentity *identity, + nzstrc *pVerStr ); + +nzerror nztGetPublicKey( nzctx *ctx, + nzttIdentity *identity, + ub1 **pubKey, + ub4 *pubKeylen ); + +nzerror nztGenericDestroy( nzctx *ctx, + ub1 **var ); + +nzerror nztSetAppDefaultLocation( nzctx *ctx, + text *, + size_t ); + +nzerror nztSearchNZDefault( nzctx *ctx, + boolean *search ); + +nzerror nztSetLightWeight(nzctx *ctx, + boolean flag); + +#endif /* NZT_ORACLE */ + diff --git a/sdk/include/occi.h b/sdk/include/occi.h new file mode 100755 index 0000000..2dca9e6 --- /dev/null +++ b/sdk/include/occi.h @@ -0,0 +1,78 @@ +/* Copyright (c) 2000, 2002, Oracle Corporation. All rights reserved. */ + +/* + NAME + occi.h - Oracle C++ Interface header files. + + DESCRIPTION + + + RELATED DOCUMENTS + + + EXPORT FUNCTION(S) + + + INTERNAL FUNCTION(S) + + + EXAMPLES + + NOTES + + + MODIFIED (MM/DD/YY) + vvinay 08/19/02 - + aahluwal 06/03/02 - bug 2360115 + gayyappa 01/03/01 - removed inclusions before occiCommon.h + kmohan 04/11/00 - include oci.h and occiCommon.h also + rkasamse 04/03/00 - header file for all the OCCI classes + rkasamse 04/03/00 - Creation + +*/ + +#ifndef OCCI_ORACLE +# define OCCI_ORACLE + +#ifndef OCCICOMMON_ORACLE +#include +#endif + +#ifndef OCCIDATA_ORACLE +#include +#endif + +#ifndef OCCICONTROL_ORACLE +#include +#endif + +#ifndef OCCIOBJECTS_ORACLE +#include +#endif + +#ifndef OCCIAQ_ORACLE +#include +#endif + +/*--------------------------------------------------------------------------- + PUBLIC TYPES AND CONSTANTS + ---------------------------------------------------------------------------*/ + + +/*--------------------------------------------------------------------------- + PRIVATE TYPES AND CONSTANTS + ---------------------------------------------------------------------------*/ + + +/*--------------------------------------------------------------------------- + EXPORT FUNCTIONS + ---------------------------------------------------------------------------*/ + + +/*--------------------------------------------------------------------------- + INTERNAL FUNCTIONS + ---------------------------------------------------------------------------*/ + + +#endif /* OCCI_ORACLE */ diff --git a/sdk/include/occiAQ.h b/sdk/include/occiAQ.h new file mode 100755 index 0000000..e07e40c --- /dev/null +++ b/sdk/include/occiAQ.h @@ -0,0 +1,374 @@ +/* Copyright (c) 2002, 2005, Oracle. All rights reserved. */ + +/* + NAME + occiAQ.h - Header file for occi AQ classes + + DESCRIPTION + Class declarations for Producer, Consumer, Message, Agent + Listener, Subscription + + RELATED DOCUMENTS + + + EXPORT FUNCTION(S) + + + INTERNAL FUNCTION(S) + + + EXAMPLES + + NOTES + + + MODIFIED (MM/DD/YY) + cparampa 10/12/02 - creation + +*/ + +#ifndef _olint /* disable olint check */ + +#ifndef OCCIAQ_ORACLE +# define OCCIAQ_ORACLE + +#ifndef OCCICOMMON_ORACLE +#include +#endif + +namespace oracle { +namespace occi { +namespace aq{ + +/*--------------------------------------------------------------------------- + PUBLIC TYPES AND CONSTANTS + ---------------------------------------------------------------------------*/ + +class Message +{ + public: + + enum MessageState + { + MSG_READY = OCI_MSG_READY, + MSG_WAITING = OCI_MSG_WAITING, + MSG_PROCESSED = OCI_MSG_PROCESSED, + MSG_EXPIRED = OCI_MSG_EXPIRED + }; + enum PayloadType + { + RAW, + ANYDATA, + OBJECT + }; + + Message( const Environment *env ); + Message( const Message& rhs); + ~Message(); + + void operator=(const Message& rhs); + int getAttemptsToDequeue() const ; + void setCorrelationId( const OCCI_STD_NAMESPACE::string& corr_id ) ; + OCCI_STD_NAMESPACE::string getCorrelationId() const ; + void setDelay( int delay ) ; + int getDelay() const ; + Date getMessageEnqueuedTime() const ; + void setExceptionQueueName( const OCCI_STD_NAMESPACE::string& queue ) ; + OCCI_STD_NAMESPACE::string getExceptionQueueName() const ; + void setExpiration( int exp ) ; + int getExpiration() const ; + MessageState getMessageState() const ; + void setPriority( int priority ) ; + int getPriority() const ; + void setRecipientList( OCCI_STD_NAMESPACE::vector& ag_list ) ; + void setSenderId( const Agent& sender ) ; + Agent getSenderId() const ; + void setOriginalMessageId( const Bytes& queue ) ; + Bytes getOriginalMessageId() const ; + void setNull(); + bool isNull() const; + + void setBytes( const Bytes& bytes); + void setObject( PObject* pobj); + void setAnyData( const AnyData& any); + + Bytes getBytes() const ; + PObject *getObject() ; + AnyData getAnyData() const ; + + PayloadType getPayloadType( ) const; + + private: + Ptr ptr; + OCIAQMsgProperties* getOCIMsgProperties() const; + Message( const Environment *env, const Connection *con, + OCIAQMsgProperties *msgprop, void *data, unsigned int dataLen, + bool isNull, PayloadType pType); + friend class ConsumerImpl; + friend class ProducerImpl; + friend class NotifyResult; +}; + +class Producer +{ + public: + + enum EnqueueSequence + { + ENQ_BEFORE = OCI_ENQ_BEFORE, + ENQ_TOP = OCI_ENQ_TOP + }; + enum Visibility + { + ENQ_IMMEDIATE = OCI_ENQ_IMMEDIATE, + ENQ_ON_COMMIT = OCI_ENQ_ON_COMMIT + }; + + Producer( const Connection *conn ); + Producer( const Connection *conn, + const OCCI_STD_NAMESPACE::string& queue ); + Producer( const Producer& rhs); + ~Producer(); + + void operator=(const Producer& prod); + void setRelativeMessageId( const Bytes& msgid ); + Bytes getRelativeMessageId() const; + void setSequenceDeviation( EnqueueSequence option ); + EnqueueSequence getSequenceDeviation() const; + void setVisibility( Visibility option ); + Visibility getVisibility() const; + void setQueueName( const OCCI_STD_NAMESPACE::string& queue ); + OCCI_STD_NAMESPACE::string getQueueName() const; + void setTransformation( const OCCI_STD_NAMESPACE::string& fName); + OCCI_STD_NAMESPACE::string getTransformation() const; + Bytes send( Message& msg, const OCCI_STD_NAMESPACE::string& queue ); + Bytes send( Message& msg ); + void setNull(); + bool isNull() const; + + private: + Ptr ptr; +}; + +class Consumer +{ + public: + + enum DequeueMode + { + DEQ_BROWSE = OCI_DEQ_BROWSE, + DEQ_LOCKED = OCI_DEQ_LOCKED, + DEQ_REMOVE = OCI_DEQ_REMOVE, + DEQ_REMOVE_NODATA = OCI_DEQ_REMOVE_NODATA + }; + enum Navigation + { + DEQ_FIRST_MSG = OCI_DEQ_FIRST_MSG, + DEQ_NEXT_TRANSACTION = OCI_DEQ_NEXT_TRANSACTION, + DEQ_NEXT_MSG = OCI_DEQ_NEXT_MSG + }; + enum Visibility + { + DEQ_IMMEDIATE = OCI_DEQ_IMMEDIATE, + DEQ_ON_COMMIT = OCI_DEQ_ON_COMMIT + }; + enum + { + DEQ_WAIT_FOREVER = OCI_DEQ_WAIT_FOREVER, + DEQ_NO_WAIT = OCI_DEQ_NO_WAIT + }; + + Consumer( const Connection *conn ); + Consumer( const Connection * conn, const Agent& agent); + Consumer( const Connection *conn, + const OCCI_STD_NAMESPACE::string& queue ); + Consumer(const Consumer& con); + ~Consumer(); + + void operator=(const Consumer& con); + void setAgent(const Agent& agent); + void setConsumerName( const OCCI_STD_NAMESPACE::string& name ); + OCCI_STD_NAMESPACE::string getConsumerName() const; + void setCorrelationId( const OCCI_STD_NAMESPACE::string& cor_id ); + OCCI_STD_NAMESPACE::string getCorrelationId() const; + void setDequeueMode( DequeueMode mode ); + DequeueMode getDequeueMode() const; + void setMessageIdToDequeue( const Bytes& msgid ); + Bytes getMessageIdToDequeue() const; + void setPositionOfMessage( Navigation pos ); + Navigation getPositionOfMessage() const; + void setVisibility( Visibility option ); + Visibility getVisibility() const; + void setWaitTime( unsigned int wait ); + unsigned int getWaitTime() const; + void setQueueName( const OCCI_STD_NAMESPACE::string& queue ); + OCCI_STD_NAMESPACE::string getQueueName() const; + void setTransformation( const OCCI_STD_NAMESPACE::string& fName); + OCCI_STD_NAMESPACE::string getTransformation() const; + Message receive( Message::PayloadType pType, + const OCCI_STD_NAMESPACE::string& type="", + const OCCI_STD_NAMESPACE::string& schema=""); + void setNull(); + bool isNull() const; + + private: + Ptr ptr; +}; + +class Agent +{ + public: + Agent( const Environment *env ); + Agent( const Environment *env, + const OCCI_STD_NAMESPACE::string& name, + const OCCI_STD_NAMESPACE::string& address, + unsigned int protocol=0 ) ; + Agent(const Agent& a); + ~Agent() ; + + void operator=(const Agent& a); + void setName( const OCCI_STD_NAMESPACE::string& name ); + OCCI_STD_NAMESPACE::string getName() const; + void setAddress( const OCCI_STD_NAMESPACE::string& addr ); + OCCI_STD_NAMESPACE::string getAddress() const; + void setProtocol(unsigned int protocol = 0); + unsigned int getProtocol() const; + void setNull(); + bool isNull() const; + OCIAQAgent* getOCIAQAgent() const; + + private: + Ptr ptr; + Agent( const Environment *env, OCIAQAgent *rhs, bool toFree = false ); + friend class Listener; + friend class MessageImpl; +}; + +class Listener +{ + public: + Listener( const Connection *conn ); + Listener( const Connection *conn, + OCCI_STD_NAMESPACE::vector &agList, + int waitTime=0 ); + ~Listener(); + + Agent listen(); + void setAgentList(OCCI_STD_NAMESPACE::vector &agList); + void setTimeOutForListen(int waitTime); + OCCI_STD_NAMESPACE::vector getAgentList() const; + int getTimeOutForListen() const; + + private: + const ConnectionImpl *conn; + OCIAQAgent** agentList; + unsigned int numAgents; + int timeOut; + void *listenerExt; +}; + + +class Subscription +{ + public: + enum Presentation + { + PRES_DEFAULT = OCI_SUBSCR_PRES_DEFAULT, + PRES_XML = OCI_SUBSCR_PRES_XML + }; + enum Protocol + { + PROTO_CBK = OCI_SUBSCR_PROTO_OCI, + PROTO_MAIL = OCI_SUBSCR_PROTO_MAIL, + PROTO_SERVER = OCI_SUBSCR_PROTO_SERVER, + PROTO_HTTP = OCI_SUBSCR_PROTO_HTTP + }; + enum Namespace + { + NS_ANONYMOUS = OCI_SUBSCR_NAMESPACE_ANONYMOUS, + NS_AQ = OCI_SUBSCR_NAMESPACE_AQ + }; + + Subscription(const Environment* env); + Subscription(const Environment* env, OCISubscription* sub); + Subscription(const Subscription& sub); + ~Subscription(); + + void operator=(const Subscription& sub); + unsigned int getDatabaseServersCount() const; + void setDatabaseServerNames( + const OCCI_STD_NAMESPACE::vector& dbsrv); + OCCI_STD_NAMESPACE::vector + getDatabaseServerNames() const ; + void setNotifyCallback(unsigned int (*callback)(Subscription& sub, + NotifyResult *nr)); + unsigned int (*getNotifyCallback() const)(Subscription& sub, + NotifyResult *nr); + void setCallbackContext(void* ctx); + void* getCallbackContext() const; + void setSubscriptionName(const OCCI_STD_NAMESPACE::string& name); + OCCI_STD_NAMESPACE::string getSubscriptionName() const ; + void setSubscriptionNamespace(Namespace nameSpace); + Namespace getSubscriptionNamespace() const ; + void setPayload(const Bytes& payload); + Bytes getPayload() const ; + void setRecipientName( const OCCI_STD_NAMESPACE::string& name); + OCCI_STD_NAMESPACE::string getRecipientName() const; + void setPresentation( Presentation pres) ; + Presentation getPresentation() const ; + void setProtocol( Protocol prot) ; + Protocol getProtocol() const ; + OCISubscription* getOCISubscription() const; + void setNull(); + bool isNull() const; + Environment* getEnvironment() const; + + private: + Ptr ptr; +}; + +class NotifyResult +{ + public: + Bytes getPayload() const; + Message getMessage() const; + Bytes getMessageId() const; + OCCI_STD_NAMESPACE::string getConsumerName() const; + OCCI_STD_NAMESPACE::string getQueueName() const; + + private: + const EnvironmentImpl *env; + void *payload; + unsigned int payloadLen; + void *desc; + ub4 mode; + void *notifyResultExt; + + //private constructor + NotifyResult(const Environment *env, void *payload, ub4 payloadLen, + void *pdescriptor, ub4 mode); + + friend class SubscriptionImpl; +}; + +/*--------------------------------------------------------------------------- + PRIVATE TYPES AND CONSTANTS + ---------------------------------------------------------------------------*/ + + +/*--------------------------------------------------------------------------- + EXPORT FUNCTIONS + ---------------------------------------------------------------------------*/ + + +/*--------------------------------------------------------------------------- + INTERNAL FUNCTIONS + ---------------------------------------------------------------------------*/ +} /* end of namespace aq */ +} /* end of namespace occi */ +} /* end of namespace oracle */ + +#endif /* OCCIAQ_ORACLE */ + +#endif /* _olint */ diff --git a/sdk/include/occiCommon.h b/sdk/include/occiCommon.h new file mode 100755 index 0000000..5485ff0 --- /dev/null +++ b/sdk/include/occiCommon.h @@ -0,0 +1,982 @@ +/* Copyright (c) 2000, 2008, Oracle. All rights reserved. */ + +/* + NAME + occiCommon.h - header file for doing forward references + + DESCRIPTION + Just declare all the classes + + RELATED DOCUMENTS + OCCI Programmer's Guide + + EXPORT FUNCTION(S) + none + + INTERNAL FUNCTION(S) + none + + EXAMPLES + + NOTES + none + +*/ + + +#ifndef OCCICOMMON_ORACLE +# define OCCICOMMON_ORACLE + +#ifndef _olint + +#ifndef OCI_ORACLE +#include +#endif + +#ifndef ORASTRINGSTL +#define ORASTRINGSTL +#include +#endif + +#ifndef ORAVECTORSTL +#include +#define ORAVECTORSTL +#endif + +#ifndef ORALISTSTL +#include +#define ORALISTSTL +#endif + +#define OCCI_STD_NAMESPACE std +#define OCCI_HAVE_STD_NAMESPACE 1 + +// version definitions +#define OCCI_MAJOR_VERSION OCI_MAJOR_VERSION +#define OCCI_MINOR_VERSION OCI_MINOR_VERSION + +namespace oracle { +namespace occi { + +//UString is the class for UTF16 characterset +//check for version = 3.2 or 3.3 +#if (__GNUC__ == 3 && (__GNUC_MINOR__ == 2 || __GNUC_MINOR__ == 3)) + //char_traits specialization for utext for gcc 3.2.3 + struct utext_char_traits + { + typedef utext char_type; + typedef unsigned int int_type; + + typedef OCCI_STD_NAMESPACE::streampos pos_type; + typedef OCCI_STD_NAMESPACE::streamoff off_type; + typedef OCCI_STD_NAMESPACE::mbstate_t state_type; + + //assign one char to another + static void assign(char_type& c1, const char_type& c2) + { + c1 = c2; + } + + //are 2 chars equal ? + static bool eq(const char_type& c1, const char_type& c2) + { + return c1 == c2; + } + + //is char c1 less then c2 ? + static bool lt(const char_type& c1, const char_type& c2) + { + return c1 < c2; + } + + //compare 2 strings of char + static int compare(const char_type* s1, const char_type* s2, size_t n) + { + for (size_t i = 0; i < n; ++i) + if (!eq(s1[i], s2[i])) + return s1[i] < s2[i] ? -1 : 1; + return 0; + } + + //length of a char string + static size_t length(const char_type* s) + { + const char_type nullchar = char_type(0); + size_t i = 0; + + while (!eq(*s++, nullchar)) i++; + return i; + } + + //find a character in the char string + static const char_type* find(const char_type* s, + size_t n, const char_type& c) + { + for ( ; n > 0 ; ++s, --n) + if (eq(*s, c)) + return s; + return 0; + } + + //move n chars from s2 to s1 + static char_type* move(char_type* s1, const char_type* s2, size_t n) + { + memmove(s1, s2, n * sizeof(char_type)); + return s1; + } + + //copy n chars from s2 to s1 + static char_type* copy(char_type* s1, const char_type* s2, size_t n) + { + memcpy(s1, s2, n * sizeof(char_type)); + return s1; + } + + //fill char c into s + static char_type* assign(char_type* s, size_t n, char_type c) + { + for (size_t i = 0; i < n; ++i) + assign(s[i], c); + return s; + } + + //is the int representation eof ? + static int_type not_eof(const int_type& c) + { + if (c == eof()) + return 0; + else + return c; + } + + //cast a int type to char + static char_type to_char_type(const int_type& c) + { + return static_cast(c); + } + + //cast char to int type + static int_type to_int_type(const char_type& c) + { + return static_cast(c); + } + + //eq operator when the chars are represented as ints + static bool eq_int_type(const int_type& c1, const int_type& c2) + { + return c1 == c2; + } + + //eof character + static int_type eof() + { + return static_cast(-1); + } + + + }; //end char_traits + +typedef OCCI_STD_NAMESPACE::basic_string UString; +#else +//for non gcc 3.2.3 platforms +typedef OCCI_STD_NAMESPACE::basic_string UString; +#endif /* if gcc 3.2.3 */ + +class Environment; +class EnvironmentImpl; +class Connection; +class ConnectionImpl; +class ConnectionPool; +class ConnectionPoolImpl; +class StatelessConnectionPool; +class StatelessConnectionPoolImpl; +class Statement; +class StatementImpl; +class ResultSet; +class ResultSetImpl; +class SQLException; +class SQLExceptionImpl; +class BatchSQLException; +class BatchSQLExceptionImpl; +class Stream; +class PObject; +class Number; +class Bytes; +class BytesImpl; +class Date; +class Timestamp; + +class MetaData; +class MetaDataImpl; +template class Ref; +class RefImpl; +class RefAny; +class Blob; +class Bfile; +class Clob; +class LobStreamImpl; +class AnyData; +class AnyDataImpl; +class Map; +class IntervalDS; +class IntervalYM; + +namespace aq { +class Message; +class MessageImpl; +class Agent; +class AgentImpl; +class Producer; +class ProducerImpl; +class Consumer; +class ConsumerImpl; +class Listener; +class Subscription; +class SubscriptionImpl; +class NotifyResult; +} + +typedef struct BFloat BFloat; +typedef struct BDouble BDouble; + +/*--------------------------------------------------------------------------- + ENUMERATORS + ---------------------------------------------------------------------------*/ +enum Type +{ + OCCI_SQLT_CHR=SQLT_CHR, + OCCI_SQLT_NUM=SQLT_NUM, + OCCIINT = SQLT_INT, + OCCIFLOAT = SQLT_FLT, + OCCIBFLOAT = SQLT_BFLOAT, + OCCIBDOUBLE = SQLT_BDOUBLE, + OCCIIBFLOAT = SQLT_IBFLOAT, + OCCIIBDOUBLE = SQLT_IBDOUBLE, + OCCI_SQLT_STR=SQLT_STR, + OCCI_SQLT_VNU=SQLT_VNU, + OCCI_SQLT_PDN=SQLT_PDN, + OCCI_SQLT_LNG=SQLT_LNG, + OCCI_SQLT_VCS=SQLT_VCS, + OCCI_SQLT_NON=SQLT_NON, + OCCI_SQLT_RID=SQLT_RID, + OCCI_SQLT_DAT=SQLT_DAT, + OCCI_SQLT_VBI=SQLT_VBI, + OCCI_SQLT_BIN=SQLT_BIN, + OCCI_SQLT_LBI=SQLT_LBI, + OCCIUNSIGNED_INT = SQLT_UIN, + OCCI_SQLT_SLS=SQLT_SLS, + OCCI_SQLT_LVC=SQLT_LVC, + OCCI_SQLT_LVB=SQLT_LVB, + OCCI_SQLT_AFC=SQLT_AFC, + OCCI_SQLT_AVC=SQLT_AVC, + OCCI_SQLT_CUR=SQLT_CUR, + OCCI_SQLT_RDD=SQLT_RDD, + OCCI_SQLT_LAB=SQLT_LAB, + OCCI_SQLT_OSL=SQLT_OSL, + OCCI_SQLT_NTY=SQLT_NTY, + OCCI_SQLT_REF=SQLT_REF, + OCCI_SQLT_CLOB=SQLT_CLOB, + OCCI_SQLT_BLOB=SQLT_BLOB, + OCCI_SQLT_BFILEE=SQLT_BFILEE, + OCCI_SQLT_CFILEE=SQLT_CFILEE, + OCCI_SQLT_RSET=SQLT_RSET, + OCCI_SQLT_NCO=SQLT_NCO, + OCCI_SQLT_VST=SQLT_VST, + OCCI_SQLT_ODT=SQLT_ODT, + OCCI_SQLT_DATE=SQLT_DATE, + OCCI_SQLT_TIME=SQLT_TIME, + OCCI_SQLT_TIME_TZ=SQLT_TIME_TZ, + OCCI_SQLT_TIMESTAMP=SQLT_TIMESTAMP, + OCCI_SQLT_TIMESTAMP_TZ=SQLT_TIMESTAMP_TZ, + OCCI_SQLT_INTERVAL_YM=SQLT_INTERVAL_YM, + OCCI_SQLT_INTERVAL_DS=SQLT_INTERVAL_DS, + OCCI_SQLT_TIMESTAMP_LTZ=SQLT_TIMESTAMP_LTZ, + OCCI_SQLT_FILE=SQLT_FILE, + OCCI_SQLT_CFILE=SQLT_CFILE, + OCCI_SQLT_BFILE=SQLT_BFILE, + + OCCICHAR = 32 *1024, + OCCIDOUBLE, + OCCIBOOL, + OCCIANYDATA , + OCCINUMBER, + OCCIBLOB, + OCCIBFILE, + OCCIBYTES, + OCCICLOB , + OCCIVECTOR, + OCCIMETADATA, + OCCIPOBJECT, + OCCIREF , + OCCIREFANY, + OCCISTRING , + OCCISTREAM , + OCCIDATE , + OCCIINTERVALDS , + OCCIINTERVALYM , + OCCITIMESTAMP, + OCCIROWID, + OCCICURSOR + + +}; + +enum LockOptions {OCCI_LOCK_NONE = OCI_LOCK_NONE, + OCCI_LOCK_X = OCI_LOCK_X, + OCCI_LOCK_X_NOWAIT = OCI_LOCK_X_NOWAIT + }; + +enum {OCCI_MAX_PREFETCH_DEPTH = UB4MAXVAL}; + +enum TypeCode +{ + +OCCI_TYPECODE_REF = OCI_TYPECODE_REF, +OCCI_TYPECODE_DATE = OCI_TYPECODE_DATE, +OCCI_TYPECODE_REAL = OCI_TYPECODE_REAL, +OCCI_TYPECODE_DOUBLE = OCI_TYPECODE_DOUBLE, +OCCI_TYPECODE_BDOUBLE = OCI_TYPECODE_BDOUBLE, +OCCI_TYPECODE_FLOAT = OCI_TYPECODE_FLOAT, +OCCI_TYPECODE_BFLOAT = OCI_TYPECODE_BFLOAT, +OCCI_TYPECODE_NUMBER = OCI_TYPECODE_NUMBER, +OCCI_TYPECODE_DECIMAL = OCI_TYPECODE_DECIMAL, +OCCI_TYPECODE_OCTET = OCI_TYPECODE_OCTET, +OCCI_TYPECODE_INTEGER = OCI_TYPECODE_INTEGER, +OCCI_TYPECODE_SMALLINT= OCI_TYPECODE_SMALLINT, +OCCI_TYPECODE_RAW = OCI_TYPECODE_RAW, +OCCI_TYPECODE_VARCHAR2 = OCI_TYPECODE_VARCHAR2, +OCCI_TYPECODE_VARCHAR = OCI_TYPECODE_VARCHAR, +OCCI_TYPECODE_CHAR = OCI_TYPECODE_CHAR, +OCCI_TYPECODE_VARRAY= OCI_TYPECODE_VARRAY, +OCCI_TYPECODE_TABLE = OCI_TYPECODE_TABLE, +OCCI_TYPECODE_CLOB = OCI_TYPECODE_CLOB, +OCCI_TYPECODE_BLOB = OCI_TYPECODE_BLOB, +OCCI_TYPECODE_BFILE = OCI_TYPECODE_BFILE, +OCCI_TYPECODE_OBJECT = OCI_TYPECODE_OBJECT, +OCCI_TYPECODE_NAMEDCOLLECTION = OCI_TYPECODE_NAMEDCOLLECTION +}; + +enum CharSetForm +{ + OCCI_SQLCS_IMPLICIT = SQLCS_IMPLICIT // use local db char set + ,OCCI_SQLCS_NCHAR = SQLCS_NCHAR // use local db nchar set + ,OCCI_SQLCS_EXPLICIT = SQLCS_EXPLICIT // char set explicitly specified + ,OCCI_SQLCS_FLEXIBLE = SQLCS_FLEXIBLE // pl/sql flexible parameter +}; + +enum LobOpenMode +{ OCCI_LOB_READONLY = OCI_LOB_READONLY + ,OCCI_LOB_READWRITE = OCI_LOB_READWRITE + ,OCCI_LOB_WRITEONLY = OCI_LOB_WRITEONLY + ,OCCI_LOB_APPENDONLY = OCI_LOB_APPENDONLY + ,OCCI_LOB_FULLOVERWRITE = OCI_LOB_FULLOVERWRITE + ,OCCI_LOB_FULLREAD = OCI_LOB_FULLREAD +}; + +enum LobOptionType +{ + OCCI_LOB_OPT_NONE = 0, + OCCI_LOB_OPT_COMPRESS = OCI_LOB_OPT_COMPRESS, + OCCI_LOB_OPT_ENCRYPT = OCI_LOB_OPT_ENCRYPT, + OCCI_LOB_OPT_DEDUPLICATE = OCI_LOB_OPT_DEDUPLICATE, + OCCI_LOB_OPT_ALLOCSIZE = OCI_LOB_OPT_ALLOCSIZE, + OCCI_LOB_OPT_CONTENTTYPE = OCI_LOB_OPT_CONTENTTYPE, + OCCI_LOB_OPT_MODTIME = OCI_LOB_OPT_MODTIME +}; + +enum LobOptionValue +{ + // Compression Options + OCCI_LOB_COMPRESS_OFF = OCI_LOB_COMPRESS_OFF, + OCCI_LOB_COMPRESS_ON = OCI_LOB_COMPRESS_ON, + // Encryption Options + OCCI_LOB_ENCRYPT_OFF = OCI_LOB_ENCRYPT_OFF, + OCCI_LOB_ENCRYPT_ON = OCI_LOB_ENCRYPT_ON, + // Sharing Options + OCCI_LOB_DEDUPLICATE_OFF = OCI_LOB_DEDUPLICATE_OFF, + OCCI_LOB_DEDUPLICATE_ON = OCI_LOB_DEDUPLICATE_ON +}; + +class RefCounted { +public: + RefCounted(); + virtual ~RefCounted(){} + const RefCounted * newRef() const; + void deleteRef() const; + +private: + + void onZeroReferences(); + unsigned long references_; + }; + +template +class ConstPtr +{ + +public: + +ConstPtr( const T* ptr = 0 ); +ConstPtr( const ConstPtr& mp ); +~ConstPtr(); +const T * operator->() const; +const T* rawPtr() const; + +#ifdef MEMBER_TEMPLATE +template operator ConstPtr(); +#endif + +protected: + +void operator=( const ConstPtr& mp ); +const T* rawPtr_; + +}; + +template +class Ptr : public ConstPtr { + +public: + +Ptr( T* ptr = 0 ); +Ptr( const Ptr& mp ); +void operator=( const Ptr& mp ); +const T * operator->() const; +T * operator->(); +T* rawPtr() ; +const T* rawPtr() const; + + + +#ifdef MEMBER_TEMPLATE + template + operator Ptr(); +#endif + +}; + +/*--------------------------------------------------------------------------- + EXPORT FUNCTIONS + ---------------------------------------------------------------------------*/ + + void getVector(const AnyData &any, + OCCI_STD_NAMESPACE::vector &vect); + void getVector(const AnyData &any, + OCCI_STD_NAMESPACE::vector &vect); + void getVector( const AnyData &any, + OCCI_STD_NAMESPACE::vector &vect) ; + void getVector( const AnyData &any, + OCCI_STD_NAMESPACE::vector &vect) ; + void getVector( const AnyData &any, + OCCI_STD_NAMESPACE::vector &vect) ; + void getVector( const AnyData &any, + OCCI_STD_NAMESPACE::vector &vect) ; + void getVector( const AnyData &any, + OCCI_STD_NAMESPACE::vector &vect); + void getVector(const AnyData &any, + OCCI_STD_NAMESPACE::vector &vect); + void getVector( const AnyData &any, + OCCI_STD_NAMESPACE::vector &vect) ; + void getVector( const AnyData &any, + OCCI_STD_NAMESPACE::vector &vect) ; + void getVector( const AnyData &any, + OCCI_STD_NAMESPACE::vector &vect) ; + void getVector( const AnyData &any, + OCCI_STD_NAMESPACE::vector &vect) ; + void getVector( const AnyData &any, + OCCI_STD_NAMESPACE::vector &vect) ; + template + void getVectorOfRefs( const AnyData &any, + OCCI_STD_NAMESPACE::vector< Ref > &vect) ; + + #if !defined(WIN32COMMON) && !defined(__MVS__) + template + void getVector(const AnyData &any, + OCCI_STD_NAMESPACE::vector< Ref > &vect) ; + #endif + #if defined(WIN32COMMON) || defined(__MVS__) + template + void getVector(const AnyData &any, + OCCI_STD_NAMESPACE::vector &vect, + void *(*rSQL)(void *)); + #else + template + void getVector(const AnyData &any, + OCCI_STD_NAMESPACE::vector &vect, + void *(*rSQL)(void *)); + #endif + + void setVector( AnyData &any, + const OCCI_STD_NAMESPACE::vector &vect) ; + void setVector( AnyData &any, + const OCCI_STD_NAMESPACE::vector &vect) ; + void setVector( AnyData &any, + const OCCI_STD_NAMESPACE::vector &vect) ; + void setVector( AnyData &any, + const OCCI_STD_NAMESPACE::vector &vect) ; + void setVector( AnyData &any, + const OCCI_STD_NAMESPACE::vector &vect) ; + void setVector( AnyData &any, + const OCCI_STD_NAMESPACE::vector &vect) ; + void setVector( AnyData &any, + const OCCI_STD_NAMESPACE::vector &vect) ; + void setVector( AnyData &any, + const OCCI_STD_NAMESPACE::vector &vect) ; + void setVector( AnyData &any, + const OCCI_STD_NAMESPACE::vector &vect) ; + void setVector( AnyData &any, + const OCCI_STD_NAMESPACE::vector &vect) ; + void setVector( AnyData &any, + const OCCI_STD_NAMESPACE::vector &vect) ; + void setVector( AnyData &any, + const OCCI_STD_NAMESPACE::vector &vect) ; + void setVector( AnyData &any, + const OCCI_STD_NAMESPACE::vector &vect) ; + template + void setVectorOfRefs( AnyData &any, + const OCCI_STD_NAMESPACE::vector< Ref > &vect) ; + #if !defined(WIN32COMMON) && !defined(__MVS__) + template + void setVector( AnyData &any, + const OCCI_STD_NAMESPACE::vector< Ref > &vect) ; + #endif + #if defined(WIN32COMMON) || defined(__MVS__) + template + void setVector( AnyData &any, + const OCCI_STD_NAMESPACE::vector< T > &vect) ; + #else + template + void setVector( AnyData &any, + const OCCI_STD_NAMESPACE::vector< T* > &vect) ; + #endif + + void getVector( ResultSet *rs, unsigned int index, + OCCI_STD_NAMESPACE::vector &vect) ; + void getVector( ResultSet *rs, unsigned int index, + OCCI_STD_NAMESPACE::vector &vect) ; + void getVector( ResultSet *rs, unsigned int index, + OCCI_STD_NAMESPACE::vector &vect) ;//UTF16 support + void getVector(ResultSet *rs, unsigned int, + OCCI_STD_NAMESPACE::vector &vect) ; + void getVector(ResultSet *rs, unsigned int, + OCCI_STD_NAMESPACE::vector &vect); + void getVector(ResultSet *rs, unsigned int, + OCCI_STD_NAMESPACE::vector &vect); + void getVector(ResultSet *rs, unsigned int, + OCCI_STD_NAMESPACE::vector &vect); + void getVector(ResultSet *rs, unsigned int, + OCCI_STD_NAMESPACE::vector &vect); + void getVector(ResultSet *rs, unsigned int, + OCCI_STD_NAMESPACE::vector &vect) ; + void getVector(ResultSet *rs, unsigned int, + OCCI_STD_NAMESPACE::vector &vect) ; + void getVector(ResultSet *rs, unsigned int, + OCCI_STD_NAMESPACE::vector &vect) ; + void getVector(ResultSet *rs, unsigned int, + OCCI_STD_NAMESPACE::vector &vect) ; + void getVector(ResultSet *rs, unsigned int, + OCCI_STD_NAMESPACE::vector &vect) ; + void getVector(ResultSet *rs, unsigned int, + OCCI_STD_NAMESPACE::vector &vect) ; + void getVector(ResultSet *rs, unsigned int, + OCCI_STD_NAMESPACE::vector &vect) ; + void getVector(ResultSet *rs, unsigned int, + OCCI_STD_NAMESPACE::vector &vect) ; + void getVector(ResultSet *rs, unsigned int, + OCCI_STD_NAMESPACE::vector &vect) ; + template + void getVectorOfRefs(ResultSet *rs, unsigned int, + OCCI_STD_NAMESPACE::vector > &vect) ; + #if !defined(WIN32COMMON) && !defined(__MVS__) + template + void getVector(ResultSet *rs, unsigned int, + OCCI_STD_NAMESPACE::vector > &vect) ; + #endif + #if defined(WIN32COMMON) || defined(__MVS__) + template + void getVector( ResultSet *rs, unsigned int index, + OCCI_STD_NAMESPACE::vector< T > &vect) ; + #else + template + void getVector( ResultSet *rs, unsigned int index, + OCCI_STD_NAMESPACE::vector< T* > &vect) ; + #endif + + + void getVector(Statement *rs, unsigned int, + OCCI_STD_NAMESPACE::vector &vect) ; + void getVector(Statement *rs, unsigned int, + OCCI_STD_NAMESPACE::vector &vect) ; + void getVector(Statement *rs, unsigned int, + OCCI_STD_NAMESPACE::vector &vect) ; + void getVector(Statement *rs, unsigned int, + OCCI_STD_NAMESPACE::vector &vect) ; + void getVector(Statement *rs, unsigned int, + OCCI_STD_NAMESPACE::vector &vect) ; + void getVector(Statement *rs, unsigned int, + OCCI_STD_NAMESPACE::vector &vect) ; + void getVector(Statement *rs, unsigned int, + OCCI_STD_NAMESPACE::vector &vect) ; + void getVector( Statement *rs, unsigned int index, + OCCI_STD_NAMESPACE::vector &vect) ; + void getVector( Statement *rs, unsigned int index, + OCCI_STD_NAMESPACE::vector &vect) ; + void getVector( Statement *rs, unsigned int index, + OCCI_STD_NAMESPACE::vector &vect) ;//UTF16 support + void getVector(Statement *rs, unsigned int, + OCCI_STD_NAMESPACE::vector &vect) ; + void getVector(Statement *rs, unsigned int, + OCCI_STD_NAMESPACE::vector &vect) ; + void getVector(Statement *rs, unsigned int, + OCCI_STD_NAMESPACE::vector &vect) ; + void getVector(Statement *rs, unsigned int, + OCCI_STD_NAMESPACE::vector &vect) ; + void getVector(Statement *rs, unsigned int, + OCCI_STD_NAMESPACE::vector &vect) ; + void getVector(Statement *rs, unsigned int, + OCCI_STD_NAMESPACE::vector &vect) ; + void getVector(Statement *rs, unsigned int, + OCCI_STD_NAMESPACE::vector &vect) ; + template + void getVectorOfRefs(Statement *rs, unsigned int, + OCCI_STD_NAMESPACE::vector > &vect) ; + #if !defined(WIN32COMMON) && !defined(__MVS__) + template + void getVector(Statement *rs, unsigned int, + OCCI_STD_NAMESPACE::vector > &vect) ; + #endif + #if defined(WIN32COMMON) || defined(__MVS__) + template + void getVector( Statement *rs, unsigned int index, + OCCI_STD_NAMESPACE::vector< T > &vect) ; + #else + template + void getVector( Statement *rs, unsigned int index, + OCCI_STD_NAMESPACE::vector< T* > &vect) ; + #endif + + + void setVector(Statement *stmt, unsigned int paramIndex, + const OCCI_STD_NAMESPACE::vector &vect, + const OCCI_STD_NAMESPACE::string &sqltype) ; + void setVector(Statement *stmt, unsigned int paramIndex, + const OCCI_STD_NAMESPACE::vector &vect, + const OCCI_STD_NAMESPACE::string &sqltype) ; + void setVector(Statement *stmt, unsigned int paramIndex, + const OCCI_STD_NAMESPACE::vector &vect, + const OCCI_STD_NAMESPACE::string &sqltype) ; + void setVector(Statement *stmt, unsigned int paramIndex, + const OCCI_STD_NAMESPACE::vector &vect, + const OCCI_STD_NAMESPACE::string &sqltype) ; + void setVector(Statement *stmt, unsigned int paramIndex, + const OCCI_STD_NAMESPACE::vector &vect, + const OCCI_STD_NAMESPACE::string &sqltype) ; + void setVector(Statement *stmt, unsigned int paramIndex, + const OCCI_STD_NAMESPACE::vector &vect, + const OCCI_STD_NAMESPACE::string &sqltype) ; + void setVector(Statement *stmt, unsigned int paramIndex, + const OCCI_STD_NAMESPACE::vector &vect, + const OCCI_STD_NAMESPACE::string &sqltype); + void setVector(Statement *stmt, unsigned int paramIndex, + const OCCI_STD_NAMESPACE::vector &vect, + const OCCI_STD_NAMESPACE::string &sqltype) ; + void setVector(Statement *stmt, unsigned int paramIndex, + const OCCI_STD_NAMESPACE::vector &vect, + const OCCI_STD_NAMESPACE::string &sqltype) ; + void setVector(Statement *stmt, unsigned int paramIndex, + const OCCI_STD_NAMESPACE::vector &vect, + const OCCI_STD_NAMESPACE::string &sqltype) ; + void setVector(Statement *stmt, unsigned int paramIndex, + const OCCI_STD_NAMESPACE::vector &vect, + const OCCI_STD_NAMESPACE::string &sqltype) ; + void setVector(Statement *stmt, unsigned int paramIndex, + const OCCI_STD_NAMESPACE::vector &vect, + const OCCI_STD_NAMESPACE::string &sqltype) ; + void setVector(Statement *stmt, unsigned int paramIndex, + const OCCI_STD_NAMESPACE::vector &vect, + const OCCI_STD_NAMESPACE::string &sqltype) ; + void setVector(Statement *stmt, unsigned int paramIndex, + const OCCI_STD_NAMESPACE::vector &vect, + const OCCI_STD_NAMESPACE::string &sqltype) ; + void setVector(Statement *stmt, unsigned int paramIndex, + const OCCI_STD_NAMESPACE::vector &vect, + const OCCI_STD_NAMESPACE::string &sqltype) ; + void setVector(Statement *stmt, unsigned int paramIndex, + const OCCI_STD_NAMESPACE::vector &vect, + const OCCI_STD_NAMESPACE::string &sqltype) ; + template + void setVectorOfRefs(Statement *stmt, unsigned int paramIndex, + const OCCI_STD_NAMESPACE::vector > &vect, + const OCCI_STD_NAMESPACE::string &sqltype) ; + #if !defined(WIN32COMMON) && !defined(__MVS__) + template + void setVector(Statement *stmt, unsigned int paramIndex, + const OCCI_STD_NAMESPACE::vector > &vect, + const OCCI_STD_NAMESPACE::string &sqltype) ; + #endif + #if defined(WIN32COMMON) || defined(__MVS__) + template + void setVector( Statement *stmt, unsigned int paramIndex, + const OCCI_STD_NAMESPACE::vector< T > &vect, + const OCCI_STD_NAMESPACE::string &sqltype) ; + #else + template + void setVector( Statement *stmt, unsigned int paramIndex, + const OCCI_STD_NAMESPACE::vector &vect, + const OCCI_STD_NAMESPACE::string &sqltype) ; + #endif + +/* ------------------------------------------------------------------------ + Statement setVector functions, schema & type separate + arguments - multibyte support + ------------------------------------------------------------------------ +*/ + void setVector(Statement *stmt, unsigned int paramIndex, + const OCCI_STD_NAMESPACE::vector &vect, + const OCCI_STD_NAMESPACE::string &schemaName, + const OCCI_STD_NAMESPACE::string &typeName) ; + void setVector(Statement *stmt, unsigned int paramIndex, + const OCCI_STD_NAMESPACE::vector &vect, + const OCCI_STD_NAMESPACE::string &schemaName, + const OCCI_STD_NAMESPACE::string &typeName) ; + void setVector(Statement *stmt, unsigned int paramIndex, + const OCCI_STD_NAMESPACE::vector &vect, + const OCCI_STD_NAMESPACE::string &schemaName, + const OCCI_STD_NAMESPACE::string &typeName) ; + void setVector(Statement *stmt, unsigned int paramIndex, + const OCCI_STD_NAMESPACE::vector &vect, + const OCCI_STD_NAMESPACE::string &schemaName, + const OCCI_STD_NAMESPACE::string &typeName) ; + void setVector(Statement *stmt, unsigned int paramIndex, + const OCCI_STD_NAMESPACE::vector &vect, + const OCCI_STD_NAMESPACE::string &schemaName, + const OCCI_STD_NAMESPACE::string &typeName) ; + void setVector(Statement *stmt, unsigned int paramIndex, + const OCCI_STD_NAMESPACE::vector &vect, + const OCCI_STD_NAMESPACE::string &schemaName, + const OCCI_STD_NAMESPACE::string &typeName) ; + void setVector(Statement *stmt, unsigned int paramIndex, + const OCCI_STD_NAMESPACE::vector &vect, + const OCCI_STD_NAMESPACE::string &schemaName, + const OCCI_STD_NAMESPACE::string &typeName); + void setVector(Statement *stmt, unsigned int paramIndex, + const OCCI_STD_NAMESPACE::vector &vect, + const OCCI_STD_NAMESPACE::string &schemaName, + const OCCI_STD_NAMESPACE::string &typeName) ; + void setVector(Statement *stmt, unsigned int paramIndex, + const OCCI_STD_NAMESPACE::vector &vect, + const OCCI_STD_NAMESPACE::string &schemaName, + const OCCI_STD_NAMESPACE::string &typeName) ; + void setVector(Statement *stmt, unsigned int paramIndex, + const OCCI_STD_NAMESPACE::vector &vect, + const OCCI_STD_NAMESPACE::string &schemaName, + const OCCI_STD_NAMESPACE::string &typeName) ; + void setVector(Statement *stmt, unsigned int paramIndex, + const OCCI_STD_NAMESPACE::vector &vect, + const OCCI_STD_NAMESPACE::string &schemaName, + const OCCI_STD_NAMESPACE::string &typeName) ; + void setVector(Statement *stmt, unsigned int paramIndex, + const OCCI_STD_NAMESPACE::vector &vect, + const OCCI_STD_NAMESPACE::string &schemaName, + const OCCI_STD_NAMESPACE::string &typeName) ; + void setVector(Statement *stmt, unsigned int paramIndex, + const OCCI_STD_NAMESPACE::vector &vect, + const OCCI_STD_NAMESPACE::string &schemaName, + const OCCI_STD_NAMESPACE::string &typeName) ; + void setVector(Statement *stmt, unsigned int paramIndex, + const OCCI_STD_NAMESPACE::vector &vect, + const OCCI_STD_NAMESPACE::string &schemaName, + const OCCI_STD_NAMESPACE::string &typeName) ; + void setVector(Statement *stmt, unsigned int paramIndex, + const OCCI_STD_NAMESPACE::vector &vect, + const OCCI_STD_NAMESPACE::string &schemaName, + const OCCI_STD_NAMESPACE::string &typeName) ; + void setVector(Statement *stmt, unsigned int paramIndex, + const OCCI_STD_NAMESPACE::vector &vect, + const OCCI_STD_NAMESPACE::string &schemaName, + const OCCI_STD_NAMESPACE::string &typeName) ; + template + void setVectorOfRefs(Statement *stmt, unsigned int paramIndex, + const OCCI_STD_NAMESPACE::vector > &vect, + const OCCI_STD_NAMESPACE::string &schemaName, + const OCCI_STD_NAMESPACE::string &typeName) ; + + #if !defined(WIN32COMMON) && !defined(__MVS__) + template + void setVector(Statement *stmt, unsigned int paramIndex, + const OCCI_STD_NAMESPACE::vector > &vect, + const OCCI_STD_NAMESPACE::string &schemaName, + const OCCI_STD_NAMESPACE::string &typeName) ; + #endif + + #if defined(WIN32COMMON) || defined(__MVS__) + template + void setVector( Statement *stmt, unsigned int paramIndex, + const OCCI_STD_NAMESPACE::vector< T > &vect, + const OCCI_STD_NAMESPACE::string &schemaName, + const OCCI_STD_NAMESPACE::string &typeName) ; + #else + template + void setVector( Statement *stmt, unsigned int paramIndex, + const OCCI_STD_NAMESPACE::vector &vect, const OCCI_STD_NAMESPACE::string + &schemaName, const OCCI_STD_NAMESPACE::string &typeName) ; + #endif + +/*------------------------------------------------------------------------- + Statement setVector function - UTF16 support + ------------------------------------------------------------------------- +*/ + void setVector(Statement *stmt, unsigned int paramIndex, + const OCCI_STD_NAMESPACE::vector &vect, + const UString &schemaName, + const UString &typeName) ; + void setVector(Statement *stmt, unsigned int paramIndex, + const OCCI_STD_NAMESPACE::vector &vect, + const UString &schemaName, + const UString &typeName) ; + void setVector(Statement *stmt, unsigned int paramIndex, + const OCCI_STD_NAMESPACE::vector &vect, + const UString &schemaName, + const UString &typeName) ; + void setVector(Statement *stmt, unsigned int paramIndex, + const OCCI_STD_NAMESPACE::vector &vect, + const UString &schemaName, + const UString &typeName) ; + void setVector(Statement *stmt, unsigned int paramIndex, + const OCCI_STD_NAMESPACE::vector &vect, + const UString &schemaName, + const UString &typeName) ; + void setVector(Statement *stmt, unsigned int paramIndex, + const OCCI_STD_NAMESPACE::vector &vect, + const UString &schemaName, + const UString &typeName) ; + void setVector(Statement *stmt, unsigned int paramIndex, + const OCCI_STD_NAMESPACE::vector &vect, + const UString &schemaName, + const UString &typeName); + void setVector(Statement *stmt, unsigned int paramIndex, + const OCCI_STD_NAMESPACE::vector &vect, + const UString &schemaName, + const UString &typeName) ; + void setVector(Statement *stmt, unsigned int paramIndex, + const OCCI_STD_NAMESPACE::vector &vect, + const OCCI_STD_NAMESPACE::string &schemaName, + const OCCI_STD_NAMESPACE::string &typeName) ; + void setVector(Statement *stmt, unsigned int paramIndex, + const OCCI_STD_NAMESPACE::vector &vect, + const UString &schemaName, + const UString &typeName) ; + void setVector(Statement *stmt, unsigned int paramIndex, + const OCCI_STD_NAMESPACE::vector &vect, + const UString &schemaName, + const UString &typeName) ; + void setVector(Statement *stmt, unsigned int paramIndex, + const OCCI_STD_NAMESPACE::vector &vect, + const UString &schemaName, + const UString &typeName) ; + void setVector(Statement *stmt, unsigned int paramIndex, + const OCCI_STD_NAMESPACE::vector &vect, + const UString &schemaName, + const UString &typeName) ; + void setVector(Statement *stmt, unsigned int paramIndex, + const OCCI_STD_NAMESPACE::vector &vect, + const UString &schemaName, + const UString &typeName) ; + void setVector(Statement *stmt, unsigned int paramIndex, + const OCCI_STD_NAMESPACE::vector &vect, + const UString &schemaName, + const UString &typeName) ; + void setVector(Statement *stmt, unsigned int paramIndex, + const OCCI_STD_NAMESPACE::vector &vect, + const UString &schemaName, + const UString &typeName) ; + void setVector(Statement *stmt, unsigned int paramIndex, + const OCCI_STD_NAMESPACE::vector &vect, + const UString &schemaName, + const UString &typeName) ; + template + void setVectorOfRefs(Statement *stmt, unsigned int paramIndex, + const OCCI_STD_NAMESPACE::vector > &vect, + const UString &schemaName, + const UString &typeName) ; + + #if !defined(WIN32COMMON) && !defined(__MVS__) + template + void setVector(Statement *stmt, unsigned int paramIndex, + const OCCI_STD_NAMESPACE::vector > &vect, + const UString &schemaName, + const UString &typeName) ; + #endif + + #if defined(WIN32COMMON) || defined(__MVS__) + template + void setVector( Statement *stmt, unsigned int paramIndex, + const OCCI_STD_NAMESPACE::vector< T > &vect, + const UString &schemaName, + const UString &typeName) ; + #else + template + void setVector( Statement *stmt, unsigned int paramIndex, + const OCCI_STD_NAMESPACE::vector &vect, const UString + &schemaName, const UString &typeName) ; + #endif + + +/* Global method for array pins */ +template +void pinVectorOfRefs( const Connection *conn, +OCCI_STD_NAMESPACE::vector > &vect, +OCCI_STD_NAMESPACE::vector &vectObj, +LockOptions lockOpt = OCCI_LOCK_NONE ); + +template +void pinVectorOfRefs( const Connection *conn, +OCCI_STD_NAMESPACE::vector > &vect, +LockOptions lockOpt = OCCI_LOCK_NONE ); + +#ifdef ORAXB8_DEFINED + void readVectorOfBfiles(const Connection *conn, + OCCI_STD_NAMESPACE::vector &vec, + oraub8 *byte_amts, oraub8 *offsets, + unsigned char *buffers[], oraub8 *buffer_lens); + + void readVectorOfBlobs(const Connection *conn, + OCCI_STD_NAMESPACE::vector &vec, + oraub8 *byte_amts, oraub8 *offsets, + unsigned char *buffers[], oraub8 *buffer_lens); + void writeVectorOfBlobs(const Connection *conn, + OCCI_STD_NAMESPACE::vector &vec, + oraub8 *byte_amts, oraub8 *offsets, + unsigned char *buffers[], oraub8 *buffer_lens); + + void readVectorOfClobs(const Connection *conn, + OCCI_STD_NAMESPACE::vector &vec, + oraub8 *byte_amts, oraub8 *char_amts, oraub8 *offsets, + unsigned char *buffers[], oraub8 *buffer_lens); + void writeVectorOfClobs(const Connection *conn, + OCCI_STD_NAMESPACE::vector &vec, + oraub8 *byte_amts, oraub8 *char_amts, oraub8 *offsets, + unsigned char *buffers[], oraub8 *buffer_lens); + void readVectorOfClobs(const Connection *conn, + OCCI_STD_NAMESPACE::vector &vec, + oraub8 *byte_amts, oraub8 *char_amts, oraub8 *offsets, + utext *buffers[], oraub8 *buffer_lens); + void writeVectorOfClobs(const Connection *conn, + OCCI_STD_NAMESPACE::vector &vec, + oraub8 *byte_amts, oraub8 *char_amts, oraub8 *offsets, + utext *buffers[], oraub8 *buffer_lens); +#endif + + +/*--------------------------------------------------------------------------- + INTERNAL FUNCTIONS + ---------------------------------------------------------------------------*/ + + +} /* end of namespace occi */ +} /* end of namespace oracle */ + + +#endif /* _olint */ + +#endif /* OCCICOMMON_ORACLE */ diff --git a/sdk/include/occiControl.h b/sdk/include/occiControl.h new file mode 100755 index 0000000..392f057 --- /dev/null +++ b/sdk/include/occiControl.h @@ -0,0 +1,2137 @@ +/* Copyright Oracle Corporation 2000, 2006. All Rights Reserved. */ + +/* + NAME + occiControl.h - header file for OCCI control classes + + DESCRIPTION + Class definitions for MetaData,SQLException,Environment, + Connection,Statement, ConnectionPool, StatelessConnectionPool + + RELATED DOCUMENTS + + + EXPORT FUNCTION(S) + + + INTERNAL FUNCTION(S) + + + EXAMPLES + + NOTES + + + +*/ + +#ifndef _olint /* disable olint check */ + +#ifndef OCCICONTROL_ORACLE +# define OCCICONTROL_ORACLE + +#ifndef OCCICOMMON_ORACLE +#include +#endif + +#ifndef ORAEXCEPTION +#define ORAEXCEPTION +#include +#endif + +namespace oracle { +namespace occi { +/*--------------------------------------------------------------------------- + PUBLIC TYPES AND CONSTANTS + ---------------------------------------------------------------------------*/ + +class MetaData +{ + public : + + enum AttrId + {ATTR_PTYPE = OCI_ATTR_PTYPE, + ATTR_TIMESTAMP = OCI_ATTR_TIMESTAMP, + ATTR_OBJ_ID = OCI_ATTR_OBJ_ID, + ATTR_OBJ_NAME = OCI_ATTR_OBJ_NAME, + ATTR_OBJ_SCHEMA = OCI_ATTR_OBJ_SCHEMA, + ATTR_OBJID = OCI_ATTR_OBJID, + ATTR_NUM_COLS = OCI_ATTR_NUM_COLS, + ATTR_LIST_COLUMNS = OCI_ATTR_LIST_COLUMNS, + ATTR_REF_TDO = OCI_ATTR_REF_TDO, + ATTR_IS_TEMPORARY = OCI_ATTR_IS_TEMPORARY, + ATTR_IS_TYPED = OCI_ATTR_IS_TYPED, + ATTR_DURATION = OCI_ATTR_DURATION, + ATTR_COLLECTION_ELEMENT = OCI_ATTR_COLLECTION_ELEMENT, + ATTR_RDBA = OCI_ATTR_RDBA, + ATTR_TABLESPACE = OCI_ATTR_TABLESPACE, + ATTR_CLUSTERED = OCI_ATTR_CLUSTERED, + ATTR_PARTITIONED = OCI_ATTR_PARTITIONED, + ATTR_INDEX_ONLY = OCI_ATTR_INDEX_ONLY, + ATTR_LIST_ARGUMENTS = OCI_ATTR_LIST_ARGUMENTS, + ATTR_IS_INVOKER_RIGHTS = OCI_ATTR_IS_INVOKER_RIGHTS, + ATTR_LIST_SUBPROGRAMS = OCI_ATTR_LIST_SUBPROGRAMS, + ATTR_NAME = OCI_ATTR_NAME, + ATTR_OVERLOAD_ID = OCI_ATTR_OVERLOAD_ID, + ATTR_TYPECODE = OCI_ATTR_TYPECODE, + ATTR_COLLECTION_TYPECODE = OCI_ATTR_COLLECTION_TYPECODE, + ATTR_VERSION = OCI_ATTR_VERSION, + ATTR_IS_INCOMPLETE_TYPE = OCI_ATTR_IS_INCOMPLETE_TYPE, + ATTR_IS_SYSTEM_TYPE = OCI_ATTR_IS_SYSTEM_TYPE, + ATTR_IS_PREDEFINED_TYPE = OCI_ATTR_IS_PREDEFINED_TYPE, + ATTR_IS_TRANSIENT_TYPE = OCI_ATTR_IS_TRANSIENT_TYPE, + ATTR_IS_SYSTEM_GENERATED_TYPE = + OCI_ATTR_IS_SYSTEM_GENERATED_TYPE, + ATTR_HAS_NESTED_TABLE = OCI_ATTR_HAS_NESTED_TABLE, + ATTR_HAS_LOB = OCI_ATTR_HAS_LOB, + ATTR_HAS_FILE = OCI_ATTR_HAS_FILE, + ATTR_NUM_TYPE_ATTRS = OCI_ATTR_NUM_TYPE_ATTRS, + ATTR_LIST_TYPE_ATTRS = OCI_ATTR_LIST_TYPE_ATTRS, + ATTR_NUM_TYPE_METHODS = OCI_ATTR_NUM_TYPE_METHODS, + ATTR_LIST_TYPE_METHODS = OCI_ATTR_LIST_TYPE_METHODS, + ATTR_MAP_METHOD = OCI_ATTR_MAP_METHOD, + ATTR_ORDER_METHOD = OCI_ATTR_ORDER_METHOD, + ATTR_DATA_SIZE = OCI_ATTR_DATA_SIZE, + ATTR_DATA_TYPE = OCI_ATTR_DATA_TYPE, + ATTR_PRECISION = OCI_ATTR_PRECISION, + ATTR_SCALE = OCI_ATTR_SCALE, + ATTR_TYPE_NAME = OCI_ATTR_TYPE_NAME, + ATTR_SCHEMA_NAME = OCI_ATTR_SCHEMA_NAME, + ATTR_CHARSET_ID = OCI_ATTR_CHARSET_ID, + ATTR_CHARSET_FORM = OCI_ATTR_CHARSET_FORM, + ATTR_ENCAPSULATION = OCI_ATTR_ENCAPSULATION, + ATTR_IS_CONSTRUCTOR = OCI_ATTR_IS_CONSTRUCTOR, + ATTR_IS_DESTRUCTOR = OCI_ATTR_IS_DESTRUCTOR, + ATTR_IS_OPERATOR = OCI_ATTR_IS_OPERATOR, + ATTR_IS_SELFISH = OCI_ATTR_IS_SELFISH, + ATTR_IS_MAP = OCI_ATTR_IS_MAP, + ATTR_IS_ORDER = OCI_ATTR_IS_ORDER, + ATTR_IS_RNDS = OCI_ATTR_IS_RNDS, + ATTR_IS_RNPS = OCI_ATTR_IS_RNPS, + ATTR_IS_WNDS = OCI_ATTR_IS_WNDS, + ATTR_IS_WNPS = OCI_ATTR_IS_WNPS, + ATTR_NUM_ELEMS = OCI_ATTR_NUM_ELEMS, + ATTR_LINK = OCI_ATTR_LINK, + ATTR_MIN = OCI_ATTR_MIN, + ATTR_MAX = OCI_ATTR_MAX, + ATTR_INCR = OCI_ATTR_INCR, + ATTR_CACHE = OCI_ATTR_CACHE, + ATTR_ORDER = OCI_ATTR_ORDER, + ATTR_HW_MARK = OCI_ATTR_HW_MARK, + ATTR_IS_NULL = OCI_ATTR_IS_NULL, + ATTR_POSITION = OCI_ATTR_POSITION, + ATTR_HAS_DEFAULT = OCI_ATTR_HAS_DEFAULT, + ATTR_LEVEL = OCI_ATTR_LEVEL, + ATTR_IOMODE = OCI_ATTR_IOMODE, + ATTR_RADIX = OCI_ATTR_RADIX, + ATTR_SUB_NAME = OCI_ATTR_SUB_NAME, + ATTR_LIST_OBJECTS = OCI_ATTR_LIST_OBJECTS, + ATTR_NCHARSET_ID = OCI_ATTR_NCHARSET_ID, + ATTR_LIST_SCHEMAS = OCI_ATTR_LIST_SCHEMAS, + ATTR_MAX_PROC_LEN = OCI_ATTR_MAX_PROC_LEN, + ATTR_MAX_COLUMN_LEN = OCI_ATTR_MAX_COLUMN_LEN, + ATTR_CURSOR_COMMIT_BEHAVIOR = + OCI_ATTR_CURSOR_COMMIT_BEHAVIOR, + ATTR_MAX_CATALOG_NAMELEN = OCI_ATTR_MAX_CATALOG_NAMELEN, + ATTR_CATALOG_LOCATION = OCI_ATTR_CATALOG_LOCATION, + ATTR_SAVEPOINT_SUPPORT = OCI_ATTR_SAVEPOINT_SUPPORT, + ATTR_NOWAIT_SUPPORT = OCI_ATTR_NOWAIT_SUPPORT, + ATTR_AUTOCOMMIT_DDL = OCI_ATTR_AUTOCOMMIT_DDL, + ATTR_LOCKING_MODE = OCI_ATTR_LOCKING_MODE, + ATTR_IS_FINAL_TYPE = OCI_ATTR_IS_FINAL_TYPE, + ATTR_IS_INSTANTIABLE_TYPE = OCI_ATTR_IS_INSTANTIABLE_TYPE, + ATTR_IS_SUBTYPE = OCI_ATTR_IS_SUBTYPE, + ATTR_SUPERTYPE_SCHEMA_NAME = OCI_ATTR_SUPERTYPE_SCHEMA_NAME, + ATTR_SUPERTYPE_NAME = OCI_ATTR_SUPERTYPE_NAME, + ATTR_FSPRECISION = OCI_ATTR_FSPRECISION, + ATTR_LFPRECISION = OCI_ATTR_LFPRECISION, + ATTR_IS_FINAL_METHOD = OCI_ATTR_IS_FINAL_METHOD, + ATTR_IS_INSTANTIABLE_METHOD = OCI_ATTR_IS_INSTANTIABLE_METHOD, + ATTR_IS_OVERRIDING_METHOD = OCI_ATTR_IS_OVERRIDING_METHOD, + ATTR_CHAR_USED = OCI_ATTR_CHAR_USED, + ATTR_CHAR_SIZE = OCI_ATTR_CHAR_SIZE, + ATTR_COL_ENC = OCI_ATTR_COL_ENC, + ATTR_COL_ENC_SALT = OCI_ATTR_COL_ENC_SALT, + ATTR_TABLE_ENC = OCI_ATTR_TABLE_ENC, + ATTR_TABLE_ENC_ALG = OCI_ATTR_TABLE_ENC_ALG, + ATTR_TABLE_ENC_ALG_ID = OCI_ATTR_TABLE_ENC_ALG_ID + }; + + enum ParamType + { + PTYPE_TABLE = OCI_PTYPE_TABLE + ,PTYPE_VIEW = OCI_PTYPE_VIEW + ,PTYPE_PROC = OCI_PTYPE_PROC + ,PTYPE_FUNC = OCI_PTYPE_FUNC + ,PTYPE_PKG = OCI_PTYPE_PKG + ,PTYPE_TYPE = OCI_PTYPE_TYPE + ,PTYPE_TYPE_ATTR = OCI_PTYPE_TYPE_ATTR + ,PTYPE_TYPE_COLL = OCI_PTYPE_TYPE_COLL + ,PTYPE_TYPE_METHOD = OCI_PTYPE_TYPE_METHOD + ,PTYPE_SYN = OCI_PTYPE_SYN + ,PTYPE_SEQ = OCI_PTYPE_SEQ + ,PTYPE_COL = OCI_PTYPE_COL + ,PTYPE_ARG = OCI_PTYPE_ARG + ,PTYPE_TYPE_ARG = OCI_PTYPE_TYPE_ARG + ,PTYPE_TYPE_RESULT = OCI_PTYPE_TYPE_RESULT + ,PTYPE_SCHEMA = OCI_PTYPE_SCHEMA + ,PTYPE_DATABASE = OCI_PTYPE_DATABASE + ,PTYPE_UNK = OCI_PTYPE_UNK + }; + + + enum { DURATION_SESSION = OCI_DURATION_SESSION + ,DURATION_TRANS = OCI_DURATION_TRANS + ,DURATION_NULL = OCI_DURATION_NULL + ,TYPEENCAP_PRIVATE = OCI_TYPEENCAP_PRIVATE + ,TYPEENCAP_PUBLIC = OCI_TYPEENCAP_PUBLIC + ,TYPEPARAM_IN = OCI_TYPEPARAM_IN + ,TYPEPARAM_OUT = OCI_TYPEPARAM_OUT + ,TYPEPARAM_INOUT = OCI_TYPEPARAM_INOUT + ,CURSOR_OPEN = OCI_CURSOR_OPEN + ,CURSOR_CLOSED = OCI_CURSOR_CLOSED + ,CL_START = OCI_CL_START + ,CL_END = OCI_CL_END + ,SP_SUPPORTED = OCI_SP_SUPPORTED + ,SP_UNSUPPORTED = OCI_SP_UNSUPPORTED + ,NW_SUPPORTED = OCI_NW_SUPPORTED + ,NW_UNSUPPORTED = OCI_NW_UNSUPPORTED + ,AC_DDL = OCI_AC_DDL + ,NO_AC_DDL = OCI_NO_AC_DDL + ,LOCK_IMMEDIATE = OCI_LOCK_IMMEDIATE + ,LOCK_DELAYED = OCI_LOCK_DELAYED + }; + + MetaData(const MetaData &omd); + unsigned int getAttributeCount() const + ; + AttrId getAttributeId(unsigned int attributenum) const + ; + Type getAttributeType(unsigned int attributenum) const + ; + int getInt(MetaData::AttrId attrid) const + ; + bool getBoolean(MetaData::AttrId attrid) const + ; + unsigned int getUInt(MetaData::AttrId attrid) const + ; + OCCI_STD_NAMESPACE::string getString(MetaData::AttrId attrid) const + ; + UString getUString(MetaData::AttrId attrid) const + ; + Number getNumber(MetaData::AttrId attrid) const + ; + RefAny getRef(MetaData::AttrId attrid) const + ; + Timestamp getTimestamp(MetaData::AttrId attrid) const + ; + MetaData getMetaData(MetaData::AttrId attrid) const + ; + OCCI_STD_NAMESPACE::vector getVector(MetaData::AttrId attrid) + const ; + void operator =(const MetaData &omd); + + ~MetaData(); + + private: + + enum ociAttrType { OCI_UB1, + OCI_UB2, + OCI_UB4, + OCI_SB1, + OCI_WORD, + OCI_UB1_BOOL, + OCI_UB1PTR_TIMESTAMP, + OCI_UB1PTR_NUMBER, + OCI_TEXTPTR, + OCI_DVOIDPTR_PARAM, + OCI_DVOIDPTR_PARAMLIST, + OCI_OCIREFPTR, + OCI_OCIDURATION, + OCI_OCITYPECODE, + OCI_OCITYPEENCAP, + OCI_OCITYPEPARAMMODE, + OCI_OCIPRECISION + }; + + enum AttrCount {COMMON_ATTR_COUNT = 5, + TABLE_ATTR_COUNT = 15, + VIEW_ATTR_COUNT = 7, + FUNCPROC_ATTR_COUNT = 4, + PKG_ATTR_COUNT = 2, + TYP_ATTR_COUNT = 27, + TYPEATTR_ATTR_COUNT = 14, + TYPEMTHD_ATTR_COUNT = 16, + COLL_ATTR_COUNT = 12, + SYN_ATTR_COUNT = 4, + SEQ_ATTR_COUNT = 7, + COL_ATTR_COUNT = 15, + ARG_TYPARG_TYPRES_ATTR_COUNT = 20, + SCHEMA_ATTR_COUNT = 1, + DATABASE_ATTR_COUNT = 13, + UNK_ATTR_COUNT = 0 + }; + + static const AttrId commonAttrId[COMMON_ATTR_COUNT]; + static const ociAttrType commonAttrType[COMMON_ATTR_COUNT]; + static const AttrId tableAttrId[TABLE_ATTR_COUNT]; + static const ociAttrType tableAttrType[TABLE_ATTR_COUNT]; + static const AttrId viewAttrId[VIEW_ATTR_COUNT]; + static const ociAttrType viewAttrType[VIEW_ATTR_COUNT]; + static const AttrId funcprocAttrId[FUNCPROC_ATTR_COUNT]; + static const ociAttrType funcprocAttrType[FUNCPROC_ATTR_COUNT]; + static const AttrId pkgAttrId[PKG_ATTR_COUNT]; + static const ociAttrType pkgAttrType[PKG_ATTR_COUNT]; + static const AttrId typAttrId[TYP_ATTR_COUNT]; + static const ociAttrType typAttrType[TYP_ATTR_COUNT]; + static const AttrId typeattrAttrId[TYPEATTR_ATTR_COUNT]; + static const ociAttrType typeattrAttrType[TYPEATTR_ATTR_COUNT]; + static const AttrId typmethdAttrId[TYPEMTHD_ATTR_COUNT]; + static const ociAttrType typemthdAttrType[TYPEMTHD_ATTR_COUNT]; + static const AttrId collAttrId[COLL_ATTR_COUNT]; + static const ociAttrType collAttrType[COLL_ATTR_COUNT]; + static const AttrId synAttrId[SYN_ATTR_COUNT]; + static const ociAttrType synAttrType[SYN_ATTR_COUNT]; + static const AttrId seqAttrId[SEQ_ATTR_COUNT]; + static const ociAttrType seqAttrType[SEQ_ATTR_COUNT]; + static const AttrId colAttrId[COL_ATTR_COUNT]; + static const ociAttrType colAttrType[COL_ATTR_COUNT]; + static const AttrId argtargtresAttrId[ARG_TYPARG_TYPRES_ATTR_COUNT]; + static const ociAttrType argtargtresAttrType[ + ARG_TYPARG_TYPRES_ATTR_COUNT]; + static const AttrId schemaAttrId[SCHEMA_ATTR_COUNT]; + static const ociAttrType schemaAttrType[SCHEMA_ATTR_COUNT]; + static const AttrId databaseAttrId[DATABASE_ATTR_COUNT]; + static const ociAttrType databaseAttrType[DATABASE_ATTR_COUNT]; + + Ptr metaDataImplPtr; + const OCIParam* paramhp; + const ConnectionImpl* sesn; + const AttrId* attrIdArray; + const ociAttrType* attrTypeArray; + AttrCount attrCount; + + MetaData(const Connection *sessp, const OCCI_STD_NAMESPACE::string& objName, + ParamType prmtyp ) ; + MetaData(const Connection *sessp, const UString& objName, + ParamType prmtyp ) ; + MetaData(const Connection *sessp, + const RefAny& ref) ; + MetaData(const Connection *sessp, MetaDataImpl *implPtr, + OCIParam* parm) ; + MetaData(const Connection *sessp, MetaDataImpl *implPtr, + OCIParam *parm, ub1 parmTyp) ; + ub1 getParamType(OCIParam* prm) const ; + const AttrId* getAttrIdArrayAddr(ub1 prmTyp) const; + const ociAttrType* getAttrTypeArrayAddr(ub1 prmTyp) const; + AttrCount getAttrCount(ub1 prmTyp) const; + Type getType(ociAttrType typ) const; + bool isListTypeAttribute(AttrId attrid,ub1 ptyp) const; + boolean isInvalidAttrId(AttrId attrid,sb4* pos, + boolean* isTypeSpecificAttrPtr) const; + ociAttrType getValidAttrType(sb4 index, boolean isTypeSpecificAttr) + const; + + int getListType (const OCIParam *plist) const; + unsigned int getLowerBound(int ltype) const; + unsigned int getUpperBound(unsigned int ltype, + unsigned int paramnum) const; + friend class ConnectionImpl; + friend class ResultSetImpl; + +}; + +//return codes for user callbacks +enum +{ + OCCI_SUCCESS = OCI_SUCCESS, + FO_RETRY = OCI_FO_RETRY +}; + + +class Connection +{ + public : + + // specifies the type of proxy to be created, + // used for future enhancements + enum ProxyType + {PROXY_DEFAULT + }; + + enum FailOverType + { + FO_NONE = OCI_FO_NONE, + FO_SESSION = OCI_FO_SESSION, + FO_SELECT = OCI_FO_SELECT + }; + + enum FailOverEventType + { + FO_BEGIN = OCI_FO_BEGIN, + FO_END = OCI_FO_END, + FO_ABORT = OCI_FO_ABORT, + FO_REAUTH = OCI_FO_REAUTH, + FO_ERROR = OCI_FO_ERROR + }; + + enum Purity + { + DEFAULT = OCI_ATTR_PURITY_DEFAULT, + NEW = OCI_ATTR_PURITY_NEW, + SELF = OCI_ATTR_PURITY_SELF + }; + + virtual ~Connection() { } + virtual Statement* createStatement( + const OCCI_STD_NAMESPACE::string &sql = "") + =0; + virtual void terminateStatement(Statement *statement) =0; + virtual void commit() =0; + virtual void rollback() =0; + virtual MetaData getMetaData(const OCCI_STD_NAMESPACE::string &object, + MetaData::ParamType prmtyp + = MetaData::PTYPE_UNK) const + =0; + virtual MetaData getMetaData(const RefAny &ref) const + =0; + virtual OCCI_STD_NAMESPACE::string getClientCharSet() const + =0; + virtual OCCI_STD_NAMESPACE::string getClientNCHARCharSet() const + =0; + virtual void changePassword(const OCCI_STD_NAMESPACE::string &user, + const OCCI_STD_NAMESPACE::string &oldPassword, + const OCCI_STD_NAMESPACE::string &newPassword) + =0; + virtual void flushCache() =0; + + virtual OCIServer* getOCIServer() const =0; + virtual OCISvcCtx* getOCIServiceContext() const =0; + virtual OCISession* getOCISession() const =0; + + //new interfaces + + virtual Statement* createStatement(const UString &sql) = 0; + virtual MetaData getMetaData(const UString &object, + MetaData::ParamType prmtyp + = MetaData::PTYPE_UNK) const + =0; + virtual UString getClientCharSetUString() const + =0; + virtual UString getClientNCHARCharSetUString() const + =0; + virtual void changePassword(const UString &user, + const UString &oldPassword, + const UString &newPassword) + =0; + virtual OCCI_STD_NAMESPACE::string getTag() const =0; + virtual void setStmtCacheSize(unsigned int cacheSize) = 0; + virtual unsigned int getStmtCacheSize() const =0; + virtual Statement* createStatement(const OCCI_STD_NAMESPACE::string &sql, + const OCCI_STD_NAMESPACE::string &tag) = 0; + virtual void terminateStatement(Statement* stmt, + const OCCI_STD_NAMESPACE::string &tag) = 0; + virtual bool isCached(const OCCI_STD_NAMESPACE::string &sql, + const OCCI_STD_NAMESPACE::string &tag = "") = 0; + virtual void registerSubscriptions( + const OCCI_STD_NAMESPACE::vector& sub) =0; + virtual void unregisterSubscription(const aq::Subscription& sub) =0; + virtual void postToSubscriptions( + const OCCI_STD_NAMESPACE::vector& sub) =0; + virtual Statement* createStatement(const UString &sql, + const UString &tag) = 0; + virtual void terminateStatement(Statement* stmt, + const UString &tag) = 0; + virtual bool isCached(const UString &sql, + const UString &tag) = 0; + virtual void setTAFNotify( + int (*notifyFn)(Environment *env, Connection *conn, void *ctx, + FailOverType foType, FailOverEventType foEvent), + void *ctx) = 0; + virtual OCCI_STD_NAMESPACE::string getServerVersion() const =0; + virtual UString getServerVersionUString() const =0; + virtual void cancel() =0; +}; + +class StatelessConnectionPool +{ + public : + + enum PoolType + { + HETEROGENEOUS = OCI_DEFAULT, + HOMOGENEOUS = OCI_SPC_HOMOGENEOUS, + NO_RLB = OCI_SPC_NO_RLB, + USES_EXT_AUTH = 16 + }; + + enum BusyOption + { + WAIT = OCI_SPOOL_ATTRVAL_WAIT, + NOWAIT = OCI_SPOOL_ATTRVAL_NOWAIT, + FORCEGET = OCI_SPOOL_ATTRVAL_FORCEGET + }; + + enum DestroyMode + { + DEFAULT = OCI_DEFAULT, + SPD_FORCE = OCI_SPD_FORCE + }; + + virtual ~StatelessConnectionPool() {} + virtual unsigned int getBusyConnections() const =0; + virtual unsigned int getOpenConnections() const =0; + virtual unsigned int getMinConnections() const =0; + virtual unsigned int getMaxConnections() const =0; + virtual unsigned int getIncrConnections() const =0; + virtual OCCI_STD_NAMESPACE::string getPoolName() const =0; + virtual unsigned int getTimeOut() const =0; + virtual void setBusyOption(BusyOption busyOption) =0; + virtual BusyOption getBusyOption() const =0; + virtual void setTimeOut(unsigned int connTimeOut =0) =0; + virtual void setPoolSize(unsigned int maxConn =1, + unsigned int minConn =0, unsigned int incrConn =1) =0; + virtual Connection* getConnection( + const OCCI_STD_NAMESPACE::string &tag ="") =0; + virtual Connection* getConnection( + const OCCI_STD_NAMESPACE::string &userName, + const OCCI_STD_NAMESPACE::string &password, + const OCCI_STD_NAMESPACE::string &tag = "") =0; + virtual Connection* getAnyTaggedConnection( + const OCCI_STD_NAMESPACE::string &tag = "") =0; + virtual Connection* getAnyTaggedConnection( + const OCCI_STD_NAMESPACE::string &userName, + const OCCI_STD_NAMESPACE::string &Password, + const OCCI_STD_NAMESPACE::string &tag = "") =0; + virtual Connection* getProxyConnection( + const OCCI_STD_NAMESPACE::string &name, + OCCI_STD_NAMESPACE::string roles[], unsigned int numRoles, + const OCCI_STD_NAMESPACE::string &tag = "", + Connection::ProxyType proxyType = Connection::PROXY_DEFAULT) =0; + virtual Connection* getProxyConnection( + const OCCI_STD_NAMESPACE::string &name, + const OCCI_STD_NAMESPACE::string &tag = "" , + Connection::ProxyType proxyType = Connection::PROXY_DEFAULT) =0; + virtual Connection* getAnyTaggedProxyConnection( + const OCCI_STD_NAMESPACE::string &name, + OCCI_STD_NAMESPACE::string roles[], unsigned int numRoles, + const OCCI_STD_NAMESPACE::string &tag = "", + Connection::ProxyType proxyType = Connection::PROXY_DEFAULT) =0; + virtual Connection* getAnyTaggedProxyConnection( + const OCCI_STD_NAMESPACE::string &name, + const OCCI_STD_NAMESPACE::string &tag="", + Connection::ProxyType proxyType = Connection::PROXY_DEFAULT ) =0; + virtual void releaseConnection (Connection *connection, + const OCCI_STD_NAMESPACE::string &tag = "") =0; + virtual void terminateConnection (Connection *connection) =0; + virtual void setStmtCacheSize(unsigned int cacheSize) =0; + virtual unsigned int getStmtCacheSize() const =0; + + virtual Connection* getConnection(const UString &tag)=0; + virtual Connection* getConnection(const UString &userName, + const UString &password, + const UString &tag)=0; + virtual Connection* getAnyTaggedConnection(const UString &tag)=0; + virtual Connection* getAnyTaggedConnection( const UString &userName, + const UString &Password, const UString &tag)=0 ; + virtual Connection* getProxyConnection(const UString &name, + OCCI_STD_NAMESPACE::string roles[], unsigned int numRoles, + const UString &tag, + Connection::ProxyType proxyType = Connection::PROXY_DEFAULT)=0; + virtual Connection* getProxyConnection(const UString &name, + const UString &tag, Connection::ProxyType + proxyType = Connection::PROXY_DEFAULT)=0; + virtual Connection* getAnyTaggedProxyConnection(const UString &name, + OCCI_STD_NAMESPACE::string roles[], unsigned int numRoles, + const UString &tag, + Connection::ProxyType proxyType = Connection::PROXY_DEFAULT)=0; + virtual Connection* getAnyTaggedProxyConnection(const UString &name, + const UString &tag, + Connection::ProxyType proxyType = Connection::PROXY_DEFAULT )=0; + virtual void releaseConnection(Connection *connection, + const UString &tag)=0; + + + virtual Connection* getConnection( + const OCCI_STD_NAMESPACE::string &connectionClass, + const Connection::Purity purity, + const OCCI_STD_NAMESPACE::string &tag = "") =0; + + virtual Connection* getConnection( + const OCCI_STD_NAMESPACE::string &userName, + const OCCI_STD_NAMESPACE::string &password, + const OCCI_STD_NAMESPACE::string &connectionClass, + const Connection::Purity purity, + const OCCI_STD_NAMESPACE::string &tag = "") =0; + + virtual Connection* getAnyTaggedConnection( + const OCCI_STD_NAMESPACE::string &connectionClass, + const Connection::Purity purity, + const OCCI_STD_NAMESPACE::string &tag = "") =0; + + virtual Connection* getAnyTaggedConnection( + const OCCI_STD_NAMESPACE::string &userName, + const OCCI_STD_NAMESPACE::string &Password, + const OCCI_STD_NAMESPACE::string &connectionClass, + const Connection::Purity purity, + const OCCI_STD_NAMESPACE::string &tag = "")= 0; + + virtual Connection* getProxyConnection( + const OCCI_STD_NAMESPACE::string &name, + OCCI_STD_NAMESPACE::string roles[], unsigned int numRoles, + const OCCI_STD_NAMESPACE::string &connectionClass, + const Connection::Purity purity, + const OCCI_STD_NAMESPACE::string &tag = "", + Connection::ProxyType proxyType = Connection::PROXY_DEFAULT) = 0; + + virtual Connection* getProxyConnection( + const OCCI_STD_NAMESPACE::string &name, + const OCCI_STD_NAMESPACE::string &connectionClass, + const Connection::Purity purity, + const OCCI_STD_NAMESPACE::string &tag = "", + Connection::ProxyType proxyType = Connection::PROXY_DEFAULT) = 0; + + virtual Connection* getAnyTaggedProxyConnection( + const OCCI_STD_NAMESPACE::string &name, + OCCI_STD_NAMESPACE::string roles[], unsigned int numRoles, + const OCCI_STD_NAMESPACE::string &connectionClass, + const Connection::Purity purity, + const OCCI_STD_NAMESPACE::string &tag = "", + Connection::ProxyType proxyType = Connection::PROXY_DEFAULT) = 0; + + + virtual Connection* getAnyTaggedProxyConnection( + const OCCI_STD_NAMESPACE::string &name, + const OCCI_STD_NAMESPACE::string &connectionClass, + const Connection::Purity purity, + const OCCI_STD_NAMESPACE::string &tag = "", + Connection::ProxyType proxyType = Connection::PROXY_DEFAULT) = 0; + + + virtual Connection* getConnection( + const UString &connectionClass, + const Connection::Purity purity, + const UString &tag) = 0; + + + + virtual Connection* getConnection(const UString &userName, + const UString &password, + const UString &connectionClass, + const Connection::Purity purity, + const UString &tag) = 0; + + virtual Connection* getAnyTaggedConnection( + const UString &connectionClass, + const Connection::Purity purity, + const UString &tag) =0; + + + + virtual Connection* getAnyTaggedConnection( const UString &userName, + const UString &Password, + const UString &connectionClass, + const Connection::Purity purity, + const UString &tag) =0; + + virtual Connection* getProxyConnection(const UString &name, + OCCI_STD_NAMESPACE::string roles[], unsigned int numRoles, + const UString &connectionClass, + const Connection::Purity purity, + const UString &tag, Connection::ProxyType proxyType) =0; + + virtual Connection* getProxyConnection(const UString &name, + const UString &connectionClass, + const Connection::Purity purity, + const UString &tag, Connection::ProxyType proxyType) = 0; + + + virtual Connection* getAnyTaggedProxyConnection(const UString &name, + OCCI_STD_NAMESPACE::string roles[], unsigned int numRoles, + const UString &connectionClass, + const Connection::Purity purity, + const UString &tag, + Connection::ProxyType proxyType) = 0; + + virtual Connection* getAnyTaggedProxyConnection(const UString &name, + const UString &connectionClass, + const Connection::Purity purity, + const UString &tag, + Connection::ProxyType proxyType ) =0; + +}; + + +class ConnectionPool +{ + public : + + virtual ~ConnectionPool() {} + virtual unsigned int getBusyConnections() const + =0; + virtual unsigned int getOpenConnections() const + =0; + virtual unsigned int getMinConnections() const + =0; + virtual unsigned int getMaxConnections() const + =0; + virtual unsigned int getIncrConnections() const + =0; + virtual OCCI_STD_NAMESPACE::string getPoolName() const + =0; + virtual unsigned int getTimeOut() const + =0; + virtual void setErrorOnBusy() + =0; + virtual void setTimeOut(unsigned int connTimeOut =0) + =0; + virtual void setPoolSize(unsigned int minConn =0, + unsigned int maxConn =1, unsigned int incrConn =1) + =0; + virtual Connection* createConnection( + const OCCI_STD_NAMESPACE::string &userName, + const OCCI_STD_NAMESPACE::string &password) =0; + + virtual Connection* createProxyConnection( + const OCCI_STD_NAMESPACE::string &name, + OCCI_STD_NAMESPACE::string roles[], unsigned int numRoles, + Connection::ProxyType proxyType = + Connection::PROXY_DEFAULT) =0; + + virtual Connection* createProxyConnection( + const OCCI_STD_NAMESPACE::string &name, + Connection::ProxyType proxyType = + Connection::PROXY_DEFAULT) =0; + + virtual void terminateConnection + (Connection *connection) =0; + + //new interfaces + + virtual Connection* createConnection( + const UString &userName, + const UString &password) =0; + + virtual Connection* createProxyConnection(const UString &name, + OCCI_STD_NAMESPACE::string roles[], unsigned int numRoles, + Connection::ProxyType proxyType = + Connection::PROXY_DEFAULT) =0; + + virtual Connection* createProxyConnection(const UString &name, + Connection::ProxyType proxyType = + Connection::PROXY_DEFAULT) =0; + + virtual void setStmtCacheSize(unsigned int cacheSize) =0; + virtual unsigned int getStmtCacheSize() const =0; + + virtual UString getPoolNameUString() const + =0; +}; + +class Environment +{ + public: + // class constants + + enum Mode + { + DEFAULT = OCI_DEFAULT, + OBJECT = OCI_OBJECT, + SHARED = OCI_SHARED, + NO_USERCALLBACKS = OCI_NO_UCB, + THREADED_MUTEXED = OCI_THREADED, + THREADED_UNMUTEXED = OCI_THREADED | OCI_NO_MUTEX, + EVENTS = OCI_EVENTS, + USE_LDAP = OCI_USE_LDAP + }; + + virtual ~Environment(){} + + // public methods + + static Environment * createEnvironment( + Mode mode = DEFAULT, + void *ctxp = 0, + void *(*malocfp)(void *ctxp, size_t size) = 0, + void *(*ralocfp)(void *ctxp, void *memptr, + size_t newsize) = 0, + void (*mfreefp)(void *ctxp, void *memptr) = 0); + + static Environment * createEnvironment( + const OCCI_STD_NAMESPACE::string &charset, + const OCCI_STD_NAMESPACE::string &ncharset, + Mode mode = DEFAULT, + void *ctxp = 0, + void *(*malocfp)(void *ctxp, size_t size) = 0, + void *(*ralocfp)(void *ctxp, void *memptr, + size_t newsize) = 0, + void (*mfreefp)(void *ctxp, void *memptr) = 0); + + static void terminateEnvironment(Environment *env); + + static Environment* getXAEnvironment(const + OCCI_STD_NAMESPACE::string& dbname); + + static void releaseXAEnvironment(Environment *env); + + static void getClientVersion( int &majorVersion, int &minorVersion, + int &updateNum, int &patchNum, + int &portUpdateNum ); + + + virtual Connection * createConnection( + const OCCI_STD_NAMESPACE::string &userName, + const OCCI_STD_NAMESPACE::string &password, + const OCCI_STD_NAMESPACE::string &connectString = "") = 0; + + virtual void terminateConnection(Connection *connection) = 0; + + virtual ConnectionPool* createConnectionPool( + const OCCI_STD_NAMESPACE::string &poolUserName, + const OCCI_STD_NAMESPACE::string &poolPassword, + const OCCI_STD_NAMESPACE::string &connectString ="", + unsigned int minConn =0, + unsigned int maxConn =1, unsigned int incrConn =1) = 0; + + virtual void terminateConnectionPool(ConnectionPool *poolp) = 0; + + virtual unsigned int getCurrentHeapSize() const = 0; + + virtual OCIEnv * getOCIEnvironment() const = 0; + + virtual Map *getMap() const = 0; + + virtual void setCacheMaxSize(unsigned int maxSize) = 0; + + virtual unsigned int getCacheMaxSize() const = 0; + + virtual void setCacheOptSize(unsigned int OptSize) = 0; + + virtual unsigned int getCacheOptSize() const = 0; + + + //new interfaces + + virtual Connection * createConnection(const UString &userName, + const UString &password, const UString &connectString) = 0; + + virtual ConnectionPool* createConnectionPool( + const UString &poolUserName, + const UString &poolPassword, const UString &connectString, + unsigned int minConn =0, + unsigned int maxConn =1, unsigned int incrConn =1) = 0; + + virtual Connection* getXAConnection(const + OCCI_STD_NAMESPACE::string& dbname) = 0; + + virtual void releaseXAConnection(Connection* conn) =0; + + virtual StatelessConnectionPool* createStatelessConnectionPool( + const OCCI_STD_NAMESPACE::string &poolUserName, + const OCCI_STD_NAMESPACE::string &poolPassword, + const OCCI_STD_NAMESPACE::string &connectString = "", + unsigned int maxConn = 1, unsigned int minConn = 0, + unsigned int incrConn = 1, + StatelessConnectionPool::PoolType pType + = StatelessConnectionPool::HETEROGENEOUS) = 0; + + virtual StatelessConnectionPool* createStatelessConnectionPool( + const UString &poolUserName, + const UString &poolPassword, + const UString &connectString, + unsigned int maxConn = 1, unsigned int minConn = 0, + unsigned int incrConn = 1, + StatelessConnectionPool::PoolType pType + = StatelessConnectionPool::HETEROGENEOUS) = 0; + + virtual void terminateStatelessConnectionPool(StatelessConnectionPool *poolp, + StatelessConnectionPool::DestroyMode mode = StatelessConnectionPool::DEFAULT) + = 0; + virtual void setLDAPAuthentication(unsigned int mode) =0; + + virtual unsigned int getLDAPAuthentication() const =0; + + virtual void setLDAPLoginNameAndPassword( + const OCCI_STD_NAMESPACE::string &login, + const OCCI_STD_NAMESPACE::string &passwd) =0; + + virtual void setLDAPAdminContext(const OCCI_STD_NAMESPACE::string &ctx)=0; + + virtual OCCI_STD_NAMESPACE::string getLDAPAdminContext() const =0; + + virtual void setLDAPHostAndPort(const OCCI_STD_NAMESPACE::string &host, + unsigned int port) =0; + + virtual OCCI_STD_NAMESPACE::string getLDAPHost() const =0; + + virtual unsigned int getLDAPPort() const =0; + + virtual void registerSubscriptions( + const OCCI_STD_NAMESPACE::vector& sub) =0; + + virtual void unregisterSubscription(const aq::Subscription& sub) =0; + + virtual void enableSubscription(const aq::Subscription& sub) =0; + + virtual void disableSubscription(const aq::Subscription& sub) =0; + + virtual bool getCacheSortedFlush() const = 0; + + virtual void setCacheSortedFlush(bool flag) = 0; + + virtual Connection * createConnection( + const OCCI_STD_NAMESPACE::string &userName, + const OCCI_STD_NAMESPACE::string &password, + const OCCI_STD_NAMESPACE::string &connectString, + const OCCI_STD_NAMESPACE::string &connectionClass, + const Connection::Purity purity) = 0; + + virtual Connection * createConnection(const UString &userName, + const UString &password, const UString &connectString, + const UString &connectionclass, + const Connection::Purity purity) =0; + + private: + +}; + + + +class Map +{ + public: + + virtual ~Map(){} + virtual void put(const OCCI_STD_NAMESPACE::string&, void *(*)(void *), + void (*)(void *, void *)) = 0; + virtual void getReadSQL( + void *, unsigned int, void *, unsigned int, void **) const = 0; + virtual void getWriteSQL( + void *, unsigned int, void *, unsigned int, void **) const = 0; + virtual void put(const OCCI_STD_NAMESPACE::string&, + const OCCI_STD_NAMESPACE::string&, void *(*)(void *), + void (*)(void *, void *)) = 0; + virtual void putUTF16(const OCCI_STD_NAMESPACE::string&, + const OCCI_STD_NAMESPACE::string&, void *(*)(void *), + void (*)(void *, void *)) = 0; + + private: +}; + + + +class SQLException : public OCCI_STD_NAMESPACE::exception +{ + public: + + virtual int getErrorCode() const; + + virtual OCCI_STD_NAMESPACE::string getMessage() const; + + const char *what() const throw(); + + virtual void setErrorCtx(void *ctx); + + SQLException(); + + SQLException(const SQLException &e); + + void operator=(const SQLException &other); + + virtual ~SQLException() throw(); + + virtual int getXAErrorCode(const OCCI_STD_NAMESPACE::string& dbname) const; + + virtual UString getUStringMessage() const; + + virtual OCCI_STD_NAMESPACE::string getNLSMessage(Environment *env) const; + + virtual UString getNLSUStringMessage(Environment *env) const; + + protected: + + Ptr ptr_; + SQLException(SQLExceptionImpl *ptr); + + friend SQLException SQLExceptionCreate(int errorCode); + friend SQLException SQLExceptionCreate(void *handle, + int handleType); + friend class BatchSQLException; +}; + +class BatchSQLException : public SQLException +{ + public: + virtual ~BatchSQLException() throw(); + + unsigned int getFailedRowCount() const; + unsigned int getRowNum( unsigned int index ) const; + SQLException getException ( unsigned int index ) const; + + private: + BatchSQLException(); + + BatchSQLException(SQLExceptionImpl *ptr); + friend BatchSQLException BatchSQLExceptionCreate(void *handle); +}; + +class Statement +{ + public: + // class constants + + virtual ~Statement() {} + + enum Status + { + UNPREPARED, + PREPARED, + RESULT_SET_AVAILABLE, + UPDATE_COUNT_AVAILABLE, + NEEDS_STREAM_DATA, + STREAM_DATA_AVAILABLE + }; + + // common methods + + virtual void setSQL(const OCCI_STD_NAMESPACE::string &sql) = 0; + + virtual OCCI_STD_NAMESPACE::string getSQL() const = 0; + + virtual Status execute(const OCCI_STD_NAMESPACE::string &sql = "") = 0; + + virtual ResultSet * getResultSet() = 0; + + virtual unsigned int getUpdateCount() const = 0; + + virtual ResultSet * executeQuery( + const OCCI_STD_NAMESPACE::string &sql = "") = 0; + + virtual unsigned int executeUpdate( + const OCCI_STD_NAMESPACE::string &sql = "") = 0; + + virtual Status status() const = 0; + + virtual void closeResultSet(ResultSet *resultSet) = 0; + + virtual void setPrefetchRowCount(unsigned int rowCount) = 0; + + virtual void setPrefetchMemorySize(unsigned int bytes) = 0; + + virtual void setAutoCommit(bool autoCommit) = 0; + + virtual bool getAutoCommit() const = 0; + + virtual OCIStmt * getOCIStatement() const = 0; + + + // methods for prepared statements with IN + // parameters + + virtual void setMaxParamSize(unsigned int paramIndex,unsigned int maxSize)=0; + + virtual unsigned int getMaxParamSize(unsigned int paramIndex) const = 0; + + virtual void setNull(unsigned int paramIndex, Type type) = 0; + + virtual void setInt(unsigned int paramIndex, int x) = 0; + + virtual void setUInt(unsigned int paramIndex, unsigned int x) = 0; + + virtual void setFloat(unsigned int paramIndex, float x) = 0; + + virtual void setDouble(unsigned int paramIndex, double x) = 0; + + virtual void setNumber(unsigned int paramIndex, const Number &x) = 0; + + virtual void setString(unsigned int paramIndex, + const OCCI_STD_NAMESPACE::string &x) = 0; + + virtual void setBytes(unsigned int paramIndex, const Bytes &x) = 0; + + virtual void setDate(unsigned int paramIndex, const Date &x) = 0; + + virtual void setTimestamp(unsigned int paramIndex, const Timestamp &x) = 0; + + virtual void setBlob(unsigned int paramIndex, const Blob &x) = 0; + + virtual void setClob(unsigned int paramIndex, const Clob &x) = 0; + + virtual void setBfile(unsigned int paramIndex, const Bfile &x) = 0; + + virtual void setIntervalYM(unsigned int paramIndex, const IntervalYM &x) = 0; + + virtual void setIntervalDS(unsigned int paramIndex, const IntervalDS &x) = 0; + + virtual void setRowid(unsigned int paramIndex, const Bytes &x) = 0; + + virtual void setRef(unsigned int paramIndex, const RefAny &x) = 0; + + virtual void setObject(unsigned int paramIndex, PObject * x) = 0; + + virtual void setDataBuffer(unsigned int paramIndex, void *buffer, + Type type, + sb4 size, ub2 *length, sb2 *ind = NULL, + ub2 *rc = NULL) = 0; + + virtual void setDataBufferArray(unsigned int paramIndex, void *buffer, + Type type, + ub4 arraySize, ub4 *arrayLength, + sb4 elementSize, + ub2 *elementLength, sb2 *ind = NULL, + ub2 *rc = NULL) = 0; + + virtual void setCharSet(unsigned int paramIndex, + const OCCI_STD_NAMESPACE::string & charSet) = 0; + + virtual OCCI_STD_NAMESPACE::string getCharSet(unsigned int paramIndex) + const = 0; + + virtual void setDatabaseNCHARParam( + unsigned int paramIndex, bool isNCHAR) = 0; + + virtual bool getDatabaseNCHARParam(unsigned int paramIndex) const = 0; + + virtual void closeStream(Stream *stream) =0; + + virtual Stream * getStream(unsigned int paramIndex) = 0; + + virtual unsigned int getCurrentStreamParam() const = 0; + + virtual unsigned int getCurrentStreamIteration() const = 0; + + virtual void setBinaryStreamMode(unsigned int colIndex, + unsigned int size) =0; + + virtual void setCharacterStreamMode(unsigned int colIndex, + unsigned int size) =0; + + virtual void setMaxIterations(unsigned int maxIterations) = 0; + + virtual unsigned int getMaxIterations() const = 0; + + virtual void addIteration() = 0; + + virtual unsigned int getCurrentIteration() const = 0; + + virtual Status executeArrayUpdate(unsigned int arrayLength) = 0; + + + // methods for Callable Statements + + virtual void registerOutParam(unsigned int paramIndex, Type type, + unsigned int maxSize=0, const OCCI_STD_NAMESPACE::string &sqltype="") = 0; + + virtual bool isNull(unsigned int paramIndex) const = 0; + + virtual bool isTruncated(unsigned int paramIndex) const + =0; + + + virtual void setErrorOnNull(unsigned int paramIndex, + bool causeException) = 0; + + virtual void setErrorOnTruncate(unsigned int paramIndex, + bool causeException) = 0; + + virtual int preTruncationLength(unsigned int paramIndex) const + =0; + + + virtual int getInt(unsigned int paramIndex) = 0; + + virtual unsigned int getUInt(unsigned int paramIndex) = 0; + + virtual float getFloat(unsigned int paramIndex) = 0; + + virtual double getDouble(unsigned int paramIndex) = 0; + + virtual Number getNumber(unsigned int paramIndex) = 0; + + virtual OCCI_STD_NAMESPACE::string getString(unsigned int paramIndex) = 0; + + virtual Bytes getBytes(unsigned int paramIndex) = 0; + + virtual Date getDate(unsigned int paramIndex) = 0; + + virtual Timestamp getTimestamp(unsigned int paramIndex) = 0; + + virtual Bytes getRowid(unsigned int paramIndex) = 0; + + virtual PObject * getObject(unsigned int paramIndex) = 0; + + virtual Blob getBlob(unsigned int paramIndex) = 0; + + virtual Clob getClob(unsigned int paramIndex) = 0; + + virtual Bfile getBfile(unsigned int paramIndex) = 0; + + virtual IntervalYM getIntervalYM(unsigned int paramIndex) = 0; + + virtual IntervalDS getIntervalDS(unsigned int paramIndex) = 0; + + virtual RefAny getRef(unsigned int paramIndex) = 0; + + virtual ResultSet * getCursor(unsigned int paramIndex) = 0; + + virtual Connection* getConnection() const =0; + + //new interfaces + + virtual void setRef(unsigned int paramIndex, const RefAny &x, + const OCCI_STD_NAMESPACE::string &typName, + const OCCI_STD_NAMESPACE::string &schName = "") = 0; + + virtual void setSQLUString(const UString &sql) = 0; + + virtual UString getSQLUString() const = 0; + + virtual Status execute(const UString &sql) = 0; + + virtual ResultSet * executeQuery( + const UString &sql) = 0; + + virtual unsigned int executeUpdate( + const UString &sql) = 0; + + virtual void setBFloat(unsigned int paramIndex, const BFloat &fval) = 0; + + virtual void setBDouble(unsigned int paramIndex, const BDouble &dval) = 0; + + virtual void setUString(unsigned int paramIndex, + const UString &x) = 0; + + virtual void setCharSetUString(unsigned int paramIndex, + const UString & charSet) = 0; + + virtual UString getCharSetUString(unsigned int paramIndex) + const = 0; + + virtual void registerOutParam(unsigned int paramIndex, Type type, + unsigned int maxSize, const OCCI_STD_NAMESPACE::string &typName, + const OCCI_STD_NAMESPACE::string &schName) = 0; + + virtual void registerOutParam(unsigned int paramIndex, Type type, + unsigned int maxSize, const UString &typName, + const UString &schName) = 0; + + virtual BFloat getBFloat(unsigned int paramIndex) = 0; + + virtual BDouble getBDouble(unsigned int paramIndex) = 0; + + virtual UString getUString(unsigned int paramIndex) = 0; + + virtual void disableCaching() =0; + + virtual void setRef(unsigned int paramIndex, const RefAny &x, + const UString &typName, + const UString &schName) = 0; + + virtual void setBinaryStreamMode(unsigned int colIndex, + unsigned int size, bool INArg) =0; + + virtual void setCharacterStreamMode(unsigned int colIndex, + unsigned int size, bool INArg) =0; + + virtual void setNull(unsigned int paramIndex, Type type, + const OCCI_STD_NAMESPACE::string &typeName, + const OCCI_STD_NAMESPACE::string &schemaName = "") = 0; + + virtual void setNull(unsigned int paramIndex, Type type, + UString &typeName, UString &schemaName) = 0; + + virtual void setBatchErrorMode( bool batchErrorMode ) =0; + + virtual bool getBatchErrorMode( ) const =0; + +}; + + + +class ResultSet +{ + public: + // class constants + + enum Status + { + END_OF_FETCH = 0, + DATA_AVAILABLE, + STREAM_DATA_AVAILABLE + }; + virtual ~ResultSet(){} + + // public methods + + virtual Status next(unsigned int numRows = 1) = 0; + + virtual Status status() const = 0; + + virtual unsigned int getNumArrayRows() const = 0; + + virtual void cancel() = 0; + + virtual void setMaxColumnSize(unsigned int colIndex, unsigned int max) = 0; + + virtual unsigned int getMaxColumnSize(unsigned int colIndex) const = 0; + + virtual bool isNull(unsigned int colIndex) const = 0; + + virtual bool isTruncated(unsigned int paramIndex) const + =0; + + virtual void setErrorOnNull(unsigned int colIndex, bool causeException) = 0; + virtual void setErrorOnTruncate(unsigned int paramIndex, + bool causeException) =0; + + virtual int preTruncationLength(unsigned int paramIndex) const + =0; + + virtual int getInt(unsigned int colIndex) = 0; + + virtual unsigned int getUInt(unsigned int colIndex) = 0; + + virtual float getFloat(unsigned int colIndex) = 0; + + virtual double getDouble(unsigned int colIndex) = 0; + + virtual Number getNumber(unsigned int colIndex) = 0; + + virtual OCCI_STD_NAMESPACE::string getString(unsigned int colIndex) = 0; + + virtual Bytes getBytes(unsigned int colIndex) = 0; + + virtual Date getDate(unsigned int colIndex) = 0; + + virtual Timestamp getTimestamp(unsigned int colIndex) = 0; + + virtual Bytes getRowid(unsigned int colIndex) = 0; + + virtual PObject * getObject(unsigned int colIndex) = 0; + + virtual Blob getBlob(unsigned int colIndex) = 0; + + virtual Clob getClob(unsigned int colIndex) =0; + + virtual Bfile getBfile(unsigned int colIndex) = 0; + + virtual IntervalYM getIntervalYM(unsigned int colIndex) =0; + + virtual IntervalDS getIntervalDS(unsigned int colIndex) =0; + + virtual RefAny getRef(unsigned int colIndex) = 0; + + virtual Bytes getRowPosition() const = 0; + + virtual ResultSet * getCursor(unsigned int colIndex) = 0; + + virtual void setDataBuffer(unsigned int colIndex, void *buffer, Type type, + sb4 size = 0, ub2 *length = NULL, + sb2 *ind = NULL, ub2 *rc = NULL) = 0; + + virtual void setCharSet(unsigned int colIndex, + const OCCI_STD_NAMESPACE::string & charSet) = 0; + + virtual OCCI_STD_NAMESPACE::string getCharSet(unsigned int colIndex) + const = 0; + + virtual void setBinaryStreamMode(unsigned int colIndex, unsigned int size) + = 0; + + virtual void setCharacterStreamMode(unsigned int colIndex, unsigned int size) + = 0; + + virtual void setDatabaseNCHARParam(unsigned int paramIndex, + bool isNCHAR) = 0; + + virtual bool getDatabaseNCHARParam(unsigned int paramIndex) const = 0; + + virtual Stream * getStream(unsigned int colIndex) = 0; + + virtual void closeStream(Stream *stream) =0; + + virtual unsigned int getCurrentStreamColumn() const= 0; + + virtual unsigned int getCurrentStreamRow() const= 0; + + virtual OCCI_STD_NAMESPACE::vector getColumnListMetaData() const + = 0; + + virtual Statement* getStatement() const=0; + + //new interfaces + + virtual BFloat getBFloat(unsigned int colIndex) = 0; + + virtual BDouble getBDouble(unsigned int colIndex) = 0; + + virtual UString getUString(unsigned int colIndex) = 0; + + virtual void setCharSetUString(unsigned int colIndex, + const UString & charSet) = 0; + + virtual UString getCharSetUString(unsigned int colIndex) + const = 0; + + virtual void setPrefetchRowCount(unsigned int rowCount) = 0; + + virtual void setPrefetchMemorySize(unsigned int bytes) = 0; +}; + + +class Stream +{ + public : + + enum Status {READY_FOR_READ, READY_FOR_WRITE, INACTIVE}; + + virtual ~Stream(){} + virtual int readBuffer(char *buffer, unsigned int size) + =0; + virtual int readLastBuffer(char *buffer, unsigned int size) + =0; + virtual void writeBuffer(char *buffer, unsigned int size) + =0; + virtual void writeLastBuffer(char *buffer, unsigned int size) + =0; + virtual Status status() const =0; + +}; + +/*--------------------------------------------------------------------------- + PROTOTYPES USED BY FUNCTION TEMPLATES + -------------------------------------------------------------------------*/ + void getVectorOfPObjects( ResultSet *rs, unsigned int index, + OCCI_STD_NAMESPACE::vector &vect) ; + void getVectorOfOCIRefs(ResultSet *rs, unsigned int index, + OCCI_STD_NAMESPACE::vector &vect) ; + void getVectorOfPObjects( Statement *rs, unsigned int index, + OCCI_STD_NAMESPACE::vector &vect) ; + void getVectorOfOCIRefs(Statement *rs, unsigned int index, + OCCI_STD_NAMESPACE::vector &vect) ; + void setVectorOfPObjects( Statement *stmt, unsigned int paramIndex, + const OCCI_STD_NAMESPACE::vector &vect, + const OCCI_STD_NAMESPACE::string &sqltype) ; + void setVectorOfPObjects( Statement *stmt, unsigned int paramIndex, + const OCCI_STD_NAMESPACE::vector &vect, + const OCCI_STD_NAMESPACE::string &schemaName, + const OCCI_STD_NAMESPACE::string &typeName) ; + void setVectorOfPObjects( Statement *stmt, unsigned int paramIndex, + const OCCI_STD_NAMESPACE::vector &vect, + const UString &schemaName, + const UString &typeName) ; + void setVectorOfOCIRefs(Statement *stmt, unsigned int paramIndex, + const OCCI_STD_NAMESPACE::vector &vect, + const OCCI_STD_NAMESPACE::vector &vecind, + const OCCI_STD_NAMESPACE::string &sqltype) ; + void setVectorOfOCIRefs(Statement *stmt, unsigned int paramIndex, + const OCCI_STD_NAMESPACE::vector &vect, + const OCCI_STD_NAMESPACE::vector &vecind, + const OCCI_STD_NAMESPACE::string &schemaName, + const OCCI_STD_NAMESPACE::string &typeName) ; + void setVectorOfOCIRefs(Statement *stmt, unsigned int paramIndex, + const OCCI_STD_NAMESPACE::vector &vect, + const OCCI_STD_NAMESPACE::vector &vecind, + const UString &schemaName, + const UString &typeName) ; + void pinVectorOfOCIRefs(const Connection *conn, + OCCI_STD_NAMESPACE::vector & vecRef, + OCCI_STD_NAMESPACE::vector & vecCor, + OCCI_STD_NAMESPACE::vector &vecPObj,LockOptions &lockOpt ); + + +/*--------------------------------------------------------------------------- + EXPORT FUNCTIONS + ---------------------------------------------------------------------------*/ + +/*------------------------ getVector for objects ---------------------------*/ +/* + NAME + getVector - overloaded function. Retrieves the attribute in the current +position as a vector of objects + + PARAMETERS + rs - ResultSet + vect- reference to vector of objects(OUT parameter). + + DESCRIPTION + Retrieves the column in the specified position as a vector of RefAny. + The attribute at the current position should be a collection type (varray or + nested table). The SQL type of the elements in the collection should be + compatible with objects. + + RETURNS + nothing + + NOTES + compatible SQL types : NTY + + will call getVector(..., vector) +*/ +#if defined(WIN32COMMON) || defined(__MVS__) +// and other platforms that do not support +// partial function template specialization + +template +void getVector( ResultSet *rs, unsigned int index,OCCI_STD_NAMESPACE::vector +& vect) +{ + OCCI_STD_NAMESPACE::vector vec_pobj; + getVectorOfPObjects(rs, index, vec_pobj); + + vect.clear(); + unsigned int size = vec_pobj.size(); + vect.reserve( size ); + for ( unsigned int i=0; i< size; i++) + vect.push_back((T)vec_pobj[i]); +} + +#else +template +void getVector( ResultSet *rs, unsigned int index, OCCI_STD_NAMESPACE::vector &vect) +{ + OCCI_STD_NAMESPACE::vector vec_pobj; + getVectorOfPObjects(rs, index, vec_pobj); + + vect.clear(); + unsigned int size = vec_pobj.size(); + vect.reserve( size ); + for (unsigned int i=0; i< size; i++) + vect.push_back((T *)vec_pobj[i]); +} +#endif + +/*------------------------ getVector for objects ---------------------------*/ +/* + NAME + getVector - overloaded function. Retrieves the attribute in the current +position as a vector of objects + + PARAMETERS + stmt - Statement + vect- reference to vector of objects(OUT parameter). + + DESCRIPTION + Retrieves the column in the specified position as a vector of RefAny. + The attribute at the current position should be a collection type (varray or + nested table). The SQL type of the elements in the collection should be + compatible with objects. + + RETURNS + nothing + + NOTES + compatible SQL types : NTY + + will call getVector(..., vector) +*/ +#if defined(WIN32COMMON) || defined(__MVS__) +// and other platforms that do not support +// partial function template specialization + +template +void getVector( Statement *stmt, unsigned int index, +OCCI_STD_NAMESPACE::vector &vect) +{ + OCCI_STD_NAMESPACE::vector vec_pobj; + getVectorOfPObjects(stmt, index, vec_pobj); + vect.clear(); + unsigned int size = vec_pobj.size(); + vect.reserve( size ); + for (unsigned int i=0; i< size; i++) + vect.push_back((T)vec_pobj[i]); +} +#else +template +void getVector( Statement *stmt, unsigned int index, +OCCI_STD_NAMESPACE::vector &vect) +{ + OCCI_STD_NAMESPACE::vector vec_pobj; + getVectorOfPObjects(stmt, index, vec_pobj); + vect.clear(); + unsigned int size = vec_pobj.size(); + vect.reserve( size ); + for (unsigned int i=0; i< size; i++) + vect.push_back((T *)vec_pobj[i]); +} +#endif + +/*------------------------ getVector for Ref ---------------------------*/ +/* + NAME + getVector - overloaded function. Retrieves the attribute in the current +position as a vector of Ref + + PARAMETERS + rs - ResultSet + vect- reference to vector of Ref(OUT parameter). + + DESCRIPTION + Retrieves the column in the specified position as a vector of Ref. + The attribute at the current position should be a collection type (varray or + nested table). The SQL type of the elements in the collection should be + compatible with Ref. + + RETURNS + nothing + + NOTES + compatible SQL types : REF +*/ +#if !defined(WIN32COMMON) && !defined(__MVS__) +template +void getVector( ResultSet *rs, unsigned int index, + OCCI_STD_NAMESPACE::vector > &vect) +{ + OCCI_STD_NAMESPACE::vector vec_ref; + getVectorOfOCIRefs(rs, index, vec_ref); + + const Connection *sess = rs->getStatement()->getConnection(); + + vect.clear(); + unsigned int size = vec_ref.size(); + vect.reserve( size ); + for (unsigned int i=0; i< size; i++) + { + if (vec_ref[i] == (OCIRef *)0) + vect.push_back(Ref()); // pushing a default-constructed Ref + else + vect.push_back(Ref(sess, (OCIRef *)vec_ref[i], FALSE)); + } +} +#endif + +/*------------------------ setVector for PObject*---------------------------*/ +/* + NAME + SetVector - overloaded function. Binds the attribute in the current + position with a vector of objects. + + PARAMETERS + rs - ResultSet + vect- reference to vector of objects(OUT parameter). + + DESCRIPTION + Binds the column in the specified position with a vector of signed int . + The column at the current position should be a collection type (varray or + nested table). The SQL type of the elements in the collection should be + compatible with objects . + + RETURNS + nothing + + NOTES + compatible SQL types : SQLT_NTY + + This will be calling setVector(..., vector,..) + +*/ +#if defined(WIN32COMMON) || defined(__MVS__) +// and other platforms that do not support +// partial function template specialization + +template +void setVector( Statement *stmt, unsigned int index, + const OCCI_STD_NAMESPACE::vector &vect, + const OCCI_STD_NAMESPACE::string &sqltype) +{ + OCCI_STD_NAMESPACE::vector vec_pobj; + unsigned int size = vect.size(); + vec_pobj.reserve( size ); + + for (unsigned int i = 0; i < size; i++) + vec_pobj.push_back((PObject *)vect[i]); + + setVectorOfPObjects(stmt, index, vec_pobj, sqltype); +} + +template +void setVector( Statement *stmt, unsigned int index, const OCCI_STD_NAMESPACE:: +vector &vect, const OCCI_STD_NAMESPACE::string &schemaName, +const OCCI_STD_NAMESPACE::string &typeName) +{ + OCCI_STD_NAMESPACE::vector vec_pobj; + unsigned int size = vect.size(); + vec_pobj.reserve( size ); + + for (unsigned int i = 0; i < size; i++) + vec_pobj.push_back((PObject *)vect[i]); + + setVectorOfPObjects(stmt, index, vec_pobj, schemaName, typeName); +} + +template +void setVector( Statement *stmt, unsigned int index, const OCCI_STD_NAMESPACE:: +vector &vect, const UString &schemaName, +const UString &typeName) +{ + OCCI_STD_NAMESPACE::vector vec_pobj; + unsigned int size = vect.size(); + vec_pobj.reserve( size ); + + for (unsigned int i = 0; i < size; i++) + vec_pobj.push_back((PObject *)vect[i]); + + setVectorOfPObjects(stmt, index, vec_pobj, schemaName, typeName); +} +#else +template +void setVector( Statement *stmt, unsigned int index, const OCCI_STD_NAMESPACE:: +vector &vect, const OCCI_STD_NAMESPACE::string &sqltype) +{ + OCCI_STD_NAMESPACE::vector vec_pobj; + unsigned int size = vect.size(); + vec_pobj.reserve( size ); + + for (unsigned int i = 0; i < size; i++) + vec_pobj.push_back((PObject *)vect[i]); + + setVectorOfPObjects(stmt, index, vec_pobj, sqltype); +} + +template +void setVector( Statement *stmt, unsigned int index, const OCCI_STD_NAMESPACE:: +vector &vect, const OCCI_STD_NAMESPACE::string &schemaName, +const OCCI_STD_NAMESPACE::string &typeName) +{ + OCCI_STD_NAMESPACE::vector vec_pobj; + unsigned int size = vect.size(); + vec_pobj.reserve( size ); + + for (unsigned int i = 0; i < size; i++) + vec_pobj.push_back((PObject *)vect[i]); + + setVectorOfPObjects(stmt, index, vec_pobj, schemaName, typeName); +} + +template +void setVector( Statement *stmt, unsigned int index, const OCCI_STD_NAMESPACE:: +vector &vect, const UString &schemaName, +const UString &typeName) +{ + OCCI_STD_NAMESPACE::vector vec_pobj; + unsigned int size = vect.size(); + vec_pobj.reserve( size ); + + for (unsigned int i = 0; i < size; i++) + vec_pobj.push_back((PObject *)vect[i]); + + setVectorOfPObjects(stmt, index, vec_pobj, schemaName, typeName); +} +#endif + +/*------------------------ setVector for Ref---------------------------*/ +/* + NAME + setVector - overloaded function. Binds the attribute in the current + position with a vector of Ref. + + PARAMETERS + rs - ResultSet + vect- reference to vector of REF + + DESCRIPTION + Binds the column in the specified position with a vector of signed int . + The column at the current position should be a collection type (varray or + nested table). The SQL type of the elements in the collection should be + compatible with OCIRef* . + + RETURNS + nothing + + NOTES + compatible SQL types : REF + + This will just call setVector(..., vector,..) + + +*/ +#if !defined(WIN32COMMON) && !defined(__MVS__) +template +void setVector( Statement *stmt, unsigned int index, + const OCCI_STD_NAMESPACE::vector > &vect, + const OCCI_STD_NAMESPACE::string &sqltype) +{ + OCCI_STD_NAMESPACE::vector vec_ref; + OCCI_STD_NAMESPACE::vector vec_ind; + unsigned int size = vect.size(); + vec_ref.reserve( size ); + vec_ind.reserve( size ); + + for (unsigned int i = 0; i < size; i++) + { + vec_ref.push_back((void *)vect[i].getRef()); + vec_ind.push_back( vect[i].isNull() ? OCI_IND_NULL : OCI_IND_NOTNULL); + } + + setVectorOfOCIRefs(stmt, index, vec_ref, vec_ind, sqltype); +} + +template +void setVector( Statement *stmt, unsigned int index, + const OCCI_STD_NAMESPACE::vector > &vect, + const OCCI_STD_NAMESPACE::string &schemaName, + const OCCI_STD_NAMESPACE::string &typeName) +{ + OCCI_STD_NAMESPACE::vector vec_ref; + OCCI_STD_NAMESPACE::vector vec_ind; + unsigned int size = vect.size(); + vec_ref.reserve( size ); + vec_ind.reserve( size ); + + for (unsigned int i = 0; i < size; i++) + { + vec_ref.push_back((void *)vect[i].getRef()); + vec_ind.push_back( vect[i].isNull() ? OCI_IND_NULL : OCI_IND_NOTNULL); + } + + setVectorOfOCIRefs(stmt, index, vec_ref, vec_ind, schemaName, typeName); +} + +template +void setVector( Statement *stmt, unsigned int index, + const OCCI_STD_NAMESPACE::vector > &vect, + const UString &schemaName, + const UString &typeName) +{ + OCCI_STD_NAMESPACE::vector vec_ref; + OCCI_STD_NAMESPACE::vector vec_ind; + unsigned int size = vect.size(); + vec_ref.reserve( size ); + vec_ind.reserve( size ); + + for (unsigned int i = 0; i < size; i++) + { + vec_ref.push_back((void *)vect[i].getRef()); + vec_ind.push_back( vect[i].isNull() ? OCI_IND_NULL : OCI_IND_NOTNULL); + } + + setVectorOfOCIRefs(stmt, index, vec_ref, vec_ind, schemaName, typeName); +} +#endif + +/*------------------------ getVector for Ref ---------------------------*/ +/* + NAME + getVector - overloaded function. Retrieves the attribute in the current +position as a vector of Ref + + PARAMETERS + stmt - Statement + vect- reference to vector of Ref(OUT parameter). + + DESCRIPTION + Retrieves the column in the specified position as a vector of Ref. + The attribute at the current position should be a collection type (varray or + nested table). The SQL type of the elements in the collection should be + compatible with Ref. + + RETURNS + nothing + + NOTES + compatible SQL types : REF +*/ +#if !defined(WIN32COMMON) && !defined(__MVS__) +template +void getVector( Statement *stmt, unsigned int index, + OCCI_STD_NAMESPACE::vector > &vect) +{ + OCCI_STD_NAMESPACE::vector vec_ref; + getVectorOfOCIRefs(stmt, index, vec_ref); + + const Connection *sess = stmt->getConnection(); + + vect.clear(); + unsigned int size = vec_ref.size(); + vect.reserve( size ); + for (unsigned int i=0; i< size; i++) + { + if (vec_ref[i] == (OCIRef *)0) + vect.push_back(Ref ()); // pushing a default-constructed Ref + else + vect.push_back(Ref (sess, (OCIRef *)vec_ref[i], FALSE)); + } + +} +#endif + +// Platform independent get/setVectorOfRefs method added +// get(set)Vector of Ref and get(set)VectorOfRefs are identical +// in functionality. + +/*------------------------ getVectorOfRefs for Ref ----------------------*/ +/* + NAME + getVectorOfRefs - overloaded function. Retrieves the attribute in the + current position as a vector of Ref + + PARAMETERS + rs - ResultSet + vect- reference to vector of Ref(OUT parameter). + + DESCRIPTION + Retrieves the column in the specified position as a vector of Ref. + The attribute at the current position should be a collection type (varray or + nested table). The SQL type of the elements in the collection should be + compatible with Ref. + + RETURNS + nothing + + NOTES + compatible SQL types : REF +*/ + +template +void getVectorOfRefs( ResultSet *rs, unsigned int index, +OCCI_STD_NAMESPACE::vector > &vect) +{ + OCCI_STD_NAMESPACE::vector vec_ref; + getVectorOfOCIRefs(rs, index, vec_ref); + + const Connection *sess = rs->getStatement()->getConnection(); + + vect.clear(); + unsigned int size = vec_ref.size(); + vect.reserve( size ); + for (unsigned int i=0; i< size; i++) + { + if (vec_ref[i] == (OCIRef *)0) + vect.push_back(Ref()); // pushing a default-constructed Ref + else + vect.push_back(Ref(sess, (OCIRef *)vec_ref[i], FALSE)); + } +} + +/*------------------------ setVectorOfRefs for Ref-----------------------*/ +/* + NAME + setVectorOfRefs - overloaded function. Binds the attribute in the current + position with a vector of Ref. + + PARAMETERS + rs - ResultSet + vect- reference to vector of REF + + DESCRIPTION + Binds the column in the specified position with a vector of signed int . + The column at the current position should be a collection type (varray or + nested table). The SQL type of the elements in the collection should be + compatible with OCIRef* . + + RETURNS + nothing + + NOTES + compatible SQL types : REF + + This will just call setVector(..., vector,..) + + +*/ + +template +void setVectorOfRefs( Statement *stmt, unsigned int index, +const OCCI_STD_NAMESPACE::vector > &vect, +const OCCI_STD_NAMESPACE::string &sqltype) +{ + OCCI_STD_NAMESPACE::vector vec_ref; + OCCI_STD_NAMESPACE::vector vec_ind; + unsigned int size = vect.size(); + vec_ref.reserve( size ); + vec_ind.reserve( size ); + + for (unsigned int i = 0; i < size; i++) + { + vec_ref.push_back((void *)vect[i].getRef()); + vec_ind.push_back( vect[i].isNull() ? OCI_IND_NULL : OCI_IND_NOTNULL); + } + + setVectorOfOCIRefs(stmt, index, vec_ref, vec_ind, sqltype); +} + +template +void setVectorOfRefs( Statement *stmt, unsigned int index, +const OCCI_STD_NAMESPACE::vector > &vect, +const OCCI_STD_NAMESPACE::string &schemaName, +const OCCI_STD_NAMESPACE::string &typeName) +{ + OCCI_STD_NAMESPACE::vector vec_ref; + OCCI_STD_NAMESPACE::vector vec_ind; + unsigned int size = vect.size(); + vec_ref.reserve( size ); + vec_ind.reserve( size ); + + for (unsigned int i = 0; i < size; i++) + { + vec_ref.push_back((void *)vect[i].getRef()); + vec_ind.push_back( vect[i].isNull() ? OCI_IND_NULL : OCI_IND_NOTNULL); + } + + setVectorOfOCIRefs(stmt, index, vec_ref, vec_ind, schemaName, typeName); +} + +template +void setVectorOfRefs( Statement *stmt, unsigned int index, +const OCCI_STD_NAMESPACE::vector > &vect, +const UString &schemaName, +const UString &typeName) +{ + OCCI_STD_NAMESPACE::vector vec_ref; + OCCI_STD_NAMESPACE::vector vec_ind; + unsigned int size = vect.size(); + vec_ref.reserve( size ); + vec_ind.reserve( size ); + + for (unsigned int i = 0; i < size; i++) + { + vec_ref.push_back((void *)vect[i].getRef()); + vec_ind.push_back( vect[i].isNull() ? OCI_IND_NULL : OCI_IND_NOTNULL); + } + + setVectorOfOCIRefs(stmt, index, vec_ref, vec_ind, schemaName, typeName); +} + +/*------------------------ getVectorOfRefs for Ref ----------------------*/ +/* + NAME + getVectorOfRefs - overloaded function. Retrieves the attribute in the + current position as a vector of Ref + + PARAMETERS + stmt - Statement + vect- reference to vector of Ref(OUT parameter). + + DESCRIPTION + Retrieves the column in the specified position as a vector of Ref. + The attribute at the current position should be a collection type (varray or + nested table). The SQL type of the elements in the collection should be + compatible with Ref. + + RETURNS + nothing + + NOTES + compatible SQL types : REF +*/ + +template +void getVectorOfRefs( Statement *stmt, unsigned int index, +OCCI_STD_NAMESPACE::vector > &vect) +{ + OCCI_STD_NAMESPACE::vector vec_ref; + getVectorOfOCIRefs(stmt, index, vec_ref); + + const Connection *sess = stmt->getConnection(); + + vect.clear(); + unsigned int size = vec_ref.size(); + vect.reserve( size ); + for (unsigned int i=0; i< size; i++) + { + if (vec_ref[i] == (OCIRef *)0) + vect.push_back(Ref ()); // pushing a default-constructed Ref + else + vect.push_back(Ref (sess, (OCIRef *)vec_ref[i], FALSE)); + } +} +/*----------------------------- pinVectorOfRefs---------------------*/ +/* + NAME + pinVectorOfRefs - array pin implementation + + PARAMETERS + conn- Connection object + vecRef - vector of OCIRefs * + vecCor - vector of OCIComplexObject * + vecPOBj - vector of PObject * ( OUT ) + + DESCRIPTION + implements the array pin of refs passed and returns the corresponding + PObject s + + RETURNS + + NOTES +*/ +template +void pinVectorOfRefs( const Connection *conn, +OCCI_STD_NAMESPACE::vector > &vect, +OCCI_STD_NAMESPACE::vector &vectObj, LockOptions lockOpt) +{ + + OCCI_STD_NAMESPACE::vector vecRef; + OCCI_STD_NAMESPACE::vector vecCor; + OCCI_STD_NAMESPACE::vector vecPObj; + unsigned int sz = vect.size(); + vecRef.reserve( sz ); + vecCor.reserve( sz ); + + for ( unsigned int i=0; i < sz; i++) + { + vecRef.push_back((void *)vect[i].getRef()); + vecCor.push_back((void *)vect[i].getCor()); + } + pinVectorOfOCIRefs(conn, vecRef, vecCor, vecPObj, lockOpt); + for ( unsigned int k=0; k < sz; k++) + { + vectObj.push_back((T *)vecPObj[k]); + vect[k].setPinnedObject(vecPObj[k]); + } +} + +/*----------------------------- pinVectorOfRefs---------------------*/ +/* + NAME + pinVectorOfRefs - array pin implementation + + PARAMETERS + conn- Connection object + vecRef - vector of OCIRefs * + vecCor - vector of OCIComplexObject * + + DESCRIPTION + implements the array pin of refs passed + + RETURNS + + NOTES +*/ +template +void pinVectorOfRefs( const Connection *conn, +OCCI_STD_NAMESPACE::vector > &vect, +LockOptions lockOpt) +{ + + OCCI_STD_NAMESPACE::vector vecRef; + OCCI_STD_NAMESPACE::vector vecCor; + OCCI_STD_NAMESPACE::vector vecPObj; + unsigned int sz = vect.size(); + vecRef.reserve( sz ); + vecCor.reserve( sz ); + + for ( unsigned int i=0; i < sz; i++) + { + vecRef.push_back((void *)vect[i].getRef()); + vecCor.push_back((void *)vect[i].getCor()); + } + pinVectorOfOCIRefs(conn, vecRef, vecCor,vecPObj, lockOpt); + for ( unsigned int k=0; k < sz; k++) + vect[k].setPinnedObject(vecPObj[k]); +} + + + +/*--------------------------------------------------------------------------- + INTERNAL FUNCTIONS + ---------------------------------------------------------------------------*/ + + +} /* end of namespace occi */ +} /* end of namespace oracle */ +#endif /* OCCICONTROL_ORACLE */ + +#endif /* _olint */ diff --git a/sdk/include/occiData.h b/sdk/include/occiData.h new file mode 100755 index 0000000..9c9631d --- /dev/null +++ b/sdk/include/occiData.h @@ -0,0 +1,1170 @@ +/* Copyright (c) 2000, 2009, Oracle and/or its affiliates. +All rights reserved. */ + +/* + NAME + occiData.h - header file for OCCI data classes + + DESCRIPTION + Class definitions for Stream, Blob, Clob ,Bfile, + Number, Date, IntervalYM, IntervalDS, Time, + Timestamp + + RELATED DOCUMENTS + + + EXPORT FUNCTION(S) + + + INTERNAL FUNCTION(S) + + + EXAMPLES + + NOTES + + + MODIFIED (MM/DD/YY) + kkverma 11/23/09 - Replace OCIEnv* type ocienv member to Environment type + slynn 03/18/08 - Add get/setContentType. + slynn 09/14/06 - Remove string.clear() + slynn 07/28/06 - Migrate to new 11g LOB terminology + slynn 06/21/06 - Add LobRegion + slynn 05/25/06 - New NG Lob Functionality. + cparampa 09/06/04 - Date changes + shiyer 10/31/03 - Timestamp constructors issue + rvallam 10/07/03 - bug 3089939 - add private method in Date to compute + hour and min component in daysBetween to be passed + to set method of IntervalDS. + cparampa 08/21/03 - added toCopy to IntervalDS and IntervalYM + cparampa 07/14/03 - make SubscriptionImpl friend of Bytes class. + rvallam 02/12/03 - modified BFloat/BDouble interface - BFloat/BDouble + type is now a struct + cparampa 01/20/03 - made ProducerImpl friend of Bytes class + rvallam 11/19/02 - objects support for interval class + shiyer 11/15/02 - Add UTF16 support to IntervalYM & IntervalDS + cparampa 12/11/02 - removed references to class Payload + cparampa 10/12/02 - AQ additions + shiyer 10/12/02 - Added UTF16 version of get/set CharsetId in Clob + shiyer 09/06/02 - OCCI globalization support + aahluwal 06/04/02 - bug 2360115 + vvinay 02/21/02 - operator= added for Bytes + gayyappa 10/23/01 - fix bug 2073327 , use string instead of + enum CharSet + vvinay 12/21/01 - signed char constructor and cast operator + (bug 2073334) + binary operator methods not friends any more + gayyappa 15/10/01 - add parameter toCopy to Lob/Timestamp private + constructors + rvallam 04/09/01 - change private constructor in Number to pass + parameter by reference and made it const + chliang 03/05/01 - disable olint + rvallam 01/27/02 - remove #include + gayyappa 01/17/01 - add methods/operators to Interval and + timestamp classes.. + gayyappa 12/15/00 - interface changes in set methods + rvallam 11/29/00 - change method signature in Bytes + added 3 new methods in Number + rvallam 10/20/00 - change method signatures in Date + rvallam 09/15/00 - make StmtImpl/ResultSetImpl friend to + interval classes + gayyappa 08/21/00 - modified timestamp, interval headers. + add OCIEnv to constructor of Bytes., + removed getOCIRaw from Bytes. + add const to setVector mthds of anydata. + add void* data member to Timestamp/Interval. + rvallam 08/10/00 - modified CORE class headers to add friends , + added private constructor in Bytes + slari 08/02/00 - comment out Stream + rratnam 08/04/00 - updated the LOB stream interface + rkasamse 08/07/00 - make getVector friend of Time + slari 07/31/00 - add const to Bytes methods + slari 07/25/00 - disable Bytes(Bytes *) + slari 07/23/00 - add Bytes + gayyappa 07/26/00 - update Timestamp, IntervalYM, IntervalDS. + gayyappa 07/04/00 - for fixing a problem in occiNumber + rratnam 06/13/00 - Updated LOB class headers + kmohan 05/31/00 - Change Environment to Environment * in + Date constructor + kmohan 05/29/00 - No string + rkasamse 04/25/00 - Added string class header + etucker 04/19/00 - Added CORE class headers + kmohan 04/11/00 - Creation + +*/ + +#ifndef _olint /* disable olint check */ + +#ifndef OCCIDATA_ORACLE +# define OCCIDATA_ORACLE + +#ifndef OCCICOMMON_ORACLE +#include +#endif + +#ifndef OCCICONTROL_ORACLE +#include +#endif + +namespace oracle { +namespace occi { +class Bytes +{ + + public: + + Bytes(const Environment *env = NULL); // default constructor + + Bytes(unsigned char *value, unsigned int count, + unsigned int offset = 0, const Environment *env = NULL); + + Bytes(const Bytes &e); // copy constructor + + + // public methods + + void getBytes(unsigned char *dst, unsigned int count, + unsigned int srcBegin = 0, + unsigned int dstBegin = 0) const; + + unsigned int length() const; + + unsigned char byteAt(unsigned int index) const; + + bool isNull() const; + + void setNull(); + + void operator=(const Bytes &other); + + ~Bytes(); + +private: + // private data members + Bytes(OCIEnv *,OCIRaw *) ; + Bytes(Ptr bytesPtr) ; + Ptr ptr_; + friend class AnyDataImpl; + friend class aq::MessageImpl; + friend class aq::ProducerImpl; + friend class aq::SubscriptionImpl; + friend void getVector(const AnyData &any, + OCCI_STD_NAMESPACE::vector &vect) ; + friend void setVector(AnyData &any, + const OCCI_STD_NAMESPACE::vector &vect) ; + +}; + +class Bfile +{ + public : + + Bfile(); + Bfile(const Connection *connectionp) ; + Bfile(const Bfile &srcBfile) ; + ~Bfile(); + unsigned int length() const ; + OCCI_STD_NAMESPACE::string getDirAlias() const ; + UString getUStringDirAlias() const ; + OCCI_STD_NAMESPACE::string getFileName() const ; + UString getUStringFileName() const ; + void setName(const OCCI_STD_NAMESPACE::string &dirAlias, + const OCCI_STD_NAMESPACE::string &fileName) ; + void setName(const UString &dirAlias, const UString &fileName) ; + bool fileExists() const ; + Bfile& operator =(const Bfile &srcBfile) ; + bool operator ==(const Bfile &srcBfile) const ; + bool operator !=(const Bfile &srcBfile) const ; + void setNull() ; + bool isNull() const ; + bool isInitialized() const; + void open() ; + void close() ; + bool isOpen() const ; + unsigned int read(unsigned int amt, unsigned char *buffer, + unsigned int bufsize, unsigned int offset = 1) const ; + Stream* getStream(unsigned int offset = 1, + unsigned int amount =0) ; + void closeStream(Stream *stream); + + private: + + //Data Members: + + // pointer to the FILE locator + OCIBFileLocator *filep; + + // pointer to the ConnectionImpl instance + const ConnectionImpl *connp; + + // pointer to the LobStreamImpl instance obtained from this FILE + LobStreamImpl *streamp; + + void *bfileExt; + + //Enumerations: + enum {MAXDIRNAMELEN = 32, MAXFILENAMELEN = 256}; + + //Constructor: + Bfile(const Connection *connectionp, + OCIBFileLocator *locatorp, bool toCopy = true) ; + + //Methods: + OCIBFileLocator* getLocator() const; + void do_getDirAlias( void * dirAlias, ub2 * dirAliasLen) const ; + void do_getFileName( void * fileName, ub2 * fileNameLen) const ; + void do_setName( void * alias, ub2 aliasLen, + void *fileName, ub2 fileNameLen); + // Friends + friend class AnyDataImpl; + friend class StatementImpl; + friend class ResultSetImpl; + friend class Blob; + friend class Clob; + friend class aq::MessageImpl; + + friend void getVector(const AnyData&, OCCI_STD_NAMESPACE::vector&) ; + friend void getVector(Statement*, unsigned int, + OCCI_STD_NAMESPACE::vector&) ; + friend void getVector(ResultSet*, unsigned int , + OCCI_STD_NAMESPACE::vector&) ; + friend void setVector(AnyData&, const OCCI_STD_NAMESPACE::vector&) ; + friend void do_setVectorOfBfile(Statement*, unsigned int, + const OCCI_STD_NAMESPACE::vector&, void *, unsigned int, + void *, unsigned int ) ; + +#ifdef ORAXB8_DEFINED + friend void readVectorOfBfiles(const Connection *conn, + OCCI_STD_NAMESPACE::vector &vec, + oraub8 *byte_amts, oraub8 *offsets, + unsigned char *buffers[], oraub8 *buffer_lens); +#endif +}; + + +#ifdef ORAXB8_DEFINED +// See the end of this file for implementation of LobRegion +template < typename lobType > class LobRegion +{ + private: + lobType *_primary; + oraub8 _primaryOffset; + oraub8 _offset; + oraub8 _length; + OCCI_STD_NAMESPACE::string _mimeType; + + void setPrimary(const ConnectionImpl *connp, + OCILobLocator *locator); + + public: + LobRegion(); + ~LobRegion(); + lobType *getPrimary(); + oraub8 getPrimaryOffset(); + oraub8 getOffset(); + oraub8 getLength(); + OCCI_STD_NAMESPACE::string getMimeType(); + + friend class Blob; + friend class Clob; +}; + +typedef LobRegion BlobRegion; +typedef LobRegion ClobRegion; +#endif + + +class Blob +{ + public: + + Blob(); + Blob(const Connection *connectionp) ; + Blob(const Blob &srcBlob) ; + ~Blob(); + unsigned int getChunkSize() const ; + unsigned int length() const ; + Blob& operator =(const Blob &srcBlob) ; + bool operator ==(const Blob &srcBlob) const ; + bool operator !=(const Blob &srcBlob) const ; + void setNull() ; + bool isNull() const ; + void setEmpty() ; + void setEmpty(const Connection *connectionp) ; + bool isInitialized() const; + void open(LobOpenMode mode=OCCI_LOB_READWRITE) ; + void close() ; + bool isOpen() const ; + void copy(const Blob &srcBlob, unsigned int numBytes, + unsigned int dstOffset =1, unsigned int srcOffset =1) ; + void copy(const Bfile &srcBfile, unsigned int numBytes, + unsigned int dstOffset =1, unsigned int srcOffset =1) ; + void append(const Blob &srcBlob) ; + unsigned int read(unsigned int amt, unsigned char *buffer, + unsigned int bufsize, unsigned int offset = 1) const ; + unsigned int write(unsigned int amt, unsigned char *buffer, + unsigned int bufsize, unsigned int offset = 1) ; + unsigned int writeChunk(unsigned int amt, unsigned char *buffer, + unsigned int bufsize, unsigned int offset = 1) ; + void trim(unsigned int newlen) ; + Stream* getStream(unsigned int offset = 1, + unsigned int amount =0) ; + void closeStream(Stream *stream); + LobOptionValue getOptions(LobOptionType optType); + void setOptions(LobOptionType optType, LobOptionValue value); + OCCI_STD_NAMESPACE::string getContentType(void); + void setContentType(const OCCI_STD_NAMESPACE::string contentType); + + void getDeduplicateRegions(OCCI_STD_NAMESPACE::vector ®ions); + private: + + //Data Members: + + // pointer to the BLOB locator + OCIBlobLocator *lobp; + + // pointer to the ConnectionImpl instance + const ConnectionImpl *connp; + + // pointer to the LobStreamImpl instance obtained from this LOB + LobStreamImpl *streamp; + + //for future use ! + void *blobExt; + + //Constructor: + Blob(const Connection *connectionp, + OCIBlobLocator *locatorp, bool toCopy=true) ; + + //Methods: + OCIBlobLocator* getLocator() const; + + // Friends + friend class AnyDataImpl; + friend class StatementImpl; + friend class ResultSetImpl; + +#ifdef ORAXB8_DEFINED + friend void + LobRegion::setPrimary(const ConnectionImpl *connp, + OCILobLocator *locator); +#endif + friend void getVector(const AnyData&, OCCI_STD_NAMESPACE::vector&) ; + friend void getVector(Statement*, unsigned int, + OCCI_STD_NAMESPACE::vector&) ; + friend void getVector(ResultSet*, unsigned int, + OCCI_STD_NAMESPACE::vector&) ; + friend void setVector(AnyData&, const OCCI_STD_NAMESPACE::vector&) ; + friend void do_setVectorOfBlob(Statement*, unsigned int, + const OCCI_STD_NAMESPACE::vector&, void *, + unsigned int, void *, unsigned int ) ; +#ifdef ORAXB8_DEFINED + friend void readVectorOfBlobs(const Connection *conn, + OCCI_STD_NAMESPACE::vector &vec, + oraub8 *byte_amts, oraub8 *offsets, + unsigned char *buffers[], oraub8 *buffer_lens); + friend void writeVectorOfBlobs(const Connection *conn, + OCCI_STD_NAMESPACE::vector &vec, + oraub8 *byte_amts, oraub8 *offsets, + unsigned char *buffers[], oraub8 *buffer_lens); +#endif +}; + +class Clob +{ + public: + + Clob(); + Clob(const Connection *connectionp) ; + Clob(const Clob &srcClob) ; + ~Clob(); + unsigned int getChunkSize() const ; + unsigned int length() const ; + OCCI_STD_NAMESPACE::string getCharSetId() const; + CharSetForm getCharSetForm() const; + void setCharSetId( const OCCI_STD_NAMESPACE::string &charset) ; + void setCharSetForm( CharSetForm csfrm) ; + Clob& operator =(const Clob &srcClob) ; + bool operator ==(const Clob &srcClob) const ; + bool operator !=(const Clob &srcClob) const ; + void setNull() ; + bool isNull() const ; + void setEmpty() ; + void setEmpty(const Connection *connectionp) ; + bool isInitialized() const; + void open(LobOpenMode mode=OCCI_LOB_READWRITE) ; + void close() ; + bool isOpen() const ; + void copy(const Clob &srcClob, unsigned int numBytes, + unsigned int dstOffset = 1, unsigned int srcOffset = 1) ; + void copy(const Bfile &srcBfile, unsigned int numBytes, + unsigned int dstOffset = 1, unsigned int srcOffset = 1) ; + void append(const Clob &srcClob) ; + unsigned int read(unsigned int amt, unsigned char *buffer, + unsigned int bufsize, unsigned int offset = 1) const; + unsigned int read(unsigned int amt, utext *buffer, + unsigned int bufsize, unsigned int offset = 1) const; + unsigned int write(unsigned int amt, unsigned char *buffer, + unsigned int bufsize, unsigned int offset = 1 ); + unsigned int write(unsigned int amt, utext *buffer, + unsigned int bufsize, unsigned int offset = 1 ); + unsigned int writeChunk(unsigned int amt, unsigned char *buffer, + unsigned int bufsize, unsigned int offset = 1 ); + unsigned int writeChunk(unsigned int amt, utext *buffer, + unsigned int bufsize, unsigned int offset = 1 ); + void trim(unsigned int newlen) ; + Stream* getStream(unsigned int offset = 1, + unsigned int amount =0 ); + void closeStream(Stream *stream); + LobOptionValue getOptions(LobOptionType optType); + void setOptions(LobOptionType optType, LobOptionValue value); + OCCI_STD_NAMESPACE::string getContentType(void); + void setContentType(const OCCI_STD_NAMESPACE::string contentType); + + UString getCharSetIdUString() const; + void setCharSetIdUString( const UString &charset) ; + + void getDeduplicateRegions(OCCI_STD_NAMESPACE::vector ®ions); + + private: + + //Data Members: + + // pointer to the CLOB locator + OCIClobLocator *lobp; + + // pointer to the ConnectionImpl instance + const ConnectionImpl *connp; + + // pointer to the LobStreamImpl instance obtained from this LOB + LobStreamImpl *streamp; + + //charset id + ub2 charsetId; + + //charset form + CharSetForm charsetForm; + + //for future use ! + void *clobExt; + + //Constructor: + Clob(const Connection *connectionp, + OCIClobLocator *locatorp, bool toCopy =true ) ; + + //Methods: + OCIClobLocator* getLocator() const; + unsigned int do_read( unsigned int amt, void *buffer, + unsigned int bufsize, unsigned int offset) const; + unsigned int do_write( unsigned int amt, void *buffer, + unsigned int bufsize, unsigned int offset) ; + unsigned int do_writeChunk( unsigned int amt, void *buffer, + unsigned int bufsize, unsigned int offset) ; + + // Friends + friend class AnyDataImpl; + friend class StatementImpl; + friend class ResultSetImpl; + +#ifdef ORAXB8_DEFINED + friend void + LobRegion::setPrimary(const ConnectionImpl *connp, + OCILobLocator *locator); +#endif + friend void getVector(const AnyData&, OCCI_STD_NAMESPACE::vector&) ; + friend void getVector(Statement*, unsigned int, + OCCI_STD_NAMESPACE::vector&) ; + friend void getVector(ResultSet*, unsigned int, + OCCI_STD_NAMESPACE::vector&) ; + friend void setVector(AnyData&, const OCCI_STD_NAMESPACE::vector&) ; + friend void do_setVectorOfClob(Statement*, unsigned int, + const OCCI_STD_NAMESPACE::vector&, void *, + unsigned int, void *, unsigned int ) ; +#ifdef ORAXB8_DEFINED + friend void readVectorOfClobs(const Connection *conn, + OCCI_STD_NAMESPACE::vector &vec, + oraub8 *byte_amts, oraub8 *char_amts, oraub8 *offsets, + unsigned char *buffers[], oraub8 *buffer_lens); + friend void writeVectorOfClobs(const Connection *conn, + OCCI_STD_NAMESPACE::vector &vec, + oraub8 *byte_amts, oraub8 *char_amts, oraub8 *offsets, + unsigned char *buffers[], oraub8 *buffer_lens); + friend void readVectorOfClobs(const Connection *conn, + OCCI_STD_NAMESPACE::vector &vec, + oraub8 *byte_amts, oraub8 *char_amts, oraub8 *offsets, + utext *buffers[], oraub8 *buffer_lens); + friend void writeVectorOfClobs(const Connection *conn, + OCCI_STD_NAMESPACE::vector &vec, + oraub8 *byte_amts, oraub8 *char_amts, oraub8 *offsets, + utext *buffers[], oraub8 *buffer_lens); +#endif +}; + +class Number +{ + + public: + + // Constructors + /* default constructor added */ + Number(); + Number(const Number &srcNum); + Number(long double val) ; + Number(double val) ; + Number(float val) ; + Number(long val) ; + Number(int val) ; + Number(short val) ; + Number(char val) ; + Number(signed char val); + Number(unsigned long val) ; + Number(unsigned int val) ; + Number(unsigned short val) ; + Number(unsigned char val) ; + + ~Number(); + // Methods + const Number abs() const ; + // unary negate + const Number operator-() ; + // unary increment + Number& operator++() ; + const Number operator++(int) ; + // unary decrement + Number& operator--() ; + const Number operator--(int) ; + // assigment operator + Number& operator=(const Number &a); + // add and assign + Number& operator+=(const Number &a) ; + // subtract and assign + Number& operator-=(const Number &a) ; + // Mulitply an assign + Number& operator*=(const Number &a) ; + // divide and assign + Number& operator/=(const Number &a) ; + // Modulo and assign + Number& operator%=(const Number &a) ; + // casting operators + operator long() const; + operator int() const; + operator short() const; + operator char() const; + operator signed char() const; + operator unsigned long() const; + operator unsigned int() const; + operator unsigned short() const; + operator unsigned char() const; + operator long double() const; + operator double() const; + operator float() const; + // Decimal shift + const Number shift(int val) const ; + // Integer Power + const Number intPower(int val) const ; + const Number ceil() const ; + const Number floor() const ; + const Number squareroot() const ; + int sign() const ; + // conversion routines + // Format Number and return as a OCCI_STD_NAMESPACE::string + OCCI_STD_NAMESPACE::string toText(const Environment *envp, + const OCCI_STD_NAMESPACE::string &fmt, + const OCCI_STD_NAMESPACE::string &nlsParam="") const + ; + UString toText(const Environment *envp, + const UString &fmt,const UString &nlsParam) const + ; + // Create an Number from formatted text + void fromText(const Environment *envp, + const OCCI_STD_NAMESPACE::string &number, + const OCCI_STD_NAMESPACE::string &fmt, + const OCCI_STD_NAMESPACE::string &nlsParam = "") + ; + void fromText(const Environment *envp, + const UString &number, + const UString &fmt, const UString &nlsParam); + void fromBytes(const Bytes &s) ; + Bytes toBytes() const; + // truncate digits + const Number trunc(int decplace) const ; + // round to the decplace place. + const Number round(int decplace) const ; + // returns an Number with digits decimal digits + const Number prec(int digits) const ; + const Number sin() const ; + const Number cos() const ; + const Number tan() const ; + const Number hypSin() const ; + const Number hypCos() const ; + const Number hypTan() const ; + const Number arcSin() const ; + const Number arcCos() const ; + const Number arcTan() const ; + const Number arcTan2(const Number &val) const; + const Number power(const Number &val) const; + const Number exp() const ; + const Number ln() const ; + const Number log(const Number &val) const; + bool isNull() const; + void setNull(); + private: + /* Private constructor for constructing number from methods inside */ + Number(const OCINumber &result); + OCINumber getOCINumber() const; + + OCINumber data; + /* a flag to indicate if the Number is null */ + bool numberIsNull; + void *numberExt; + + // a >= b + friend bool operator>=(const Number &a, const Number &b); + // a < = b + friend bool operator<=(const Number &a, const Number &b); + // a > b + friend bool operator>(const Number &a, const Number &b); + // a < b + friend bool operator<(const Number &a, const Number &b); + + friend class IntervalDS; + friend class IntervalYM; + friend const IntervalYM operator*(const IntervalYM &a, + const Number& factor) ; + friend const IntervalDS operator*(const IntervalDS &a, + const Number& factor) ; + friend const IntervalYM operator/(const IntervalYM &a, + const Number &factor) ; + friend const IntervalDS operator/(const IntervalDS &a, + const Number &factor) ; + friend class ResultSetImpl; + friend class StatementImpl; + friend class AnyDataImpl; + friend void getVector(const AnyData &any, + OCCI_STD_NAMESPACE::vector &vect); + friend void setVector(AnyData &any, + const OCCI_STD_NAMESPACE::vector &vect) ; + friend Number MetaData::getNumber(MetaData::AttrId attrid) const ; + friend void getVector(Statement *stmt, unsigned int paramIndex, + OCCI_STD_NAMESPACE::vector &vect) ; + friend void do_setVectorOfNumber(Statement *stmt, unsigned int paramIndex, + const OCCI_STD_NAMESPACE::vector &vect, void *schemaName, + unsigned int schemaNameLen, + void *typeName, unsigned int typeNameLen); + friend void getVector(ResultSet *rs, unsigned int colIndex, + OCCI_STD_NAMESPACE::vector &vect); + +}; + +class Date +{ + public: + + // Constructors + Date(); + Date(const Date &a); + Date(const Environment *envp,int year = 1,unsigned int month = 1, + unsigned int day = 1,unsigned int hour = 0, + unsigned int minute = 0, unsigned int seconds = 0); + ~Date(); + // Methods + + void setDate(int year = 1,unsigned int month = 1,unsigned int day = 1, + unsigned int hour = 0,unsigned int minute = 0, + unsigned int seconds = 0); + void getDate(int &year,unsigned int &month,unsigned int &day, + unsigned int &hour ,unsigned int &min ,unsigned int &sec) const; + Bytes toBytes() const ; + void fromBytes(const Bytes &byteStream, + const Environment *envp = NULL); + OCCI_STD_NAMESPACE::string toText( + const OCCI_STD_NAMESPACE::string &fmt = "", + const OCCI_STD_NAMESPACE::string &nlsParam = "") const; + UString toText( + const UString &fmt , + const UString &nlsParam ) const; + void fromText(const OCCI_STD_NAMESPACE::string &datestr, + const OCCI_STD_NAMESPACE::string &fmt = "", + const OCCI_STD_NAMESPACE::string &nlsParam = "", + const Environment *envp = NULL); + void fromText(const UString &datestr, + const UString &fmt , const UString &nlsParam , + const Environment *envp = NULL); + Date toZone(const OCCI_STD_NAMESPACE::string &zone1, + const OCCI_STD_NAMESPACE::string &zone2) const; + Date& operator=(const Date &d); + Date addMonths(int i) const; + Date addDays(int i) const ; + Date lastDay() const ; + IntervalDS daysBetween(const Date &d) const; + Date nextDay(const OCCI_STD_NAMESPACE::string &dow) const; + Date nextDay(const UString &dow) const; + bool isNull() const; + void setNull(); + static Date getSystemDate(const Environment *envp) ; + + private: + OCIDate date; + const EnvironmentImpl *envp; + bool dateIsNull; + void *dateExt; + + /* private constructor */ + Date(const Environment *env,OCIDate dateval); + OCIDate getOCIDate() const; + void constructHourAndMinute(sb4 &seconds, sb4 &hours, sb4 &minutes) const; + friend bool operator==(const Date &a,const Date &b); + friend bool operator>(const Date &a,const Date &b); + friend bool operator<(const Date &a,const Date &b); + friend bool operator!=(const Date &a,const Date &b); + friend bool operator>=(const Date &a,const Date &b); + friend bool operator<=(const Date &a,const Date &b); + friend class ResultSetImpl; + friend class StatementImpl; + friend class AnyDataImpl; + friend class aq::MessageImpl; + friend void getVector(const AnyData &any, + OCCI_STD_NAMESPACE::vector &vect) ; + friend void setVector(AnyData &any, + const OCCI_STD_NAMESPACE::vector &vect); + friend void getVector(Statement *stmt, unsigned int paramIndex, + OCCI_STD_NAMESPACE::vector &vect) ; + friend void do_setVectorOfDate(Statement *stmt, unsigned int paramIndex, + const OCCI_STD_NAMESPACE::vector &vect, void *schemaName, + unsigned int schemaNameLen,void *typeName, unsigned int typeNameLen) ; + friend void getVector(ResultSet *rs, unsigned int colIndex, + OCCI_STD_NAMESPACE::vector &vect) ; + +}; //class Date + +class Timestamp +{ + public: + Timestamp() ; + + Timestamp( const Environment *env, int year=1, + unsigned int month=1, unsigned int day=1, unsigned int hour=0, + unsigned int min=0 ,unsigned int sec=0, unsigned int fs=0, + int tzhour=0, int tzmin=0) ; + Timestamp( const Environment *env, int year, + unsigned int month, unsigned int day, unsigned int hour, + unsigned int min ,unsigned int sec, unsigned int fs, + const OCCI_STD_NAMESPACE::string &timezone); + Timestamp( const Environment *env, int year, + unsigned int month, unsigned int day, unsigned int hour, + unsigned int min ,unsigned int sec, unsigned int fs, + const UString &timezone); + Timestamp( const Timestamp &src) ; + ~Timestamp(); + + void getTimeZoneOffset( int &hour, int &minute) const ; + void getTime( unsigned int &hour, unsigned int &minute, + unsigned int &second, unsigned int &fs) const ; + void getDate( int &year, unsigned int &month, unsigned int &day )const ; + OCCI_STD_NAMESPACE::string toText(const OCCI_STD_NAMESPACE::string &fmt, + unsigned int fsprec, + const OCCI_STD_NAMESPACE::string &nlsParam ="") const ; + UString toText(const UString &fmt, + unsigned int fsprec, const UString &nlsParam ) const ; + void setTimeZoneOffset( int hour, int minute) ; + void setTime( unsigned int hour, unsigned int minute, + unsigned int second, unsigned int fs) ; + void setDate( int year, unsigned int month, unsigned int day ) ; + void setNull() ; + void fromText( const OCCI_STD_NAMESPACE::string ×tmpStr, + const OCCI_STD_NAMESPACE::string &fmt , + const OCCI_STD_NAMESPACE::string &nlsParam= "", + const Environment *env =NULL); + void fromText( const UString ×tmpStr, + const UString &fmt , const UString &nlsParam, + const Environment *env =NULL); + bool isNull() const; + Timestamp & operator =( const Timestamp &src) ; + const IntervalYM subYM(const Timestamp& val) const ; + const IntervalDS subDS(const Timestamp& val) const ; + const Timestamp intervalAdd(const IntervalDS& val) const ; + const Timestamp intervalSub(const IntervalDS& val) const ; + const Timestamp intervalAdd(const IntervalYM& val) const ; + const Timestamp intervalSub(const IntervalYM& val) const ; + + friend bool operator==(const Timestamp &a,const Timestamp &b); + friend bool operator>(const Timestamp &a,const Timestamp &b); + friend bool operator<(const Timestamp &a,const Timestamp &b); + friend bool operator !=(const Timestamp &a,const Timestamp &b); + friend bool operator >=(const Timestamp &a,const Timestamp &b); + friend bool operator <=(const Timestamp &a,const Timestamp &b); + + friend class ResultSetImpl; + friend class StatementImpl; + friend class AnyDataImpl; + + private: + OCIDateTime *ocidatetime; + Environment *env_; + void *timestampExt; + + OCIDateTime *getOCIDateTime() const; + void getTZString( OraText *TimeZone, int th, int tm ); + Timestamp( Environment *env, OCIDateTime *dt, bool toCopy = true) ; + void allocateDataMembers( Environment *env) ; + void do_TimestampConstruct( const Environment *env, int year, + unsigned int month, unsigned int day, unsigned int hour, unsigned int min, + unsigned int sec, unsigned int fs, void *tz, int tsize); + + friend void getVector(const AnyData &any, + OCCI_STD_NAMESPACE::vector &vect); + friend void setVector(AnyData &any, + const OCCI_STD_NAMESPACE::vector &vect) ; + friend Timestamp MetaData::getTimestamp( + MetaData::AttrId attrid) const ; + friend void getVector(ResultSet *rs, unsigned int, + OCCI_STD_NAMESPACE::vector &vect) ; + friend void getVector(Statement *rs, unsigned int, + OCCI_STD_NAMESPACE::vector &vect) ; + friend void do_setVectorOfTimestamp(Statement *stmt, + unsigned int paramIndex, + const OCCI_STD_NAMESPACE::vector &vect, + void *schemaName, unsigned int schemaNameLen, + void *typeName, unsigned int typeNameLen) ; +}; // class Timestamp + +class IntervalDS +{ + + public: + IntervalDS() ; + IntervalDS( const Environment *env,int day=0, + int hour=0, int minute=0, int second=0, + int fs=0) ; + IntervalDS( const IntervalDS &src) ; + + ~IntervalDS(); + + int getDay () const ; + int getHour () const ; + int getMinute () const ; + int getSecond() const ; + int getFracSec () const ; + void set( int day, int hour, int minute, int second, int fracsec) ; + void setNull() ; + void fromText( const OCCI_STD_NAMESPACE::string &inpstr, + const OCCI_STD_NAMESPACE::string &nlsParam ="", + const Environment *env=NULL) ; + OCCI_STD_NAMESPACE::string toText( unsigned int lfprec, unsigned int fsprec, + const OCCI_STD_NAMESPACE::string &nlsParam="") const ; + bool isNull() const; + IntervalDS& operator =( const IntervalDS &src) ; + IntervalDS& operator +=( const IntervalDS &a); + IntervalDS& operator -=( const IntervalDS &a); + IntervalDS& operator *=( const Number &factor); + IntervalDS& operator /=( const Number &factor); + + friend bool operator>(const IntervalDS &a, + const IntervalDS &b) ; + friend bool operator<(const IntervalDS &a, + const IntervalDS &b) ; + friend bool operator >=( const IntervalDS &a, + const IntervalDS &b); + friend bool operator <=( const IntervalDS &a, + const IntervalDS &b); + + //UTF16 support + void fromUText( const UString &inpstr, const Environment *env=NULL ); + UString toUText( unsigned int lfprec, unsigned int fsprec) const; + + private: + OCIInterval *ociinter; + OCIEnv *ocienv; + void *intervalDSExt; + + IntervalDS( OCIEnv *env, OCIInterval *inter, bool toCopy = true) ; + OCIInterval * getOCIInterval() const; + + void allocateDataMembers( OCIEnv *env) ; + friend const IntervalDS Timestamp::subDS( + const Timestamp& val) const ; + friend const Timestamp Timestamp::intervalAdd( + const IntervalDS& val) const ; + friend const Timestamp Timestamp::intervalSub( + const IntervalDS& val) const ; + friend class Date; + friend void getVector(ResultSet *rs, unsigned int, + OCCI_STD_NAMESPACE::vector &vect) ; + friend void getVector(Statement *rs, unsigned int, + OCCI_STD_NAMESPACE::vector &vect) ; + friend void do_setVectorOfIntervalDS(Statement *stmt, + unsigned int paramIndex, + const OCCI_STD_NAMESPACE::vector &vect, + void *schemaName, unsigned int schemaNameLen, + void *typeName, unsigned int typeNameLen) ; + friend class StatementImpl; + friend class ResultSetImpl; + friend class AnyDataImpl; + friend void getVector(const AnyData &any, + OCCI_STD_NAMESPACE::vector &vect); + friend void setVector(AnyData &any, + const OCCI_STD_NAMESPACE::vector &vect) ; + + +}; //class IntervalDS + +class IntervalYM +{ + + public: + IntervalYM() ; + IntervalYM( const Environment *env,int year=0, int month=0) ; + IntervalYM( const IntervalYM &src) ; + ~IntervalYM(); + + int getYear() const ; + int getMonth() const ; + + void set( int year, int month) ; + void setNull() ; + void fromText( const OCCI_STD_NAMESPACE::string &inpstr, + const OCCI_STD_NAMESPACE::string &nlsParam="", + const Environment *env=NULL) ; + OCCI_STD_NAMESPACE::string toText( unsigned int lfprec, + const OCCI_STD_NAMESPACE::string &nlsParam="") const; + bool isNull() const; + IntervalYM & operator =( const IntervalYM &src) ; + IntervalYM& operator +=( const IntervalYM &a); + IntervalYM& operator -=( const IntervalYM &a); + IntervalYM& operator *=( const Number &factor); + IntervalYM& operator /=( const Number &factor); + + friend bool operator>(const IntervalYM &a, const IntervalYM &b) ; + friend bool operator<( const IntervalYM &a, const IntervalYM &b) ; + friend bool operator >=(const IntervalYM &a, const IntervalYM &b); + friend bool operator <=(const IntervalYM &a, const IntervalYM &b); + + //UTF16 support + void fromUText( const UString &inpstr, const Environment *env=NULL ); + UString toUText( unsigned int lfprec ) const; + + private: + OCIInterval *ociinter; + OCIEnv *ocienv; + void *intervalYMExt; + + IntervalYM( OCIEnv *env, OCIInterval *inter, bool toCopy = true) ; + OCIInterval *getOCIInterval() const; + void allocateDataMembers( OCIEnv *env) ; + friend const IntervalYM Timestamp :: subYM( + const Timestamp& val) const ; + friend const Timestamp Timestamp::intervalAdd( + const IntervalYM &val) const ; + friend const Timestamp Timestamp::intervalSub( + const IntervalYM &val) const ; + + friend void getVector(ResultSet *rs, unsigned int, + OCCI_STD_NAMESPACE::vector &vect) ; + friend void getVector(Statement *rs, unsigned int, + OCCI_STD_NAMESPACE::vector &vect) ; + friend void do_setVectorOfIntervalYM(Statement *stmt, + unsigned int paramIndex, + const OCCI_STD_NAMESPACE::vector &vect, + void *schemaName, unsigned int schemaNameLen, + void *typeName, unsigned int typeNameLen) ; + + friend class StatementImpl; + friend class ResultSetImpl; + friend class AnyDataImpl; + friend void getVector(const AnyData &any, + OCCI_STD_NAMESPACE::vector &vect); + friend void setVector(AnyData &any, + const OCCI_STD_NAMESPACE::vector &vect) ; + +}; //class IntervalYM + + +Number operator+(const Number &a, const Number &b) ; +Number operator/(const Number ÷nd, const Number &divisor) ; +Number operator*(const Number &a, const Number &b) ; +Number operator%(const Number &a, const Number &b) ; +Number operator-(const Number &subtrahend, const Number &subtractor) ; +bool operator==(const Number &a, const Number &b); +bool operator!=(const Number &a, const Number &b); + +const IntervalYM operator+(const IntervalYM &a, const IntervalYM &b) ; +const IntervalYM operator-(const IntervalYM &a, const IntervalYM &b) ; +const IntervalYM operator*(const IntervalYM &a, const Number& factor); +const IntervalYM operator/(const IntervalYM &a, const Number &factor); +bool operator==(const IntervalYM &a, const IntervalYM &b) ; +bool operator!=(const IntervalYM &a, const IntervalYM &b) ; + +const IntervalDS operator+(const IntervalDS &a, const IntervalDS &b) ; +const IntervalDS operator-(const IntervalDS &a, const IntervalDS &b) ; +const IntervalDS operator*(const IntervalDS &a, const Number& factor); +const IntervalDS operator/(const IntervalDS &a, const Number &factor); +bool operator==(const IntervalDS &a, const IntervalDS &b) ; +bool operator!=(const IntervalDS &a, const IntervalDS &b) ; + + +typedef struct BFloat +{ + float value; + bool isNull; + + BFloat() + { + isNull = false; + value = 0.; + } +} BFloat; + +typedef struct BDouble +{ + double value; + bool isNull; + + BDouble() + { + isNull = false; + value = 0.; + } +} BDouble; + +/*--------------------------------------------------------------------------- + EXPORT FUNCTIONS + ---------------------------------------------------------------------------*/ + + +/*--------------------------------------------------------------------------- + INTERNAL FUNCTIONS + ---------------------------------------------------------------------------*/ + + +#ifdef ORAXB8_DEFINED +/* + NAME + Lob Region class + + DESCRIPTION + Contains the implementation of the Lob Region template Class. + This class is the underlying implementation for the BlobRegion and + ClobRegion classes. + + RELATED DOCUMENTS + Functional/Design Specifications: + 18209 - Next Generation LOBs: API + 18206 - Next Generation LOBs: Comb. Storage, Compressio & Encryption + + EXPORT FUNCTION(S) + LobRegion() - constructors + ~LobRegion() - destructor + getPrimary() - Get the Primary Lob object + getPrimaryOffset() - Get the offset of this region in the Primary Lob. + getOffset() - Get the offset of this region in this lob. + getLength() - Get the length of this region + getMimeType() - Get the mime type of this region + + PUBLIC IMPLEMENTATION FUNCTION(S) + + INTERNAL FUNCTION(S) + none + + EXAMPLES + + NOTES +*/ + +/*------------------------------ LobRegion ------------------*/ +/* + NAME + LobRegion - constructor for the class + + PARAMETERS + none + + DESCRIPTION + default constructor + + RETURNS + Nothing + + NOTES +*/ +template +LobRegion::LobRegion() +{ + _primary = (lobType *)0; + _primaryOffset = 0; + _offset = 0; + _length = 0; +} + +/*------------------------------ ~LobRegion ------------------*/ +/* + NAME + ~LobRegion - destructor for the class + + PARAMETERS + none + + DESCRIPTION + default constructor + + RETURNS + Nothing + + NOTES +*/ +template +LobRegion::~LobRegion() +{ + if (_primary != (lobType *)0) + { + delete _primary; + } +} + +template +lobType *LobRegion::getPrimary() +{ + return _primary; +} + +template +oraub8 LobRegion::getPrimaryOffset() +{ + return _primaryOffset; +} + +template +oraub8 LobRegion::getOffset() +{ + return _offset; +} + +template +oraub8 LobRegion::getLength() +{ + return _length; +} + +template +OCCI_STD_NAMESPACE::string LobRegion::getMimeType() +{ + return _mimeType; +} + +template +void LobRegion::setPrimary(const ConnectionImpl *connp, + OCILobLocator *locator) +{ + if (locator != (OCILobLocator *)0) + { + _primary = new lobType(connp, locator, true); + } +} + +#endif /* ORAXB8_DEFINED */ + +} /* end of namespace occi */ +} /* end of namespace oracle */ +#endif /* OCCIDATA_ORACLE */ + +#endif /* _olint */ diff --git a/sdk/include/occiObjects.h b/sdk/include/occiObjects.h new file mode 100755 index 0000000..1b301ad --- /dev/null +++ b/sdk/include/occiObjects.h @@ -0,0 +1,910 @@ +/* Copyright (c) 2000, 2007, Oracle. All rights reserved. */ + +/* + NAME + occiObjects.h - header file for OCCI object classes + + DESCRIPTION + Class definitions for Ref, RefAny, AnyData + + RELATED DOCUMENTS + + + EXPORT FUNCTION(S) + + + INTERNAL FUNCTION(S) + + + EXAMPLES + + NOTES + + + +*/ + +#ifndef _olint /* disable olint check */ + +#ifndef OCCIOBJECTS_ORACLE +# define OCCIOBJECTS_ORACLE + +#ifndef OCCICOMMON_ORACLE +#include +#endif + +namespace oracle { +namespace occi { +struct AnyDataCtx { + ConnectionImpl *occiSession; + OCIAnyData *anyData; + void *objHeader; + ub4 errNum; +}; +typedef struct AnyDataCtx AnyDataCtx; + +class PObject +{ + public: + enum LockOption {OCCI_LOCK_WAIT, OCCI_LOCK_NOWAIT}; + enum UnpinOption {OCCI_PINCOUNT_DECR, OCCI_PINCOUNT_RESET}; + static void destroy(void *); + static void refresh(void *); + PObject(); + PObject(const void *ctx); + PObject(const PObject& obj); + virtual ~PObject(); + PObject& operator=(const PObject& obj); + void *operator new(size_t size); + void *operator new(size_t size, const Connection *x, + const OCCI_STD_NAMESPACE::string& tablename, + const char *typeName); + void *operator new(size_t size, const Connection *sess, + const OCCI_STD_NAMESPACE::string& tablename, + const OCCI_STD_NAMESPACE::string& typName , + const OCCI_STD_NAMESPACE::string& schTabName="", + const OCCI_STD_NAMESPACE::string& schTypName = ""); + void *operator new(size_t size, const Connection *sess, + const UString& tablename, const UString &typName, + const UString& schTabName, const UString& schTypName); + void *operator new(size_t size, void *adctx); + void operator delete(void *obj, size_t size); + RefAny getRef() const; + bool isLocked() const; + void unpin(UnpinOption mode=OCCI_PINCOUNT_DECR); + void pin(); + void lock(PObject::LockOption lock_option); + void unmark(); + void flush(); + void markDelete(); + void markModified(); + bool isNull() const; + void setNull(); + const Connection *getConnection() const; + virtual OCCI_STD_NAMESPACE::string getSQLTypeName() const = 0; + virtual void getSQLTypeName(Environment *env, void **schName, + unsigned int &schNameLen, void **typeName, + unsigned int &typeNameLen) const = 0; + void getSQLTypeName(Environment *env, void *(*rSQL)(void *), + void **schname, unsigned int &schnamelen, + void **typname, unsigned int &typnamelen) const; + virtual void writeSQL(AnyData& stream) = 0; + virtual void readSQL(AnyData& stream) = 0; + private: + static void initialise( void * obj, const Connection * sess, + void *schTabName, unsigned int schTabLen, + void *tableName, unsigned int tabLen, + void *schTypName, unsigned int schTypLen, + void *typeName, unsigned int typLen); + + ConnectionImpl *occiSession_; + void *objHeader_; + ub2 customNewed_; + enum {CUSTOM_NEWED = 0x5cde}; + ub2 flags_; + enum {NULL_INFO = 0x0001, GARBAGE_COLLECTED = 0x0002, + REFRESH_OBJECT = 0x0004, + CACHED_OBJECT = 0xBAF8}; + //check PObject implementation for CACHED_OBJECT flag + // for future use + void *pobjectExt; + friend class RefImpl; +}; + +class AnyData +{ + public: + ~AnyData(); + AnyData(void *any) ; + AnyData(const Connection *sessp); + AnyData(const Connection *sessp, OCIAnyData *any, bool freeImg = true) ; + + AnyData(const AnyData &src); + AnyData& operator = (const AnyData &src); + + OCIAnyData* getOCIAnyData() const; + const Connection* getConnection() const; + + + bool isNull() const ; + void setNull() ; + OCCI_STD_NAMESPACE::string getString() const ; + UString getUString() const ; + Blob getBlob() const ; + Clob getClob() const ; + Bfile getBfile() const ; + BFloat getBFloat() const ; + BDouble getBDouble() const ; + Number getNumber() const ; + Bytes getBytes() const ; + Date getDate() const ; + Timestamp getTimestamp() const ; + IntervalYM getIntervalYM() const ; + IntervalDS getIntervalDS() const ; + PObject *getObject(void *(*rSQL)(void *)) const ; + RefAny getRef() const ; + + void setString(const OCCI_STD_NAMESPACE::string &str) ; + void setUString(const UString &str) ; + void setBlob(const Blob &blob) ; + void setClob(const Clob &clob) ; + void setBfile(const Bfile &bfile) ; + void setBFloat(const BFloat &n) ; + void setBDouble(const BDouble &n) ; + void setNumber(const Number &n) ; + void setBytes(const Bytes &bytes) ; + void setDate(const Date &date) ; + void setTimestamp(const Timestamp ×tamp) ; + void setIntervalYM(const IntervalYM &intervalym) ; + void setIntervalDS(const IntervalDS &intervalds) ; + void setObject(const PObject *objptr) ; + void setRef(const RefAny &ref) ; + + void setFromString(const OCCI_STD_NAMESPACE::string &str) ; + void setFromBfile(const Bfile &bfile) ; + void setFromBFloat(const BFloat &n) ; + void setFromBDouble(const BDouble &n) ; + void setFromNumber(const Number &n) ; + void setFromBytes(const Bytes &bytes) ; + void setFromDate(const Date &date) ; + void setFromTimestamp(const Timestamp ×tamp) ; + void setFromIntervalYM(const IntervalYM &intervalym) ; + void setFromIntervalDS(const IntervalDS &intervalds) ; + void setFromObject(const PObject *objptr) ; + void setFromRef(const RefAny &ref, + const OCCI_STD_NAMESPACE::string &typname, + const OCCI_STD_NAMESPACE::string &schname) ; + + OCCI_STD_NAMESPACE::string getAsString() const ; + Bfile getAsBfile() const ; + BFloat getAsBFloat() const ; + BDouble getAsBDouble() const ; + Number getAsNumber() const ; + Bytes getAsBytes() const ; + Date getAsDate() const ; + Timestamp getAsTimestamp() const ; + IntervalYM getAsIntervalYM() const ; + IntervalDS getAsIntervalDS() const ; + PObject *getAsObject() const ; + RefAny getAsRef() const ; + + TypeCode getType() const; + + private: + + + // private data members + Ptr anyDataImplPtr; + + +}; + +template +class Ref +{ + public: + + Ref(); + Ref(const T *obj) ; + Ref(const RefAny &refAny) ; + Ref(const Ref &src) ; + Ref(const Connection *sessp, OCIRef *tref, bool copy=TRUE) + ; + ~Ref(); + Ref& operator=(const Ref &src) + ; + Ref& operator=(const T *obj) ; + Ref& operator=(const RefAny &src); + T * operator->() ; + T * ptr() ; + T & operator *() ; + const T * operator->() const; + const T * ptr() const; + const T & operator *() const ; + void markDelete() ; + void unmarkDelete() ; + void setNull(); + bool isNull() const; + void clear() ; + bool isClear() const; + void setPrefetch(const OCCI_STD_NAMESPACE::string &typeName, + unsigned int depth); + void setPrefetch(const OCCI_STD_NAMESPACE::string &schName, + const OCCI_STD_NAMESPACE::string &typeName, + unsigned int depth); + void setPrefetch(const UString &schName, + const UString &typeName, + unsigned int depth); + void setPrefetch(unsigned int depth) ; + void setLock(LockOptions ); + operator RefAny() const; + OCIRef *getRef() const; + const Connection *getConnection() const; + bool operator == (const Ref &ref) const; + bool operator != (const Ref &ref) const; + bool operator == (const RefAny &refAnyR) const ; + bool operator != (const RefAny &refAnyR) const ; + OCIComplexObject *getCor() const; + void setPinnedObject(PObject *objPtr); + private: + + RefImpl *rimplPtr; +}; + + +class RefImpl +{ + public: + + RefImpl(); + RefImpl(PObject *obj) ; + RefImpl(const RefAny &refAny) ; + RefImpl(const RefImpl &src) ; + RefImpl(const Connection *sessp, OCIRef *tref, + bool copy=TRUE) ; + ~RefImpl(); + bool isNull() const ; + void setNull() ; + void markDelete() ; + void unmarkDelete() ; + void clear() ; + bool isClear() const ; + void setPrefetch(const OCCI_STD_NAMESPACE::string &typeName, + unsigned int depth) ; + void setPrefetch(const OCCI_STD_NAMESPACE::string &schName, + const OCCI_STD_NAMESPACE::string &typeName, + unsigned int depth); + void setPrefetch(const UString &schName, + const UString &typeName, + unsigned int depth); + void setPrefetch(unsigned int depth) ; + void setLock(LockOptions lckOption) ; + PObject *pin() ; + void unpin(PObject *obj) ; + void setRefFromObjPtr(const PObject *obj) ; + OCIRef* getRef() const; + void setRefImpl(RefImpl *rptr); + const Connection * getConnection() const; + bool operator == (const RefImpl &refI) const ; + bool operator == (const RefAny &refAnyR) const ; + void assignObj(PObject *newObjPtr) ; + void assignRefAny(const RefAny &src) ; + // added following methods + bool isEqual(PObject *obj); + void operator = ( const RefImpl &src); + OCIComplexObject *getCor() const; + void setPinnedObject( PObject *objPtr); + private: + + OCIRef *ref; + const ConnectionImpl *sessp; + OCIComplexObject *corhp; + OCCI_STD_NAMESPACE::list descriptorList; + LockOptions lockOption; + // added data member for object header + void *objHeader; + //common implementation function for setPrefetch + void do_setPrefetch(void *schName, unsigned int schNameLen, + void *typeName, unsigned int typeNameLen, + unsigned int depth); +}; + + +class RefAny +{ + public: + + RefAny(); + RefAny (const Connection *sessptr, const OCIRef *ref); + RefAny (const Connection *sessptr, const OCIRef *ref, bool isowner); + ~RefAny() ; + RefAny(const RefAny& src) ; + RefAny& operator=(const RefAny& src) ; + void markDelete() ; + void unmarkDelete() ; + void clear() ; + bool isNull() const; + OCIRef * getRef() const; + const Connection * getConnection() const; + bool operator == (const RefAny &refAnyR) const; + bool operator != (const RefAny &refAnyR) const; + bool isOwner() const; + + private: + + OCIRef *ref; + const ConnectionImpl *sessp; + // for future use + void *refanyExt; + bool owner; + + friend RefAny MetaData::getRef(MetaData::AttrId) const; + friend RefAny PObject::getRef() const; + friend class AnyDataImpl; + friend class ResultSetImpl; + friend class StatementImpl; + friend void getVector(const ResultSet *rs, + unsigned int colIndex, + OCCI_STD_NAMESPACE::vector &vect) ; + friend void getVector(const Statement *stmt, + unsigned int colIndex, + OCCI_STD_NAMESPACE::vector &vect) ; +}; + +template +Ref::Ref() +{ + rimplPtr = new RefImpl(); +} + +template +Ref::Ref(const T *obj) +{ + rimplPtr = new RefImpl((PObject *)obj); +} + +template +Ref::Ref(const RefAny &refAny) + +{ + rimplPtr = new RefImpl(refAny); +} + +template +Ref::Ref(const Ref& src) + +{ + rimplPtr = new RefImpl(*(src.rimplPtr)); +} + +template +Ref::Ref(const Connection *sessp, OCIRef *tref, bool copy) + +{ + rimplPtr = new RefImpl(sessp, tref, copy); +} + +template +Ref::~Ref() +{ + delete rimplPtr; +} + + +template +Ref& Ref::operator=(const Ref &src) +{ + if (&src == this) + return *this; + *rimplPtr = *(src.rimplPtr); + return *this; +} + +template +Ref& Ref::operator=(const T *obj) +{ + if (rimplPtr->isEqual((PObject *)obj)) + return *this; + rimplPtr->assignObj((PObject *)obj); + return *this; +} + +template +Ref& Ref::operator=(const RefAny &src) +{ + rimplPtr->assignRefAny(src); + return *this; +} + +template +T* Ref::operator->() +{ + return ((T *)rimplPtr->pin()); +} + +template +T* Ref::ptr() +{ + return ((T *)rimplPtr->pin()); +} + +template +T& Ref::operator * () +{ + return ((T &)(*(rimplPtr->pin()))); +} + +template +const T* Ref::operator->() const +{ + return ((const T *)rimplPtr->pin()); +} + +template +const T* Ref::ptr() const +{ + return ((const T *)rimplPtr->pin()); +} + +template +const T& Ref::operator * () const +{ + return ((const T &)(*(rimplPtr->pin()))); +} + +template +void Ref::markDelete () +{ + rimplPtr->markDelete(); +} + +template +void Ref::unmarkDelete () +{ + rimplPtr->unmarkDelete(); +} + +template +void Ref::setNull() +{ + rimplPtr->setNull(); +} + +template +bool Ref::isNull() const +{ + return rimplPtr->isNull(); +} + +template +void Ref::clear () +{ + rimplPtr->clear(); +} + +template +bool Ref::isClear() const +{ + return rimplPtr->isClear(); +} + +template +void Ref::setPrefetch (const OCCI_STD_NAMESPACE::string &typeName, +unsigned int depth) + +{ + rimplPtr->setPrefetch(typeName,depth); +} + +template +void Ref::setPrefetch (const OCCI_STD_NAMESPACE::string &schemaName, +const OCCI_STD_NAMESPACE::string &typeName, +unsigned int depth) + +{ + rimplPtr->setPrefetch(schemaName,typeName,depth); +} + +template +void Ref::setPrefetch (const UString &schemaName, +const UString &typeName, +unsigned int depth) + +{ + rimplPtr->setPrefetch(schemaName,typeName,depth); +} + +template +void Ref::setPrefetch (unsigned int depth) + +{ + rimplPtr->setPrefetch(depth); +} + +template +void Ref::setLock (LockOptions lckOption) +{ + rimplPtr->setLock(lckOption); +} + +template +OCIRef* Ref::getRef() const +{ + return (rimplPtr->getRef()); +} + +template +const Connection* Ref::getConnection () const +{ + return (rimplPtr->getConnection()); +} + +template +Ref::operator RefAny () const +{ + if (isNull()) + return RefAny(); + return (RefAny(rimplPtr->getConnection(), rimplPtr->getRef())); +} + +template +bool Ref::operator ==(const Ref &ref) const + +{ + return ( (*rimplPtr) == (*(ref.rimplPtr)) ); +} + +template +bool Ref::operator !=(const Ref &ref) const + +{ + return ( !((*rimplPtr) == (*(ref.rimplPtr))) ); +} + +template +bool Ref::operator == (const RefAny & refAnyR) const + +{ + return ( (*rimplPtr) == refAnyR ); +} + +template +bool Ref::operator != (const RefAny & refAnyR) const + +{ + return ( !((*rimplPtr) == refAnyR )); +} + +template +OCIComplexObject * Ref::getCor() const +{ + return (rimplPtr->getCor()); +} + +template < class T> +void Ref::setPinnedObject( PObject *objPtr) +{ + rimplPtr->setPinnedObject(objPtr); +} + +/*--------------------------------------------------------------------------- + PROTOTYPES USED BY FUNCTION TEMPLATES + ---------------------------------------------------------------------------*/ + void getVectorOfOCIRefs( const AnyData &any, + OCCI_STD_NAMESPACE::vector &vect); + void getVectorOfPObjects( const AnyData &any, + OCCI_STD_NAMESPACE::vector< PObject* > &vect, + void *(*rSQL)(void *)) ; + void setVectorOfOCIRefs( AnyData &any, + const OCCI_STD_NAMESPACE::vector &vect, + const OCCI_STD_NAMESPACE::vector< OCIInd> &vec_ind) ; + void setVectorOfPObjects( AnyData &any, + const OCCI_STD_NAMESPACE::vector< PObject* > &vect) ; + +/*--------------------------------------------------------------------------- + EXPORT FUNCTIONS + ---------------------------------------------------------------------------*/ + +/*------------------- getVector for POBject----------------------------*/ +/* + NAME + getVector - overloaded function. Retrieves the attribute in the + current position as a vector of PObject + + PARAMETERS + any - AnyData + vect- reference to vector of PObject (OUT parameter). + + DESCRIPTION + Retrieves the attribute in the current position as a vector + of PObject + The attribute at the current position should be a collection + type (varray or nested table). The SQL type of the elements in + the collection should be compatible with PObject + + RETURNS + nothing + + NOTES + compatible SQL types : user defined types (SQLT_NTY) etc. +*/ + +#if defined(WIN32COMMON) || defined(__MVS__) +// and other platforms that do not support +// partial function template specialization + template + void getVector(const AnyData &any, OCCI_STD_NAMESPACE::vector &vect, + void *(*rSQL)(void *)) + { + OCCI_STD_NAMESPACE::vector< PObject *> vec_pobj; + getVectorOfPObjects( any, vec_pobj, rSQL); + + vect.clear(); + unsigned int size= vec_pobj.size(); + vect.reserve( size ); + for( unsigned int i=0; i< size; i++) + vect.push_back( (T)vec_pobj[i] ); + } +#else + template + void getVector(const AnyData &any, OCCI_STD_NAMESPACE::vector &vect, + void *(*rSQL)(void *)) + { + OCCI_STD_NAMESPACE::vector< PObject *> vec_pobj; + getVectorOfPObjects( any, vec_pobj, rSQL); + + vect.clear(); + unsigned int size= vec_pobj.size(); + vect.reserve( size ); + for( unsigned int i=0; i< size; i++) + vect.push_back( (T*)vec_pobj[i] ); + } +#endif /* end of #ifdef WIN32COMMON */ + + /*------------------- getVector for Ref----------------------------*/ +/* + NAME + getVector - overloaded function. Retrieves the attribute in the + current position as a vector of PObject + + PARAMETERS + any - AnyData + vect- reference to vector of PObject (OUT parameter). + + DESCRIPTION + Retrieves the attribute in the current position as a vector + of PObject + The attribute at the current position should be a collection + type (varray or nested table). The SQL type of the elements in + the collection should be compatible with PObject + + RETURNS + nothing + + NOTES + compatible SQL types : user defined types (SQLT_NTY) etc. +*/ +#if !defined(WIN32COMMON) && !defined(__MVS__) + template + void getVector(const AnyData &any,OCCI_STD_NAMESPACE::vector< Ref > &vect) + { + OCCI_STD_NAMESPACE::vector< void *> vec_ref; + getVectorOfOCIRefs( any, vec_ref); + + vect.clear(); + unsigned int size = vec_ref.size(); + vect.reserve( size ); + const Connection *sess = any.getConnection(); + + for (unsigned int i=0; i< size; i++) + { + if (vec_ref[i] == (OCIRef *)0) + vect.push_back(Ref()); // pushing a default-constructed Ref + else + vect.push_back(Ref(sess, (OCIRef *)vec_ref[i], FALSE)); + } + } +#endif /* end of #ifndef WIN32COMMON */ + +/*-----------------------setVector for PObject--------------------------*/ +/* + NAME + setVector - overloaded function. sets the attribute in the current + position of anydata with the vector elements. + + PARAMETERS + none. + + DESCRIPTION + sets the attribute in the current position in anydata with the + vector elements. + The attribute in the current position of anydata should be a + collection type. If the collection type is a varray, the input vector + size should be equal to the size of the varray. Also the SQL type of + the collection's elements should be compatible with PObject. + + RETURNS + nothing. + + NOTES + compatible SQL types : SQLT_NTY (user defined types). +*/ +#if defined(WIN32COMMON) || defined(__MVS__) +// and other platforms that do not support +// partial function template specialization + + template + void setVector(AnyData &any, const OCCI_STD_NAMESPACE::vector &vect) + { + OCCI_STD_NAMESPACE::vector< PObject *> vec_pobj; + unsigned int size= vect.size(); + vec_pobj.reserve( size ); + for( unsigned int i=0; i< size; i++) + vec_pobj.push_back( vect[i] ); + setVectorOfPObjects( any, vec_pobj); + + } + +#else + + template + void setVector(AnyData &any, const OCCI_STD_NAMESPACE::vector &vect) + { + OCCI_STD_NAMESPACE::vector< PObject *> vec_pobj; + unsigned int size= vect.size(); + vec_pobj.reserve( size ); + for( unsigned int i=0; i< size; i++) + vec_pobj.push_back( vect[i] ); + setVectorOfPObjects( any, vec_pobj); + + } +#endif /* end of #ifdef WIN32COMMON */ + +/*-----------------------setVector for Ref--------------------------*/ +/* + NAME + setVector - overloaded function. sets the attribute in the current + position of anydata with the vector elements. + + PARAMETERS + none. + + DESCRIPTION + sets the attribute in the current position in anydata with the + vector elements. + The attribute in the current position of anydata should be a + collection type. If the collection type is a varray, the input vector + size should be equal to the size of the varray. Also the SQL type of + the collection's elements should be compatible with PObject. + + RETURNS + nothing. + + NOTES + compatible SQL types : SQLT_NTY (user defined types). +*/ +#if !defined(WIN32COMMON) && !defined(__MVS__) + template + void setVector(AnyData &any, const OCCI_STD_NAMESPACE::vector< Ref > &vect) + { + OCCI_STD_NAMESPACE::vector< void *> vec_ref; + OCCI_STD_NAMESPACE::vector vec_ind; + + unsigned int size= vect.size(); + vec_ref.reserve( size ); + vec_ind.reserve( size ); + for( unsigned int i=0; i< size; i++) + { + vec_ref.push_back( vect[i].getRef() ); + vec_ind.push_back(vect[i].isNull() ? OCI_IND_NULL : OCI_IND_NOTNULL); + } + setVectorOfOCIRefs( any, vec_ref, vec_ind); + + } +#endif /* end of #ifndef WIN32COMMON */ + +// Platform independent get/setVectorOfRefs method added +// get(set)Vector of Ref and get(set)VectorOfRefs are identical +// in functionality. + + /*------------------- getVectorOfRefs for Ref----------------------------*/ +/* + NAME + getVectorOfRefs - overloaded function. Retrieves the attribute in the + current position as a vector of PObject + + PARAMETERS + any - AnyData + vect- reference to vector of PObject (OUT parameter). + + DESCRIPTION + Retrieves the attribute in the current position as a vector + of PObject + The attribute at the current position should be a collection + type (varray or nested table). The SQL type of the elements in + the collection should be compatible with PObject + + RETURNS + nothing + + NOTES + compatible SQL types : user defined types (SQLT_NTY) etc. +*/ + + template + void getVectorOfRefs(const AnyData &any, + OCCI_STD_NAMESPACE::vector< Ref > &vect) + { + OCCI_STD_NAMESPACE::vector< void *> vec_ref; + getVectorOfOCIRefs( any, vec_ref); + + vect.clear(); + unsigned int size = vec_ref.size(); + vect.reserve( size ); + const Connection *sess = any.getConnection(); + + for (unsigned int i=0; i< size; i++) + { + if (vec_ref[i] == (OCIRef *)0) + vect.push_back(Ref()); // pushing a default-constructed Ref + else + vect.push_back(Ref(sess, (OCIRef *)vec_ref[i], FALSE)); + } + } + +/*-----------------------setVectorOfRefs for Ref--------------------------*/ +/* + NAME + setVectorOfRefs - overloaded function. sets the attribute in the current + position of anydata with the vector elements. + + PARAMETERS + none. + + DESCRIPTION + sets the attribute in the current position in anydata with the + vector elements. + The attribute in the current position of anydata should be a + collection type. If the collection type is a varray, the input vector + size should be equal to the size of the varray. Also the SQL type of + the collection's elements should be compatible with PObject. + + RETURNS + nothing. + + NOTES + compatible SQL types : SQLT_NTY (user defined types). +*/ + + template + void setVectorOfRefs(AnyData &any, + const OCCI_STD_NAMESPACE::vector< Ref > &vect) + + { + OCCI_STD_NAMESPACE::vector< void *> vec_ref; + OCCI_STD_NAMESPACE::vector vec_ind; + + unsigned int size= vect.size(); + vec_ref.reserve( size ); + vec_ind.reserve( size ); + for( unsigned int i=0; i< size; i++) + { + vec_ref.push_back( vect[i].getRef() ); + vec_ind.push_back(vect[i].isNull() ? OCI_IND_NULL : OCI_IND_NOTNULL); + } + setVectorOfOCIRefs( any, vec_ref, vec_ind); + + } + + +/*--------------------------------------------------------------------------- + INTERNAL FUNCTIONS + ---------------------------------------------------------------------------*/ + + +} /* end of namespace occi */ +} /* end of namespace oracle */ +#endif /* OCCIOBJECTS_ORACLE */ + +#endif /* _olint */ diff --git a/sdk/include/oci.h b/sdk/include/oci.h new file mode 100755 index 0000000..3735893 --- /dev/null +++ b/sdk/include/oci.h @@ -0,0 +1,3066 @@ +/* Copyright (c) 1995, 2011, Oracle and/or its affiliates. +All rights reserved. */ + +/* + NAME + oci.h - V8 Oracle Call Interface public definitions + + DESCRIPTION + This file defines all the constants and structures required by a V8 + OCI programmer. + + RELATED DOCUMENTS + V8 OCI Functional Specification + Oracle Call Interface Programmer's Guide Vol 1 and 2 + + INSPECTION STATUS + Inspection date: + Inspection status: + Estimated increasing cost defects per page: + Rule sets: + + ACCEPTANCE REVIEW STATUS + Review date: + Review status: + Reviewers: + + PUBLIC FUNCTION(S) + None + + PRIVATE FUNCTION(S) + None + + EXAMPLES + + NOTES + + + MODIFIED (MM/DD/YY) + umabhat 05/29/11 - Backport umabhat_bug-10209825 from main + slari 03/24/11 - add OCI_ATTR_RESERVED_438 and OCI_ATTR_RESERVED_439 + rphillip 09/28/10 - Bug 9835605: recnum changes + rphillip 08/03/09 - Bug 8720046: add OCI_ATTR_DIRPATH_USE_ACTIVE_TRANS + mbastawa 03/15/10 - add OCI_FETCH_RESERVED_6 + ebatbout 12/28/09 - 8465341: Add OCI_ATTR_DIRPATH_RESERVED_22 + ssahu 04/15/09 - Add user handle as an attribute to session pool + handle + dalpern 03/17/09 - bug 7646876: applying_crossedition_trigger + kneel 11/21/08 - bump OCI version to 11.2 + thoang 09/24/08 - include ocixstream.h + asohi 08/25/08 - Bug 7320582 : AQ dequeue navigation flags fix + thoang 08/04/08 - Add XStream attributes + msowdaga 07/23/08 - Add flag OCI_SESSGET_SYSDBA + rphillip 03/21/08 - Add partition memory attribute + nikeda 04/15/08 - Support OCIP_ATTR_CONTYPE + mbastawa 12/24/07 - add server, envhp attributes + slynn 03/18/08 - + amullick 02/11/08 - add support for OCILobGet/SetContentType + tbhosle 01/07/08 - add OCI_ATTR_SUBSCR_IPADDR + nikeda 12/19/07 - Add OCI_SUBSCR_QOS_HAREG + rphillip 10/22/07 - Add OCI_ATTR_DIRPATH_NO_INDEX_ERRORS + debanerj 12/14/07 - Added OCI_ATTR_RESERVED_38 and OCI_ATTR_RESERVED_39 + umabhat 09/20/07 - bug6119750 added OCI_FNCODE_APPCTXSET & + OCI_FNCODE_APPCTXCLEARALL + debanerj 04/10/07 - XDS Attributes + msakayed 05/24/07 - Bug #5095734: add OCI_ATTR_DIRPATH_RESERVED_19 + schoi 03/02/07 - Get/SetOptions API change + ebatbout 03/30/07 - 5598333: Add OCI_ATTR_DIRPATH_RESERVED_18 + nikeda 03/21/07 - Add OCI_ATTR_RESERVED_37 + abande 03/06/07 - Remove attributes for global stmt cache and + metadata cache + rphillip 02/20/07 - Add OCI_ATTR_DIRPATH_RESERVED_17 + shan 11/16/06 - bug 5595911. + msakayed 12/04/06 - Bug #5660845: add OCI_DIRPATH_INPUT_OCI + gviswana 10/26/06 - Remove OCI_ATTR_CURRENT_EDITION + maramali 09/29/06 - bug 5568492, added OCI_NLS_LOCALE_A2_ISO_2_ORA + gviswana 09/29/06 - CURRENT_EDITION -> EDITION + aramappa 09/20/06 - Update major and minor version information + slynn 07/28/06 - Migrate to new 11g LOB terminiology + debanerj 07/20/06 - Add OCI_ATTR_LOBPREFETCH_LENGTH + mbastawa 06/25/06 - add OCI_ATTR_RESERVED_36 + hqian 05/22/06 - 11gR1 proj-18303: add OCI_SYSASM + dkogan 04/06/06 - disable charset validation by default + jhealy 05/15/06 - Add TimesTen OCI adapter. + slynn 06/20/06 - GetSharedRegions + rthammai 06/13/06 - add reserved attribute + msakayed 06/15/06 - Project 20586: interval partitioning support + debanerj 10/25/05 - LOB prefetch + slynn 05/25/06 - New NG Lob Functionality. + yujwang 05/16/06 - Add OCI_ATTR_RESERVED_33, OCI_ATTR_RESERVED_34 + abande 04/25/06 - 18297: Add attributes for global stmt cache and + metadata cache + ssvemuri 04/26/06 - Constants for Query Notification support + jgiloni 05/05/06 - Add OCI_ATCH_RESERVED_7 + mxyang 02/01/06 - Added OCI_ATTR_CURRENT_EDITION attribute + hqian 05/04/06 - new runtime capability attribute for asm volume + nikeda 06/06/06 - OCI_TT: Add new OCIP attributes + aramappa 04/17/06 - Added OCI_FNCODE_ARRAYDESCRIPTORALLOC and + OCI_FNCODE_ARRAYDESCRIPTORFREE + debanerj 05/04/06 - 18313: OCI Net Fusion + rupsingh 05/26/06 - + jacao 05/11/06 - + absaxena 04/17/06 - add notification grouping attributes + rpingte 02/02/06 - add OCI_ATCH_RESERVED_6 + rpingte 04/27/06 - Add OCI_ATTR_DRIVER_NAME + jawilson 02/14/06 - add OCI_FNCODE_AQENQSTREAM + kneel 04/03/06 - Adding support in kjhn for critical severity + rphillip 03/31/06 - Add OCI_ATTR_DIRPATH_RESERVED_14 + mxyang 02/01/06 - Added OCI_ATTR_APPLICATION_EDITION attribute + rphillip 01/30/06 - Add new DPAPI attrs + ebatbout 11/03/05 - Add direct path support for multiple subtypes + porangas 02/22/06 - 5055398: Define OCI_STMT_CALL + mbastawa 01/31/06 - add OCI_ATTR_RESERVED_26 + yohu 01/27/06 - align Execution Modes macros + sjanardh 01/25/06 - add OCI_EXEC_RESERVED_6 + sichandr 01/18/06 - add OCI_ATTR_XMLTYPE_BINARY_XML + yohu 12/22/05 - add OCI_TRANS_PROMOTE + srseshad 09/12/05 - stmtcache: callback + krajan 10/25/05 - Added ENABLE_BEQUEATH attach flag + mbastawa 09/16/05 - dbhygiene + porangas 07/20/04 - 1175350: adding attribute for ognfd + chliang 06/30/05 - add OCI_SUPPRESS_NLS_VALIDATION mode + aahluwal 03/15/05 - [Bug 4235014]:add ASM, Preconnect events + ssappara 08/12/04 - Bug3669429 add OCI_ATTR_DESC_SYNBAS + absaxena 03/24/05 - remove OCI_AQ_RESERVED_5 + mbastawa 03/01/05 - add OCI_EXEC_RESERVED_5 + msakayed 02/15/05 - Bug #3147299: Add OCI_ATTR_CURRENT_ERRCOL + aahluwal 01/11/05 - [Bug 3944589]: add OCI_AUTH_RESERVED_5 + nikeda 11/15/04 - Add OCIP_IIO + rvissapr 11/10/04 - bug 3843644 - isencrypted + hohung 11/22/04 - add OCI_BIND_RESERVED_3 + cchui 10/25/04 - add OCI_ATTR_PROXY_CLIENT + aahluwal 09/27/04 - add incarnation, reason, cardinality to event handle + msakayed 09/14/04 - column encryption support (project id 5578) + jacao 08/17/04 - Add OCI_ATTR_DB_CHARSET_ID + mhho 08/29/04 - resolve conflicting mode declaration + sgollapu 05/28/04 - Add OCI_AUTH_RESERVED_3 + mbastawa 08/05/04 - add OCI_ATTR_RESERVED_21 + ebatbout 07/27/04 - add OCI_ATTR_DIRPATH_RESERVED_9 and move all direct + path attributes into a separate area in this file. + clei 06/29/04 - add OCI_ATTR_ENCC_SIZE + weiwang 05/06/04 - add OCIAQListenOpts and OCIAQLisMsgProps + weiwang 04/30/04 - add OCI_AQ_RESERVED_5 + nbhatt 04/27/04 - add new attribute + ssvemuri 06/19/04 - change notification descriptors and attributes + ksurlake 06/01/04 - grabtrans 'ksurlake_txn_skmishra_clone' + ksurlake 05/13/04 - add subscriber handle attributes + mbastawa 06/01/04 - add 3 more OCI_FETCH_RESERVED modes + chliang 05/28/04 - add nchar literal replacement modes + nikeda 05/14/04 - [OLS on RAC] new authentication mode + debanerj 05/17/04 - 13064: add fncodes for LOB array Read and Write + nikeda 05/20/04 - [OCI Events] Add incarnation, cardinality,reason + nikeda 05/18/04 - [OCI Events] Add OCI_ATTR_SERVICENAME + nikeda 05/17/04 - Add event handle + nikeda 05/13/04 - [OCI Events] Rename HACBK->EVTCBK, HACTX->EVTCTX + nikeda 05/10/04 - [OCI Events] code review changes + nikeda 04/15/04 - [OCI Events] OCI_SESSRLS_DROPSESS_FORCE + nikeda 04/12/04 - [OCI Events] Add OCI_ATTR_USER_MEMORY + aahluwal 04/12/04 - add OCI_HNDLFR_RESERVED5 + vraja 04/28/04 - add options for redo sync on commit + aahluwal 05/29/04 - [OCI Events]: add support for svc, svc member events + nikeda 05/28/04 - grabtrans 'nikeda_oci_events_copy' + nikeda 05/18/04 - [OCI Events] Add OCI_ATTR_SERVICENAME + nikeda 05/17/04 - Add event handle + nikeda 05/13/04 - [OCI Events] Rename HACBK->EVTCBK, HACTX->EVTCTX + nikeda 05/10/04 - [OCI Events] code review changes + nikeda 04/15/04 - [OCI Events] OCI_SESSRLS_DROPSESS_FORCE + nikeda 04/12/04 - [OCI Events] Add OCI_ATTR_USER_MEMORY + aahluwal 04/12/04 - add OCI_HNDLFR_RESERVED5 + jciminsk 04/28/04 - merge from RDBMS_MAIN_SOLARIS_040426 + jacao 03/06/04 - add OCI_ATTR_CURRENT_SCHEMA + aahluwal 01/20/04 - remove OCI_KEEP_FETCH_STATE + aahluwal 03/25/04 - [OCI Events] add OCI_HTYPE_HAEVENT and related attrs + nikeda 03/19/04 - [OCI Events] Add OCI_ATTR_HACBK and OCI_ATTR_HACTX + dfrumkin 12/04/03 - Add database startup/shutdown + chliang 12/22/03 - grid/main merge: add OCI_ATTR_RESERVED_20 + jciminsk 12/12/03 - merge from RDBMS_MAIN_SOLARIS_031209 + sgollapu 09/19/03 - Add fetch modes + sgollapu 07/30/03 - Add TSM attributes + sgollapu 06/26/03 - Add OCI_MUTEX_TRY + aime 06/23/03 - sync grid with main + sgollapu 06/07/03 - Add reserved attribute + sgollapu 06/05/03 - Add reserved auth flag + rpingte 05/22/03 - Add OCI_ATCH_RESERVED_5 + sgollapu 05/06/03 - Add TSM attributes + sgollapu 04/10/03 - Session migration Flags/interfaces + dfrumkin 04/23/04 - add OCI_PREP2_RESERVED_1 + rpingte 05/06/04 - add major and minor version information + bsinha 04/06/04 - add new OCI_TRANS flag + chliang 11/26/03 - add OCI_ATTR_RESERVED_19 + preilly 10/23/03 - Make OCI_ATTR_DIRPATH_METADATA_BUF private + chliang 08/07/03 - add OCI_ATTR_SKIP_BUFFER + srseshad 03/12/03 - convert public oci api to ansi + weiwang 05/14/03 - remove iot creation for rule sets + rkoti 04/15/03 - [2746515] add fntcodes for Unlimited size LOB 6003 + tcruanes 05/13/03 - add slave SQL OCI execution mode + rkoti 02/21/03 - [2761455] add OCI_FNCODE_AQENQARRAY, + OCI_FNCODE_AQDEQARRAY and update OCI_FNCODE_MAXFCN + tkeefe 01/29/03 - bug-2773794: Add new interface for setting Kerb attrs + aahluwal 02/06/03 - add OCI_ATTR_TRANSFORMATION_NO + weiwang 12/05/02 - add OCI_ATTR_USER_PROPERTY + ataracha 01/03/03 - include ocixmldb.h + preilly 12/05/02 - Add wait attribute for locking when using dir path + tkeefe 01/03/03 - bug-2623771: Added OCI_ATTR_KERBEROS_KEY + lchidamb 12/13/02 - end-to-end tracing attributes + msakayed 10/28/02 - Bug #2643907: add OCI_ATTR_DIRPATH_SKIPINDEX_METHOD + rphillip 11/13/02 - Add OCIP_ATTR_DIRPATH_INDEX + sagrawal 10/13/02 - liniting + sagrawal 10/03/02 - PL/SQL Compiler warnings + jstenois 11/07/02 - remove ocixad.h + chliang 10/21/02 - add OCI_ATTR_RESERVED_16,17 + hsbedi 10/30/02 - grabtrans 'jstenois_fix_xt_convert' + aahluwal 10/12/02 - add OCI_ATTR_AQ_NUM_E_ERRORS/OCI_ATTR_AQ_ERROR_INDEX + bdagevil 10/21/02 - add SQL analyze internal exec mode + csteinba 10/11/02 - add OCI_ATTR_RESERVED_16 + chliang 10/12/02 - add bind row callback attributes + preilly 10/25/02 - Add new reserved parameters + tkeefe 10/31/02 - bug-2623771: Added OCI_ATTR_AUDIT_SESSION_ID + csteinba 10/04/02 - Add OCI_ATTR_RESERVED_15 + mhho 10/11/02 - add new credential constant + thoang 09/25/02 - Add OCI_XMLTYPE_CREATE_CLOB + skaluska 10/07/02 - describe rules objects + csteinba 09/16/02 - Remove OCI_CACHE + gtarora 10/03/02 - OCI_ATTR_COL_SUBS => OCI_ATTR_OBJ_SUBS + msakayed 09/09/02 - Bug #2482469: add OCI_ATTR_DIRPATH_RESERVED_[3-6] + aahluwal 08/30/02 - adding dequeue across txn group + srseshad 04/24/02 - Add attribute OCI_ATTR_SPOOL_STMTCACHESIZE. + ebatbout 07/22/02 - Remove OCI_ATTR_RESERVED_11. + abande 01/17/02 - Bug 1788921; Add external attribute. + aahluwal 06/04/02 - bug 2360115 + pbagal 05/24/02 - Incorporate review comments + pbagal 05/22/02 - Introduce instance type attribute. + whe 07/01/02 - add OCI_BIND_DEFINE_SOFT flags + gtarora 07/01/02 - Add OCI_ATTR_COL_SUBS + tkeefe 05/30/02 - Add support for new proxy authentication credentials + dgprice 12/18/01 - bug 2102779 add reserved force describe + schandir 11/19/01 - add/modify modes. + schandir 11/15/01 - add OCI_SPC_STMTCACHE. + schandir 12/06/01 - change mode value of OCI_SPOOL. + msakayed 11/02/01 - Bug #2094292: add OCI_ATTR_DIRPATH_INPUT + dsaha 11/09/01 - add OCI_DTYPE_RESERVED1 + skabraha 11/05/01 - new method flag + skabraha 10/25/01 - another flag for XML + skabraha 10/11/01 - describe flags for subtypes + nbhatt 09/18/01 - new reserved AQ flags + celsbern 10/19/01 - merge LOG to MAIN + ksurlake 10/12/01 - add OCI_ATTR_RESERVED_13 + ksurlake 08/13/01 - add OCI_ATTR_RESERVED_12 + schandir 09/24/01 - Adding stmt caching + abande 09/04/01 - Adding session pooling + sagrawal 10/23/01 - add new bit for OCIPHandleFree + preilly 10/25/01 - Add support for specifying metadata on DirPathCtx + skabraha 09/24/01 - describe flags for XML type + schandir 09/24/01 - Adding stmt caching + abande 09/04/01 - Adding session pooling + stakeda 09/17/01 - add OCI_NLS_CHARSET_ID + whe 09/19/01 - add OCIXMLType create options + rpingte 09/11/01 - add OCI_MUTEX_ENV_ONLY and OCI_NO_MUTEX_STMT + cmlim 08/28/01 - mod datecache attrs to use same naming as dpapi attrs + wzhang 08/24/01 - Add new keywords for OCINlsNameMap. + rphillip 05/02/01 - Add date cache attributes + rphillip 08/22/01 - Add new stream version + ebatbout 04/13/01 - add definition, OCI_ATTR_RESERVED_11 + chliang 04/12/01 - add shortnames for newer oci funcation + wzhang 04/11/01 - Add new OCI NLS constants. + cmlim 04/13/01 - remove attrs not used by dpapi (151 & 152 avail) + rkambo 03/23/01 - bugfix 1421793 + cmlim 04/02/01 - remove OCI_ATTR_DIRPATH_{NESTED_TBL, SUBST_OBJ_TBL} + - note: attribute #s 186 & 205 available + whe 03/28/01 - add OCI_AFC_PAD_ON/OFF mode + preilly 03/05/01 - Add stream versioning support to DirPath context + schandir 12/18/00 - remove attr CONN_INCR_DELAY. + schandir 12/12/00 - change mode from OCI_POOL to OCI_CPOOL. + cbarclay 01/12/01 - add atribute for OCIP_ATTR_TMZ + whe 01/07/01 - add attributes related to UTF16 env mode + slari 12/29/00 - add blank line + slari 12/28/00 - OCI_ATTR_RESERVED_10 + whe 12/19/00 - add OCI_ENVCR_RESERVED3 + rpang 11/29/00 - Added OCI_ATTR_ORA_DEBUG_JDWP attribute + cmlim 11/28/00 - support substitutable object tables in dpapi + akatti 10/09/00 - [198379]:add OCIRowidToChar + sgollapu 10/11/00 - Add OCI_PREP_RESERVED_1 + sgollapu 08/27/00 - add attribute to get erroneous column + sgollapu 07/29/00 - Add snapshot attributes + kmohan 09/18/00 - add OCI_FNCODE_LOGON2 + abrumm 10/08/00 - include ocixad.h + mbastawa 10/04/00 - add OCI_ATTR_ROWS_FETCHED + nbhatt 08/24/00 - add transformation attribute + dmwong 08/22/00 - OCI_ATTR_CID_VALUE -> OCI_ATTR_CLIENT_IDENTIFIER. + cmlim 08/30/00 - add OCI_ATTR_DIRPATH_SID + dsaha 08/18/00 - add OCI_ATTR_RESERVED_5 + amangal 08/17/00 - Merge into 8.2 : 1194361 + slari 08/03/00 - add OCI_ATTR_HANDLE_POSITION + dsaha 07/20/00 - 2rt exec + sgollapu 07/04/00 - Add virtual session flag + cmlim 07/07/00 - add OCI_ATTR_DIRPATH_OID, OCI_ATTR_DIRPATH_NESTED_TBL + etucker 07/28/00 - add OCIIntervalFromTZ + rwessman 06/26/00 - N-tier: added new credential attributes + whe 07/27/00 - add OCI_UTF16 mode + vjayaram 07/18/00 - add connection pooling changes + etucker 07/12/00 - add dls apis + cmlim 07/07/00 - add OCI_ATTR_DIRPATH_OID, OCI_ATTR_DIRPATH_NESTED_TBL + sgollapu 07/04/00 - Add virtual session flag + najain 05/01/00 - AQ Signature support + sgollapu 06/14/00 - Add reserved OCI mode + rkambo 06/08/00 - notification presentation support + sagrawal 06/04/00 - ref cursor to c + ksurlake 06/07/00 - define OCI_POOL + mbastawa 06/05/00 - added scrollable cursor attributes + weiwang 03/31/00 - add LDAP support + whe 05/30/00 - add OCI_ATTR_MAXCHAR_SIZE + whe 05/23/00 - validate OCI_NO_CACHE mode + dsaha 02/02/00 - Add no-cache attr in statement handle + whe 05/23/00 - add OCIP_ICACHE + allee 05/17/00 - describe support for JAVA implmented TYPE + preilly 05/30/00 - Continue adding support for objects in direct path lo + cmlim 05/16/00 - 8.2 dpapi support of ADTs + rxgovind 05/04/00 - OCIAnyDataSet changes + rkasamse 05/25/00 - add OCIAnyDataCtx + rmurthy 04/26/00 - describe support for inheritance + ksurlake 04/18/00 - Add credential type + whe 05/24/00 - add OCI_ATTR_CHAR_ attrs + rkambo 04/19/00 - subscription enhancement + rmurthy 04/26/00 - describe support for inheritance + delson 03/28/00 - add OCI_ATTR_RESERVED_2 + abrumm 03/31/00 - external table support + rkasamse 03/13/00 - add declarations for OCIAnyData + najain 02/24/00 - support for dequeue as select + dsaha 03/10/00 - Add OCI_ALWAYS_BLOCKING + esoyleme 04/25/00 - separated transactions + sgollapu 12/23/99 - OCIServerAttach extensions + slari 08/23/99 - add OCI_DTYPE_UCB + slari 08/20/99 - add OCI_UCBTYPE_REPLACE + hsbedi 08/31/99 - Memory Stats . + sgollapu 08/02/99 - oci sql routing + slari 08/06/99 - rename values for OCI_SERVER_STATUS + slari 08/02/99 - add OCI_ATTR_SERVER_STATUS + tnbui 07/28/99 - Remove OCI_DTYPE_TIMESTAMP_ITZ + amangal 07/19/99 - Merge into 8.1.6 : bug 785797 + tnbui 07/07/99 - Change ADJUSTMENT modes + dsaha 07/07/99 - OCI_SAHRED_EXT + dmwong 06/08/99 - add OCI_ATTR_APPCTX_* + vyanaman 06/23/99 - + vyanaman 06/21/99 - Add new OCI Datetime and Interval descriptors + esoyleme 06/29/99 - expose MTS performance enhancements + rshaikh 04/23/99 - add OCI_SQL_VERSION_* + tnbui 05/24/99 - Remove OCIAdjStr + dsaha 05/21/99 - Add OCI_ADJUST_UNK + mluong 05/17/99 - fix merge + tnbui 04/05/99 - ADJUSTMENT values + abrumm 04/16/99 - dpapi: more attributes + dsaha 02/24/99 - Add OCI_SHOW_DML_WARNINGS + jiyang 12/07/98 - Add OCI_NLS_DUAL_CURRENCY + slari 12/07/98 - change OCI_NOMUTEX to OCI_NO_MUTEX + aroy 11/30/98 - change OCI_NOCALLBACK to OCI_NO_UCB + aroy 11/13/98 - add env modes to process modes + slari 09/08/98 - add OCI_FNCODE_SVC2HST and _SVCRH + aroy 09/04/98 - Add OCI_ATTR_MIGSESSION + skray 08/14/98 - server groups for session switching + mluong 08/11/98 - add back OCI_HTYPE_LAST. + aroy 05/25/98 - add process handle type + aroy 04/06/98 - add shared mode + slari 07/13/98 - merge forward to 8.1.4 + slari 07/09/98 - add OCI_BIND_RESERVED_2 + slari 07/08/98 - add OCI_EXACT_FETCH_RESERVED_1 + dsaha 07/07/98 - Add OCI_PARSE_ONLY + dsaha 06/29/98 - Add OCI_PARSE_ONLY + slari 07/01/98 - add OCI_BIND_RESERVED_2 + sgollapu 06/25/98 - Fix bug 683565 + slari 06/17/98 - remove OC_FETCH_RESERVED_2 + slari 06/11/98 - add OCI_FETCH_RESERVED_1 and 2 + jhasenbe 05/27/98 - Remove definitions for U-Calls (Unicode) + jiyang 05/18/98 - remove OCI_ATTR_CARTLANG + nbhatt 05/20/98 - OCI_DEQ_REMOVE_NODATA + nbhatt 05/19/98 - correct AQ opcode + skmishra 05/06/98 - Add precision attribute to Attributes list + aroy 04/20/98 - merge forward 8.0.5 -> 8.1.3 + schandra 05/01/98 - OCI sender id + sgollapu 02/19/98 - enhanced array DML + nbhatt 05/15/98 - AQ listen call + sgollapu 04/27/98 - more attributes + skaluska 04/06/98 - Add OCI_PTYPE_SCHEMA, OCI_PTYPE_DATABASE + slari 04/28/98 - add OCI_ATTR_PDPRC + lchidamb 05/05/98 - change OCI_NAMESPACE_AQ to 1 + nbhatt 04/27/98 - AQ Notification Descriptor + abrumm 06/24/98 - more direct path attributes + abrumm 05/27/98 - OCI direct path interface support + abrumm 05/08/98 - OCI direct path interface support + lchidamb 03/02/98 - client notification additions + kkarun 04/17/98 - Add more Interval functions + vyanaman 04/16/98 - Add get/set TZ + kkarun 04/14/98 - Add OCI Datetime shortnames + vyanaman 04/13/98 - Add OCI DateTime and Interval check error codes + kkarun 04/07/98 - Add OCI_DTYPE_DATETIME and OCI_DTYPE_INTERVAL + esoyleme 12/15/97 - support failover callback retry + esoyleme 04/22/98 - merge support for failover callback retry + mluong 04/16/98 - add OCI_FNCODE_LOBLOCATORASSIGN + rkasamse 04/17/98 - add short names for OCIPickler(Memory/Ctx) cart servi + slari 04/10/98 - add OCI_FNCODE_SVCCTXTOLDA + slari 04/09/98 - add OCI_FNCODE_RESET + slari 04/07/98 - add OCI_FNCODE_LOBFILEISOPEN + slari 04/06/98 - add OCI_FNCODE_LOBOPEN + slari 03/20/98 - change OCI_CBTYPE_xxx to OCI_UCBTYPE_xxx + slari 03/18/98 - add OCI_FNCODE_MAXFCN + slari 02/12/98 - add OCI_ENV_NO_USRCB + skabraha 04/09/98 - adding shortnames for OCIFile + rhwu 04/03/98 - Add short names for the OCIThread package + tanguyen 04/03/98 - add OCI_ATTR_xxxx for type inheritance + rkasamse 04/02/98 - add OCI_ATTR_UCI_REFRESH + nramakri 04/01/98 - Add short names for the OCIExtract package + ewaugh 03/31/98 - Add short names for the OCIFormat package. + jhasenbe 04/06/98 - Add definitions for U-Calls (Unicode) + (OCI_TEXT, OCI_UTEXT, OCI_UTEXT4) + skmishra 03/03/98 - Add OCI_ATTR_PARSE_ERROR_OFFSET + rwessman 03/11/98 - Added OCI_CRED_PROXY for proxy authentication + abrumm 03/31/98 - OCI direct path interface support + nmallava 03/03/98 - add constants for temp lob apis + skotsovo 03/05/98 - resolve merge conflicts + skotsovo 02/24/98 - add OCI_DTYPE_LOC + skaluska 01/21/98 - Add OCI_ATTR_LTYPE + rkasamse 01/06/98 - add OCI_ATTR* for obj cache enhancements + dchatter 01/08/98 - more comments + skabraha 12/02/97 - moved oci1.h to the front of include files. + jiyang 12/18/97 - Add OCI_NLS_MAX_BUFSZ + rhwu 12/02/97 - move oci1.h up + ewaugh 12/15/97 - Add short names for the OCIFormat package. + rkasamse 12/02/97 - Add a constant for memory cartridge services -- OCI_M + nmallava 12/31/97 - open/close for internal lobs + khnguyen 11/27/97 - add OCI_ATTR_LFPRECISION, OCI_ATTR_FSPRECISION + rkasamse 11/03/97 - add types for pickler cartridge services + mluong 11/20/97 - changed ubig_ora to ub4 per skotsovo + ssamu 11/14/97 - add oci1.h + jiyang 11/13/97 - Add NLS service for cartridge + esoyleme 12/15/97 - support failover callback retry + jwijaya 10/21/97 - change OCILobOffset/Length from ubig_ora to ub4 + cxcheng 07/28/97 - fix compile with SLSHORTNAME + schandra 06/25/97 - AQ OCI interface + sgollapu 07/25/97 - Add OCI_ATTR_DESC_PUBLIC + cxcheng 06/16/97 - add OCI_ATTR_TDO + skotsovo 06/05/97 - add fntcodes for lob buffering subsystem + esoyleme 05/13/97 - move failover callback prototype + skmishra 05/06/97 - stdc compiler fixes + skmishra 04/22/97 - Provide C++ compatibility + lchidamb 04/19/97 - add OCI_ATTR_SESSLANG + ramkrish 04/15/97 - Add OCI_LOB_BUFFER_(NO)FREE + sgollapu 04/18/97 - Add OCI_ATTR_TABLESPACE + skaluska 04/17/97 - Add OCI_ATTR_SUB_NAME + schandra 04/10/97 - Use long OCI names + aroy 03/27/97 - add OCI_DTYPE_FILE + sgollapu 03/26/97 - Add OCI_OTYPEs + skmishra 04/09/97 - Added constant OCI_ROWID_LEN + dchatter 03/21/97 - add attr OCI_ATTR_IN_V8_MODE + lchidamb 03/21/97 - add OCI_COMMIT_ON_SUCCESS execution mode + skmishra 03/20/97 - Added OCI_ATTR_LOBEMPTY + sgollapu 03/19/97 - Add OCI_ATTR_OVRLD_ID + aroy 03/17/97 - add postprocessing callback + sgollapu 03/15/97 - Add OCI_ATTR_PARAM + cxcheng 02/07/97 - change OCI_PTYPE codes for type method for consistenc + cxcheng 02/05/97 - add OCI_PTYPE_TYPE_RESULT + cxcheng 02/04/97 - rename OCI_PTYPE constants to be more consistent + cxcheng 02/03/97 - add OCI_ATTR, OCI_PTYPE contants for describe type + esoyleme 01/23/97 - merge neerja callback + sgollapu 12/30/96 - Remove OCI_DTYPE_SECURITY + asurpur 12/26/96 - CHanging OCI_NO_AUTH to OCI_AUTH + sgollapu 12/23/96 - Add more attrs to COL, ARG, and SEQ + sgollapu 12/12/96 - Add OCI_DESCRIBE_ONLY + slari 12/11/96 - change prototype of OCICallbackInBind + nbhatt 12/05/96 - "callback" + lchidamb 11/19/96 - handle subclassing + sgollapu 11/09/96 - OCI_PATTR_* + dchatter 11/04/96 - add attr OCI_ATTR_CHRCNT + mluong 11/01/96 - test + cxcheng 10/31/96 - add #defines for OCILobLength etc + dchatter 10/31/96 - add lob read write call back fp defs + dchatter 10/30/96 - more changes + rhari 10/30/96 - Include ociextp.h at the very end + lchidamb 10/22/96 - add fdo attribute for bind/server handle + dchatter 10/22/96 - change attr defn for prefetch parameters & lobs/file + calls + slari 10/21/96 - add OCI_ENV_NO_MUTEX + rhari 10/25/96 - Include ociextp.h + rxgovind 10/25/96 - add OCI_LOBMAXSIZE, remove OCI_FILE_READWRITE + sgollapu 10/24/96 - Correct OCILogon and OCILogoff + sgollapu 10/24/96 - Correct to OCILogon and OCILogoff + sgollapu 10/21/96 - Add ocilon and ociloff + skaluska 10/31/96 - Add OCI_PTYPE values + sgollapu 10/17/96 - correct OCI_ATTR_SVCCTX to OCI_ATTR_SERVER + rwessman 10/16/96 - Added security functions and fixed olint errors. + sthakur 10/14/96 - add more COR attributes + cxcheng 10/14/96 - re-enable LOB functions + sgollapu 10/10/96 - Add ocibdp and ocibdn + slari 10/07/96 - add back OCIRowid + aroy 10/08/96 - add typedef ocibfill for PRO*C + mluong 10/11/96 - replace OCI_ATTR_CHARSET* with OCI_ATTR_CHARSET_* + cxcheng 10/10/96 - temporarily take out #define for lob functions + sgollapu 10/02/96 - Rename OCI functions and datatypes + skotsovo 10/01/96 - move orl lob fnts to oci + aroy 09/10/96 - fix merge errors + aroy 08/19/96 - NCHAR support + jboonleu 09/05/96 - add OCI attributes for object cache + dchatter 08/20/96 - HTYPE ranges from 1-50; DTYPE from 50-255 + slari 08/06/96 - define OCI_DTYPE_ROWID + sthakur 08/14/96 - complex object support + schandra 06/17/96 - Convert XA to use new OCI + abrik 08/15/96 - OCI_ATTR_HEAPALLOC added + aroy 07/17/96 - terminology change: ocilobd => ocilobl + aroy 07/03/96 - add lob typedefs for Pro*C + slari 06/28/96 - add OCI_ATTR_STMT_TYPE + lchidamb 06/26/96 - reorg #ifndef + schandra 05/31/96 - attribute types for internal and external client name + asurpur 05/30/96 - Changing the value of mode + schandra 05/18/96 - OCI_TRANS_TWOPHASE -> 0x00000001 to 0x00100000 + slari 05/30/96 - add callback function prototypes + jbellemo 05/23/96 - remove ociisc + schandra 04/23/96 - loosely-coupled branches + asurpur 05/15/96 - New mode for ocicpw + aroy 04/24/96 - making ocihandles opaque + slari 04/18/96 - add missing defines + schandra 03/27/96 - V8OCI - add transaction related calls + dchatter 04/01/96 - add OCI_FILE options + dchatter 03/21/96 - add oci2lda conversion routines + dchatter 03/07/96 - add OCI piece definition + slari 03/12/96 - add describe attributes + slari 03/12/96 - add OCI_OTYPE_QUERY + aroy 02/28/96 - Add column attributes + slari 02/09/96 - add OCI_OBJECT + slari 02/07/96 - add OCI_HYTPE_DSC + aroy 01/10/96 - adding function code defines... + dchatter 01/03/96 - define OCI_NON_BLOCKING + dchatter 01/02/96 - Add Any descriptor + dchatter 01/02/96 - Add Select List descriptor + dchatter 12/29/95 - V8 OCI definitions + dchatter 12/29/95 - Creation + +*/ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef ORATYPES +#include +#endif + +#ifndef OCIDFN +#include +#endif + +#ifndef OCI_ORACLE +# define OCI_ORACLE + + +/*--------------------------------------------------------------------------- + Short names provided for platforms which do not allow extended symbolic names + ---------------------------------------------------------------------------*/ + +#ifdef SLSHORTNAME +/* Translation of the long function/type names to short names for IBM only */ +/* maybe lint will use this too */ +#define OCISessionEnd ocitac +#define OCIResultSetToStmt ocirs2sh +#define OCISessionBegin ociauth +#define OCIServerAttach ociatch +#define OCIDescriptorAlloc ocigdesc +#define OCIServerDetach ocidtch +#define OCIDescriptorFree ocifdesc +#define OCIServerVersion ocivers +#define OCIDescribeAny ocidsca +#define OCIBindDynamic ocibda +#define OCIBindByName ocibdn +#define OCIBindByPos ocibdp +#define OCIErrorGet ocigdr +#define OCIBindArrayOfStruct ocibsa +#define OCIEnvInit ociinit +#define OCIBindObject ocibndt +#define OCIHandleAlloc ocighndl +#define OCIHandleFree ocifhndl +#define OCIRowidToChar ociri2c +#ifdef NEVER +#define OCIStmtBindByPos ocibndp +#define OCIStmtBindByName ocibndn +#endif +#define OCIAttrGet ocigattr +#define OCIDefineByPos ocidfne +#define OCIAttrSet ocisattr +#define OCIDefineDynamic ociddf +#define OCILdaToSvcCtx ocild2sv +#define OCIDefineArrayOfStruct ocidarr +#define OCIInitialize ocipi +#define OCIDefineObject ocidndt +#define OCIStmtExecute ociexec +#define OCILobAppend ocilfap +#define OCILobOpenFile ocifopn +#define OCILobCloseFile ocifcls +#define OCILobLocator ocilobd +#define OCILobGetDeduplicateRegions ocilgshr +#define OCILobRegion ocilregd +#define OCILobCopy ocilfcp +#define OCILobFileCreate ocifcrt +#define OCILobFileDelete ocifdel +#define OCILobGetLength ocilfln +#define OCILobWrite ocilfwr +#define OCILobRead ocilfrd +#define OCILobErase ocilfer +#define OCILobTrim ocilftr +#define OCILobSetOptions ocinglso +#define OCILobGetOptions ocinglgo +#define OCILobFragmentInsert ocinglfi +#define OCILobFragmentDelete ocinglfd +#define OCILobFragmentMove ocinglfm +#define OCILobFragmentReplace ocinglfr +#define OCILobSetContentType ocinglsct +#define OCILobGetContentType ocinglgct + +#define OCIStmtFetch ocifch +#define OCIStmtGetBindInfo ocigbp +#define OCIStmtGetPieceInfo ocigpi +#define OCIStmtPrepare ocireq +#define OCIStmtSetPieceInfo ocispi +#define OCISvcCtxToLda ocisv2ld +#define OCITransCommit ocitxcm +#define OCITransDetach ocitxdt +#define OCITransForget ocitxfgt +#define OCITransPrepare ocitxpre +#define OCITransRollback ocitxrl +#define OCIPasswordChange ocicpw +#define OCITransStart ocitxst +#define OCITransMultiPrepare ocitxmp + +#define OCIBreak ocibreak +#define OCIParamGet ocigparm +#define OCIParamSet ocisparm + +#define OCISecurityOpenWallet ocizwOpenWallet +#define OCISecurityCloseWallet ocizwCloseWallet +#define OCISecurityCreateWallet ocizwCreateWallet +#define OCISecurityDestroyWallet ocizwDestroyWallet +#define OCISecurityStorePersona ocizeStorePersona +#define OCISecurityOpenPersona ocizeOpenPersona +#define OCISecurityClosePersona ocizeClosePersona +#define OCISecurityRemovePersona ocizeRemovePersona +#define OCISecurityCreatePersona ocizeCreatePersona +#define OCISecuritySetProtection ocizeSetProtection +#define OCISecurityGetProtection ocizeGetProtection +#define OCISecurityRemoveIdentity ociziRemoveIdentity +#define OCISecurityCreateIdentity ociziCreateIdentity +#define OCISecurityAbortIdentity ociziAbortIdentity +#define OCISecurityFreeIdentity ociziFreeIdentity +#define OCISecurityStoreTrustedIdentity ociziStoreTrustedIdentity +#define OCISecuritySign ocizSign +#define OCISecuritySignExpansion ocizxSignExpansion +#define OCISecurityVerify ocizVerify +#define OCISecurityValidate ocizValidate +#define OCISecuritySignDetached ocizsd_SignDetached +#define OCISecuritySignDetExpansion ocizxsd_SignDetachedExpansion +#define OCISecurityVerifyDetached ocizved_VerifyDetached +#define OCISecurity_PKEncrypt ocizkec_PKEncrypt +#define OCISecurityPKEncryptExpansion ocizxkec_PKEncryptExpansion +#define OCISecurityPKDecrypt ocizkdc_PKDecrypt +#define OCISecurityEncrypt ocizEncrypt +#define OCISecurityEncryptExpansion ocizxEncryptExpansion +#define OCISecurityDecrypt ocizDecrypt +#define OCISecurityEnvelope ocizEnvelope +#define OCISecurityDeEnvelope ocizDeEnvelope +#define OCISecurityKeyedHash ocizKeyedHash +#define OCISecurityKeyedHashExpansion ocizxKeyedHashExpansion +#define OCISecurityHash ocizHash +#define OCISecurityHashExpansion ocizxHashExpansion +#define OCISecuritySeedRandom ocizSeedRandom +#define OCISecurityRandomBytes ocizrb_RandomBytes +#define OCISecurityRandomNumber ocizrn_RandomNumber +#define OCISecurityInitBlock ocizibInitBlock +#define OCISecurityReuseBlock ocizrbReuseBlock +#define OCISecurityPurgeBlock ocizpbPurgeBlock +#define OCISecuritySetBlock ocizsbSetBlock +#define OCISecurityGetIdentity ocizgi_GetIdentity + +#define OCIExtractInit ocixeini +#define OCIExtractTerm ocixetrm +#define OCIExtractReset ocixerst +#define OCIExtractSetNumKeys ocixesnk +#define OCIExtractSetKey ocixesk +#define OCIExtractFromFile ocixeff +#define OCIExtractFromStr ocixefs +#define OCIExtractToInt ocixeti +#define OCIExtractToBool ocixetb +#define OCIExtractToStr ocixets +#define OCIExtractToOCINum ocixeton +#define OCIExtractToList ocixetl +#define OCIExtractFromList ocixefl + +#define OCIDateTimeGetTime ocidt01_GetTime +#define OCIDateTimeGetDate ocidt02_GetDate +#define OCIDateTimeGetTimeZoneOffset ocidt03_GetTZ +#define OCIDateTimeSysTimeStamp ocidt07_SysTS +#define OCIDateTimeAssign ocidt08_Assign +#define OCIDateTimeToText ocidt09_ToText +#define OCIDateTimeFromText ocidt10_FromText +#define OCIDateTimeCompare ocidt11_Compare +#define OCIDateTimeCheck ocidt12_Check +#define OCIDateTimeConvert ocidt13_Convert +#define OCIDateTimeSubtract ocidt14_Subtract +#define OCIDateTimeIntervalAdd ocidt15_IntervalAdd +#define OCIDateTimeIntervalSub ocidt16_IntervalSub +#define OCIDateTimeGetTimeZoneName ocidt17_Gettzname +#define OCIDateTimeToArray ocidt18_ToArray +#define OCIDateTimeFromArray ocidt19_FromArray + +#define OCIIntervalSubtract ociint01_Subtract +#define OCIIntervalAdd ociint02_Add +#define OCIIntervalMultiply ociint03_Multiply +#define OCIIntervalDivide ociint04_Divide +#define OCIIntervalCompare ociint05_Compare +#define OCIIntervalFromText ociint06_FromText +#define OCIIntervalToText ociint07_ToText +#define OCIIntervalToNumber ociint08_ToNumber +#define OCIIntervalCheck ociint09_Check +#define OCIIntervalAssign ociint10_Assign +#define OCIIntervalGetYearMonth ociint11_GetYearMonth +#define OCIIntervalSetYearMonth ociint12_SetYearMonth +#define OCIIntervalGetDaySecond ociint13_GetDaySecond +#define OCIIntervalSetDaySecond ociint14_SetDaySecond +#define OCIIntervalFromNumber ociint15_FromNumber +#define OCIIntervalFromTZ ociint16_FromTZ + +#define OCIFormatInit ocixs01_Init +#define OCIFormatString ocixs02_Format +#define OCIFormatTerm ocixs03_Term +#define OCIFormatTUb1 ocixs04_TUb1 +#define OCIFormatTUb2 ocixs05_TUb2 +#define OCIFormatTUb4 ocixs06_TUb4 +#define OCIFormatTUword ocixs07_TUword +#define OCIFormatTUbig_ora ocixs08_TUbig_ora +#define OCIFormatTSb1 ocixs09_TSb1 +#define OCIFormatTSb2 ocixs10_TSb2 +#define OCIFormatTSb4 ocixs11_TSb4 +#define OCIFormatTSword ocixs12_TSword +#define OCIFormatTSbig_ora ocixs13_TSbig_ora +#define OCIFormatTEb1 ocixs14_TEb1 +#define OCIFormatTEb2 ocixs15_TEb2 +#define OCIFormatTEb4 ocixs16_TEb4 +#define OCIFormatTEword ocixs17_TEword +#define OCIFormatTChar ocixs18_TChar +#define OCIFormatTText ocixs19_TText +#define OCIFormatTDouble ocixs20_TDouble +#define OCIFormatTDvoid ocixs21_TDvoid +#define OCIFormatTEnd ocixs22_TEnd + +#define OCIFileInit ocifinit +#define OCIFileTerm ocifterm +#define OCIFileOpen ocifopen +#define OCIFileClose ocifclose +#define OCIFileRead ocifread +#define OCIFileWrite ocifwrite +#define OCIFileSeek ocifseek +#define OCIFileExists ocifexists +#define OCIFileGetLength ocifglen +#define OCIFileFlush ocifflush + + +/* OCIThread short name */ +#define OCIThreadProcessInit ocitt01_ProcessInit +#define OCIThreadInit ocitt02_Init +#define OCIThreadTerm ocitt03_Term +#define OCIThreadIsMulti ocitt04_IsMulti +#define OCIThreadMutexInit ocitt05_MutexInit +#define OCIThreadMutexDestroy ocitt06_MutexDestroy +#define OCIThreadMutexAcquire ocitt07_MutexAcquire +#define OCIThreadMutexRelease ocitt08_MutexRelease +#define OCIThreadKeyInit ocitt09_KeyInit +#define OCIThreadKeyDestroy ocitt10_KeyDestroy +#define OCIThreadKeyGet ocitt11_KeyGet +#define OCIThreadKeySet ocitt12_KeySet +#define OCIThreadIdInit ocitt13_IdInit +#define OCIThreadIdDestroy ocitt14_IdDestroy +#define OCIThreadIdSet ocitt15_IdSet +#define OCIThreadIdSetNull ocitt16_IdSetNull +#define OCIThreadIdGet ocitt17_IdGet +#define OCIThreadIdSame ocitt18_IdSame +#define OCIThreadIdNull ocitt19_IdNull +#define OCIThreadHndInit ocitt20_HndInit +#define OCIThreadHndDestroy ocitt21_HndDestroy +#define OCIThreadCreate ocitt22_Create +#define OCIThreadJoin ocitt23_Join +#define OCIThreadClose ocitt24_Close +#define OCIThreadHandleGet ocitt25_HandleGet + +/* Translation between the old and new datatypes */ + +#define OCISession ociusrh +#define OCIBind ocibndh +#define OCIDescribe ocidsch +#define OCIDefine ocidfnh +#define OCIEnv ocienvh +#define OCIError ocierrh + +#define OCICPool ocicpool + +#define OCISPool ocispool +#define OCIAuthInfo ociauthinfo + + +#define OCILob ocilobd +#define OCILobLength ocillen +#define OCILobMode ocilmo +#define OCILobOffset ociloff + +#define OCILobLocator ocilobd +#define OCIBlobLocator ociblobl +#define OCIClobLocator ociclobl +#define OCILobRegion ocilregd +#define OCIBFileLocator ocibfilel + +#define OCIParam ocipard +#define OCIResult ocirstd +#define OCISnapshot ocisnad +#define OCIServer ocisrvh +#define OCIStmt ocistmh +#define OCISvcCtx ocisvch +#define OCITrans ocitxnh +#define OCICallbackInBind ocibicfp +#define OCICallbackOutBind ocibocfp +#define OCICallbackDefine ocidcfp +#define OCICallbackLobRead ocilrfp +#define OCICallbackLobWrite ocilwfp +#define OCICallbackLobGetDededuplicateRegions ocilgshr +#define OCISecurity ociossh +#define OCIComplexObject ocicorh +#define OCIComplexObjectComp ocicord +#define OCIRowid ociridd + +#define OCIAQDeq ociaqdeq +#define OCIAQEnq ociaqenq +#define OCIConnectionPoolCreate ociconpc +#define OCIConnectionPoolDestroy ociconpd +#define OCIEnvCreate ocienvct +#define OCILobAssign ociloass +#define OCILobCharSetForm ocilocfm +#define OCILobCharSetId ocilocid +#define OCILobDisableBuffering ocilodbf +#define OCILobEnableBuffering ociloebf +#define OCILobFileClose ocilofcl +#define OCILobFileCloseAll ocilofca +#define OCILobFileExists ocilofex +#define OCILobFileGetName ocilofgn +#define OCILobFileIsOpen ocifiopn +#define OCILobFileOpen ocilofop +#define OCILobFileSetName ocilofsn +#define OCILobFlushBuffer ocilofbf +#define OCILobIsEqual ociloieq +#define OCILobLoadFromFile ocilolff +#define OCILobLocatorIsInit ocilolii +#define OCILobLocatorAssign ocilolas +#define OCILogon ocilogon +#define OCILogon2 ocilgon2 +#define OCILogoff ocilgoff +#endif /* ifdef SLSHORTNAME */ + +/*--------------------------------------------------------------------------- + PUBLIC TYPES AND CONSTANTS + ---------------------------------------------------------------------------*/ + +/*-----------------------------Handle Types----------------------------------*/ + /* handle types range from 1 - 49 */ +#define OCI_HTYPE_FIRST 1 /* start value of handle type */ +#define OCI_HTYPE_ENV 1 /* environment handle */ +#define OCI_HTYPE_ERROR 2 /* error handle */ +#define OCI_HTYPE_SVCCTX 3 /* service handle */ +#define OCI_HTYPE_STMT 4 /* statement handle */ +#define OCI_HTYPE_BIND 5 /* bind handle */ +#define OCI_HTYPE_DEFINE 6 /* define handle */ +#define OCI_HTYPE_DESCRIBE 7 /* describe handle */ +#define OCI_HTYPE_SERVER 8 /* server handle */ +#define OCI_HTYPE_SESSION 9 /* authentication handle */ +#define OCI_HTYPE_AUTHINFO OCI_HTYPE_SESSION /* SessionGet auth handle */ +#define OCI_HTYPE_TRANS 10 /* transaction handle */ +#define OCI_HTYPE_COMPLEXOBJECT 11 /* complex object retrieval handle */ +#define OCI_HTYPE_SECURITY 12 /* security handle */ +#define OCI_HTYPE_SUBSCRIPTION 13 /* subscription handle */ +#define OCI_HTYPE_DIRPATH_CTX 14 /* direct path context */ +#define OCI_HTYPE_DIRPATH_COLUMN_ARRAY 15 /* direct path column array */ +#define OCI_HTYPE_DIRPATH_STREAM 16 /* direct path stream */ +#define OCI_HTYPE_PROC 17 /* process handle */ +#define OCI_HTYPE_DIRPATH_FN_CTX 18 /* direct path function context */ +#define OCI_HTYPE_DIRPATH_FN_COL_ARRAY 19 /* dp object column array */ +#define OCI_HTYPE_XADSESSION 20 /* access driver session */ +#define OCI_HTYPE_XADTABLE 21 /* access driver table */ +#define OCI_HTYPE_XADFIELD 22 /* access driver field */ +#define OCI_HTYPE_XADGRANULE 23 /* access driver granule */ +#define OCI_HTYPE_XADRECORD 24 /* access driver record */ +#define OCI_HTYPE_XADIO 25 /* access driver I/O */ +#define OCI_HTYPE_CPOOL 26 /* connection pool handle */ +#define OCI_HTYPE_SPOOL 27 /* session pool handle */ +#define OCI_HTYPE_ADMIN 28 /* admin handle */ +#define OCI_HTYPE_EVENT 29 /* HA event handle */ + +#define OCI_HTYPE_LAST 29 /* last value of a handle type */ + +/*---------------------------------------------------------------------------*/ + + +/*-------------------------Descriptor Types----------------------------------*/ + /* descriptor values range from 50 - 255 */ +#define OCI_DTYPE_FIRST 50 /* start value of descriptor type */ +#define OCI_DTYPE_LOB 50 /* lob locator */ +#define OCI_DTYPE_SNAP 51 /* snapshot descriptor */ +#define OCI_DTYPE_RSET 52 /* result set descriptor */ +#define OCI_DTYPE_PARAM 53 /* a parameter descriptor obtained from ocigparm */ +#define OCI_DTYPE_ROWID 54 /* rowid descriptor */ +#define OCI_DTYPE_COMPLEXOBJECTCOMP 55 + /* complex object retrieval descriptor */ +#define OCI_DTYPE_FILE 56 /* File Lob locator */ +#define OCI_DTYPE_AQENQ_OPTIONS 57 /* enqueue options */ +#define OCI_DTYPE_AQDEQ_OPTIONS 58 /* dequeue options */ +#define OCI_DTYPE_AQMSG_PROPERTIES 59 /* message properties */ +#define OCI_DTYPE_AQAGENT 60 /* aq agent */ +#define OCI_DTYPE_LOCATOR 61 /* LOB locator */ +#define OCI_DTYPE_INTERVAL_YM 62 /* Interval year month */ +#define OCI_DTYPE_INTERVAL_DS 63 /* Interval day second */ +#define OCI_DTYPE_AQNFY_DESCRIPTOR 64 /* AQ notify descriptor */ +#define OCI_DTYPE_DATE 65 /* Date */ +#define OCI_DTYPE_TIME 66 /* Time */ +#define OCI_DTYPE_TIME_TZ 67 /* Time with timezone */ +#define OCI_DTYPE_TIMESTAMP 68 /* Timestamp */ +#define OCI_DTYPE_TIMESTAMP_TZ 69 /* Timestamp with timezone */ +#define OCI_DTYPE_TIMESTAMP_LTZ 70 /* Timestamp with local tz */ +#define OCI_DTYPE_UCB 71 /* user callback descriptor */ +#define OCI_DTYPE_SRVDN 72 /* server DN list descriptor */ +#define OCI_DTYPE_SIGNATURE 73 /* signature */ +#define OCI_DTYPE_RESERVED_1 74 /* reserved for internal use */ +#define OCI_DTYPE_AQLIS_OPTIONS 75 /* AQ listen options */ +#define OCI_DTYPE_AQLIS_MSG_PROPERTIES 76 /* AQ listen msg props */ +#define OCI_DTYPE_CHDES 77 /* Top level change notification desc */ +#define OCI_DTYPE_TABLE_CHDES 78 /* Table change descriptor */ +#define OCI_DTYPE_ROW_CHDES 79 /* Row change descriptor */ +#define OCI_DTYPE_CQDES 80 /* Query change descriptor */ +#define OCI_DTYPE_LOB_REGION 81 /* LOB Share region descriptor */ +#define OCI_DTYPE_LAST 81 /* last value of a descriptor type */ + +/*---------------------------------------------------------------------------*/ + +/*--------------------------------LOB types ---------------------------------*/ +#define OCI_TEMP_BLOB 1 /* LOB type - BLOB ------------------ */ +#define OCI_TEMP_CLOB 2 /* LOB type - CLOB ------------------ */ +/*---------------------------------------------------------------------------*/ + +/*-------------------------Object Ptr Types----------------------------------*/ +#define OCI_OTYPE_NAME 1 /* object name */ +#define OCI_OTYPE_REF 2 /* REF to TDO */ +#define OCI_OTYPE_PTR 3 /* PTR to TDO */ +/*---------------------------------------------------------------------------*/ + +/*=============================Attribute Types===============================*/ +/* + Note: All attributes are global. New attibutes should be added to the end + of the list. Before you add an attribute see if an existing one can be + used for your handle. + + If you see any holes please use the holes first. + +*/ +/*===========================================================================*/ + + +#define OCI_ATTR_FNCODE 1 /* the OCI function code */ +#define OCI_ATTR_OBJECT 2 /* is the environment initialized in object mode */ +#define OCI_ATTR_NONBLOCKING_MODE 3 /* non blocking mode */ +#define OCI_ATTR_SQLCODE 4 /* the SQL verb */ +#define OCI_ATTR_ENV 5 /* the environment handle */ +#define OCI_ATTR_SERVER 6 /* the server handle */ +#define OCI_ATTR_SESSION 7 /* the user session handle */ +#define OCI_ATTR_TRANS 8 /* the transaction handle */ +#define OCI_ATTR_ROW_COUNT 9 /* the rows processed so far */ +#define OCI_ATTR_SQLFNCODE 10 /* the SQL verb of the statement */ +#define OCI_ATTR_PREFETCH_ROWS 11 /* sets the number of rows to prefetch */ +#define OCI_ATTR_NESTED_PREFETCH_ROWS 12 /* the prefetch rows of nested table*/ +#define OCI_ATTR_PREFETCH_MEMORY 13 /* memory limit for rows fetched */ +#define OCI_ATTR_NESTED_PREFETCH_MEMORY 14 /* memory limit for nested rows */ +#define OCI_ATTR_CHAR_COUNT 15 + /* this specifies the bind and define size in characters */ +#define OCI_ATTR_PDSCL 16 /* packed decimal scale */ +#define OCI_ATTR_FSPRECISION OCI_ATTR_PDSCL + /* fs prec for datetime data types */ +#define OCI_ATTR_PDPRC 17 /* packed decimal format */ +#define OCI_ATTR_LFPRECISION OCI_ATTR_PDPRC + /* fs prec for datetime data types */ +#define OCI_ATTR_PARAM_COUNT 18 /* number of column in the select list */ +#define OCI_ATTR_ROWID 19 /* the rowid */ +#define OCI_ATTR_CHARSET 20 /* the character set value */ +#define OCI_ATTR_NCHAR 21 /* NCHAR type */ +#define OCI_ATTR_USERNAME 22 /* username attribute */ +#define OCI_ATTR_PASSWORD 23 /* password attribute */ +#define OCI_ATTR_STMT_TYPE 24 /* statement type */ +#define OCI_ATTR_INTERNAL_NAME 25 /* user friendly global name */ +#define OCI_ATTR_EXTERNAL_NAME 26 /* the internal name for global txn */ +#define OCI_ATTR_XID 27 /* XOPEN defined global transaction id */ +#define OCI_ATTR_TRANS_LOCK 28 /* */ +#define OCI_ATTR_TRANS_NAME 29 /* string to identify a global transaction */ +#define OCI_ATTR_HEAPALLOC 30 /* memory allocated on the heap */ +#define OCI_ATTR_CHARSET_ID 31 /* Character Set ID */ +#define OCI_ATTR_CHARSET_FORM 32 /* Character Set Form */ +#define OCI_ATTR_MAXDATA_SIZE 33 /* Maximumsize of data on the server */ +#define OCI_ATTR_CACHE_OPT_SIZE 34 /* object cache optimal size */ +#define OCI_ATTR_CACHE_MAX_SIZE 35 /* object cache maximum size percentage */ +#define OCI_ATTR_PINOPTION 36 /* object cache default pin option */ +#define OCI_ATTR_ALLOC_DURATION 37 + /* object cache default allocation duration */ +#define OCI_ATTR_PIN_DURATION 38 /* object cache default pin duration */ +#define OCI_ATTR_FDO 39 /* Format Descriptor object attribute */ +#define OCI_ATTR_POSTPROCESSING_CALLBACK 40 + /* Callback to process outbind data */ +#define OCI_ATTR_POSTPROCESSING_CONTEXT 41 + /* Callback context to process outbind data */ +#define OCI_ATTR_ROWS_RETURNED 42 + /* Number of rows returned in current iter - for Bind handles */ +#define OCI_ATTR_FOCBK 43 /* Failover Callback attribute */ +#define OCI_ATTR_IN_V8_MODE 44 /* is the server/service context in V8 mode */ +#define OCI_ATTR_LOBEMPTY 45 /* empty lob ? */ +#define OCI_ATTR_SESSLANG 46 /* session language handle */ + +#define OCI_ATTR_VISIBILITY 47 /* visibility */ +#define OCI_ATTR_RELATIVE_MSGID 48 /* relative message id */ +#define OCI_ATTR_SEQUENCE_DEVIATION 49 /* sequence deviation */ + +#define OCI_ATTR_CONSUMER_NAME 50 /* consumer name */ +#define OCI_ATTR_DEQ_MODE 51 /* dequeue mode */ +#define OCI_ATTR_NAVIGATION 52 /* navigation */ +#define OCI_ATTR_WAIT 53 /* wait */ +#define OCI_ATTR_DEQ_MSGID 54 /* dequeue message id */ + +#define OCI_ATTR_PRIORITY 55 /* priority */ +#define OCI_ATTR_DELAY 56 /* delay */ +#define OCI_ATTR_EXPIRATION 57 /* expiration */ +#define OCI_ATTR_CORRELATION 58 /* correlation id */ +#define OCI_ATTR_ATTEMPTS 59 /* # of attempts */ +#define OCI_ATTR_RECIPIENT_LIST 60 /* recipient list */ +#define OCI_ATTR_EXCEPTION_QUEUE 61 /* exception queue name */ +#define OCI_ATTR_ENQ_TIME 62 /* enqueue time (only OCIAttrGet) */ +#define OCI_ATTR_MSG_STATE 63/* message state (only OCIAttrGet) */ + /* NOTE: 64-66 used below */ +#define OCI_ATTR_AGENT_NAME 64 /* agent name */ +#define OCI_ATTR_AGENT_ADDRESS 65 /* agent address */ +#define OCI_ATTR_AGENT_PROTOCOL 66 /* agent protocol */ +#define OCI_ATTR_USER_PROPERTY 67 /* user property */ +#define OCI_ATTR_SENDER_ID 68 /* sender id */ +#define OCI_ATTR_ORIGINAL_MSGID 69 /* original message id */ + +#define OCI_ATTR_QUEUE_NAME 70 /* queue name */ +#define OCI_ATTR_NFY_MSGID 71 /* message id */ +#define OCI_ATTR_MSG_PROP 72 /* message properties */ + +#define OCI_ATTR_NUM_DML_ERRORS 73 /* num of errs in array DML */ +#define OCI_ATTR_DML_ROW_OFFSET 74 /* row offset in the array */ + + /* AQ array error handling uses DML method of accessing errors */ +#define OCI_ATTR_AQ_NUM_ERRORS OCI_ATTR_NUM_DML_ERRORS +#define OCI_ATTR_AQ_ERROR_INDEX OCI_ATTR_DML_ROW_OFFSET + +#define OCI_ATTR_DATEFORMAT 75 /* default date format string */ +#define OCI_ATTR_BUF_ADDR 76 /* buffer address */ +#define OCI_ATTR_BUF_SIZE 77 /* buffer size */ + +/* For values 78 - 80, see DirPathAPI attribute section in this file */ + +#define OCI_ATTR_NUM_ROWS 81 /* number of rows in column array */ + /* NOTE that OCI_ATTR_NUM_COLS is a column + * array attribute too. + */ +#define OCI_ATTR_COL_COUNT 82 /* columns of column array + processed so far. */ +#define OCI_ATTR_STREAM_OFFSET 83 /* str off of last row processed */ +#define OCI_ATTR_SHARED_HEAPALLOC 84 /* Shared Heap Allocation Size */ + +#define OCI_ATTR_SERVER_GROUP 85 /* server group name */ + +#define OCI_ATTR_MIGSESSION 86 /* migratable session attribute */ + +#define OCI_ATTR_NOCACHE 87 /* Temporary LOBs */ + +#define OCI_ATTR_MEMPOOL_SIZE 88 /* Pool Size */ +#define OCI_ATTR_MEMPOOL_INSTNAME 89 /* Instance name */ +#define OCI_ATTR_MEMPOOL_APPNAME 90 /* Application name */ +#define OCI_ATTR_MEMPOOL_HOMENAME 91 /* Home Directory name */ +#define OCI_ATTR_MEMPOOL_MODEL 92 /* Pool Model (proc,thrd,both)*/ +#define OCI_ATTR_MODES 93 /* Modes */ + +#define OCI_ATTR_SUBSCR_NAME 94 /* name of subscription */ +#define OCI_ATTR_SUBSCR_CALLBACK 95 /* associated callback */ +#define OCI_ATTR_SUBSCR_CTX 96 /* associated callback context */ +#define OCI_ATTR_SUBSCR_PAYLOAD 97 /* associated payload */ +#define OCI_ATTR_SUBSCR_NAMESPACE 98 /* associated namespace */ + +#define OCI_ATTR_PROXY_CREDENTIALS 99 /* Proxy user credentials */ +#define OCI_ATTR_INITIAL_CLIENT_ROLES 100 /* Initial client role list */ + +#define OCI_ATTR_UNK 101 /* unknown attribute */ +#define OCI_ATTR_NUM_COLS 102 /* number of columns */ +#define OCI_ATTR_LIST_COLUMNS 103 /* parameter of the column list */ +#define OCI_ATTR_RDBA 104 /* DBA of the segment header */ +#define OCI_ATTR_CLUSTERED 105 /* whether the table is clustered */ +#define OCI_ATTR_PARTITIONED 106 /* whether the table is partitioned */ +#define OCI_ATTR_INDEX_ONLY 107 /* whether the table is index only */ +#define OCI_ATTR_LIST_ARGUMENTS 108 /* parameter of the argument list */ +#define OCI_ATTR_LIST_SUBPROGRAMS 109 /* parameter of the subprogram list */ +#define OCI_ATTR_REF_TDO 110 /* REF to the type descriptor */ +#define OCI_ATTR_LINK 111 /* the database link name */ +#define OCI_ATTR_MIN 112 /* minimum value */ +#define OCI_ATTR_MAX 113 /* maximum value */ +#define OCI_ATTR_INCR 114 /* increment value */ +#define OCI_ATTR_CACHE 115 /* number of sequence numbers cached */ +#define OCI_ATTR_ORDER 116 /* whether the sequence is ordered */ +#define OCI_ATTR_HW_MARK 117 /* high-water mark */ +#define OCI_ATTR_TYPE_SCHEMA 118 /* type's schema name */ +#define OCI_ATTR_TIMESTAMP 119 /* timestamp of the object */ +#define OCI_ATTR_NUM_ATTRS 120 /* number of sttributes */ +#define OCI_ATTR_NUM_PARAMS 121 /* number of parameters */ +#define OCI_ATTR_OBJID 122 /* object id for a table or view */ +#define OCI_ATTR_PTYPE 123 /* type of info described by */ +#define OCI_ATTR_PARAM 124 /* parameter descriptor */ +#define OCI_ATTR_OVERLOAD_ID 125 /* overload ID for funcs and procs */ +#define OCI_ATTR_TABLESPACE 126 /* table name space */ +#define OCI_ATTR_TDO 127 /* TDO of a type */ +#define OCI_ATTR_LTYPE 128 /* list type */ +#define OCI_ATTR_PARSE_ERROR_OFFSET 129 /* Parse Error offset */ +#define OCI_ATTR_IS_TEMPORARY 130 /* whether table is temporary */ +#define OCI_ATTR_IS_TYPED 131 /* whether table is typed */ +#define OCI_ATTR_DURATION 132 /* duration of temporary table */ +#define OCI_ATTR_IS_INVOKER_RIGHTS 133 /* is invoker rights */ +#define OCI_ATTR_OBJ_NAME 134 /* top level schema obj name */ +#define OCI_ATTR_OBJ_SCHEMA 135 /* schema name */ +#define OCI_ATTR_OBJ_ID 136 /* top level schema object id */ + +/* For values 137 - 141, see DirPathAPI attribute section in this file */ + + +#define OCI_ATTR_TRANS_TIMEOUT 142 /* transaction timeout */ +#define OCI_ATTR_SERVER_STATUS 143/* state of the server handle */ +#define OCI_ATTR_STATEMENT 144 /* statement txt in stmt hdl */ + +/* For value 145, see DirPathAPI attribute section in this file */ + +#define OCI_ATTR_DEQCOND 146 /* dequeue condition */ +#define OCI_ATTR_RESERVED_2 147 /* reserved */ + + +#define OCI_ATTR_SUBSCR_RECPT 148 /* recepient of subscription */ +#define OCI_ATTR_SUBSCR_RECPTPROTO 149 /* protocol for recepient */ + +/* For values 150 - 151, see DirPathAPI attribute section in this file */ + +#define OCI_ATTR_LDAP_HOST 153 /* LDAP host to connect to */ +#define OCI_ATTR_LDAP_PORT 154 /* LDAP port to connect to */ +#define OCI_ATTR_BIND_DN 155 /* bind DN */ +#define OCI_ATTR_LDAP_CRED 156 /* credentials to connect to LDAP */ +#define OCI_ATTR_WALL_LOC 157 /* client wallet location */ +#define OCI_ATTR_LDAP_AUTH 158 /* LDAP authentication method */ +#define OCI_ATTR_LDAP_CTX 159 /* LDAP adminstration context DN */ +#define OCI_ATTR_SERVER_DNS 160 /* list of registration server DNs */ + +#define OCI_ATTR_DN_COUNT 161 /* the number of server DNs */ +#define OCI_ATTR_SERVER_DN 162 /* server DN attribute */ + +#define OCI_ATTR_MAXCHAR_SIZE 163 /* max char size of data */ + +#define OCI_ATTR_CURRENT_POSITION 164 /* for scrollable result sets*/ + +/* Added to get attributes for ref cursor to statement handle */ +#define OCI_ATTR_RESERVED_3 165 /* reserved */ +#define OCI_ATTR_RESERVED_4 166 /* reserved */ + +/* For value 167, see DirPathAPI attribute section in this file */ + +#define OCI_ATTR_DIGEST_ALGO 168 /* digest algorithm */ +#define OCI_ATTR_CERTIFICATE 169 /* certificate */ +#define OCI_ATTR_SIGNATURE_ALGO 170 /* signature algorithm */ +#define OCI_ATTR_CANONICAL_ALGO 171 /* canonicalization algo. */ +#define OCI_ATTR_PRIVATE_KEY 172 /* private key */ +#define OCI_ATTR_DIGEST_VALUE 173 /* digest value */ +#define OCI_ATTR_SIGNATURE_VAL 174 /* signature value */ +#define OCI_ATTR_SIGNATURE 175 /* signature */ + +/* attributes for setting OCI stmt caching specifics in svchp */ +#define OCI_ATTR_STMTCACHESIZE 176 /* size of the stm cache */ + +/* --------------------------- Connection Pool Attributes ------------------ */ +#define OCI_ATTR_CONN_NOWAIT 178 +#define OCI_ATTR_CONN_BUSY_COUNT 179 +#define OCI_ATTR_CONN_OPEN_COUNT 180 +#define OCI_ATTR_CONN_TIMEOUT 181 +#define OCI_ATTR_STMT_STATE 182 +#define OCI_ATTR_CONN_MIN 183 +#define OCI_ATTR_CONN_MAX 184 +#define OCI_ATTR_CONN_INCR 185 + +/* For value 187, see DirPathAPI attribute section in this file */ + +#define OCI_ATTR_NUM_OPEN_STMTS 188 /* open stmts in session */ +#define OCI_ATTR_DESCRIBE_NATIVE 189 /* get native info via desc */ + +#define OCI_ATTR_BIND_COUNT 190 /* number of bind postions */ +#define OCI_ATTR_HANDLE_POSITION 191 /* pos of bind/define handle */ +#define OCI_ATTR_RESERVED_5 192 /* reserverd */ +#define OCI_ATTR_SERVER_BUSY 193 /* call in progress on server*/ + +/* For value 194, see DirPathAPI attribute section in this file */ + +/* notification presentation for recipient */ +#define OCI_ATTR_SUBSCR_RECPTPRES 195 +#define OCI_ATTR_TRANSFORMATION 196 /* AQ message transformation */ + +#define OCI_ATTR_ROWS_FETCHED 197 /* rows fetched in last call */ + +/* --------------------------- Snapshot attributes ------------------------- */ +#define OCI_ATTR_SCN_BASE 198 /* snapshot base */ +#define OCI_ATTR_SCN_WRAP 199 /* snapshot wrap */ + +/* --------------------------- Miscellanous attributes --------------------- */ +#define OCI_ATTR_RESERVED_6 200 /* reserved */ +#define OCI_ATTR_READONLY_TXN 201 /* txn is readonly */ +#define OCI_ATTR_RESERVED_7 202 /* reserved */ +#define OCI_ATTR_ERRONEOUS_COLUMN 203 /* position of erroneous col */ +#define OCI_ATTR_RESERVED_8 204 /* reserved */ +#define OCI_ATTR_ASM_VOL_SPRT 205 /* ASM volume supported? */ + +/* For value 206, see DirPathAPI attribute section in this file */ + +#define OCI_ATTR_INST_TYPE 207 /* oracle instance type */ +/******USED attribute 208 for OCI_ATTR_SPOOL_STMTCACHESIZE*******************/ + +#define OCI_ATTR_ENV_UTF16 209 /* is env in utf16 mode? */ +#define OCI_ATTR_RESERVED_9 210 /* reserved */ +#define OCI_ATTR_RESERVED_10 211 /* reserved */ + +/* For values 212 and 213, see DirPathAPI attribute section in this file */ + +#define OCI_ATTR_RESERVED_12 214 /* reserved */ +#define OCI_ATTR_RESERVED_13 215 /* reserved */ +#define OCI_ATTR_IS_EXTERNAL 216 /* whether table is external */ + + +/* -------------------------- Statement Handle Attributes ------------------ */ + +#define OCI_ATTR_RESERVED_15 217 /* reserved */ +#define OCI_ATTR_STMT_IS_RETURNING 218 /* stmt has returning clause */ +#define OCI_ATTR_RESERVED_16 219 /* reserved */ +#define OCI_ATTR_RESERVED_17 220 /* reserved */ +#define OCI_ATTR_RESERVED_18 221 /* reserved */ + +/* --------------------------- session attributes ---------------------------*/ +#define OCI_ATTR_RESERVED_19 222 /* reserved */ +#define OCI_ATTR_RESERVED_20 223 /* reserved */ +#define OCI_ATTR_CURRENT_SCHEMA 224 /* Current Schema */ +#define OCI_ATTR_RESERVED_21 415 /* reserved */ + +/* ------------------------- notification subscription ----------------------*/ +#define OCI_ATTR_SUBSCR_QOSFLAGS 225 /* QOS flags */ +#define OCI_ATTR_SUBSCR_PAYLOADCBK 226 /* Payload callback */ +#define OCI_ATTR_SUBSCR_TIMEOUT 227 /* Timeout */ +#define OCI_ATTR_SUBSCR_NAMESPACE_CTX 228 /* Namespace context */ +#define OCI_ATTR_SUBSCR_CQ_QOSFLAGS 229 + /* change notification (CQ) specific QOS flags */ +#define OCI_ATTR_SUBSCR_CQ_REGID 230 + /* change notification registration id */ +#define OCI_ATTR_SUBSCR_NTFN_GROUPING_CLASS 231/* ntfn grouping class */ +#define OCI_ATTR_SUBSCR_NTFN_GROUPING_VALUE 232/* ntfn grouping value */ +#define OCI_ATTR_SUBSCR_NTFN_GROUPING_TYPE 233 /* ntfn grouping type */ +#define OCI_ATTR_SUBSCR_NTFN_GROUPING_START_TIME 234/* ntfn grp start time */ +#define OCI_ATTR_SUBSCR_NTFN_GROUPING_REPEAT_COUNT 235 /* ntfn grp rep count */ +#define OCI_ATTR_AQ_NTFN_GROUPING_MSGID_ARRAY 236 /* aq grp msgid array */ +#define OCI_ATTR_AQ_NTFN_GROUPING_COUNT 237 /* ntfns recd in grp */ + +/* ----------------------- row callback attributes ------------------------- */ +#define OCI_ATTR_BIND_ROWCBK 301 /* bind row callback */ +#define OCI_ATTR_BIND_ROWCTX 302 /* ctx for bind row callback */ +#define OCI_ATTR_SKIP_BUFFER 303 /* skip buffer in array ops */ + +/* ----------------------- XStream API attributes -------------------------- */ +#define OCI_ATTR_XSTREAM_ACK_INTERVAL 350 /* XStream ack interval */ +#define OCI_ATTR_XSTREAM_IDLE_TIMEOUT 351 /* XStream idle timeout */ + +/*----- Db Change Notification (CQ) statement handle attributes------------ */ +#define OCI_ATTR_CQ_QUERYID 304 +/* ------------- DB Change Notification reg handle attributes ---------------*/ +#define OCI_ATTR_CHNF_TABLENAMES 401 /* out: array of table names */ +#define OCI_ATTR_CHNF_ROWIDS 402 /* in: rowids needed */ +#define OCI_ATTR_CHNF_OPERATIONS 403 + /* in: notification operation filter*/ +#define OCI_ATTR_CHNF_CHANGELAG 404 + /* txn lag between notifications */ + +/* DB Change: Notification Descriptor attributes -----------------------*/ +#define OCI_ATTR_CHDES_DBNAME 405 /* source database */ +#define OCI_ATTR_CHDES_NFYTYPE 406 /* notification type flags */ +#define OCI_ATTR_CHDES_XID 407 /* XID of the transaction */ +#define OCI_ATTR_CHDES_TABLE_CHANGES 408/* array of table chg descriptors*/ + +#define OCI_ATTR_CHDES_TABLE_NAME 409 /* table name */ +#define OCI_ATTR_CHDES_TABLE_OPFLAGS 410 /* table operation flags */ +#define OCI_ATTR_CHDES_TABLE_ROW_CHANGES 411 /* array of changed rows */ +#define OCI_ATTR_CHDES_ROW_ROWID 412 /* rowid of changed row */ +#define OCI_ATTR_CHDES_ROW_OPFLAGS 413 /* row operation flags */ + +/* Statement handle attribute for db change notification */ +#define OCI_ATTR_CHNF_REGHANDLE 414 /* IN: subscription handle */ +#define OCI_ATTR_NETWORK_FILE_DESC 415 /* network file descriptor */ + +/* client name for single session proxy */ +#define OCI_ATTR_PROXY_CLIENT 416 + +/* 415 is already taken - see OCI_ATTR_RESERVED_21 */ + +/* TDE attributes on the Table */ +#define OCI_ATTR_TABLE_ENC 417/* does table have any encrypt columns */ +#define OCI_ATTR_TABLE_ENC_ALG 418 /* Table encryption Algorithm */ +#define OCI_ATTR_TABLE_ENC_ALG_ID 419 /* Internal Id of encryption Algorithm*/ + +/* -------- Attributes related to Statement cache callback ----------------- */ +#define OCI_ATTR_STMTCACHE_CBKCTX 420 /* opaque context on stmt */ +#define OCI_ATTR_STMTCACHE_CBK 421 /* callback fn for stmtcache */ + +/*---------------- Query change descriptor attributes -----------------------*/ +#define OCI_ATTR_CQDES_OPERATION 422 +#define OCI_ATTR_CQDES_TABLE_CHANGES 423 +#define OCI_ATTR_CQDES_QUERYID 424 + + +#define OCI_ATTR_CHDES_QUERIES 425 /* Top level change desc array of queries */ + +/* Please use from 143 */ + +/* -------- Internal statement attributes ------- */ +#define OCI_ATTR_RESERVED_26 422 + +/* 424 is used by OCI_ATTR_DRIVER_NAME */ +/* --------- Attributes added to support server side session pool ---------- */ +#define OCI_ATTR_CONNECTION_CLASS 425 +#define OCI_ATTR_PURITY 426 + +#define OCI_ATTR_PURITY_DEFAULT 0x00 +#define OCI_ATTR_PURITY_NEW 0x01 +#define OCI_ATTR_PURITY_SELF 0x02 + +/* -------- Attributes for Times Ten --------------------------*/ +#define OCI_ATTR_RESERVED_28 426 /* reserved */ +#define OCI_ATTR_RESERVED_29 427 /* reserved */ +#define OCI_ATTR_RESERVED_30 428 /* reserved */ +#define OCI_ATTR_RESERVED_31 429 /* reserved */ +#define OCI_ATTR_RESERVED_32 430 /* reserved */ +#define OCI_ATTR_RESERVED_41 454 /* reserved */ + + +/* ----------- Reserve internal attributes for workload replay ------------ */ +#define OCI_ATTR_RESERVED_33 433 +#define OCI_ATTR_RESERVED_34 434 + +/* statement attribute */ +#define OCI_ATTR_RESERVED_36 444 + +/* -------- Attributes for Network Session Time Out--------------------------*/ +#define OCI_ATTR_SEND_TIMEOUT 435 /* NS send timeout */ +#define OCI_ATTR_RECEIVE_TIMEOUT 436 /* NS receive timeout */ + +/*--------- Attributes related to LOB prefetch------------------------------ */ +#define OCI_ATTR_DEFAULT_LOBPREFETCH_SIZE 438 /* default prefetch size */ +#define OCI_ATTR_LOBPREFETCH_SIZE 439 /* prefetch size */ +#define OCI_ATTR_LOBPREFETCH_LENGTH 440 /* prefetch length & chunk */ + +/*--------- Attributes related to LOB Deduplicate Regions ------------------ */ +#define OCI_ATTR_LOB_REGION_PRIMARY 442 /* Primary LOB Locator */ +#define OCI_ATTR_LOB_REGION_PRIMOFF 443 /* Offset into Primary LOB */ +#define OCI_ATTR_LOB_REGION_OFFSET 445 /* Region Offset */ +#define OCI_ATTR_LOB_REGION_LENGTH 446 /* Region Length Bytes/Chars */ +#define OCI_ATTR_LOB_REGION_MIME 447 /* Region mime type */ + +/*--------------------Attribute to fetch ROWID ------------------------------*/ +#define OCI_ATTR_FETCH_ROWID 448 + +/* server attribute */ +#define OCI_ATTR_RESERVED_37 449 + +/*------------------- Client Internal Attributes -----------------------*/ +#define OCI_ATTR_RESERVED_38 450 +#define OCI_ATTR_RESERVED_39 451 + +/* --------------- ip address attribute in environment handle -------------- */ +#define OCI_ATTR_SUBSCR_IPADDR 452 /* ip address to listen on */ + +/* server attribute */ +#define OCI_ATTR_RESERVED_40 453 + +/* ------------- round trip callback attributes in the process handle ----- */ +#define OCI_ATTR_RESERVED_458 458 /* reserved */ +#define OCI_ATTR_RESERVED_459 459 /* reserved */ + +/* DB Change: Event types ---------------*/ +#define OCI_EVENT_NONE 0x0 /* None */ +#define OCI_EVENT_STARTUP 0x1 /* Startup database */ +#define OCI_EVENT_SHUTDOWN 0x2 /* Shutdown database */ +#define OCI_EVENT_SHUTDOWN_ANY 0x3 /* Startup instance */ +#define OCI_EVENT_DROP_DB 0x4 /* Drop database */ +#define OCI_EVENT_DEREG 0x5 /* Subscription deregistered */ +#define OCI_EVENT_OBJCHANGE 0x6 /* Object change notification */ +#define OCI_EVENT_QUERYCHANGE 0x7 /* query result change */ + +/* DB Change: Operation types -----------*/ +#define OCI_OPCODE_ALLROWS 0x1 /* all rows invalidated */ +#define OCI_OPCODE_ALLOPS 0x0 /* interested in all operations */ +#define OCI_OPCODE_INSERT 0x2 /* INSERT */ +#define OCI_OPCODE_UPDATE 0x4 /* UPDATE */ +#define OCI_OPCODE_DELETE 0x8 /* DELETE */ +#define OCI_OPCODE_ALTER 0x10 /* ALTER */ +#define OCI_OPCODE_DROP 0x20 /* DROP TABLE */ +#define OCI_OPCODE_UNKNOWN 0x40 /* GENERIC/ UNKNOWN*/ + +/* -------- client side character and national character set ids ----------- */ +#define OCI_ATTR_ENV_CHARSET_ID OCI_ATTR_CHARSET_ID /* charset id in env */ +#define OCI_ATTR_ENV_NCHARSET_ID OCI_ATTR_NCHARSET_ID /* ncharset id in env */ + +/* ----------------------- ha event callback attributes -------------------- */ +#define OCI_ATTR_EVTCBK 304 /* ha callback */ +#define OCI_ATTR_EVTCTX 305 /* ctx for ha callback */ + +/* ------------------ User memory attributes (all handles) ----------------- */ +#define OCI_ATTR_USER_MEMORY 306 /* pointer to user memory */ + +/* ------- unauthorised access and user action auditing banners ------------ */ +#define OCI_ATTR_ACCESS_BANNER 307 /* access banner */ +#define OCI_ATTR_AUDIT_BANNER 308 /* audit banner */ + +/* ----------------- port no attribute in environment handle ------------- */ +#define OCI_ATTR_SUBSCR_PORTNO 390 /* port no to listen */ + +#define OCI_ATTR_RESERVED_35 437 + +/*------------- Supported Values for protocol for recepient -----------------*/ +#define OCI_SUBSCR_PROTO_OCI 0 /* oci */ +#define OCI_SUBSCR_PROTO_MAIL 1 /* mail */ +#define OCI_SUBSCR_PROTO_SERVER 2 /* server */ +#define OCI_SUBSCR_PROTO_HTTP 3 /* http */ +#define OCI_SUBSCR_PROTO_MAX 4 /* max current protocols */ + +/*------------- Supported Values for presentation for recepient -------------*/ +#define OCI_SUBSCR_PRES_DEFAULT 0 /* default */ +#define OCI_SUBSCR_PRES_XML 1 /* xml */ +#define OCI_SUBSCR_PRES_MAX 2 /* max current presentations */ + +/*------------- Supported QOS values for notification registrations ---------*/ +#define OCI_SUBSCR_QOS_RELIABLE 0x01 /* reliable */ +#define OCI_SUBSCR_QOS_PAYLOAD 0x02 /* payload delivery */ +#define OCI_SUBSCR_QOS_REPLICATE 0x04 /* replicate to director */ +#define OCI_SUBSCR_QOS_SECURE 0x08 /* secure payload delivery */ +#define OCI_SUBSCR_QOS_PURGE_ON_NTFN 0x10 /* purge on first ntfn */ +#define OCI_SUBSCR_QOS_MULTICBK 0x20 /* multi instance callback */ + /* 0x40 is used for a internal flag */ +#define OCI_SUBSCR_QOS_HAREG 0x80 /* HA reg */ + +/* ----QOS flags specific to change notification/ continuous queries CQ -----*/ +#define OCI_SUBSCR_CQ_QOS_QUERY 0x01 /* query level notification */ +#define OCI_SUBSCR_CQ_QOS_BEST_EFFORT 0x02 /* best effort notification */ +#define OCI_SUBSCR_CQ_QOS_CLQRYCACHE 0x04 /* client query caching */ + +/*------------- Supported Values for notification grouping class ------------*/ +#define OCI_SUBSCR_NTFN_GROUPING_CLASS_TIME 1 /* time */ + +/*------------- Supported Values for notification grouping type -------------*/ +#define OCI_SUBSCR_NTFN_GROUPING_TYPE_SUMMARY 1 /* summary */ +#define OCI_SUBSCR_NTFN_GROUPING_TYPE_LAST 2 /* last */ + +/* ----- Temporary attribute value for UCS2/UTF16 character set ID -------- */ +#define OCI_UCS2ID 1000 /* UCS2 charset ID */ +#define OCI_UTF16ID 1000 /* UTF16 charset ID */ + +/*============================== End OCI Attribute Types ====================*/ + +/*---------------- Server Handle Attribute Values ---------------------------*/ + +/* OCI_ATTR_SERVER_STATUS */ +#define OCI_SERVER_NOT_CONNECTED 0x0 +#define OCI_SERVER_NORMAL 0x1 + +/*---------------------------------------------------------------------------*/ + +/*------------------------- Supported Namespaces ---------------------------*/ +#define OCI_SUBSCR_NAMESPACE_ANONYMOUS 0 /* Anonymous Namespace */ +#define OCI_SUBSCR_NAMESPACE_AQ 1 /* Advanced Queues */ +#define OCI_SUBSCR_NAMESPACE_DBCHANGE 2 /* change notification */ +#define OCI_SUBSCR_NAMESPACE_MAX 3 /* Max Name Space Number */ + + +/*-------------------------Credential Types----------------------------------*/ +#define OCI_CRED_RDBMS 1 /* database username/password */ +#define OCI_CRED_EXT 2 /* externally provided credentials */ +#define OCI_CRED_PROXY 3 /* proxy authentication */ +#define OCI_CRED_RESERVED_1 4 /* reserved */ +#define OCI_CRED_RESERVED_2 5 /* reserved */ +/*---------------------------------------------------------------------------*/ + +/*------------------------Error Return Values--------------------------------*/ +#define OCI_SUCCESS 0 /* maps to SQL_SUCCESS of SAG CLI */ +#define OCI_SUCCESS_WITH_INFO 1 /* maps to SQL_SUCCESS_WITH_INFO */ +#define OCI_RESERVED_FOR_INT_USE 200 /* reserved */ +#define OCI_NO_DATA 100 /* maps to SQL_NO_DATA */ +#define OCI_ERROR -1 /* maps to SQL_ERROR */ +#define OCI_INVALID_HANDLE -2 /* maps to SQL_INVALID_HANDLE */ +#define OCI_NEED_DATA 99 /* maps to SQL_NEED_DATA */ +#define OCI_STILL_EXECUTING -3123 /* OCI would block error */ +/*---------------------------------------------------------------------------*/ + +/*--------------------- User Callback Return Values -------------------------*/ +#define OCI_CONTINUE -24200 /* Continue with the body of the OCI function */ +#define OCI_ROWCBK_DONE -24201 /* done with user row callback */ +/*---------------------------------------------------------------------------*/ + +/*------------------DateTime and Interval check Error codes------------------*/ + +/* DateTime Error Codes used by OCIDateTimeCheck() */ +#define OCI_DT_INVALID_DAY 0x1 /* Bad day */ +#define OCI_DT_DAY_BELOW_VALID 0x2 /* Bad DAy Low/high bit (1=low)*/ +#define OCI_DT_INVALID_MONTH 0x4 /* Bad MOnth */ +#define OCI_DT_MONTH_BELOW_VALID 0x8 /* Bad MOnth Low/high bit (1=low) */ +#define OCI_DT_INVALID_YEAR 0x10 /* Bad YeaR */ +#define OCI_DT_YEAR_BELOW_VALID 0x20 /* Bad YeaR Low/high bit (1=low) */ +#define OCI_DT_INVALID_HOUR 0x40 /* Bad HouR */ +#define OCI_DT_HOUR_BELOW_VALID 0x80 /* Bad HouR Low/high bit (1=low) */ +#define OCI_DT_INVALID_MINUTE 0x100 /* Bad MiNute */ +#define OCI_DT_MINUTE_BELOW_VALID 0x200 /*Bad MiNute Low/high bit (1=low) */ +#define OCI_DT_INVALID_SECOND 0x400 /* Bad SeCond */ +#define OCI_DT_SECOND_BELOW_VALID 0x800 /*bad second Low/high bit (1=low)*/ +#define OCI_DT_DAY_MISSING_FROM_1582 0x1000 + /* Day is one of those "missing" from 1582 */ +#define OCI_DT_YEAR_ZERO 0x2000 /* Year may not equal zero */ +#define OCI_DT_INVALID_TIMEZONE 0x4000 /* Bad Timezone */ +#define OCI_DT_INVALID_FORMAT 0x8000 /* Bad date format input */ + + +/* Interval Error Codes used by OCIInterCheck() */ +#define OCI_INTER_INVALID_DAY 0x1 /* Bad day */ +#define OCI_INTER_DAY_BELOW_VALID 0x2 /* Bad DAy Low/high bit (1=low) */ +#define OCI_INTER_INVALID_MONTH 0x4 /* Bad MOnth */ +#define OCI_INTER_MONTH_BELOW_VALID 0x8 /*Bad MOnth Low/high bit (1=low) */ +#define OCI_INTER_INVALID_YEAR 0x10 /* Bad YeaR */ +#define OCI_INTER_YEAR_BELOW_VALID 0x20 /*Bad YeaR Low/high bit (1=low) */ +#define OCI_INTER_INVALID_HOUR 0x40 /* Bad HouR */ +#define OCI_INTER_HOUR_BELOW_VALID 0x80 /*Bad HouR Low/high bit (1=low) */ +#define OCI_INTER_INVALID_MINUTE 0x100 /* Bad MiNute */ +#define OCI_INTER_MINUTE_BELOW_VALID 0x200 + /*Bad MiNute Low/high bit(1=low) */ +#define OCI_INTER_INVALID_SECOND 0x400 /* Bad SeCond */ +#define OCI_INTER_SECOND_BELOW_VALID 0x800 + /*bad second Low/high bit(1=low) */ +#define OCI_INTER_INVALID_FRACSEC 0x1000 /* Bad Fractional second */ +#define OCI_INTER_FRACSEC_BELOW_VALID 0x2000 + /* Bad fractional second Low/High */ + + +/*------------------------Parsing Syntax Types-------------------------------*/ +#define OCI_V7_SYNTAX 2 /* V815 language - for backwards compatibility */ +#define OCI_V8_SYNTAX 3 /* V815 language - for backwards compatibility */ +#define OCI_NTV_SYNTAX 1 /* Use what so ever is the native lang of server */ + /* these values must match the values defined in kpul.h */ +/*---------------------------------------------------------------------------*/ + +/*------------------------(Scrollable Cursor) Fetch Options------------------- + * For non-scrollable cursor, the only valid (and default) orientation is + * OCI_FETCH_NEXT + */ +#define OCI_FETCH_CURRENT 0x00000001 /* refetching current position */ +#define OCI_FETCH_NEXT 0x00000002 /* next row */ +#define OCI_FETCH_FIRST 0x00000004 /* first row of the result set */ +#define OCI_FETCH_LAST 0x00000008 /* the last row of the result set */ +#define OCI_FETCH_PRIOR 0x00000010 /* previous row relative to current */ +#define OCI_FETCH_ABSOLUTE 0x00000020 /* absolute offset from first */ +#define OCI_FETCH_RELATIVE 0x00000040 /* offset relative to current */ +#define OCI_FETCH_RESERVED_1 0x00000080 /* reserved */ +#define OCI_FETCH_RESERVED_2 0x00000100 /* reserved */ +#define OCI_FETCH_RESERVED_3 0x00000200 /* reserved */ +#define OCI_FETCH_RESERVED_4 0x00000400 /* reserved */ +#define OCI_FETCH_RESERVED_5 0x00000800 /* reserved */ +#define OCI_FETCH_RESERVED_6 0x00001000 /* reserved */ + +/*---------------------------------------------------------------------------*/ + +/*------------------------Bind and Define Options----------------------------*/ +#define OCI_SB2_IND_PTR 0x00000001 /* unused */ +#define OCI_DATA_AT_EXEC 0x00000002 /* data at execute time */ +#define OCI_DYNAMIC_FETCH 0x00000002 /* fetch dynamically */ +#define OCI_PIECEWISE 0x00000004 /* piecewise DMLs or fetch */ +#define OCI_DEFINE_RESERVED_1 0x00000008 /* reserved */ +#define OCI_BIND_RESERVED_2 0x00000010 /* reserved */ +#define OCI_DEFINE_RESERVED_2 0x00000020 /* reserved */ +#define OCI_BIND_SOFT 0x00000040 /* soft bind or define */ +#define OCI_DEFINE_SOFT 0x00000080 /* soft bind or define */ +#define OCI_BIND_RESERVED_3 0x00000100 /* reserved */ +#define OCI_IOV 0x00000200 /* For scatter gather bind/define */ +/*---------------------------------------------------------------------------*/ + +/*----------------------------- Various Modes ------------------------------*/ +#define OCI_DEFAULT 0x00000000 + /* the default value for parameters and attributes */ +/*-------------OCIInitialize Modes / OCICreateEnvironment Modes -------------*/ +#define OCI_THREADED 0x00000001 /* appl. in threaded environment */ +#define OCI_OBJECT 0x00000002 /* application in object environment */ +#define OCI_EVENTS 0x00000004 /* application is enabled for events */ +#define OCI_RESERVED1 0x00000008 /* reserved */ +#define OCI_SHARED 0x00000010 /* the application is in shared mode */ +#define OCI_RESERVED2 0x00000020 /* reserved */ +/* The following *TWO* are only valid for OCICreateEnvironment call */ +#define OCI_NO_UCB 0x00000040 /* No user callback called during ini */ +#define OCI_NO_MUTEX 0x00000080 /* the environment handle will not be */ + /* protected by a mutex internally */ +#define OCI_SHARED_EXT 0x00000100 /* Used for shared forms */ +/************************** 0x00000200 free **********************************/ +#define OCI_ALWAYS_BLOCKING 0x00000400 /* all connections always blocking */ +/************************** 0x00000800 free **********************************/ +#define OCI_USE_LDAP 0x00001000 /* allow LDAP connections */ +#define OCI_REG_LDAPONLY 0x00002000 /* only register to LDAP */ +#define OCI_UTF16 0x00004000 /* mode for all UTF16 metadata */ +#define OCI_AFC_PAD_ON 0x00008000 + /* turn on AFC blank padding when rlenp present */ +#define OCI_ENVCR_RESERVED3 0x00010000 /* reserved */ +#define OCI_NEW_LENGTH_SEMANTICS 0x00020000 /* adopt new length semantics */ + /* the new length semantics, always bytes, is used by OCIEnvNlsCreate */ +#define OCI_NO_MUTEX_STMT 0x00040000 /* Do not mutex stmt handle */ +#define OCI_MUTEX_ENV_ONLY 0x00080000 /* Mutex only the environment handle */ +#define OCI_SUPPRESS_NLS_VALIDATION 0x00100000 /* suppress nls validation */ + /* nls validation suppression is on by default; + use OCI_ENABLE_NLS_VALIDATION to disable it */ +#define OCI_MUTEX_TRY 0x00200000 /* try and acquire mutex */ +#define OCI_NCHAR_LITERAL_REPLACE_ON 0x00400000 /* nchar literal replace on */ +#define OCI_NCHAR_LITERAL_REPLACE_OFF 0x00800000 /* nchar literal replace off*/ +#define OCI_ENABLE_NLS_VALIDATION 0x01000000 /* enable nls validation */ +#define OCI_ENVCR_RESERVED4 0x02000000 /* reserved */ + +/*---------------------------------------------------------------------------*/ +/*------------------------OCIConnectionpoolCreate Modes----------------------*/ + +#define OCI_CPOOL_REINITIALIZE 0x111 + +/*---------------------------------------------------------------------------*/ +/*--------------------------------- OCILogon2 Modes -------------------------*/ + +#define OCI_LOGON2_SPOOL 0x0001 /* Use session pool */ +#define OCI_LOGON2_CPOOL OCI_CPOOL /* Use connection pool */ +#define OCI_LOGON2_STMTCACHE 0x0004 /* Use Stmt Caching */ +#define OCI_LOGON2_PROXY 0x0008 /* Proxy authentiaction */ + +/*---------------------------------------------------------------------------*/ +/*------------------------- OCISessionPoolCreate Modes ----------------------*/ + +#define OCI_SPC_REINITIALIZE 0x0001 /* Reinitialize the session pool */ +#define OCI_SPC_HOMOGENEOUS 0x0002 /* Session pool is homogeneneous */ +#define OCI_SPC_STMTCACHE 0x0004 /* Session pool has stmt cache */ +#define OCI_SPC_NO_RLB 0x0008 /* Do not enable Runtime load balancing. */ + +/*---------------------------------------------------------------------------*/ +/*--------------------------- OCISessionGet Modes ---------------------------*/ + +#define OCI_SESSGET_SPOOL 0x0001 /* SessionGet called in SPOOL mode */ +#define OCI_SESSGET_CPOOL OCI_CPOOL /* SessionGet called in CPOOL mode */ +#define OCI_SESSGET_STMTCACHE 0x0004 /* Use statement cache */ +#define OCI_SESSGET_CREDPROXY 0x0008 /* SessionGet called in proxy mode */ +#define OCI_SESSGET_CREDEXT 0x0010 +#define OCI_SESSGET_SPOOL_MATCHANY 0x0020 +#define OCI_SESSGET_PURITY_NEW 0x0040 +#define OCI_SESSGET_PURITY_SELF 0x0080 +#define OCI_SESSGET_SYSDBA 0x0100 /* SessionGet with SYSDBA privileges */ + +/*---------------------------------------------------------------------------*/ +/*------------------------ATTR Values for Session Pool-----------------------*/ +/* Attribute values for OCI_ATTR_SPOOL_GETMODE */ +#define OCI_SPOOL_ATTRVAL_WAIT 0 /* block till you get a session */ +#define OCI_SPOOL_ATTRVAL_NOWAIT 1 /* error out if no session avaliable */ +#define OCI_SPOOL_ATTRVAL_FORCEGET 2 /* get session even if max is exceeded */ + +/*---------------------------------------------------------------------------*/ +/*--------------------------- OCISessionRelease Modes -----------------------*/ + +#define OCI_SESSRLS_DROPSESS 0x0001 /* Drop the Session */ +#define OCI_SESSRLS_RETAG 0x0002 /* Retag the session */ + +/*---------------------------------------------------------------------------*/ +/*----------------------- OCISessionPoolDestroy Modes -----------------------*/ + +#define OCI_SPD_FORCE 0x0001 /* Force the sessions to terminate. + Even if there are some busy + sessions close them */ + +/*---------------------------------------------------------------------------*/ +/*----------------------------- Statement States ----------------------------*/ + +#define OCI_STMT_STATE_INITIALIZED 0x0001 +#define OCI_STMT_STATE_EXECUTED 0x0002 +#define OCI_STMT_STATE_END_OF_FETCH 0x0003 + +/*---------------------------------------------------------------------------*/ + +/*----------------------------- OCIMemStats Modes ---------------------------*/ +#define OCI_MEM_INIT 0x01 +#define OCI_MEM_CLN 0x02 +#define OCI_MEM_FLUSH 0x04 +#define OCI_DUMP_HEAP 0x80 + +#define OCI_CLIENT_STATS 0x10 +#define OCI_SERVER_STATS 0x20 + +/*----------------------------- OCIEnvInit Modes ----------------------------*/ +/* NOTE: NO NEW MODES SHOULD BE ADDED HERE BECAUSE THE RECOMMENDED METHOD + * IS TO USE THE NEW OCICreateEnvironment MODES. + */ +#define OCI_ENV_NO_UCB 0x01 /* A user callback will not be called in + OCIEnvInit() */ +#define OCI_ENV_NO_MUTEX 0x08 /* the environment handle will not be protected + by a mutex internally */ + +/*---------------------------------------------------------------------------*/ + +/*------------------------ Prepare Modes ------------------------------------*/ +#define OCI_NO_SHARING 0x01 /* turn off statement handle sharing */ +#define OCI_PREP_RESERVED_1 0x02 /* reserved */ +#define OCI_PREP_AFC_PAD_ON 0x04 /* turn on blank padding for AFC */ +#define OCI_PREP_AFC_PAD_OFF 0x08 /* turn off blank padding for AFC */ +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ + +/*----------------------- Execution Modes -----------------------------------*/ +#define OCI_BATCH_MODE 0x00000001 /* batch the oci stmt for exec */ +#define OCI_EXACT_FETCH 0x00000002 /* fetch exact rows specified */ +/* #define 0x00000004 available */ +#define OCI_STMT_SCROLLABLE_READONLY \ + 0x00000008 /* if result set is scrollable */ +#define OCI_DESCRIBE_ONLY 0x00000010 /* only describe the statement */ +#define OCI_COMMIT_ON_SUCCESS 0x00000020 /* commit, if successful exec */ +#define OCI_NON_BLOCKING 0x00000040 /* non-blocking */ +#define OCI_BATCH_ERRORS 0x00000080 /* batch errors in array dmls */ +#define OCI_PARSE_ONLY 0x00000100 /* only parse the statement */ +#define OCI_EXACT_FETCH_RESERVED_1 0x00000200 /* reserved */ +#define OCI_SHOW_DML_WARNINGS 0x00000400 + /* return OCI_SUCCESS_WITH_INFO for delete/update w/no where clause */ +#define OCI_EXEC_RESERVED_2 0x00000800 /* reserved */ +#define OCI_DESC_RESERVED_1 0x00001000 /* reserved */ +#define OCI_EXEC_RESERVED_3 0x00002000 /* reserved */ +#define OCI_EXEC_RESERVED_4 0x00004000 /* reserved */ +#define OCI_EXEC_RESERVED_5 0x00008000 /* reserved */ +#define OCI_EXEC_RESERVED_6 0x00010000 /* reserved */ +#define OCI_RESULT_CACHE 0x00020000 /* hint to use query caching */ +#define OCI_NO_RESULT_CACHE 0x00040000 /*hint to bypass query caching*/ +#define OCI_EXEC_RESERVED_7 0x00080000 /* reserved */ + +/*---------------------------------------------------------------------------*/ + +/*------------------------Authentication Modes-------------------------------*/ +#define OCI_MIGRATE 0x00000001 /* migratable auth context */ +#define OCI_SYSDBA 0x00000002 /* for SYSDBA authorization */ +#define OCI_SYSOPER 0x00000004 /* for SYSOPER authorization */ +#define OCI_PRELIM_AUTH 0x00000008 /* for preliminary authorization */ +#define OCIP_ICACHE 0x00000010 /* Private OCI cache mode */ +#define OCI_AUTH_RESERVED_1 0x00000020 /* reserved */ +#define OCI_STMT_CACHE 0x00000040 /* enable OCI Stmt Caching */ +#define OCI_STATELESS_CALL 0x00000080 /* stateless at call boundary */ +#define OCI_STATELESS_TXN 0x00000100 /* stateless at txn boundary */ +#define OCI_STATELESS_APP 0x00000200 /* stateless at user-specified pts */ +#define OCI_AUTH_RESERVED_2 0x00000400 /* reserved */ +#define OCI_AUTH_RESERVED_3 0x00000800 /* reserved */ +#define OCI_AUTH_RESERVED_4 0x00001000 /* reserved */ +#define OCI_AUTH_RESERVED_5 0x00002000 /* reserved */ +#define OCI_SYSASM 0x00008000 /* for SYSASM authorization */ +#define OCI_AUTH_RESERVED_6 0x00010000 /* reserved */ + +/*---------------------------------------------------------------------------*/ + +/*------------------------Session End Modes----------------------------------*/ +#define OCI_SESSEND_RESERVED_1 0x0001 /* reserved */ +#define OCI_SESSEND_RESERVED_2 0x0002 /* reserved */ +/*---------------------------------------------------------------------------*/ + +/*------------------------Attach Modes---------------------------------------*/ + +/* The following attach modes are the same as the UPI modes defined in + * UPIDEF.H. Do not use these values externally. + */ + +#define OCI_FASTPATH 0x0010 /* Attach in fast path mode */ +#define OCI_ATCH_RESERVED_1 0x0020 /* reserved */ +#define OCI_ATCH_RESERVED_2 0x0080 /* reserved */ +#define OCI_ATCH_RESERVED_3 0x0100 /* reserved */ +#define OCI_CPOOL 0x0200 /* Attach using server handle from pool */ +#define OCI_ATCH_RESERVED_4 0x0400 /* reserved */ +#define OCI_ATCH_RESERVED_5 0x2000 /* reserved */ +#define OCI_ATCH_ENABLE_BEQ 0x4000 /* Allow bequeath connect strings */ +#define OCI_ATCH_RESERVED_6 0x8000 /* reserved */ +#define OCI_ATCH_RESERVED_7 0x10000 /* reserved */ +#define OCI_ATCH_RESERVED_8 0x20000 /* reserved */ + +#define OCI_SRVATCH_RESERVED5 0x01000000 /* reserved */ +#define OCI_SRVATCH_RESERVED6 0x02000000 /* reserved */ + +/*---------------------OCIStmtPrepare2 Modes---------------------------------*/ +#define OCI_PREP2_CACHE_SEARCHONLY 0x0010 /* ONly Search */ +#define OCI_PREP2_GET_PLSQL_WARNINGS 0x0020 /* Get PL/SQL warnings */ +#define OCI_PREP2_RESERVED_1 0x0040 /* reserved */ + +/*---------------------OCIStmtRelease Modes----------------------------------*/ +#define OCI_STRLS_CACHE_DELETE 0x0010 /* Delete from Cache */ + +/*---------------------OCIHanlde Mgmt Misc Modes-----------------------------*/ +#define OCI_STM_RESERVED4 0x00100000 /* reserved */ + +/*-----------------------------End Various Modes ----------------------------*/ + +/*------------------------Piece Information----------------------------------*/ +#define OCI_PARAM_IN 0x01 /* in parameter */ +#define OCI_PARAM_OUT 0x02 /* out parameter */ +/*---------------------------------------------------------------------------*/ + +/*------------------------ Transaction Start Flags --------------------------*/ +/* NOTE: OCI_TRANS_JOIN and OCI_TRANS_NOMIGRATE not supported in 8.0.X */ +#define OCI_TRANS_NEW 0x00000001 /* start a new local or global txn */ +#define OCI_TRANS_JOIN 0x00000002 /* join an existing global txn */ +#define OCI_TRANS_RESUME 0x00000004 /* resume the global txn branch */ +#define OCI_TRANS_PROMOTE 0x00000008 /* promote the local txn to global */ +#define OCI_TRANS_STARTMASK 0x000000ff /* mask for start operation flags */ + +#define OCI_TRANS_READONLY 0x00000100 /* start a readonly txn */ +#define OCI_TRANS_READWRITE 0x00000200 /* start a read-write txn */ +#define OCI_TRANS_SERIALIZABLE 0x00000400 /* start a serializable txn */ +#define OCI_TRANS_ISOLMASK 0x0000ff00 /* mask for start isolation flags */ + +#define OCI_TRANS_LOOSE 0x00010000 /* a loosely coupled branch */ +#define OCI_TRANS_TIGHT 0x00020000 /* a tightly coupled branch */ +#define OCI_TRANS_TYPEMASK 0x000f0000 /* mask for branch type flags */ + +#define OCI_TRANS_NOMIGRATE 0x00100000 /* non migratable transaction */ +#define OCI_TRANS_SEPARABLE 0x00200000 /* separable transaction (8.1.6+) */ +#define OCI_TRANS_OTSRESUME 0x00400000 /* OTS resuming a transaction */ +#define OCI_TRANS_OTHRMASK 0xfff00000 /* mask for other start flags */ + + +/*---------------------------------------------------------------------------*/ + +/*------------------------ Transaction End Flags ----------------------------*/ +#define OCI_TRANS_TWOPHASE 0x01000000 /* use two phase commit */ +#define OCI_TRANS_WRITEBATCH 0x00000001 /* force cmt-redo for local txns */ +#define OCI_TRANS_WRITEIMMED 0x00000002 /* no force cmt-redo */ +#define OCI_TRANS_WRITEWAIT 0x00000004 /* no sync cmt-redo */ +#define OCI_TRANS_WRITENOWAIT 0x00000008 /* sync cmt-redo for local txns */ +/*---------------------------------------------------------------------------*/ + +/*------------------------- AQ Constants ------------------------------------ + * NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE + * The following constants must match the PL/SQL dbms_aq constants + * NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE + */ +/* ------------------------- Visibility flags -------------------------------*/ +#define OCI_ENQ_IMMEDIATE 1 /* enqueue is an independent transaction */ +#define OCI_ENQ_ON_COMMIT 2 /* enqueue is part of current transaction */ + +/* ----------------------- Dequeue mode flags -------------------------------*/ +#define OCI_DEQ_BROWSE 1 /* read message without acquiring a lock */ +#define OCI_DEQ_LOCKED 2 /* read and obtain write lock on message */ +#define OCI_DEQ_REMOVE 3 /* read the message and delete it */ +#define OCI_DEQ_REMOVE_NODATA 4 /* delete message w'o returning payload */ +#define OCI_DEQ_GETSIG 5 /* get signature only */ + +/* ----------------- Dequeue navigation flags -------------------------------*/ +#define OCI_DEQ_FIRST_MSG 1 /* get first message at head of queue */ +#define OCI_DEQ_NEXT_MSG 3 /* next message that is available */ +#define OCI_DEQ_NEXT_TRANSACTION 2 /* get first message of next txn group */ +#define OCI_DEQ_FIRST_MSG_MULTI_GROUP 4 + /* start from first message and array deq across txn groups */ +#define OCI_DEQ_MULT_TRANSACTION 5 /* array dequeue across txn groups */ +#define OCI_DEQ_NEXT_MSG_MULTI_GROUP OCI_DEQ_MULT_TRANSACTION + /* array dequeue across txn groups */ + +/* ----------------- Dequeue Option Reserved flags ------------------------- */ +#define OCI_DEQ_RESERVED_1 0x000001 + +/* --------------------- Message states -------------------------------------*/ +#define OCI_MSG_WAITING 1 /* the message delay has not yet completed */ +#define OCI_MSG_READY 0 /* the message is ready to be processed */ +#define OCI_MSG_PROCESSED 2 /* the message has been processed */ +#define OCI_MSG_EXPIRED 3 /* message has moved to exception queue */ + +/* --------------------- Sequence deviation ---------------------------------*/ +#define OCI_ENQ_BEFORE 2 /* enqueue message before another message */ +#define OCI_ENQ_TOP 3 /* enqueue message before all messages */ + +/* ------------------------- Visibility flags -------------------------------*/ +#define OCI_DEQ_IMMEDIATE 1 /* dequeue is an independent transaction */ +#define OCI_DEQ_ON_COMMIT 2 /* dequeue is part of current transaction */ + +/* ------------------------ Wait --------------------------------------------*/ +#define OCI_DEQ_WAIT_FOREVER -1 /* wait forever if no message available */ +#define OCI_NTFN_GROUPING_FOREVER -1 /* send grouping notifications forever */ +#define OCI_DEQ_NO_WAIT 0 /* do not wait if no message is available */ + +#define OCI_FLOW_CONTROL_NO_TIMEOUT -1 + /* streaming enqueue: no timeout for flow control */ + +/* ------------------------ Delay -------------------------------------------*/ +#define OCI_MSG_NO_DELAY 0 /* message is available immediately */ + +/* ------------------------- Expiration -------------------------------------*/ +#define OCI_MSG_NO_EXPIRATION -1 /* message will never expire */ + +#define OCI_MSG_PERSISTENT_OR_BUFFERED 3 +#define OCI_MSG_BUFFERED 2 +#define OCI_MSG_PERSISTENT 1 + +/* ----------------------- Reserved/AQE pisdef flags ------------------------*/ +/* see aqeflg defines in kwqp.h */ +#define OCI_AQ_RESERVED_1 0x0002 +#define OCI_AQ_RESERVED_2 0x0004 +#define OCI_AQ_RESERVED_3 0x0008 +#define OCI_AQ_RESERVED_4 0x0010 + +#define OCI_AQ_STREAMING_FLAG 0x02000000 + +/* ------------------------------ Replay Info -------------------------------*/ +#define OCI_AQ_LAST_ENQUEUED 0 +#define OCI_AQ_LAST_ACKNOWLEDGED 1 + +/* -------------------------- END AQ Constants ----------------------------- */ + +/* --------------------END DateTime and Interval Constants ------------------*/ + +/*-----------------------Object Types----------------------------------------*/ +/*-----------Object Types **** Not to be Used **** --------------------------*/ +/* Deprecated */ +#define OCI_OTYPE_UNK 0 +#define OCI_OTYPE_TABLE 1 +#define OCI_OTYPE_VIEW 2 +#define OCI_OTYPE_SYN 3 +#define OCI_OTYPE_PROC 4 +#define OCI_OTYPE_FUNC 5 +#define OCI_OTYPE_PKG 6 +#define OCI_OTYPE_STMT 7 +/*---------------------------------------------------------------------------*/ + +/*=======================Describe Handle Parameter Attributes ===============*/ +/* + These attributes are orthogonal to the other set of attributes defined + above. These attrubutes are to be used only for the describe handle. +*/ +/*===========================================================================*/ +/* Attributes common to Columns and Stored Procs */ +#define OCI_ATTR_DATA_SIZE 1 /* maximum size of the data */ +#define OCI_ATTR_DATA_TYPE 2 /* the SQL type of the column/argument */ +#define OCI_ATTR_DISP_SIZE 3 /* the display size */ +#define OCI_ATTR_NAME 4 /* the name of the column/argument */ +#define OCI_ATTR_PRECISION 5 /* precision if number type */ +#define OCI_ATTR_SCALE 6 /* scale if number type */ +#define OCI_ATTR_IS_NULL 7 /* is it null ? */ +#define OCI_ATTR_TYPE_NAME 8 + /* name of the named data type or a package name for package private types */ +#define OCI_ATTR_SCHEMA_NAME 9 /* the schema name */ +#define OCI_ATTR_SUB_NAME 10 /* type name if package private type */ +#define OCI_ATTR_POSITION 11 + /* relative position of col/arg in the list of cols/args */ +/* complex object retrieval parameter attributes */ +#define OCI_ATTR_COMPLEXOBJECTCOMP_TYPE 50 +#define OCI_ATTR_COMPLEXOBJECTCOMP_TYPE_LEVEL 51 +#define OCI_ATTR_COMPLEXOBJECT_LEVEL 52 +#define OCI_ATTR_COMPLEXOBJECT_COLL_OUTOFLINE 53 + +/* Only Columns */ +#define OCI_ATTR_DISP_NAME 100 /* the display name */ +#define OCI_ATTR_ENCC_SIZE 101 /* encrypted data size */ +#define OCI_ATTR_COL_ENC 102 /* column is encrypted ? */ +#define OCI_ATTR_COL_ENC_SALT 103 /* is encrypted column salted ? */ + +/*Only Stored Procs */ +#define OCI_ATTR_OVERLOAD 210 /* is this position overloaded */ +#define OCI_ATTR_LEVEL 211 /* level for structured types */ +#define OCI_ATTR_HAS_DEFAULT 212 /* has a default value */ +#define OCI_ATTR_IOMODE 213 /* in, out inout */ +#define OCI_ATTR_RADIX 214 /* returns a radix */ +#define OCI_ATTR_NUM_ARGS 215 /* total number of arguments */ + +/* only named type attributes */ +#define OCI_ATTR_TYPECODE 216 /* object or collection */ +#define OCI_ATTR_COLLECTION_TYPECODE 217 /* varray or nested table */ +#define OCI_ATTR_VERSION 218 /* user assigned version */ +#define OCI_ATTR_IS_INCOMPLETE_TYPE 219 /* is this an incomplete type */ +#define OCI_ATTR_IS_SYSTEM_TYPE 220 /* a system type */ +#define OCI_ATTR_IS_PREDEFINED_TYPE 221 /* a predefined type */ +#define OCI_ATTR_IS_TRANSIENT_TYPE 222 /* a transient type */ +#define OCI_ATTR_IS_SYSTEM_GENERATED_TYPE 223 /* system generated type */ +#define OCI_ATTR_HAS_NESTED_TABLE 224 /* contains nested table attr */ +#define OCI_ATTR_HAS_LOB 225 /* has a lob attribute */ +#define OCI_ATTR_HAS_FILE 226 /* has a file attribute */ +#define OCI_ATTR_COLLECTION_ELEMENT 227 /* has a collection attribute */ +#define OCI_ATTR_NUM_TYPE_ATTRS 228 /* number of attribute types */ +#define OCI_ATTR_LIST_TYPE_ATTRS 229 /* list of type attributes */ +#define OCI_ATTR_NUM_TYPE_METHODS 230 /* number of type methods */ +#define OCI_ATTR_LIST_TYPE_METHODS 231 /* list of type methods */ +#define OCI_ATTR_MAP_METHOD 232 /* map method of type */ +#define OCI_ATTR_ORDER_METHOD 233 /* order method of type */ + +/* only collection element */ +#define OCI_ATTR_NUM_ELEMS 234 /* number of elements */ + +/* only type methods */ +#define OCI_ATTR_ENCAPSULATION 235 /* encapsulation level */ +#define OCI_ATTR_IS_SELFISH 236 /* method selfish */ +#define OCI_ATTR_IS_VIRTUAL 237 /* virtual */ +#define OCI_ATTR_IS_INLINE 238 /* inline */ +#define OCI_ATTR_IS_CONSTANT 239 /* constant */ +#define OCI_ATTR_HAS_RESULT 240 /* has result */ +#define OCI_ATTR_IS_CONSTRUCTOR 241 /* constructor */ +#define OCI_ATTR_IS_DESTRUCTOR 242 /* destructor */ +#define OCI_ATTR_IS_OPERATOR 243 /* operator */ +#define OCI_ATTR_IS_MAP 244 /* a map method */ +#define OCI_ATTR_IS_ORDER 245 /* order method */ +#define OCI_ATTR_IS_RNDS 246 /* read no data state method */ +#define OCI_ATTR_IS_RNPS 247 /* read no process state */ +#define OCI_ATTR_IS_WNDS 248 /* write no data state method */ +#define OCI_ATTR_IS_WNPS 249 /* write no process state */ + +#define OCI_ATTR_DESC_PUBLIC 250 /* public object */ + +/* Object Cache Enhancements : attributes for User Constructed Instances */ +#define OCI_ATTR_CACHE_CLIENT_CONTEXT 251 +#define OCI_ATTR_UCI_CONSTRUCT 252 +#define OCI_ATTR_UCI_DESTRUCT 253 +#define OCI_ATTR_UCI_COPY 254 +#define OCI_ATTR_UCI_PICKLE 255 +#define OCI_ATTR_UCI_UNPICKLE 256 +#define OCI_ATTR_UCI_REFRESH 257 + +/* for type inheritance */ +#define OCI_ATTR_IS_SUBTYPE 258 +#define OCI_ATTR_SUPERTYPE_SCHEMA_NAME 259 +#define OCI_ATTR_SUPERTYPE_NAME 260 + +/* for schemas */ +#define OCI_ATTR_LIST_OBJECTS 261 /* list of objects in schema */ + +/* for database */ +#define OCI_ATTR_NCHARSET_ID 262 /* char set id */ +#define OCI_ATTR_LIST_SCHEMAS 263 /* list of schemas */ +#define OCI_ATTR_MAX_PROC_LEN 264 /* max procedure length */ +#define OCI_ATTR_MAX_COLUMN_LEN 265 /* max column name length */ +#define OCI_ATTR_CURSOR_COMMIT_BEHAVIOR 266 /* cursor commit behavior */ +#define OCI_ATTR_MAX_CATALOG_NAMELEN 267 /* catalog namelength */ +#define OCI_ATTR_CATALOG_LOCATION 268 /* catalog location */ +#define OCI_ATTR_SAVEPOINT_SUPPORT 269 /* savepoint support */ +#define OCI_ATTR_NOWAIT_SUPPORT 270 /* nowait support */ +#define OCI_ATTR_AUTOCOMMIT_DDL 271 /* autocommit DDL */ +#define OCI_ATTR_LOCKING_MODE 272 /* locking mode */ + +/* for externally initialized context */ +#define OCI_ATTR_APPCTX_SIZE 273 /* count of context to be init*/ +#define OCI_ATTR_APPCTX_LIST 274 /* count of context to be init*/ +#define OCI_ATTR_APPCTX_NAME 275 /* name of context to be init*/ +#define OCI_ATTR_APPCTX_ATTR 276 /* attr of context to be init*/ +#define OCI_ATTR_APPCTX_VALUE 277 /* value of context to be init*/ + +/* for client id propagation */ +#define OCI_ATTR_CLIENT_IDENTIFIER 278 /* value of client id to set*/ + +/* for inheritance - part 2 */ +#define OCI_ATTR_IS_FINAL_TYPE 279 /* is final type ? */ +#define OCI_ATTR_IS_INSTANTIABLE_TYPE 280 /* is instantiable type ? */ +#define OCI_ATTR_IS_FINAL_METHOD 281 /* is final method ? */ +#define OCI_ATTR_IS_INSTANTIABLE_METHOD 282 /* is instantiable method ? */ +#define OCI_ATTR_IS_OVERRIDING_METHOD 283 /* is overriding method ? */ + +#define OCI_ATTR_DESC_SYNBASE 284 /* Describe the base object */ + + +#define OCI_ATTR_CHAR_USED 285 /* char length semantics */ +#define OCI_ATTR_CHAR_SIZE 286 /* char length */ + +/* SQLJ support */ +#define OCI_ATTR_IS_JAVA_TYPE 287 /* is java implemented type ? */ + +/* N-Tier support */ +#define OCI_ATTR_DISTINGUISHED_NAME 300 /* use DN as user name */ +#define OCI_ATTR_KERBEROS_TICKET 301 /* Kerberos ticket as cred. */ + +/* for multilanguage debugging */ +#define OCI_ATTR_ORA_DEBUG_JDWP 302 /* ORA_DEBUG_JDWP attribute */ + +#define OCI_ATTR_EDITION 288 /* ORA_EDITION */ + +#define OCI_ATTR_RESERVED_14 303 /* reserved */ + + +/*---------------------------End Describe Handle Attributes -----------------*/ + +/* For values 303 - 307, see DirPathAPI attribute section in this file */ + +/* ----------------------- Session Pool Attributes ------------------------- */ +#define OCI_ATTR_SPOOL_TIMEOUT 308 /* session timeout */ +#define OCI_ATTR_SPOOL_GETMODE 309 /* session get mode */ +#define OCI_ATTR_SPOOL_BUSY_COUNT 310 /* busy session count */ +#define OCI_ATTR_SPOOL_OPEN_COUNT 311 /* open session count */ +#define OCI_ATTR_SPOOL_MIN 312 /* min session count */ +#define OCI_ATTR_SPOOL_MAX 313 /* max session count */ +#define OCI_ATTR_SPOOL_INCR 314 /* session increment count */ +#define OCI_ATTR_SPOOL_STMTCACHESIZE 208 /*Stmt cache size of pool */ +#define OCI_ATTR_SPOOL_AUTH 460 /* Auth handle on pool handle*/ +/*------------------------------End Session Pool Attributes -----------------*/ +/*---------------------------- For XML Types ------------------------------- */ +/* For table, view and column */ +#define OCI_ATTR_IS_XMLTYPE 315 /* Is the type an XML type? */ +#define OCI_ATTR_XMLSCHEMA_NAME 316 /* Name of XML Schema */ +#define OCI_ATTR_XMLELEMENT_NAME 317 /* Name of XML Element */ +#define OCI_ATTR_XMLSQLTYPSCH_NAME 318 /* SQL type's schema for XML Ele */ +#define OCI_ATTR_XMLSQLTYPE_NAME 319 /* Name of SQL type for XML Ele */ +#define OCI_ATTR_XMLTYPE_STORED_OBJ 320 /* XML type stored as object? */ +#define OCI_ATTR_XMLTYPE_BINARY_XML 422 /* XML type stored as binary? */ + +/*---------------------------- For Subtypes ------------------------------- */ +/* For type */ +#define OCI_ATTR_HAS_SUBTYPES 321 /* Has subtypes? */ +#define OCI_ATTR_NUM_SUBTYPES 322 /* Number of subtypes */ +#define OCI_ATTR_LIST_SUBTYPES 323 /* List of subtypes */ + +/* XML flag */ +#define OCI_ATTR_XML_HRCHY_ENABLED 324 /* hierarchy enabled? */ + +/* Method flag */ +#define OCI_ATTR_IS_OVERRIDDEN_METHOD 325 /* Method is overridden? */ + +/* For values 326 - 335, see DirPathAPI attribute section in this file */ + +/*------------- Attributes for 10i Distributed Objects ----------------------*/ +#define OCI_ATTR_OBJ_SUBS 336 /* obj col/tab substitutable */ + +/* For values 337 - 338, see DirPathAPI attribute section in this file */ + +/*---------- Attributes for 10i XADFIELD (NLS language, territory -----------*/ +#define OCI_ATTR_XADFIELD_RESERVED_1 339 /* reserved */ +#define OCI_ATTR_XADFIELD_RESERVED_2 340 /* reserved */ +/*------------- Kerberos Secure Client Identifier ---------------------------*/ +#define OCI_ATTR_KERBEROS_CID 341 /* Kerberos db service ticket*/ + + +/*------------------------ Attributes for Rules objects ---------------------*/ +#define OCI_ATTR_CONDITION 342 /* rule condition */ +#define OCI_ATTR_COMMENT 343 /* comment */ +#define OCI_ATTR_VALUE 344 /* Anydata value */ +#define OCI_ATTR_EVAL_CONTEXT_OWNER 345 /* eval context owner */ +#define OCI_ATTR_EVAL_CONTEXT_NAME 346 /* eval context name */ +#define OCI_ATTR_EVALUATION_FUNCTION 347 /* eval function name */ +#define OCI_ATTR_VAR_TYPE 348 /* variable type */ +#define OCI_ATTR_VAR_VALUE_FUNCTION 349 /* variable value function */ +#define OCI_ATTR_VAR_METHOD_FUNCTION 350 /* variable method function */ +#define OCI_ATTR_ACTION_CONTEXT 351 /* action context */ +#define OCI_ATTR_LIST_TABLE_ALIASES 352 /* list of table aliases */ +#define OCI_ATTR_LIST_VARIABLE_TYPES 353 /* list of variable types */ +#define OCI_ATTR_TABLE_NAME 356 /* table name */ + +/* For values 357 - 359, see DirPathAPI attribute section in this file */ + +#define OCI_ATTR_MESSAGE_CSCN 360 /* message cscn */ +#define OCI_ATTR_MESSAGE_DSCN 361 /* message dscn */ + +/*--------------------- Audit Session ID ------------------------------------*/ +#define OCI_ATTR_AUDIT_SESSION_ID 362 /* Audit session ID */ + +/*--------------------- Kerberos TGT Keys -----------------------------------*/ +#define OCI_ATTR_KERBEROS_KEY 363 /* n-tier Kerberos cred key */ +#define OCI_ATTR_KERBEROS_CID_KEY 364 /* SCID Kerberos cred key */ + + +#define OCI_ATTR_TRANSACTION_NO 365 /* AQ enq txn number */ + +/*----------------------- Attributes for End To End Tracing -----------------*/ +#define OCI_ATTR_MODULE 366 /* module for tracing */ +#define OCI_ATTR_ACTION 367 /* action for tracing */ +#define OCI_ATTR_CLIENT_INFO 368 /* client info */ +#define OCI_ATTR_COLLECT_CALL_TIME 369 /* collect call time */ +#define OCI_ATTR_CALL_TIME 370 /* extract call time */ +#define OCI_ATTR_ECONTEXT_ID 371 /* execution-id context */ +#define OCI_ATTR_ECONTEXT_SEQ 372 /*execution-id sequence num */ + + +/*------------------------------ Session attributes -------------------------*/ +#define OCI_ATTR_SESSION_STATE 373 /* session state */ +#define OCI_SESSION_STATELESS 1 /* valid states */ +#define OCI_SESSION_STATEFUL 2 + +#define OCI_ATTR_SESSION_STATETYPE 374 /* session state type */ +#define OCI_SESSION_STATELESS_DEF 0 /* valid state types */ +#define OCI_SESSION_STATELESS_CAL 1 +#define OCI_SESSION_STATELESS_TXN 2 +#define OCI_SESSION_STATELESS_APP 3 + +#define OCI_ATTR_SESSION_STATE_CLEARED 376 /* session state cleared */ +#define OCI_ATTR_SESSION_MIGRATED 377 /* did session migrate */ +#define OCI_ATTR_SESSION_PRESERVE_STATE 388 /* preserve session state */ +#define OCI_ATTR_DRIVER_NAME 424 /* Driver Name */ + +/* -------------------------- Admin Handle Attributes ---------------------- */ + +#define OCI_ATTR_ADMIN_PFILE 389 /* client-side param file */ + +/*----------------------- Attributes for End To End Tracing -----------------*/ +/* -------------------------- HA Event Handle Attributes ------------------- */ + +#define OCI_ATTR_HOSTNAME 390 /* SYS_CONTEXT hostname */ +#define OCI_ATTR_DBNAME 391 /* SYS_CONTEXT dbname */ +#define OCI_ATTR_INSTNAME 392 /* SYS_CONTEXT instance name */ +#define OCI_ATTR_SERVICENAME 393 /* SYS_CONTEXT service name */ +#define OCI_ATTR_INSTSTARTTIME 394 /* v$instance instance start time */ +#define OCI_ATTR_HA_TIMESTAMP 395 /* event time */ +#define OCI_ATTR_RESERVED_22 396 /* reserved */ +#define OCI_ATTR_RESERVED_23 397 /* reserved */ +#define OCI_ATTR_RESERVED_24 398 /* reserved */ +#define OCI_ATTR_DBDOMAIN 399 /* db domain */ +#define OCI_ATTR_RESERVED_27 425 /* reserved */ + +#define OCI_ATTR_EVENTTYPE 400 /* event type */ +#define OCI_EVENTTYPE_HA 0 /* valid value for OCI_ATTR_EVENTTYPE */ + +#define OCI_ATTR_HA_SOURCE 401 +/* valid values for OCI_ATTR_HA_SOURCE */ +#define OCI_HA_SOURCE_INSTANCE 0 +#define OCI_HA_SOURCE_DATABASE 1 +#define OCI_HA_SOURCE_NODE 2 +#define OCI_HA_SOURCE_SERVICE 3 +#define OCI_HA_SOURCE_SERVICE_MEMBER 4 +#define OCI_HA_SOURCE_ASM_INSTANCE 5 +#define OCI_HA_SOURCE_SERVICE_PRECONNECT 6 + +#define OCI_ATTR_HA_STATUS 402 +#define OCI_HA_STATUS_DOWN 0 /* valid values for OCI_ATTR_HA_STATUS */ +#define OCI_HA_STATUS_UP 1 + +#define OCI_ATTR_HA_SRVFIRST 403 + +#define OCI_ATTR_HA_SRVNEXT 404 +/* ------------------------- Server Handle Attributes -----------------------*/ + +#define OCI_ATTR_TAF_ENABLED 405 + +/* Extra notification attributes */ +#define OCI_ATTR_NFY_FLAGS 406 + +#define OCI_ATTR_MSG_DELIVERY_MODE 407 /* msg delivery mode */ +#define OCI_ATTR_DB_CHARSET_ID 416 /* database charset ID */ +#define OCI_ATTR_DB_NCHARSET_ID 417 /* database ncharset ID */ +#define OCI_ATTR_RESERVED_25 418 /* reserved */ + +#define OCI_ATTR_FLOW_CONTROL_TIMEOUT 423 /* AQ: flow control timeout */ +/*---------------------------------------------------------------------------*/ +/* ------------------DirPathAPI attribute Section----------------------------*/ +/* All DirPathAPI attributes are in this section of the file. Existing */ +/* attributes prior to this section being created are assigned values < 2000 */ +/* Add new DirPathAPI attributes to this section and their assigned value */ +/* should be whatever the last entry is + 1. */ + +/*------------- Supported Values for Direct Path Stream Version -------------*/ +#define OCI_DIRPATH_STREAM_VERSION_1 100 +#define OCI_DIRPATH_STREAM_VERSION_2 200 +#define OCI_DIRPATH_STREAM_VERSION_3 300 /* default */ + + +#define OCI_ATTR_DIRPATH_MODE 78 /* mode of direct path operation */ +#define OCI_ATTR_DIRPATH_NOLOG 79 /* nologging option */ +#define OCI_ATTR_DIRPATH_PARALLEL 80 /* parallel (temp seg) option */ + +#define OCI_ATTR_DIRPATH_SORTED_INDEX 137 /* index that data is sorted on */ + + /* direct path index maint method (see oci8dp.h) */ +#define OCI_ATTR_DIRPATH_INDEX_MAINT_METHOD 138 + + /* parallel load: db file, initial and next extent sizes */ + +#define OCI_ATTR_DIRPATH_FILE 139 /* DB file to load into */ +#define OCI_ATTR_DIRPATH_STORAGE_INITIAL 140 /* initial extent size */ +#define OCI_ATTR_DIRPATH_STORAGE_NEXT 141 /* next extent size */ + /* direct path index maint method (see oci8dp.h) */ +#define OCI_ATTR_DIRPATH_SKIPINDEX_METHOD 145 + + /* 8.2 dpapi support of ADTs */ +#define OCI_ATTR_DIRPATH_EXPR_TYPE 150 /* expr type of OCI_ATTR_NAME */ + +/* For the direct path API there are three data formats: + * TEXT - used mainly by SQL*Loader, data is in textual form + * STREAM - used by datapump, data is in stream loadable form + * OCI - used by OCI programs utilizing the DpApi, data is in binary form + */ +#define OCI_ATTR_DIRPATH_INPUT 151 +#define OCI_DIRPATH_INPUT_TEXT 0x01 /* text */ +#define OCI_DIRPATH_INPUT_STREAM 0x02 /* stream (datapump) */ +#define OCI_DIRPATH_INPUT_OCI 0x04 /* binary (oci) */ +#define OCI_DIRPATH_INPUT_UNKNOWN 0x08 + +#define OCI_ATTR_DIRPATH_FN_CTX 167 /* fn ctx ADT attrs or args */ + +#define OCI_ATTR_DIRPATH_OID 187 /* loading into an OID col */ +#define OCI_ATTR_DIRPATH_SID 194 /* loading into an SID col */ +#define OCI_ATTR_DIRPATH_OBJ_CONSTR 206 /* obj type of subst obj tbl */ + +/* Attr to allow setting of the stream version PRIOR to calling Prepare */ +#define OCI_ATTR_DIRPATH_STREAM_VERSION 212 /* version of the stream*/ + +#define OCIP_ATTR_DIRPATH_VARRAY_INDEX 213 /* varray index column */ + +/*------------- Supported Values for Direct Path Date cache -----------------*/ +#define OCI_ATTR_DIRPATH_DCACHE_NUM 303 /* date cache entries */ +#define OCI_ATTR_DIRPATH_DCACHE_SIZE 304 /* date cache limit */ +#define OCI_ATTR_DIRPATH_DCACHE_MISSES 305 /* date cache misses */ +#define OCI_ATTR_DIRPATH_DCACHE_HITS 306 /* date cache hits */ +#define OCI_ATTR_DIRPATH_DCACHE_DISABLE 307 /* on set: disable datecache + * on overflow. + * on get: datecache disabled? + * could be due to overflow + * or others */ + +/*------------- Attributes for 10i Updates to the DirPath API ---------------*/ +#define OCI_ATTR_DIRPATH_RESERVED_7 326 /* reserved */ +#define OCI_ATTR_DIRPATH_RESERVED_8 327 /* reserved */ +#define OCI_ATTR_DIRPATH_CONVERT 328 /* stream conversion needed? */ +#define OCI_ATTR_DIRPATH_BADROW 329 /* info about bad row */ +#define OCI_ATTR_DIRPATH_BADROW_LENGTH 330 /* length of bad row info */ +#define OCI_ATTR_DIRPATH_WRITE_ORDER 331 /* column fill order */ +#define OCI_ATTR_DIRPATH_GRANULE_SIZE 332 /* granule size for unload */ +#define OCI_ATTR_DIRPATH_GRANULE_OFFSET 333 /* offset to last granule */ +#define OCI_ATTR_DIRPATH_RESERVED_1 334 /* reserved */ +#define OCI_ATTR_DIRPATH_RESERVED_2 335 /* reserved */ + +/*------ Attributes for 10i DirPathAPI conversion (NLS lang, terr, cs) ------*/ +#define OCI_ATTR_DIRPATH_RESERVED_3 337 /* reserved */ +#define OCI_ATTR_DIRPATH_RESERVED_4 338 /* reserved */ +#define OCI_ATTR_DIRPATH_RESERVED_5 357 /* reserved */ +#define OCI_ATTR_DIRPATH_RESERVED_6 358 /* reserved */ + +#define OCI_ATTR_DIRPATH_LOCK_WAIT 359 /* wait for lock in dpapi */ + +#define OCI_ATTR_DIRPATH_RESERVED_9 2000 /* reserved */ + +/*------ Attribute for 10iR2 for column encryption for Direct Path API ------*/ +#define OCI_ATTR_DIRPATH_RESERVED_10 2001 /* reserved */ +#define OCI_ATTR_DIRPATH_RESERVED_11 2002 /* reserved */ + +/*------ Attribute to determine last column successfully converted ----------*/ +#define OCI_ATTR_CURRENT_ERRCOL 2003 /* current error column */ + + /*--Attributes for 11gR1 for multiple subtype support in Direct Path API - */ +#define OCI_ATTR_DIRPATH_SUBTYPE_INDEX 2004 /* sbtyp indx for attribute */ + +#define OCI_ATTR_DIRPATH_RESERVED_12 2005 /* reserved */ +#define OCI_ATTR_DIRPATH_RESERVED_13 2006 /* reserver */ + + /*--Attribute for partitioning constraint optimization in Direct Path API */ +#define OCI_ATTR_DIRPATH_RESERVED_14 2007 /* reserved */ + + /*--Attribute for interval partitioning in Direct Path API */ +#define OCI_ATTR_DIRPATH_RESERVED_15 2008 /* reserved */ + + /*--Attribute for interval partitioning in Direct Path API */ +#define OCI_ATTR_DIRPATH_RESERVED_16 2009 /* reserved */ + +/*--Attribute for allowing parallel lob loads in Direct Path API */ +#define OCI_ATTR_DIRPATH_RESERVED_17 2010 /* reserved */ + +/*--Attribute for process order number of table being loaded/unloaded */ +#define OCI_ATTR_DIRPATH_RESERVED_18 2011 /* reserved */ + +#define OCI_ATTR_DIRPATH_RESERVED_19 2012 /* reserved */ + +#define OCI_ATTR_DIRPATH_NO_INDEX_ERRORS 2013 /* reserved */ + +/*--Attribute for private sqlldr no index errors */ +#define OCI_ATTR_DIRPATH_RESERVED_20 2014 /* reserved */ + +/*--Attribute for private sqlldr partition memory limit */ +#define OCI_ATTR_DIRPATH_RESERVED_21 2015 /* reserved */ + +#define OCI_ATTR_DIRPATH_RESERVED_22 2016 /* reserved */ + +/*--Attribute to use caller's transaction rather than starting on in kpodpp */ +#define OCI_ATTR_DIRPATH_USE_ACTIVE_TRANS 2017 /* reserved */ + +/*--Attribute for recnum column */ +#define OCI_ATTR_DIRPATH_RESERVED_23 2018 /* reserved */ + +/* Add DirPathAPI attributes above. Next value to be assigned is 2019 */ + + + +/* ------------------End of DirPathAPI attribute Section --------------------*/ +/*---------------------------------------------------------------------------*/ + + +/*---------------- Describe Handle Parameter Attribute Values ---------------*/ + +/* OCI_ATTR_CURSOR_COMMIT_BEHAVIOR */ +#define OCI_CURSOR_OPEN 0 +#define OCI_CURSOR_CLOSED 1 + +/* OCI_ATTR_CATALOG_LOCATION */ +#define OCI_CL_START 0 +#define OCI_CL_END 1 + +/* OCI_ATTR_SAVEPOINT_SUPPORT */ +#define OCI_SP_SUPPORTED 0 +#define OCI_SP_UNSUPPORTED 1 + +/* OCI_ATTR_NOWAIT_SUPPORT */ +#define OCI_NW_SUPPORTED 0 +#define OCI_NW_UNSUPPORTED 1 + +/* OCI_ATTR_AUTOCOMMIT_DDL */ +#define OCI_AC_DDL 0 +#define OCI_NO_AC_DDL 1 + +/* OCI_ATTR_LOCKING_MODE */ +#define OCI_LOCK_IMMEDIATE 0 +#define OCI_LOCK_DELAYED 1 + +/* ------------------- Instance type attribute values -----------------------*/ +#define OCI_INSTANCE_TYPE_UNKNOWN 0 +#define OCI_INSTANCE_TYPE_RDBMS 1 +#define OCI_INSTANCE_TYPE_OSM 2 + +/* ---------------- ASM Volume Device Support attribute values --------------*/ +#define OCI_ASM_VOLUME_UNSUPPORTED 0 +#define OCI_ASM_VOLUME_SUPPORTED 1 + +/*---------------------------------------------------------------------------*/ + +/*---------------------------OCIPasswordChange-------------------------------*/ +#define OCI_AUTH 0x08 /* Change the password but do not login */ + + +/*------------------------Other Constants------------------------------------*/ +#define OCI_MAX_FNS 100 /* max number of OCI Functions */ +#define OCI_SQLSTATE_SIZE 5 +#define OCI_ERROR_MAXMSG_SIZE 1024 /* max size of an error message */ +#define OCI_ERROR_MAXMSG_SIZE2 3072 /* new len max size of an error message */ +#define OCI_LOBMAXSIZE MINUB4MAXVAL /* maximum lob data size */ +#define OCI_ROWID_LEN 23 +#define OCI_LOB_CONTENTTYPE_MAXSIZE 128 /* max size of securefile contenttype */ +#define OCI_LOB_CONTENTTYPE_MAXBYTESIZE OCI_LOB_CONTENTTYPE_MAXSIZE +/*---------------------------------------------------------------------------*/ + +/*------------------------ Fail Over Events ---------------------------------*/ +#define OCI_FO_END 0x00000001 +#define OCI_FO_ABORT 0x00000002 +#define OCI_FO_REAUTH 0x00000004 +#define OCI_FO_BEGIN 0x00000008 +#define OCI_FO_ERROR 0x00000010 +/*---------------------------------------------------------------------------*/ + +/*------------------------ Fail Over Callback Return Codes ------------------*/ +#define OCI_FO_RETRY 25410 +/*---------------------------------------------------------------------------*/ + +/*------------------------- Fail Over Types ---------------------------------*/ +#define OCI_FO_NONE 0x00000001 +#define OCI_FO_SESSION 0x00000002 +#define OCI_FO_SELECT 0x00000004 +#define OCI_FO_TXNAL 0x00000008 +/*---------------------------------------------------------------------------*/ + +/*-----------------------Function Codes--------------------------------------*/ +#define OCI_FNCODE_INITIALIZE 1 /* OCIInitialize */ +#define OCI_FNCODE_HANDLEALLOC 2 /* OCIHandleAlloc */ +#define OCI_FNCODE_HANDLEFREE 3 /* OCIHandleFree */ +#define OCI_FNCODE_DESCRIPTORALLOC 4 /* OCIDescriptorAlloc */ +#define OCI_FNCODE_DESCRIPTORFREE 5 /* OCIDescriptorFree */ +#define OCI_FNCODE_ENVINIT 6 /* OCIEnvInit */ +#define OCI_FNCODE_SERVERATTACH 7 /* OCIServerAttach */ +#define OCI_FNCODE_SERVERDETACH 8 /* OCIServerDetach */ +/* unused 9 */ +#define OCI_FNCODE_SESSIONBEGIN 10 /* OCISessionBegin */ +#define OCI_FNCODE_SESSIONEND 11 /* OCISessionEnd */ +#define OCI_FNCODE_PASSWORDCHANGE 12 /* OCIPasswordChange */ +#define OCI_FNCODE_STMTPREPARE 13 /* OCIStmtPrepare */ + /* unused 14- 16 */ +#define OCI_FNCODE_BINDDYNAMIC 17 /* OCIBindDynamic */ +#define OCI_FNCODE_BINDOBJECT 18 /* OCIBindObject */ + /* 19 unused */ +#define OCI_FNCODE_BINDARRAYOFSTRUCT 20 /* OCIBindArrayOfStruct */ +#define OCI_FNCODE_STMTEXECUTE 21 /* OCIStmtExecute */ + /* unused 22-24 */ +#define OCI_FNCODE_DEFINEOBJECT 25 /* OCIDefineObject */ +#define OCI_FNCODE_DEFINEDYNAMIC 26 /* OCIDefineDynamic */ +#define OCI_FNCODE_DEFINEARRAYOFSTRUCT 27 /* OCIDefineArrayOfStruct */ +#define OCI_FNCODE_STMTFETCH 28 /* OCIStmtFetch */ +#define OCI_FNCODE_STMTGETBIND 29 /* OCIStmtGetBindInfo */ + /* 30, 31 unused */ +#define OCI_FNCODE_DESCRIBEANY 32 /* OCIDescribeAny */ +#define OCI_FNCODE_TRANSSTART 33 /* OCITransStart */ +#define OCI_FNCODE_TRANSDETACH 34 /* OCITransDetach */ +#define OCI_FNCODE_TRANSCOMMIT 35 /* OCITransCommit */ + /* 36 unused */ +#define OCI_FNCODE_ERRORGET 37 /* OCIErrorGet */ +#define OCI_FNCODE_LOBOPENFILE 38 /* OCILobFileOpen */ +#define OCI_FNCODE_LOBCLOSEFILE 39 /* OCILobFileClose */ + /* 40 was LOBCREATEFILE, unused */ + /* 41 was OCILobFileDelete, unused */ +#define OCI_FNCODE_LOBCOPY 42 /* OCILobCopy */ +#define OCI_FNCODE_LOBAPPEND 43 /* OCILobAppend */ +#define OCI_FNCODE_LOBERASE 44 /* OCILobErase */ +#define OCI_FNCODE_LOBLENGTH 45 /* OCILobGetLength */ +#define OCI_FNCODE_LOBTRIM 46 /* OCILobTrim */ +#define OCI_FNCODE_LOBREAD 47 /* OCILobRead */ +#define OCI_FNCODE_LOBWRITE 48 /* OCILobWrite */ + /* 49 unused */ +#define OCI_FNCODE_SVCCTXBREAK 50 /* OCIBreak */ +#define OCI_FNCODE_SERVERVERSION 51 /* OCIServerVersion */ + +#define OCI_FNCODE_KERBATTRSET 52 /* OCIKerbAttrSet */ + +/* unused 53 */ + +#define OCI_FNCODE_ATTRGET 54 /* OCIAttrGet */ +#define OCI_FNCODE_ATTRSET 55 /* OCIAttrSet */ +#define OCI_FNCODE_PARAMSET 56 /* OCIParamSet */ +#define OCI_FNCODE_PARAMGET 57 /* OCIParamGet */ +#define OCI_FNCODE_STMTGETPIECEINFO 58 /* OCIStmtGetPieceInfo */ +#define OCI_FNCODE_LDATOSVCCTX 59 /* OCILdaToSvcCtx */ + /* 60 unused */ +#define OCI_FNCODE_STMTSETPIECEINFO 61 /* OCIStmtSetPieceInfo */ +#define OCI_FNCODE_TRANSFORGET 62 /* OCITransForget */ +#define OCI_FNCODE_TRANSPREPARE 63 /* OCITransPrepare */ +#define OCI_FNCODE_TRANSROLLBACK 64 /* OCITransRollback */ +#define OCI_FNCODE_DEFINEBYPOS 65 /* OCIDefineByPos */ +#define OCI_FNCODE_BINDBYPOS 66 /* OCIBindByPos */ +#define OCI_FNCODE_BINDBYNAME 67 /* OCIBindByName */ +#define OCI_FNCODE_LOBASSIGN 68 /* OCILobAssign */ +#define OCI_FNCODE_LOBISEQUAL 69 /* OCILobIsEqual */ +#define OCI_FNCODE_LOBISINIT 70 /* OCILobLocatorIsInit */ + +#define OCI_FNCODE_LOBENABLEBUFFERING 71 /* OCILobEnableBuffering */ +#define OCI_FNCODE_LOBCHARSETID 72 /* OCILobCharSetID */ +#define OCI_FNCODE_LOBCHARSETFORM 73 /* OCILobCharSetForm */ +#define OCI_FNCODE_LOBFILESETNAME 74 /* OCILobFileSetName */ +#define OCI_FNCODE_LOBFILEGETNAME 75 /* OCILobFileGetName */ +#define OCI_FNCODE_LOGON 76 /* OCILogon */ +#define OCI_FNCODE_LOGOFF 77 /* OCILogoff */ +#define OCI_FNCODE_LOBDISABLEBUFFERING 78 /* OCILobDisableBuffering */ +#define OCI_FNCODE_LOBFLUSHBUFFER 79 /* OCILobFlushBuffer */ +#define OCI_FNCODE_LOBLOADFROMFILE 80 /* OCILobLoadFromFile */ + +#define OCI_FNCODE_LOBOPEN 81 /* OCILobOpen */ +#define OCI_FNCODE_LOBCLOSE 82 /* OCILobClose */ +#define OCI_FNCODE_LOBISOPEN 83 /* OCILobIsOpen */ +#define OCI_FNCODE_LOBFILEISOPEN 84 /* OCILobFileIsOpen */ +#define OCI_FNCODE_LOBFILEEXISTS 85 /* OCILobFileExists */ +#define OCI_FNCODE_LOBFILECLOSEALL 86 /* OCILobFileCloseAll */ +#define OCI_FNCODE_LOBCREATETEMP 87 /* OCILobCreateTemporary */ +#define OCI_FNCODE_LOBFREETEMP 88 /* OCILobFreeTemporary */ +#define OCI_FNCODE_LOBISTEMP 89 /* OCILobIsTemporary */ + +#define OCI_FNCODE_AQENQ 90 /* OCIAQEnq */ +#define OCI_FNCODE_AQDEQ 91 /* OCIAQDeq */ +#define OCI_FNCODE_RESET 92 /* OCIReset */ +#define OCI_FNCODE_SVCCTXTOLDA 93 /* OCISvcCtxToLda */ +#define OCI_FNCODE_LOBLOCATORASSIGN 94 /* OCILobLocatorAssign */ + +#define OCI_FNCODE_UBINDBYNAME 95 + +#define OCI_FNCODE_AQLISTEN 96 /* OCIAQListen */ + +#define OCI_FNCODE_SVC2HST 97 /* reserved */ +#define OCI_FNCODE_SVCRH 98 /* reserved */ + /* 97 and 98 are reserved for Oracle internal use */ + +#define OCI_FNCODE_TRANSMULTIPREPARE 99 /* OCITransMultiPrepare */ + +#define OCI_FNCODE_CPOOLCREATE 100 /* OCIConnectionPoolCreate */ +#define OCI_FNCODE_CPOOLDESTROY 101 /* OCIConnectionPoolDestroy */ +#define OCI_FNCODE_LOGON2 102 /* OCILogon2 */ +#define OCI_FNCODE_ROWIDTOCHAR 103 /* OCIRowidToChar */ + +#define OCI_FNCODE_SPOOLCREATE 104 /* OCISessionPoolCreate */ +#define OCI_FNCODE_SPOOLDESTROY 105 /* OCISessionPoolDestroy */ +#define OCI_FNCODE_SESSIONGET 106 /* OCISessionGet */ +#define OCI_FNCODE_SESSIONRELEASE 107 /* OCISessionRelease */ +#define OCI_FNCODE_STMTPREPARE2 108 /* OCIStmtPrepare2 */ +#define OCI_FNCODE_STMTRELEASE 109 /* OCIStmtRelease */ +#define OCI_FNCODE_AQENQARRAY 110 /* OCIAQEnqArray */ +#define OCI_FNCODE_AQDEQARRAY 111 /* OCIAQDeqArray */ +#define OCI_FNCODE_LOBCOPY2 112 /* OCILobCopy2 */ +#define OCI_FNCODE_LOBERASE2 113 /* OCILobErase2 */ +#define OCI_FNCODE_LOBLENGTH2 114 /* OCILobGetLength2 */ +#define OCI_FNCODE_LOBLOADFROMFILE2 115 /* OCILobLoadFromFile2 */ +#define OCI_FNCODE_LOBREAD2 116 /* OCILobRead2 */ +#define OCI_FNCODE_LOBTRIM2 117 /* OCILobTrim2 */ +#define OCI_FNCODE_LOBWRITE2 118 /* OCILobWrite2 */ +#define OCI_FNCODE_LOBGETSTORAGELIMIT 119 /* OCILobGetStorageLimit */ +#define OCI_FNCODE_DBSTARTUP 120 /* OCIDBStartup */ +#define OCI_FNCODE_DBSHUTDOWN 121 /* OCIDBShutdown */ +#define OCI_FNCODE_LOBARRAYREAD 122 /* OCILobArrayRead */ +#define OCI_FNCODE_LOBARRAYWRITE 123 /* OCILobArrayWrite */ +#define OCI_FNCODE_AQENQSTREAM 124 /* OCIAQEnqStreaming */ +#define OCI_FNCODE_AQGETREPLAY 125 /* OCIAQGetReplayInfo */ +#define OCI_FNCODE_AQRESETREPLAY 126 /* OCIAQResetReplayInfo */ +#define OCI_FNCODE_ARRAYDESCRIPTORALLOC 127 /*OCIArrayDescriptorAlloc */ +#define OCI_FNCODE_ARRAYDESCRIPTORFREE 128 /* OCIArrayDescriptorFree */ +#define OCI_FNCODE_LOBGETOPT 129 /* OCILobGetCptions */ +#define OCI_FNCODE_LOBSETOPT 130 /* OCILobSetCptions */ +#define OCI_FNCODE_LOBFRAGINS 131 /* OCILobFragementInsert */ +#define OCI_FNCODE_LOBFRAGDEL 132 /* OCILobFragementDelete */ +#define OCI_FNCODE_LOBFRAGMOV 133 /* OCILobFragementMove */ +#define OCI_FNCODE_LOBFRAGREP 134 /* OCILobFragementReplace */ +#define OCI_FNCODE_LOBGETDEDUPLICATEREGIONS 135/* OCILobGetDeduplicateRegions */ +#define OCI_FNCODE_APPCTXSET 136 /* OCIAppCtxSet */ +#define OCI_FNCODE_APPCTXCLEARALL 137 /* OCIAppCtxClearAll */ + +#define OCI_FNCODE_LOBGETCONTENTTYPE 138 /* OCILobGetContentType */ +#define OCI_FNCODE_LOBSETCONTENTTYPE 139 /* OCILobSetContentType */ +#define OCI_FNCODE_MAXFCN 139 /* maximum OCI function code */ + +/*---------------Statement Cache callback modes-----------------------------*/ +#define OCI_CBK_STMTCACHE_STMTPURGE 0x01 + +/*---------------------------------------------------------------------------*/ + +/*-----------------------Handle Definitions----------------------------------*/ +typedef struct OCIEnv OCIEnv; /* OCI environment handle */ +typedef struct OCIError OCIError; /* OCI error handle */ +typedef struct OCISvcCtx OCISvcCtx; /* OCI service handle */ +typedef struct OCIStmt OCIStmt; /* OCI statement handle */ +typedef struct OCIBind OCIBind; /* OCI bind handle */ +typedef struct OCIDefine OCIDefine; /* OCI Define handle */ +typedef struct OCIDescribe OCIDescribe; /* OCI Describe handle */ +typedef struct OCIServer OCIServer; /* OCI Server handle */ +typedef struct OCISession OCISession; /* OCI Authentication handle */ +typedef struct OCIComplexObject OCIComplexObject; /* OCI COR handle */ +typedef struct OCITrans OCITrans; /* OCI Transaction handle */ +typedef struct OCISecurity OCISecurity; /* OCI Security handle */ +typedef struct OCISubscription OCISubscription; /* subscription handle */ + +typedef struct OCICPool OCICPool; /* connection pool handle */ +typedef struct OCISPool OCISPool; /* session pool handle */ +typedef struct OCIAuthInfo OCIAuthInfo; /* auth handle */ +typedef struct OCIAdmin OCIAdmin; /* admin handle */ +typedef struct OCIEvent OCIEvent; /* HA event handle */ + +/*-----------------------Descriptor Definitions------------------------------*/ +typedef struct OCISnapshot OCISnapshot; /* OCI snapshot descriptor */ +typedef struct OCIResult OCIResult; /* OCI Result Set Descriptor */ +typedef struct OCILobLocator OCILobLocator; /* OCI Lob Locator descriptor */ +typedef struct OCILobRegion OCILobRegion; /* OCI Lob Regions descriptor */ +typedef struct OCIParam OCIParam; /* OCI PARameter descriptor */ +typedef struct OCIComplexObjectComp OCIComplexObjectComp; + /* OCI COR descriptor */ +typedef struct OCIRowid OCIRowid; /* OCI ROWID descriptor */ + +typedef struct OCIDateTime OCIDateTime; /* OCI DateTime descriptor */ +typedef struct OCIInterval OCIInterval; /* OCI Interval descriptor */ + +typedef struct OCIUcb OCIUcb; /* OCI User Callback descriptor */ +typedef struct OCIServerDNs OCIServerDNs; /* OCI server DN descriptor */ + +/*-------------------------- AQ Descriptors ---------------------------------*/ +typedef struct OCIAQEnqOptions OCIAQEnqOptions; /* AQ Enqueue Options hdl */ +typedef struct OCIAQDeqOptions OCIAQDeqOptions; /* AQ Dequeue Options hdl */ +typedef struct OCIAQMsgProperties OCIAQMsgProperties; /* AQ Mesg Properties */ +typedef struct OCIAQAgent OCIAQAgent; /* AQ Agent descriptor */ +typedef struct OCIAQNfyDescriptor OCIAQNfyDescriptor; /* AQ Nfy descriptor */ +typedef struct OCIAQSignature OCIAQSignature; /* AQ Siganture */ +typedef struct OCIAQListenOpts OCIAQListenOpts; /* AQ listen options */ +typedef struct OCIAQLisMsgProps OCIAQLisMsgProps; /* AQ listen msg props */ + +/*---------------------------------------------------------------------------*/ + +/* Lob typedefs for Pro*C */ +typedef struct OCILobLocator OCIClobLocator; /* OCI Character LOB Locator */ +typedef struct OCILobLocator OCIBlobLocator; /* OCI Binary LOB Locator */ +typedef struct OCILobLocator OCIBFileLocator; /* OCI Binary LOB File Locator */ +/*---------------------------------------------------------------------------*/ + +/* Undefined value for tz in interval types*/ +#define OCI_INTHR_UNK 24 + + /* These defined adjustment values */ +#define OCI_ADJUST_UNK 10 +#define OCI_ORACLE_DATE 0 +#define OCI_ANSI_DATE 1 + +/*------------------------ Lob-specific Definitions -------------------------*/ + +/* + * ociloff - OCI Lob OFFset + * + * The offset in the lob data. The offset is specified in terms of bytes for + * BLOBs and BFILes. Character offsets are used for CLOBs, NCLOBs. + * The maximum size of internal lob data is 4 gigabytes. FILE LOB + * size is limited by the operating system. + */ +typedef ub4 OCILobOffset; + +/* + * ocillen - OCI Lob LENgth (of lob data) + * + * Specifies the length of lob data in bytes for BLOBs and BFILes and in + * characters for CLOBs, NCLOBs. The maximum length of internal lob + * data is 4 gigabytes. The length of FILE LOBs is limited only by the + * operating system. + */ +typedef ub4 OCILobLength; +/* + * ocilmo - OCI Lob open MOdes + * + * The mode specifies the planned operations that will be performed on the + * FILE lob data. The FILE lob can be opened in read-only mode only. + * + * In the future, we may include read/write, append and truncate modes. Append + * is equivalent to read/write mode except that the FILE is positioned for + * writing to the end. Truncate is equivalent to read/write mode except that + * the FILE LOB data is first truncated to a length of 0 before use. + */ +enum OCILobMode +{ + OCI_LOBMODE_READONLY = 1, /* read-only */ + OCI_LOBMODE_READWRITE = 2 /* read_write for internal lobs only */ +}; +typedef enum OCILobMode OCILobMode; + +/*---------------------------------------------------------------------------*/ + + +/*----------------------------Piece Definitions------------------------------*/ + +/* if ocidef.h is being included in the app, ocidef.h should precede oci.h */ + +/* + * since clients may use oci.h, ocidef.h and ocidfn.h the following defines + * need to be guarded, usually internal clients + */ + +#ifndef OCI_FLAGS +#define OCI_FLAGS +#define OCI_ONE_PIECE 0 /* one piece */ +#define OCI_FIRST_PIECE 1 /* the first piece */ +#define OCI_NEXT_PIECE 2 /* the next of many pieces */ +#define OCI_LAST_PIECE 3 /* the last piece */ +#endif +/*---------------------------------------------------------------------------*/ + +/*--------------------------- FILE open modes -------------------------------*/ +#define OCI_FILE_READONLY 1 /* readonly mode open for FILE types */ +/*---------------------------------------------------------------------------*/ +/*--------------------------- LOB open modes --------------------------------*/ +#define OCI_LOB_READONLY 1 /* readonly mode open for ILOB types */ +#define OCI_LOB_READWRITE 2 /* read write mode open for ILOBs */ +#define OCI_LOB_WRITEONLY 3 /* Writeonly mode open for ILOB types*/ +#define OCI_LOB_APPENDONLY 4 /* Appendonly mode open for ILOB types */ +#define OCI_LOB_FULLOVERWRITE 5 /* Completely overwrite ILOB */ +#define OCI_LOB_FULLREAD 6 /* Doing a Full Read of ILOB */ + +/*----------------------- LOB Buffering Flush Flags -------------------------*/ +#define OCI_LOB_BUFFER_FREE 1 +#define OCI_LOB_BUFFER_NOFREE 2 +/*---------------------------------------------------------------------------*/ + +/*---------------------------LOB Option Types -------------------------------*/ +#define OCI_LOB_OPT_COMPRESS 1 /* SECUREFILE Compress */ +#define OCI_LOB_OPT_ENCRYPT 2 /* SECUREFILE Encrypt */ +#define OCI_LOB_OPT_DEDUPLICATE 4 /* SECUREFILE Deduplicate */ +#define OCI_LOB_OPT_ALLOCSIZE 8 /* SECUREFILE Allocation Size */ +#define OCI_LOB_OPT_CONTENTTYPE 16 /* SECUREFILE Content Type */ +#define OCI_LOB_OPT_MODTIME 32 /* SECUREFILE Modification Time */ + +/*------------------------ LOB Option Values ------------------------------*/ +/* Compression */ +#define OCI_LOB_COMPRESS_OFF 0 /* Compression off */ +#define OCI_LOB_COMPRESS_ON 1 /* Compression on */ +/* Encryption */ +#define OCI_LOB_ENCRYPT_OFF 0 /* Encryption Off */ +#define OCI_LOB_ENCRYPT_ON 2 /* Encryption On */ +/* Deduplciate */ +#define OCI_LOB_DEDUPLICATE_OFF 0 /* Deduplicate Off */ +#define OCI_LOB_DEDUPLICATE_ON 4 /* Deduplicate Lobs */ + +/*--------------------------- OCI Statement Types ---------------------------*/ + +#define OCI_STMT_UNKNOWN 0 /* Unknown statement */ +#define OCI_STMT_SELECT 1 /* select statement */ +#define OCI_STMT_UPDATE 2 /* update statement */ +#define OCI_STMT_DELETE 3 /* delete statement */ +#define OCI_STMT_INSERT 4 /* Insert Statement */ +#define OCI_STMT_CREATE 5 /* create statement */ +#define OCI_STMT_DROP 6 /* drop statement */ +#define OCI_STMT_ALTER 7 /* alter statement */ +#define OCI_STMT_BEGIN 8 /* begin ... (pl/sql statement)*/ +#define OCI_STMT_DECLARE 9 /* declare .. (pl/sql statement ) */ +#define OCI_STMT_CALL 10 /* corresponds to kpu call */ +/*---------------------------------------------------------------------------*/ + +/*--------------------------- OCI Parameter Types ---------------------------*/ +#define OCI_PTYPE_UNK 0 /* unknown */ +#define OCI_PTYPE_TABLE 1 /* table */ +#define OCI_PTYPE_VIEW 2 /* view */ +#define OCI_PTYPE_PROC 3 /* procedure */ +#define OCI_PTYPE_FUNC 4 /* function */ +#define OCI_PTYPE_PKG 5 /* package */ +#define OCI_PTYPE_TYPE 6 /* user-defined type */ +#define OCI_PTYPE_SYN 7 /* synonym */ +#define OCI_PTYPE_SEQ 8 /* sequence */ +#define OCI_PTYPE_COL 9 /* column */ +#define OCI_PTYPE_ARG 10 /* argument */ +#define OCI_PTYPE_LIST 11 /* list */ +#define OCI_PTYPE_TYPE_ATTR 12 /* user-defined type's attribute */ +#define OCI_PTYPE_TYPE_COLL 13 /* collection type's element */ +#define OCI_PTYPE_TYPE_METHOD 14 /* user-defined type's method */ +#define OCI_PTYPE_TYPE_ARG 15 /* user-defined type method's arg */ +#define OCI_PTYPE_TYPE_RESULT 16/* user-defined type method's result */ +#define OCI_PTYPE_SCHEMA 17 /* schema */ +#define OCI_PTYPE_DATABASE 18 /* database */ +#define OCI_PTYPE_RULE 19 /* rule */ +#define OCI_PTYPE_RULE_SET 20 /* rule set */ +#define OCI_PTYPE_EVALUATION_CONTEXT 21 /* evaluation context */ +#define OCI_PTYPE_TABLE_ALIAS 22 /* table alias */ +#define OCI_PTYPE_VARIABLE_TYPE 23 /* variable type */ +#define OCI_PTYPE_NAME_VALUE 24 /* name value pair */ + +/*---------------------------------------------------------------------------*/ + +/*----------------------------- OCI List Types ------------------------------*/ +#define OCI_LTYPE_UNK 0 /* unknown */ +#define OCI_LTYPE_COLUMN 1 /* column list */ +#define OCI_LTYPE_ARG_PROC 2 /* procedure argument list */ +#define OCI_LTYPE_ARG_FUNC 3 /* function argument list */ +#define OCI_LTYPE_SUBPRG 4 /* subprogram list */ +#define OCI_LTYPE_TYPE_ATTR 5 /* type attribute */ +#define OCI_LTYPE_TYPE_METHOD 6 /* type method */ +#define OCI_LTYPE_TYPE_ARG_PROC 7 /* type method w/o result argument list */ +#define OCI_LTYPE_TYPE_ARG_FUNC 8 /* type method w/result argument list */ +#define OCI_LTYPE_SCH_OBJ 9 /* schema object list */ +#define OCI_LTYPE_DB_SCH 10 /* database schema list */ +#define OCI_LTYPE_TYPE_SUBTYPE 11 /* subtype list */ +#define OCI_LTYPE_TABLE_ALIAS 12 /* table alias list */ +#define OCI_LTYPE_VARIABLE_TYPE 13 /* variable type list */ +#define OCI_LTYPE_NAME_VALUE 14 /* name value list */ + +/*---------------------------------------------------------------------------*/ + +/*-------------------------- Memory Cartridge Services ---------------------*/ +#define OCI_MEMORY_CLEARED 1 + +/*-------------------------- Pickler Cartridge Services ---------------------*/ +typedef struct OCIPicklerTdsCtx OCIPicklerTdsCtx; +typedef struct OCIPicklerTds OCIPicklerTds; +typedef struct OCIPicklerImage OCIPicklerImage; +typedef struct OCIPicklerFdo OCIPicklerFdo; +typedef ub4 OCIPicklerTdsElement; + +typedef struct OCIAnyData OCIAnyData; + +typedef struct OCIAnyDataSet OCIAnyDataSet; +typedef struct OCIAnyDataCtx OCIAnyDataCtx; + +/*---------------------------------------------------------------------------*/ + +/*--------------------------- User Callback Constants -----------------------*/ +#define OCI_UCBTYPE_ENTRY 1 /* entry callback */ +#define OCI_UCBTYPE_EXIT 2 /* exit callback */ +#define OCI_UCBTYPE_REPLACE 3 /* replacement callback */ + +/*---------------------------------------------------------------------------*/ + +/*--------------------- NLS service type and constance ----------------------*/ +#define OCI_NLS_DAYNAME1 1 /* Native name for Monday */ +#define OCI_NLS_DAYNAME2 2 /* Native name for Tuesday */ +#define OCI_NLS_DAYNAME3 3 /* Native name for Wednesday */ +#define OCI_NLS_DAYNAME4 4 /* Native name for Thursday */ +#define OCI_NLS_DAYNAME5 5 /* Native name for Friday */ +#define OCI_NLS_DAYNAME6 6 /* Native name for for Saturday */ +#define OCI_NLS_DAYNAME7 7 /* Native name for for Sunday */ +#define OCI_NLS_ABDAYNAME1 8 /* Native abbreviated name for Monday */ +#define OCI_NLS_ABDAYNAME2 9 /* Native abbreviated name for Tuesday */ +#define OCI_NLS_ABDAYNAME3 10 /* Native abbreviated name for Wednesday */ +#define OCI_NLS_ABDAYNAME4 11 /* Native abbreviated name for Thursday */ +#define OCI_NLS_ABDAYNAME5 12 /* Native abbreviated name for Friday */ +#define OCI_NLS_ABDAYNAME6 13 /* Native abbreviated name for for Saturday */ +#define OCI_NLS_ABDAYNAME7 14 /* Native abbreviated name for for Sunday */ +#define OCI_NLS_MONTHNAME1 15 /* Native name for January */ +#define OCI_NLS_MONTHNAME2 16 /* Native name for February */ +#define OCI_NLS_MONTHNAME3 17 /* Native name for March */ +#define OCI_NLS_MONTHNAME4 18 /* Native name for April */ +#define OCI_NLS_MONTHNAME5 19 /* Native name for May */ +#define OCI_NLS_MONTHNAME6 20 /* Native name for June */ +#define OCI_NLS_MONTHNAME7 21 /* Native name for July */ +#define OCI_NLS_MONTHNAME8 22 /* Native name for August */ +#define OCI_NLS_MONTHNAME9 23 /* Native name for September */ +#define OCI_NLS_MONTHNAME10 24 /* Native name for October */ +#define OCI_NLS_MONTHNAME11 25 /* Native name for November */ +#define OCI_NLS_MONTHNAME12 26 /* Native name for December */ +#define OCI_NLS_ABMONTHNAME1 27 /* Native abbreviated name for January */ +#define OCI_NLS_ABMONTHNAME2 28 /* Native abbreviated name for February */ +#define OCI_NLS_ABMONTHNAME3 29 /* Native abbreviated name for March */ +#define OCI_NLS_ABMONTHNAME4 30 /* Native abbreviated name for April */ +#define OCI_NLS_ABMONTHNAME5 31 /* Native abbreviated name for May */ +#define OCI_NLS_ABMONTHNAME6 32 /* Native abbreviated name for June */ +#define OCI_NLS_ABMONTHNAME7 33 /* Native abbreviated name for July */ +#define OCI_NLS_ABMONTHNAME8 34 /* Native abbreviated name for August */ +#define OCI_NLS_ABMONTHNAME9 35 /* Native abbreviated name for September */ +#define OCI_NLS_ABMONTHNAME10 36 /* Native abbreviated name for October */ +#define OCI_NLS_ABMONTHNAME11 37 /* Native abbreviated name for November */ +#define OCI_NLS_ABMONTHNAME12 38 /* Native abbreviated name for December */ +#define OCI_NLS_YES 39 /* Native string for affirmative response */ +#define OCI_NLS_NO 40 /* Native negative response */ +#define OCI_NLS_AM 41 /* Native equivalent string of AM */ +#define OCI_NLS_PM 42 /* Native equivalent string of PM */ +#define OCI_NLS_AD 43 /* Native equivalent string of AD */ +#define OCI_NLS_BC 44 /* Native equivalent string of BC */ +#define OCI_NLS_DECIMAL 45 /* decimal character */ +#define OCI_NLS_GROUP 46 /* group separator */ +#define OCI_NLS_DEBIT 47 /* Native symbol of debit */ +#define OCI_NLS_CREDIT 48 /* Native sumbol of credit */ +#define OCI_NLS_DATEFORMAT 49 /* Oracle date format */ +#define OCI_NLS_INT_CURRENCY 50 /* International currency symbol */ +#define OCI_NLS_LOC_CURRENCY 51 /* Locale currency symbol */ +#define OCI_NLS_LANGUAGE 52 /* Language name */ +#define OCI_NLS_ABLANGUAGE 53 /* Abbreviation for language name */ +#define OCI_NLS_TERRITORY 54 /* Territory name */ +#define OCI_NLS_CHARACTER_SET 55 /* Character set name */ +#define OCI_NLS_LINGUISTIC_NAME 56 /* Linguistic name */ +#define OCI_NLS_CALENDAR 57 /* Calendar name */ +#define OCI_NLS_DUAL_CURRENCY 78 /* Dual currency symbol */ +#define OCI_NLS_WRITINGDIR 79 /* Language writing direction */ +#define OCI_NLS_ABTERRITORY 80 /* Territory Abbreviation */ +#define OCI_NLS_DDATEFORMAT 81 /* Oracle default date format */ +#define OCI_NLS_DTIMEFORMAT 82 /* Oracle default time format */ +#define OCI_NLS_SFDATEFORMAT 83 /* Local string formatted date format */ +#define OCI_NLS_SFTIMEFORMAT 84 /* Local string formatted time format */ +#define OCI_NLS_NUMGROUPING 85 /* Number grouping fields */ +#define OCI_NLS_LISTSEP 86 /* List separator */ +#define OCI_NLS_MONDECIMAL 87 /* Monetary decimal character */ +#define OCI_NLS_MONGROUP 88 /* Monetary group separator */ +#define OCI_NLS_MONGROUPING 89 /* Monetary grouping fields */ +#define OCI_NLS_INT_CURRENCYSEP 90 /* International currency separator */ +#define OCI_NLS_CHARSET_MAXBYTESZ 91 /* Maximum character byte size */ +#define OCI_NLS_CHARSET_FIXEDWIDTH 92 /* Fixed-width charset byte size */ +#define OCI_NLS_CHARSET_ID 93 /* Character set id */ +#define OCI_NLS_NCHARSET_ID 94 /* NCharacter set id */ + +#define OCI_NLS_MAXBUFSZ 100 /* Max buffer size may need for OCINlsGetInfo */ + +#define OCI_NLS_BINARY 0x1 /* for the binary comparison */ +#define OCI_NLS_LINGUISTIC 0x2 /* for linguistic comparison */ +#define OCI_NLS_CASE_INSENSITIVE 0x10 /* for case-insensitive comparison */ + +#define OCI_NLS_UPPERCASE 0x20 /* convert to uppercase */ +#define OCI_NLS_LOWERCASE 0x40 /* convert to lowercase */ + +#define OCI_NLS_CS_IANA_TO_ORA 0 /* Map charset name from IANA to Oracle */ +#define OCI_NLS_CS_ORA_TO_IANA 1 /* Map charset name from Oracle to IANA */ +#define OCI_NLS_LANG_ISO_TO_ORA 2 /* Map language name from ISO to Oracle */ +#define OCI_NLS_LANG_ORA_TO_ISO 3 /* Map language name from Oracle to ISO */ +#define OCI_NLS_TERR_ISO_TO_ORA 4 /* Map territory name from ISO to Oracle*/ +#define OCI_NLS_TERR_ORA_TO_ISO 5 /* Map territory name from Oracle to ISO*/ +#define OCI_NLS_TERR_ISO3_TO_ORA 6 /* Map territory name from 3-letter ISO */ + /* abbreviation to Oracle */ +#define OCI_NLS_TERR_ORA_TO_ISO3 7 /* Map territory name from Oracle to */ + /* 3-letter ISO abbreviation */ +#define OCI_NLS_LOCALE_A2_ISO_TO_ORA 8 + /*Map locale name from A2 ISO to oracle*/ +#define OCI_NLS_LOCALE_A2_ORA_TO_ISO 9 + /*Map locale name from oracle to A2 ISO*/ + +typedef struct OCIMsg OCIMsg; +typedef ub4 OCIWchar; + +#define OCI_XMLTYPE_CREATE_OCISTRING 1 +#define OCI_XMLTYPE_CREATE_CLOB 2 +#define OCI_XMLTYPE_CREATE_BLOB 3 + +/*------------------------- Kerber Authentication Modes ---------------------*/ +#define OCI_KERBCRED_PROXY 1 /* Apply Kerberos Creds for Proxy */ +#define OCI_KERBCRED_CLIENT_IDENTIFIER 2/*Apply Creds for Secure Client ID */ + +/*------------------------- Database Startup Flags --------------------------*/ +#define OCI_DBSTARTUPFLAG_FORCE 0x00000001 /* Abort running instance, start */ +#define OCI_DBSTARTUPFLAG_RESTRICT 0x00000002 /* Restrict access to DBA */ + +/*------------------------- Database Shutdown Modes -------------------------*/ +#define OCI_DBSHUTDOWN_TRANSACTIONAL 1 /* Wait for all the transactions */ +#define OCI_DBSHUTDOWN_TRANSACTIONAL_LOCAL 2 /* Wait for local transactions */ +#define OCI_DBSHUTDOWN_IMMEDIATE 3 /* Terminate and roll back */ +#define OCI_DBSHUTDOWN_ABORT 4 /* Terminate and don't roll back */ +#define OCI_DBSHUTDOWN_FINAL 5 /* Orderly shutdown */ + +/*------------------------- Version information -----------------------------*/ +#define OCI_MAJOR_VERSION 11 /* Major release version */ +#define OCI_MINOR_VERSION 2 /* Minor release version */ + +/*---------------------- OCIIOV structure definitions -----------------------*/ +struct OCIIOV +{ + void *bfp; /* The Pointer to the data buffer */ + ub4 bfl; /* Length of the Data Buffer */ +}; +typedef struct OCIIOV OCIIOV; + +/*--------------------------------------------------------------------------- + PRIVATE TYPES AND CONSTANTS + ---------------------------------------------------------------------------*/ + +/* None */ + +/*--------------------------------------------------------------------------- + PUBLIC FUNCTIONS + ---------------------------------------------------------------------------*/ + +/* see ociap.h or ocikp.h */ + +/*--------------------------------------------------------------------------- + PRIVATE FUNCTIONS + ---------------------------------------------------------------------------*/ + +/* None */ + + +#endif /* OCI_ORACLE */ + + +/* more includes */ + +#ifndef OCI1_ORACLE +#include +#endif + +#ifndef ORO_ORACLE +#include +#endif + +#ifndef ORI_ORACLE +#include +#endif + +#ifndef ORL_ORACLE +#include +#endif + +#ifndef ORT_ORACLE +#include +#endif + +#ifndef OCIEXTP_ORACLE +#include +#endif + +#include +#include + +#ifndef OCIXMLDB_ORACLE +#include +#endif + +#ifndef OCI8DP_ORACLE +#include /* interface definitions for the direct path api */ +#endif + +#ifndef OCIEXTP_ORACLE +#include +#endif + +#ifndef OCIXSTREAM_ORACLE +#include +#endif + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + diff --git a/sdk/include/oci1.h b/sdk/include/oci1.h new file mode 100755 index 0000000..8c59c94 --- /dev/null +++ b/sdk/include/oci1.h @@ -0,0 +1,182 @@ + +/* Copyright (c) 1997, 2005, Oracle. All rights reserved. */ + +/* NOTE: See 'header_template.doc' in the 'doc' dve under the 'forms' + directory for the header file template that includes instructions. +*/ + +/* + NAME + oci1.h - Cartridge Service definitions + + DESCRIPTION + + + RELATED DOCUMENTS + + INSPECTION STATUS + Inspection date: + Inspection status: + Estimated increasing cost defects per page: + Rule sets: + + ACCEPTANCE REVIEW STATUS + Review date: + Review status: + Reviewers: + + PUBLIC FUNCTION(S) + + + PRIVATE FUNCTION(S) + + + EXAMPLES + + NOTES + + + MODIFIED (MM/DD/YY) + mbastawa 09/16/05 - dbhygiene + dmukhin 06/29/05 - ANSI prototypes; miscellaneous cleanup + nramakri 01/16/98 - remove #ifdef NEVER clause + ewaugh 12/18/97 - Turn type wrappers into functions. + skabraha 12/02/97 - Adding data structures & constants for OCIFile + rhwu 12/02/97 - OCI Thread + nramakri 12/15/97 - move to core4 + ewaugh 12/11/97 - add OCIFormat package constants + ssamu 12/10/97 - do not include s.h + nramakri 11/19/97 - add OCIExtract definitions + ssamu 11/14/97 - creation + +*/ + + +#ifndef OCI1_ORACLE +# define OCI1_ORACLE + +# ifndef ORATYPES +# include +# endif + + +/*--------------------------------------------------------------------------- + PUBLIC TYPES AND CONSTANTS + ---------------------------------------------------------------------------*/ + +/* Constants required by the OCIFormat package. */ + +#define OCIFormatUb1(variable) OCIFormatTUb1(), &(variable) +#define OCIFormatUb2(variable) OCIFormatTUb2(), &(variable) +#define OCIFormatUb4(variable) OCIFormatTUb4(), &(variable) +#define OCIFormatUword(variable) OCIFormatTUword(), &(variable) +#define OCIFormatUbig_ora(variable) OCIFormatTUbig_ora(), &(variable) +#define OCIFormatSb1(variable) OCIFormatTSb1(), &(variable) +#define OCIFormatSb2(variable) OCIFormatTSb2(), &(variable) +#define OCIFormatSb4(variable) OCIFormatTSb4(), &(variable) +#define OCIFormatSword(variable) OCIFormatTSword(), &(variable) +#define OCIFormatSbig_ora(variable) OCIFormatTSbig_ora(), &(variable) +#define OCIFormatEb1(variable) OCIFormatTEb1(), &(variable) +#define OCIFormatEb2(variable) OCIFormatTEb2(), &(variable) +#define OCIFormatEb4(variable) OCIFormatTEb4(), &(variable) +#define OCIFormatEword(variable) OCIFormatTEword(), &(variable) +#define OCIFormatChar(variable) OCIFormatTChar(), &(variable) +#define OCIFormatText(variable) OCIFormatTText(), (variable) +#define OCIFormatDouble(variable) OCIFormatTDouble(), &(variable) +#define OCIFormatDvoid(variable) OCIFormatTDvoid(), (variable) +#define OCIFormatEnd OCIFormatTEnd() + +#define OCIFormatDP 6 + + +/*----------------- Public Constants for OCIFile -------------------------*/ + +/* flags for open.*/ +/* flags for mode */ +#define OCI_FILE_READ_ONLY 1 /* open for read only */ +#define OCI_FILE_WRITE_ONLY 2 /* open for write only */ +#define OCI_FILE_READ_WRITE 3 /* open for read & write */ +/* flags for create */ +#define OCI_FILE_EXIST 0 /* the file should exist */ +#define OCI_FILE_CREATE 1 /* create if the file doesn't exist */ +#define OCI_FILE_EXCL 2 /* the file should not exist */ +#define OCI_FILE_TRUNCATE 4 /* create if the file doesn't exist, + else truncate file the file to 0 */ +#define OCI_FILE_APPEND 8 /* open the file in append mode */ + +/* flags for seek */ +#define OCI_FILE_SEEK_BEGINNING 1 /* seek from the beginning of the file */ +#define OCI_FILE_SEEK_CURRENT 2 /* seek from the current position */ +#define OCI_FILE_SEEK_END 3 /* seek from the end of the file */ + +#define OCI_FILE_FORWARD 1 /* seek forward */ +#define OCI_FILE_BACKWARD 2 /* seek backward */ + +/* file type */ +#define OCI_FILE_BIN 0 /* binary file */ +#define OCI_FILE_TEXT 1 /* text file */ +#define OCI_FILE_STDIN 2 /* standard i/p */ +#define OCI_FILE_STDOUT 3 /* standard o/p */ +#define OCI_FILE_STDERR 4 /* standard error */ + +/* Represents an open file */ +typedef struct OCIFileObject OCIFileObject; + + +/*--------------------- OCI Thread Object Definitions------------------------*/ + +/* OCIThread Context */ +typedef struct OCIThreadContext OCIThreadContext; + +/* OCIThread Mutual Exclusion Lock */ +typedef struct OCIThreadMutex OCIThreadMutex; + +/* OCIThread Key for Thread-Specific Data */ +typedef struct OCIThreadKey OCIThreadKey; + +/* OCIThread Thread ID */ +typedef struct OCIThreadId OCIThreadId; + +/* OCIThread Thread Handle */ +typedef struct OCIThreadHandle OCIThreadHandle; + + +/*-------------------- OCI Thread Callback Function Pointers ----------------*/ + +/* OCIThread Key Destructor Function Type */ +typedef void (*OCIThreadKeyDestFunc)( void * ); + + +/* Flags passed into OCIExtractFromXXX routines to direct processing */ +#define OCI_EXTRACT_CASE_SENSITIVE 0x1 /* matching is case sensitive */ +#define OCI_EXTRACT_UNIQUE_ABBREVS 0x2 /* unique abbreviations for keys + are allowed */ +#define OCI_EXTRACT_APPEND_VALUES 0x4 /* if multiple values for a key + exist, this determines if the + new value should be appended + to (or replace) the current + list of values */ + +/* Constants passed into OCIExtractSetKey routine */ +#define OCI_EXTRACT_MULTIPLE 0x8 /* key can accept multiple values */ +#define OCI_EXTRACT_TYPE_BOOLEAN 1 /* key type is boolean */ +#define OCI_EXTRACT_TYPE_STRING 2 /* key type is string */ +#define OCI_EXTRACT_TYPE_INTEGER 3 /* key type is integer */ +#define OCI_EXTRACT_TYPE_OCINUM 4 /* key type is ocinum */ + +/*--------------------------------------------------------------------------- + PRIVATE TYPES AND CONSTANTS + ---------------------------------------------------------------------------*/ + + +/*--------------------------------------------------------------------------- + PUBLIC FUNCTIONS + ---------------------------------------------------------------------------*/ + + +/*--------------------------------------------------------------------------- + PRIVATE FUNCTIONS + ---------------------------------------------------------------------------*/ + + +#endif /* OCI1_ORACLE */ diff --git a/sdk/include/oci8dp.h b/sdk/include/oci8dp.h new file mode 100755 index 0000000..d73258c --- /dev/null +++ b/sdk/include/oci8dp.h @@ -0,0 +1,317 @@ +/* + * + */ + +/* Copyright (c) 1998, 2005, Oracle. All rights reserved. */ + +/* + NAME + oci8dp.h - OCI: Direct Path API interface prototypes. + + DESCRIPTION + Public types, constants, and interfaces to the direct path API. + + RELATED DOCUMENTS + + NOTES + This file is not directly included by the application, this file + is included by "oci.h", which the application should include. + + MODIFIED (MM/DD/YY) + dmukhin 06/29/05 - ANSI prototypes; miscellaneous cleanup + rphillip 02/27/04 - Add OCI_DIRPATH_COL_ERROR + srseshad 03/12/03 - convert oci public api to ansi + msakayed 10/28/02 - Bug #2643907: add OCI_ATTR_DIRPATH_SKIPINDEX_METHOD + cmlim 04/13/01 - remove OCIDirPathStreamToStream - not used by dpapi + cmlim 04/02/01 - OCI_DIRPATH_EXPR_OPQ_SQL_FN to OCI_DIRPATH_EXPR_SQL + ebatbout 01/22/01 - PARTIAL value for OCIDirPathDataSave action parameter + cmlim 07/20/00 - support opaques/sql strings in 8.2 dpapi + cmlim 08/14/00 - support refs in 8.2 dpapi + cmlim 04/17/00 - add defines for OCIDirPathFuncCtx handle & OCI_ATTR_D + whe 09/01/99 - 976457:check __cplusplus for C++ code + abrumm 04/16/99 - dpapi: more attributes + abrumm 02/26/99 - add defines for DataSave action + abrumm 10/04/98 - clen must be a ub4 + abrumm 05/27/98 - add column array flag values + abrumm 05/12/98 - direct path api support + abrumm 03/31/98 - OCI direct path interface support + abrumm 03/18/98 - Creation + +*/ + +#ifndef OCI8DP_ORACLE +# define OCI8DP_ORACLE + +#ifndef ORATYPES +#include +#endif + +#ifndef OCIDFN +#include +#endif + +#ifndef OCI_ORACLE +#include +#endif + + +/*--------------------------------------------------------------------------- + PUBLIC TYPES AND CONSTANTS + ---------------------------------------------------------------------------*/ + +/*----- Handles and descriptors for direct path operations (OCIDirPath*) ----*/ + +typedef struct OCIDirPathCtx OCIDirPathCtx; /* context */ +typedef struct OCIDirPathFuncCtx OCIDirPathFuncCtx; /* function context */ +typedef struct OCIDirPathColArray OCIDirPathColArray; /* column array */ +typedef struct OCIDirPathStream OCIDirPathStream; /* stream */ +typedef struct OCIDirPathDesc OCIDirPathDesc; /* direct path descriptor */ + + /*----- Defines for Direct Path Options -----*/ + + /* values for OCI_ATTR_DIRPATH_MODE attribute */ +#define OCI_DIRPATH_LOAD 1 /* direct path load operation */ +#define OCI_DIRPATH_UNLOAD 2 /* direct path unload operation */ +#define OCI_DIRPATH_CONVERT 3 /* direct path convert only operation */ + + /*----- values for OCI_ATTR_DIRPATH_INDEX_MAINT_METHOD attribute -----*/ +#define OCI_DIRPATH_INDEX_MAINT_SINGLE_ROW 1 + +/* Note that there are two attributes dealing with index maintenance - + * OCI_ATTR_DIRPATH_INDEX_MAINT_METHOD and OCI_ATTR_DIRPATH_SKIPINDEX_METHOD. + * OCI_ATTR_DIRPATH_SKIPINDEX_METHOD exists to isolate the behavior for + * skipping index maintenance since maintenance of unusable indexes is + * orthogonal to that of single row insertion. + * For backwards compatibility we still allow users to specify skip + * methods in OCI_ATTR_DIRPATH_INDEX_MAINT_METHOD so make sure the + * enumerations for the two attributes are distinct. + */ + /*----- values for OCI_ATTR_DIRPATH_SKIPINDEX_METHOD attribute -----*/ +#define OCI_DIRPATH_INDEX_MAINT_SKIP_UNUSABLE 2 +#define OCI_DIRPATH_INDEX_MAINT_DONT_SKIP_UNUSABLE 3 +#define OCI_DIRPATH_INDEX_MAINT_SKIP_ALL 4 + + /* values for OCI_ATTR_STATE attribute of OCIDirPathCtx */ +#define OCI_DIRPATH_NORMAL 1 /* can accept rows, last row complete */ +#define OCI_DIRPATH_PARTIAL 2 /* last row was partial */ +#define OCI_DIRPATH_NOT_PREPARED 3 /* direct path context is not prepared */ + + /*----- values for cflg argument to OCIDirpathColArrayEntrySet -----*/ +#define OCI_DIRPATH_COL_COMPLETE 0 /* column data is complete */ +#define OCI_DIRPATH_COL_NULL 1 /* column is null */ +#define OCI_DIRPATH_COL_PARTIAL 2 /* column data is partial */ +#define OCI_DIRPATH_COL_ERROR 3 /* column error, ignore row */ + /*----- values for action parameter to OCIDirPathDataSave -----*/ +#define OCI_DIRPATH_DATASAVE_SAVEONLY 0 /* data save point only */ +#define OCI_DIRPATH_DATASAVE_FINISH 1 /* execute finishing logic */ +/* save portion of input data (before space error occurred) and finish */ +#define OCI_DIRPATH_DATASAVE_PARTIAL 2 + + /*- OCI_ATTR_DIRPATH_EXPR_TYPE values (describes OCI_ATTR_NAME expr type) -*/ +#define OCI_DIRPATH_EXPR_OBJ_CONSTR 1 /* NAME is an object constructor */ +#define OCI_DIRPATH_EXPR_SQL 2 /* NAME is an opaque or sql function */ +#define OCI_DIRPATH_EXPR_REF_TBLNAME 3 /* NAME is table name if ref is scoped*/ + + +/*--------------------------------------------------------------------------- + PUBLIC FUNCTIONS + ---------------------------------------------------------------------------*/ + +/*------------------------ OCIDirPathCtx Operations -------------------------*/ + +/* + NAME + OCIDirPathAbort - OCI: Abort a direct path operation. + + DESCRIPTION + Aborts a direct path operation. Upon successful completion + the direct path context is no longer valid. + + RETURNS + An OCI error code, Oracle errors are returned via the error handle. + NOTES + */ +sword +OCIDirPathAbort( OCIDirPathCtx *dpctx, OCIError *errhp ); + +/* + NAME + OCIDirPathDataSave - OCI: Execute a data save point. + + DESCRIPTION + Successful return of this function indicates that a data save + point has been executed. + + RETURNS + An OCI error code, Oracle errors are returned via the error handle. + NOTES + */ +sword +OCIDirPathDataSave( OCIDirPathCtx *dpctx, OCIError *errhp, ub4 action ); + +/* + NAME + OCIDirPathFinish - OCI: Finish a direct path operation. + + DESCRIPTION + Finishes a direct path operation. + + RETURNS + An OCI error code, Oracle errors are returned via the error handle. + NOTES + */ +sword +OCIDirPathFinish( OCIDirPathCtx *dpctx, OCIError *errhp ); + +/* + NAME + OCIDirPathFlushRow - OCI: Flush a partial row from the server. + + DESCRIPTION + Flushes a partially loaded row from the server. + + RETURNS + An OCI error code, Oracle errors are returned via the error handle. + NOTES + */ +sword +OCIDirPathFlushRow( OCIDirPathCtx *dpctx, OCIError *errhp ); + +/* + NAME + OCIDirPathPrepare - OCI: Prepare a direct path operation. + + DESCRIPTION + Prepares a table/partition for a direct path operation. + + RETURNS + An OCI error code, Oracle errors are returned via the error handle. + NOTES + */ +sword +OCIDirPathPrepare( OCIDirPathCtx *dpctx, OCISvcCtx *svchp, + OCIError *errhp ); + +/* + NAME + OCIDirPathLoadStream - OCI: Load a direct path stream. + + DESCRIPTION + Load a direct path stream to the object associated with + the direct path context. + + RETURNS + An OCI error code, Oracle errors are returned via the error handle. + NOTES + */ +sword +OCIDirPathLoadStream( OCIDirPathCtx *dpctx, OCIDirPathStream *dpstr, + OCIError *errhp ); + + +/*---------------------- OCIDirPathColArray Operations ----------------------*/ + +/* + NAME + OCIDirPathColArrayEntryGet - OCI: Get column array entry. + + DESCRIPTION + Column array function which is used to get a specified entry in + a column array. + + RETURNS + An OCI error code, Oracle errors are returned via the error handle. + NOTES + */ +sword +OCIDirPathColArrayEntryGet( OCIDirPathColArray *dpca, OCIError *errhp, + ub4 rownum, ub2 colIdx, ub1 **cvalpp, ub4 *clenp, + ub1 *cflgp ); + +/* + NAME + OCIDirPathColArrayEntrySet - OCI: Set column array entry. + + DESCRIPTION + Column array function which is used to set a specified entry in + a column array. + + RETURNS + An OCI error code, Oracle errors are returned via the error handle. + NOTES + */ +sword +OCIDirPathColArrayEntrySet( OCIDirPathColArray *dpca, OCIError *errhp, + ub4 rownum, ub2 colIdx, ub1 *cvalp, ub4 clen, + ub1 cflg ); + +/* + NAME + OCIDirPathColArrayRowGet - OCI: Get column array row pointers. + + DESCRIPTION + Column array function which is used to get the base row pointers + for a specified row in a column array. + To be used in lieu of OCIDirPathColArrayEntryGet() and + OCIDirPathColArrayEntrySet(). + + RETURNS + An OCI error code, Oracle errors are returned via the error handle. + NOTES + */ +sword +OCIDirPathColArrayRowGet( OCIDirPathColArray *dpca, OCIError *errhp, + ub4 rownum, ub1 ***cvalppp, ub4 **clenpp, + ub1 **cflgpp ); + +/* + NAME + OCIDirPathColArrayReset - OCI: Reset Column Array State + + DESCRIPTION + Function which resets the column array state. + + RETURNS + An OCI error code, Oracle errors are returned via the error handle. + NOTES + Resetting the column array state is necessary when piecing in a large + column and an error occurs in the middle of loading the column. + */ +sword +OCIDirPathColArrayReset( OCIDirPathColArray *dpca, OCIError *errhp ); + +/* + NAME + OCIDirPathColArrayToStream - OCI: Convert Column Array to Stream Format. + + DESCRIPTION + Convert from column array format to stream format which is suitable + for loading via OCIDirPathLoadStream(). + + RETURNS + An OCI error code, Oracle errors are returned via the error handle. + NOTES + */ +sword +OCIDirPathColArrayToStream( OCIDirPathColArray *dpca, OCIDirPathCtx *dpctx, + OCIDirPathStream *dpstr, OCIError *errhp, + ub4 rowcnt, ub4 rowoff ); + + + +/*----------------------- OCIDirPathStream Operations -----------------------*/ + +/* + NAME + OCIDirPathStreamReset - OCI: + + DESCRIPTION + + RETURNS + An OCI error code, Oracle errors are returned via the error handle. + NOTES + */ +sword +OCIDirPathStreamReset( OCIDirPathStream *dpstr, OCIError *errhp ); + +#endif /* OCI8DP_ORACLE */ diff --git a/sdk/include/ociap.h b/sdk/include/ociap.h new file mode 100755 index 0000000..10d9f89 --- /dev/null +++ b/sdk/include/ociap.h @@ -0,0 +1,11129 @@ +/* Copyright (c) 1996, 2011, Oracle and/or its affiliates. +All rights reserved. */ + +/* + NAME + ociap.h + + DESCRIPTION + Oracle Call Interface - Ansi Prototypes + + RELATED DOCUMENTS + + INSPECTION STATUS + Inspection date: + Inspection status: + Estimated increasing cost defects per page: + Rule sets: + + ACCEPTANCE REVIEW STATUS + Review date: + Review status: + Reviewers: + + PUBLIC FUNCTION(S) + OCIAttrGet + OCIAttrSet + OCIBindArrayOfStruct + OCIBindByName + OCIBindByPos + OCIBindDynamic + OCIBindObject + OCIBreak + OCIConnectionPoolCreate + OCISessionPoolCreate + OCISessionGet + OCISessionRelease + OCIDateTimeAssign + OCIDateTimeCheck + OCIDateTimeCompare + OCIDateTimeConvert + OCIDateTimeFromText + OCIDateTimeGetDate + OCIDateTimeGetTime + OCIDateTimeGetTime + OCIDateTimeGetTimeZoneOffset + OCIDateTimeSysTimeStamp + OCIDateTimeIntervalAdd + OCIDateTimeIntervalSub + OCIDateTimeConstruct + OCIDateTimeSubtract + OCIDateTimeToText + OCIDateTimeGetTimeZoneName + OCIDateTimeToArray + OCIDateTimeFromArray + OCIRowidToChar + OCIDefineArrayOfStruct + OCIDefineByPos + OCIDefineDynamic + OCIDefineObject + OCIDescAlloc + OCIDescFree + OCIDescribeAny + OCIEnvCreate + OCIEnvNlsCreate + OCIEnvInit + OCIErrorGet + OCIExtractSetKey + OCIExtractFromFile + OCIIntervalSubtract + OCIIntervalMultiply + OCIIntervalToNumber + OCIIntervalToText + OCIIntervalFromTZ + OCIKerbAttrSet + OCILdaToSvcCtx + OCILobAppend + OCILobAssign + OCILobCharSetForm + OCILobCharSetId + OCILobCopy + OCILobCreateTemporary + OCILobDisableBuffering + OCILobEnableBuffering + OCILobErase + OCILobOpen + OCILobClose + OCILobFileClose + OCILobFileCLoseAll + OCILobFileExists + OCILobFileGetName + OCILobFileIsOpen + OCILobFileOpen + OCILobFileSetName + OCILobFlushBuffer + OCILobFreeTemporary + OCILobGetChunkSize + OCILobGetLength + OCILobIsEqual + OCILobIsTemporary + OCILobLoadFromFile + OCILobLocatorAssign + OCILobLocatorIsInit + OCILobRead + OCILobTrim + OCILobWrite + OCILobWriteAppend + OCILobGetStorageLimit + OCILobGetOptions + OCILobSetOptions + OCILobGetContentType + OCILobSetContentType + OCILogoff + OCILogon + OCILogon2 + OCIMemoryFree + OCIParamGet + OCIParamGet + OCIPasswordChange + OCIReset + OCIResultSetToStmt + OCIServerAttach + OCIServerDetach + OCIServerVersion + OCISessionBegin + OCISessionEnd + OCIStmtExecute + OCIStmtFetch + OCIStmtFetch2 + OCIStmtGetPieceInfo + OCIStmtPrepare + OCIStmtPrepare2 + OCIStmtRelease + OCIStmtSetPieceInfo + OCIFormatString + OCISvcCtxToLda + OCITransCommit + OCITransDetach + OCITransForget + OCITransMultiPrepare + OCITransPrepare + OCITransRollback + OCITransStart + OCIInitialize + OCIEnvCreate + OCIEnvNlsCreate + OCIFEnvCreate + OCIHandleAlloc + OCIDescriptorAlloc + OCIDescriptorFree + OCIArrayDescriptorAlloc + OCIArrayDescriptorFree + OCIEnvInit + OCIServerAttach + OCISessionBegin + OCISessionEnd + OCILogon + OCILogon2 + OCIPasswordChange + OCIStmtPrepare + OCIStmtPrepare2 + OCIStmtRelease + OCIBindByPos + OCIBindByName + OCIBindObject + OCIBindDynamic + OCIBindArrayOfStruct + OCIStmtGetPieceInfo + OCIStmtSetPieceInfo + OCIStmtExecute + OCIDefineByPos + OCIDefineObject + OCIDefineDynamic + OCIRowidToChar + OCIDefineArrayOfStruct + OCIStmtFetch + OCIStmtFetch2 + OCIStmtGetBindInfo + OCIDescribeAny + OCIParamGet + OCIParamSet + OCITransStart + OCITransMultiPrepare + OCIErrorGet + OCILobAppend + OCILobAssign + OCILobCharSetForm + OCILobCharSetId + OCILobCopy + OCILobCreateTemporary + OCILobClose + OCILobDisableBuffering + OCILobEnableBuffering + OCILobErase + OCILobFileClose + OCILobFileExists + OCILobFileGetName + OCILobFileIsOpen + OCILobFileOpen + OCILobFileSetName + OCILobFlushBuffer + OCILobFreeTemporary + OCILobGetChunkSize + OCILobGetLength + OCILobIsEqual + OCILobIsOpen + OCILobIsTemporary + OCILobLoadFromFile + OCILobLocatorAssign + OCILobLocatorIsInit + OCILobOpen + OCILobRead + OCILobTrim + OCILobWrite + OCILobWriteAppend + OCIServerVersion + OCIServerRelease + OCIAttrGet + OCIAttrSet + OCIUserCallbackRegister + OCIUserCallbackGet + OCISharedLibInit + OCIFileExists + OCIFileGetLength + OCIFileOpen + OCIFileRead + OCIFileSeek + OCIFileWrite + OCILobCopy2 + OCILobErase2 + OCILobGetLength2 + OCILobLoadFromFile2 + OCILobRead2 + OCILobArrayRead + OCILobTrim2 + OCILobWrite2 + OCILobArrayWrite + OCILobWriteAppend2 + OCILobGetStorageLimit + OCISecurityOpenWallet + OCISecurityCloseWallet + OCISecurityCreateWallet + OCISecurityDestroyWallet + OCISecurityStorePersona + OCISecurityOpenPersona + OCISecurityClosePersona + OCISecurityRemovePersona + OCISecurityCreatePersona + OCISecuritySetProtection + OCISecurityGetProtection + OCISecurityRemoveIdentity + OCISecurityCreateIdentity + OCISecurityAbortIdentity + OCISecurityFreeIdentity + OCISecurityStoreTrustedIdentity + OCISecuritySign + OCISecuritySignExpansion + OCISecurityVerify + OCISecurityValidate + OCISecuritySignDetached + OCISecuritySignDetExpansion + OCISecurityVerifyDetached + OCISecurity_PKEncrypt + OCISecurityPKEncryptExpansion + OCISecurityPKDecrypt + OCISecurityEncrypt + OCISecurityEncryptExpansion + OCISecurityDecrypt + OCISecurityEnvelope + OCISecurityDeEnvelope + OCISecurityKeyedHash + OCISecurityKeyedHashExpansion + OCISecurityHash + OCISecurityHashExpansion + OCISecuritySeedRandom + OCISecurityRandomBytes + OCISecurityRandomNumber + OCISecurityInitBlock + OCISecurityReuseBlock + OCISecurityPurgeBlock + OCISecuritySetBlock + OCISecurityGetIdentity + OCIAQEnq + OCIAQDeq + OCIAQEnqArray + OCIAQEnqStreaming + OCIAQDeqArray + OCIAQListen + OCIAQListen2 + OCIExtractSetKey + OCIExtractFromFile + OCIExtractToInt + OCIExtractToBool + OCIExtractToStr + OCIExtractToOCINum + OCIExtractFromList + OCIMemoryAlloc + OCIMemoryResize + OCIContextSetValue + OCIContextGetValue + OCIContextClearValue + OCIMemorySetCurrentIDs + OCIPicklerTdsCtxInit + OCIPicklerTdsInit + OCIPicklerTdsCreateElementNumber + OCIPicklerTdsCreateElementChar + OCIPicklerTdsCreateElementVarchar + OCIPicklerTdsCreateElementRaw + OCIPicklerTdsCreateElement + OCIPicklerTdsAddAttr + OCIPicklerTdsGenerate + OCIPicklerTdsGetAttr + OCIPicklerFdoInit + OCIPicklerFdoFree + OCIPicklerImageInit + OCIPicklerImageFree + OCIPicklerImageAddScalar + OCIPicklerImageAddNullScalar + OCIPicklerImageGenerate + OCIPicklerImageGetScalarSize + OCIPicklerImageGetScalar + OCIPicklerImageCollBegin + OCIPicklerImageCollAddScalar + OCIPicklerImageCollEnd + OCIPicklerImageCollBeginScan + OCIPicklerImageCollGetScalarSize + OCIPicklerImageCollGetScalar + OCIAnyDataGetType + OCIAnyDataIsNull + OCIAnyDataConvert + OCIAnyDataBeginCreate + OCIAnyDataAttrSet + OCIAnyDataCollAddElem + OCIAnyDataEndCreate + OCIAnyDataAccess + OCIAnyDataGetCurrAttrNum + OCIAnyDataAttrGet + OCIAnyDataCollGetElem + OCIPicklerTdsCtxInit + OCIPicklerTdsInit + OCIPicklerTdsCreateElementNumber + OCIPicklerTdsCreateElementChar + OCIPicklerTdsCreateElementVarchar + OCIPicklerTdsCreateElementRaw + OCIPicklerTdsCreateElement + OCIPicklerTdsAddAttr + OCIPicklerTdsGenerate + OCIPicklerTdsGetAttr + OCIPicklerFdoInit + OCIPicklerFdoFree + OCIPicklerImageInit + OCIPicklerImageFree + OCIPicklerImageAddScalar + OCIPicklerImageAddNullScalar + OCIPicklerImageGenerate + OCIPicklerImageGetScalarSize + OCIPicklerImageGetScalar + OCIPicklerImageCollBegin + OCIPicklerImageCollAddScalar + OCIPicklerImageCollEnd + OCIPicklerImageCollBeginScan + OCIPicklerImageCollGetScalarSize + OCIPicklerImageCollGetScalar + OCIAnyDataGetType + OCIAnyDataIsNull + OCIAnyDataConvert + OCIAnyDataBeginCreate + OCIAnyDataAttrSet + OCIAnyDataCollAddElem + OCIAnyDataEndCreate + OCIAnyDataAccess + OCIAnyDataGetCurrAttrNum + OCIAnyDataAttrGet + OCIAnyDataCollGetElem + OCIPicklerTdsCtxInit + OCIPicklerTdsInit + OCIPicklerTdsCreateElementNumber + OCIPicklerTdsCreateElementChar + OCIPicklerTdsCreateElementVarchar + OCIPicklerTdsCreateElementRaw + OCIPicklerTdsCreateElement + OCIPicklerTdsAddAttr + OCIPicklerTdsGenerate + OCIPicklerTdsGetAttr + OCIPicklerFdoInit + OCIPicklerFdoFree + OCIPicklerImageInit + OCIPicklerImageFree + OCIPicklerImageAddScalar + OCIPicklerImageAddNullScalar + OCIPicklerImageGenerate + OCIPicklerImageGetScalarSize + OCIPicklerImageGetScalar + OCIPicklerImageCollBegin + OCIPicklerImageCollAddScalar + OCIPicklerImageCollEnd + OCIPicklerImageCollBeginScan + OCIPicklerImageCollGetScalarSize + OCIPicklerImageCollGetScalar + OCIAnyDataGetType + OCIAnyDataIsNull + OCIAnyDataConvert + OCIAnyDataBeginCreate + OCIAnyDataAttrSet + OCIAnyDataCollAddElem + OCIAnyDataEndCreate + OCIAnyDataAccess + OCIAnyDataGetCurrAttrNum + OCIAnyDataAttrGet + OCIAnyDataCollGetElem + OCIAnyDataSetBeginCreate + OCIAnyDataSetDestroy + OCIAnyDataSetAddInstance + OCIAnyDataSetEndCreate + OCIAnyDataSetGetType + OCIAnyDataSetGetCount + OCIAnyDataSetGetInstance + OCIFormatString + OCINlsGetInfo + OCINlsNameMap + OCIMultiByteToWideChar + OCIMultiByteInSizeToWideChar + OCIWideCharToMultiByte + OCIWideCharInSizeToMultiByte + OCIWideCharStrcmp + OCIWideCharStrncmp + OCIWideCharStrcat + *OCIWideCharStrchr + OCIWideCharStrcpy + OCIWideCharStrncat + OCIWideCharStrncpy + *OCIWideCharStrrchr + OCIWideCharStrCaseConversion + OCIMultiByteStrcmp + OCIMultiByteStrncmp + OCIMultiByteStrcat + OCIMultiByteStrcpy + OCIMultiByteStrncat + OCIMultiByteStrncpy + OCIMultiByteStrnDisplayLength + OCIMultiByteStrCaseConversion + OCICharSetToUnicode + OCIUnicodeToCharSet + OCINlsCharSetConvert + OCINlsEnvironmentVariableGet + OCIMessageOpen + OCIMessageGet + OCIThreadMutexInit + OCIThreadMutexDestroy + OCIThreadMutexAcquire + OCIThreadMutexRelease + OCIThreadKeyInit + OCIThreadKeyDestroy + OCIThreadKeyGet + OCIThreadKeySet + OCIThreadIdSet + OCIThreadIdSetNull + OCIThreadIdGet + OCIThreadIdSame + OCIThreadIdNull + OCIThreadHndInit + OCIThreadHndDestroy + OCIThreadCreate + OCIThreadHandleGet + OCIThreadMutexInit + OCIThreadMutexDestroy + OCIThreadMutexAcquire + OCIThreadMutexRelease + OCIThreadKeyInit + OCIThreadKeyDestroy + OCIThreadKeyGet + OCIThreadKeySet + OCIThreadIdSet + OCIThreadIdSame + OCIThreadIdNull + OCIThreadCreate + OCISubscriptionRegister + OCISubscriptionPost + OCISubscriptionUnRegister + OCISubscriptionDisable + OCISubscriptionEnable + OCIDateTimeGetTime + OCIDateTimeGetDate + OCIDateTimeGetTimeZoneOffset + OCIDateTimeConstruct + OCIDateTimeSysTimeStamp + OCIDateTimeAssign + OCIDateTimeToText + OCIDateTimeFromText + OCIDateTimeCompare + OCIDateTimeCheck + OCIDateTimeConvert + OCIDateTimeSubtract + OCIDateTimeIntervalAdd + OCIDateTimeIntervalSub + OCIIntervalSubtract + OCIIntervalAdd + OCIIntervalMultiply + OCIIntervalDivide + OCIIntervalCompare + OCIIntervalFromNumber + OCIIntervalFromText + OCIIntervalToText + OCIIntervalToNumber + OCIIntervalCheck + OCIIntervalAssign + OCIIntervalSetYearMonth + OCIIntervalGetYearMonth + OCIIntervalSetDaySecond + OCIIntervalGetDaySecond + OCIDateTimeToArray + OCIDateTimeFromArray + OCIDateTimeGetTimeZoneName + OCIIntervalFromTZ + OCIConnectionPoolCreate + OCIConnectionPoolDestroy + OCISessionPoolCreate + OCISessionPoolDestroy + OCISessionGet + OCISessionRelease + OCIAppCtxSet + OCIAppCtxClearAll + OCIMemStats + OCIKerbAttrSet + OCIDBStartup + OCIDBShutdown + OCIClientVersion + OCIInitEventHandle + OCIStmtBindByPos + OCIStmtBindByName + + PRIVATE FUNCTION(S) + + EXAMPLES + + NOTES + + MODIFIED (MM/DD/YY) + slari 03/24/11 - OCIRoundTripCallback + slynn 03/18/08 - OCILobSet/SetContenttype->OCILobGet/SetContentType + amullick 02/11/08 - add OCILobGet/SetContenttype APIs + schoi 02/27/07 - OCILobGet/SetOptions API change + slynn 07/28/06 - Migrate to new 11g LOB terminology + hqian 05/22/06 - add OCI_SYSASM + slynn 06/21/06 - Add Lob Get Shared Regions Functionality + slynn 05/25/06 - New NG Lob Functionality. + jawilson 05/22/06 - add TDO out parameter for streaming enq callback + aramappa 01/19/06 - Added OCIArrayDescriptorAlloc, + OCIArrayDescriptorFree + jawilson 02/09/06 - add OCIAQEnqStreaming + mxu 03/08/06 - Fix bug 5037807 + srseshad 09/12/05 - stmtcache: callback + mbastawa 09/16/05 - dbhygiene + dmukhin 06/29/05 - ANSI prototypes; miscellaneous cleanup + nbhatt 06/17/04 - merge conflicts + nbhatt 05/24/04 - merge conflicts + weiwang 05/06/04 - add OCIAQListen2 + rvissapr 06/21/04 - add OCIAppCtx API + debanerj 05/17/04 - 13064: LOB array Read and Write + aahluwal 06/02/04 - [OCI Events]: add OCIInitEventHandle + nikeda 05/28/04 - grabtrans 'nikeda_oci_events_copy' + nikeda 05/13/04 - [OCI Events] Rename HACBK->EVTCBK, HACTX->EVTCTX + nikeda 05/10/04 - [OCI Events] code review changes + aahluwal 04/09/04 - [OCI Events]: add OCIHAServerHandleGet + nikeda 03/18/04 - [OCI Events] New Server Handle Callback + dfrumkin 12/04/03 - Add OCIDBStartup, OCIDBShutdown + jciminsk 12/12/03 - merge from RDBMS_MAIN_SOLARIS_031209 + sgollapu 06/26/03 - Change OCIPing prototype + sgollapu 05/05/03 - Add OCIPing + debanerj 01/16/03 - Bug 2753018: Lob Locator parameter for + OCILobGetStorageLimit + rpingte 05/06/04 - add OCIClientVersion + debanerj 08/26/03 - 6003: Lob interface changes + sgollapu 06/23/03 - Add OCIPing + debanerj 01/16/03 - Bug 2753018: Lob Locator parameter for + OCILobGetStorageLimit + tkeefe 02/17/03 - bug-2773794: Add new interface for setting Kerb attrs + ataracha 01/03/03 - Move OCIXMLType functions to ocixml.h + akatti 11/28/02 - [2521361]:add OCIRowidToChar prototype + chliang 10/23/02 - add OCIFetchRowCallback + cparampa 10/13/02 - Fix the prototype of OCIAQListen(ansi prototype) + chliang 10/12/02 - add OCIBindRowCallback + debanerj 09/30/02 - Unlimited size LOB 6003 + thoang 09/25/02 - Add csid to XMLType create functions + thoang 04/19/02 - Add OCIXMLTypeGetNS + aahluwal 08/09/02 - adding OCIAQDeqArray + aahluwal 06/03/02 - bug 2360115 + skabraha 04/16/02 - fix compiler warnings + sichandr 02/12/02 - fix OCIXMLTypeExists + gayyappa 02/01/02 - fix 2210776 : change Dom to DOM + sichandr 10/24/01 - OCISvcCtx for XMLType create routines + schandir 09/14/01 - Add prototypes for Stmt Caching + abande 09/04/01 - Add Prototypes for Session Pooling Methods + stakeda 09/12/01 - add OCINlsCharSetConvert + whe 08/28/01 - add OCIEnvNlsCreate + wzhang 08/22/01 - Add OCINlsCharSetNameToId. + whe 10/05/01 - add prototype for OCIXMLType functions + mdmehta 04/06/01 - Bug 1683763, OCIDateTimeToText: buf_size to ub4* + schandir 12/12/00 - modify the ociconnectionpoolcreate() interface. + porangas 12/04/00 - Forward merge bug#974710 to 9i + rpingte 11/29/00 - Fix bug# 1485795. + gtarora 11/30/00 - fix comment for OCILobIsTemporary + akatti 11/07/00 - [1198379]:add OCIRowidToChar + bpalaval 10/15/00 - Forward merge 892654. + kmohan 09/18/00 - add OCILogon2 + etucker 07/28/00 - add OCIIntervalFromTZ + vjayaram 07/18/00 - add connection pooling changes + etucker 07/13/00 - add dls apis for oci + hmasaki 07/05/00 - fix 1230846: forward merge into 8.2 + mbastawa 06/05/00 - add OCIStmtFetch2 + rxgovind 06/07/00 - update OCIAnyData interfaces + rxgovind 05/04/00 - add OCIAnyDataSet interfaces + rkasamse 05/01/00 - remove attrno from OCIAnyDataAttrGet + rkasamse 03/13/00 - add prototype s for OCCIAnyData + slari 09/01/99 - remove OCIEnvCallback + slari 08/23/99 - add OCIUcb in user callback functions + dsaha 07/07/99 - Add OCIFEnvCreate for forms + vyanaman 06/21/99 - Change OCI DateTime/Interval APIs. + esoyleme 07/01/99 - expose MTS performance enhancements + whe 06/14/99 - bug727872:add CONST to match definitions + kkarun 02/23/99 - Fix OCIDateTime APIs + jiyang 12/07/98 - Add comments for OCI_NLS_DUAL_CURRENCY + aroy 12/01/98 - add OCIEnvCreate + slari 11/23/98 - use ORASTDARG + slari 11/21/98 - replace ellipsis by arglist in OCIUserCallback + thchang 10/20/98 - correct comment on OCILobCreateTemporary + slari 09/08/98 - allow envh to receive error info also in CallbackReg/ + kkarun 09/02/98 - Change const to CONST + aroy 08/04/98 - add OCITerminate calls + nramakri 06/25/98 - remove CONST from some OCIPickler APIs + jiyang 06/22/98 - Fix a lint error + nmallava 06/08/98 - ociistemporary -> envhp + jhasenbe 05/27/98 - Remove definitions for U-Calls (Unicode) + nmallava 05/18/98 - add comments + sgollapu 05/19/98 - Change text to OraText + aroy 04/20/98 - merge forward 8.0.5 -> 8.1.3 + nbhatt 05/14/98 - aq listen call + lchidamb 03/02/98 - Client Notification prototypes + vyanaman 04/19/98 - System Timestamp + kkarun 04/17/98 - Add more Interval functions + vyanaman 04/17/98 - Fix min (proc error) + vyanaman 04/16/98 - Add get/set TZ + kkarun 04/13/98 - Add Datetime prototypes + rkasamse 04/13/98 - change OCIEnv* to dvoid* for context/memory cart serv + rkasamse 04/15/98 - chage pickler cart interface + slari 03/20/98 - change proto of OCIUserCallback + slari 02/17/98 - add OCIUserCallback + jiyang 04/02/98 - Accept both env and user handles for NLS + rkasamse 03/20/98 - remove prototypes for OCIMemoryDuration* functions. + tsaulys 03/20/98 - use environment or session handle + nmallava 04/09/98 - OCILobLocatorAssign + nmallava 04/07/98 - lobgetchunksize and writeappend apis + jhasenbe 04/06/98 - Add new interfaces for Unicode support + nmallava 03/17/98 - add interfaces + nmallava 03/16/98 - add open/close apis + nmallava 03/10/98 - add temporary lobs apis + sgollapu 07/10/97 - Add OCIReset + sgollapu 02/09/98 - OCI non-blocking + nramakri 01/16/98 - remove #ifdef NEVER clause for OCIExtract + rmurthy 01/08/98 - OCIContextGenerateKey: change ub1 to ub4 + ewaugh 12/18/97 - Turn type wrappers into functions. + skabraha 12/02/97 - adding OCIFile functions + rhwu 12/02/97 - add OCI Thread + nramakri 12/15/97 - move to core4 + nramakri 12/11/97 - modify OCIExtract prototype + ewaugh 12/10/97 - add OCIFormat prototypes + nmallava 12/17/97 - Add ilob open and close apis + rkasamse 12/03/97 - Change some of the function names for pickler cartrid + nramakri 11/12/97 - add OCIExtract prototypes + rkasamse 11/21/97 - add prototypes for memory cartridge services and cont + rkasamse 11/03/97 - Add pickler cartridge interfaces. + jiyang 11/11/97 - Add NLS service for cartridge + tanguyen 08/19/97 - + cxcheng 07/30/97 - replace OCISvcCtx with OCISvcCtx + schandra 06/25/97 - AQ OCI interface + bnainani 07/21/97 - add prototypes for Oracle XA extensions + esoyleme 05/13/97 - move failover callback prototype + skmishra 05/06/97 - stdc compiler fixes + skmishra 04/24/97 - C++ Compatibility changes + skotsovo 04/21/97 - make lob parameter names consistent + rwhitman 04/16/97 - Fix LOB prototypes - Olint OCI 8.0.3 + ramkrish 04/15/97 - Add free flag to OCILobFlushBuffer + dchatter 04/10/97 - add nzt.h inclusion + cxcheng 04/09/97 - change objnamp from CONST text* to dvoid* + cxcheng 04/08/97 - fix prototype of OCIDescribeAny() + skotsovo 03/31/97 - remove OCILobLocatorSize + skotsovo 03/27/97 - add OCILobLoadFromFile + bcchang 02/18/97 - Fix syntax error + dchatter 01/13/97 - fix comments on LOB calls + aroy 01/10/97 - remove ocilobfilecreate delete + sgollapu 12/27/96 - Correct OCILogon prototype + dchatter 01/04/97 - comments to describe the functions + sgollapu 11/25/96 - Change OCILobFileIsExistent + schandra 11/18/96 - Remove xa.h include + sgollapu 11/09/96 - Change prototype of OCIDescribeAny + dchatter 10/31/96 - delete CONST from lob write cb fn + dchatter 10/30/96 - more changes + dchatter 10/26/96 - lob/file long name corrections + slari 10/16/96 - delete unused calls + rwessman 10/29/96 - Fixed OCISecurityGetIdentity prototype + bcchang 10/25/96 - Fix syntax error + sgollapu 10/22/96 - Add OCILogon and OCILogoff + rwessman 10/16/96 - Added cryptographic and digital signature functions + sgollapu 10/10/96 - Add ocibdp and ocibdn + rxgovind 10/07/96 - add oci file calls + skotsovo 10/01/96 - move orl lob fnts to oci + skotsovo 09/20/96 - in OCILobGetLength(), remove the 'isnull' parameter. + aroy 08/29/96 - change prototype for Nchar Lob support + dchatter 08/21/96 - OCIResultSetToStmt prototype change + sthakur 08/14/96 - add OCIParamSet + schandra 07/26/96 - TX OCI return values - sb4->sword + aroy 07/17/96 - terminology change: OCILobLocator => OCILobLocator + dchatter 07/01/96 - create ANSI prototypes + dchatter 07/01/96 - Creation + +*/ + + +#ifndef OCIAP_ORACLE +# define OCIAP_ORACLE + +# ifndef ORATYPES +# include +# endif + +#ifndef ORASTDARG +#include +#define ORASTDARG +#endif + +#ifndef OCIDFN +#include +#endif + +#ifndef NZT_ORACLE +#include +#endif /* NZT_ORACLE */ + +#ifndef OCI_ORACLE +#include +#endif + +#ifndef ORT_ORACLE +#include +#endif + + + +/*--------------------------------------------------------------------------- + PUBLIC TYPES AND CONSTANTS + ---------------------------------------------------------------------------*/ + + +/*--------------------------------------------------------------------------- + PRIVATE TYPES AND CONSTANTS + ---------------------------------------------------------------------------*/ + + +/*--------------------------------------------------------------------------- + PUBLIC FUNCTIONS + ---------------------------------------------------------------------------*/ + +/***************************************************************************** + DESCRIPTION +****************************************************************************** +Note: the descriptions of the functions are alphabetically arranged. Please +maintain the arrangement when adding a new function description. The actual +prototypes are below this comment section and donot follow any alphabetical +ordering. + + +--------------------------------OCIAttrGet------------------------------------ + +OCIAttrGet() +Name +OCI Attribute Get +Purpose +This call is used to get a particular attribute of a handle. +Syntax +sword OCIAttrGet ( const void *trgthndlp, + ub4 trghndltyp, + void *attributep, + ub4 *sizep, + ub4 attrtype, + OCIError *errhp ); +Comments +This call is used to get a particular attribute of a handle. +See Appendix B, "Handle Attributes", for a list of handle types and their +readable attributes. +Parameters +trgthndlp (IN) - is the pointer to a handle type. +trghndltyp (IN) - is the handle type. +attributep (OUT) - is a pointer to the storage for an attribute value. The +attribute value is filled in. +sizep (OUT) - is the size of the attribute value. +This can be passed in as NULL for most parameters as the size is well known. +For text* parameters, a pointer to a ub4 must be passed in to get the length +of the string. +attrtype (IN) - is the type of attribute. +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +Related Functions +OCIAttrSet() + +--------------------------------OCIAttrSet------------------------------------ + + +OCIAttrSet() +Name +OCI Attribute Set +Purpose +This call is used to set a particular attribute of a handle or a descriptor. +Syntax +sword OCIAttrSet ( void *trgthndlp, + ub4 trghndltyp, + void *attributep, + ub4 size, + ub4 attrtype, + OCIError *errhp ); +Comments +This call is used to set a particular attribute of a handle or a descriptor. +See Appendix B for a list of handle types and their writeable attributes. +Parameters +trghndlp (IN/OUT) - the pointer to a handle type whose attribute gets +modified. +trghndltyp (IN/OUT) - is the handle type. +attributep (IN) - a pointer to an attribute value. +The attribute value is copied into the target handle. If the attribute value +is a pointer, then only the pointer is copied, not the contents of the pointer. +size (IN) - is the size of an attribute value. This can be passed in as 0 for +most attributes as the size is already known by the OCI library. For text* +attributes, a ub4 must be passed in set to the length of the string. +attrtype (IN) - the type of attribute being set. +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +Related Functions +OCIAttrGet() + + + +--------------------------------OCIBindArrayOfStruct-------------------------- + + + +OCIBindArrayOfStruct() +Name +OCI Bind for Array of Structures +Purpose +This call sets up the skip parameters for a static array bind. +Syntax +sword OCIBindArrayOfStruct ( OCIBind *bindp, + OCIError *errhp, + ub4 pvskip, + ub4 indskip, + ub4 alskip, + ub4 rcskip ); +Comments +This call sets up the skip parameters necessary for a static array bind. +This call follows a call to OCIBindByName() or OCIBindByPos(). The bind +handle returned by that initial bind call is used as a parameter for the +OCIBindArrayOfStruct() call. +For information about skip parameters, see the section "Arrays of Structures" +on page 4-16. +Parameters +bindp (IN) - the handle to a bind structure. +errhp (IN) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +pvskip (IN) - skip parameter for the next data value. +indskip (IN) - skip parameter for the next indicator value or structure. +alskip (IN) - skip parameter for the next actual length value. +rcskip (IN) - skip parameter for the next column-level return code value. +Related Functions +OCIAttrGet() + + +--------------------------------OCIBindByName--------------------------------- + +OCIBindByName() +Name +OCI Bind by Name +Purpose +Creates an association between a program variable and a placeholder in a SQL +statement or PL/SQL block. +Syntax +sword OCIBindByName ( + OCIStmt *stmtp, + OCIBind **bindp, + OCIError *errhp, + const OraText *placeholder, + sb4 placeh_len, + void *valuep, + sb4 value_sz, + ub2 dty, + void *indp, + ub2 *alenp, + ub2 *rcodep, + ub4 maxarr_len, + ub4 *curelep, + ub4 mode ); +Description +This call is used to perform a basic bind operation. The bind creates an +association between the address of a program variable and a placeholder in a +SQL statement or PL/SQL block. The bind call also specifies the type of data +which is being bound, and may also indicate the method by which data will be +provided at runtime. +This function also implicitly allocates the bind handle indicated by the bindp +parameter. +Data in an OCI application can be bound to placeholders statically or +dynamically. Binding is static when all the IN bind data and the OUT bind +buffers are well-defined just before the execute. Binding is dynamic when the +IN bind data and the OUT bind buffers are provided by the application on +demand at execute time to the client library. Dynamic binding is indicated by +setting the mode parameter of this call to OCI_DATA_AT_EXEC. +Related Functions: For more information about dynamic binding, see +the section "Runtime Data Allocation and Piecewise Operations" on +page 5-16. +Both OCIBindByName() and OCIBindByPos() take as a parameter a bind handle, +which is implicitly allocated by the bind call A separate bind handle is +allocated for each placeholder the application is binding. +Additional bind calls may be required to specify particular attributes +necessary when binding certain data types or handling input data in certain +ways: +If arrays of structures are being utilized, OCIBindArrayOfStruct() must +be called to set up the necessary skip parameters. +If data is being provided dynamically at runtime, and the application +will be using user-defined callback functions, OCIBindDynamic() must +be called to register the callbacks. +If a named data type is being bound, OCIBindObject() must be called to +specify additional necessary information. +Parameters +stmth (IN/OUT) - the statement handle to the SQL or PL/SQL statement +being processed. +bindp (IN/OUT) - a pointer to a pointer to a bind handle which is implicitly +allocated by this call. The bind handle maintains all the bind information +for this particular input value. The handle is feed implicitly when the +statement handle is deallocated. +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +placeholder (IN) - the placeholder attributes are specified by name if +ocibindn() is being called. +placeh_len (IN) - the length of the placeholder name specified in placeholder. +valuep (IN/OUT) - a pointer to a data value or an array of data values of the +type specified in the dty parameter. An array of data values can be specified +for mapping into a PL/SQL table or for providing data for SQL multiple-row +operations. When an array of bind values is provided, this is called an array +bind in OCI terms. Additional attributes of the array bind (not bind to a +column of ARRAY type) are set up in OCIBindArrayOfStruct() call. +For a REF, named data type bind, the valuep parameter is used only for IN +bind data. The pointers to OUT buffers are set in the pgvpp parameter +initialized by OCIBindObject(). For named data type and REF binds, the bind +values are unpickled into the Object Cache. The OCI object navigational calls +can then be used to navigate the objects and the refs in the Object Cache. +If the OCI_DATA_AT_EXEC mode is specified in the mode parameter, valuep +is ignored for all data types. OCIBindArrayOfStruct() cannot be used and +OCIBindDynamic() must be invoked to provide callback functions if desired. +value_sz (IN) - the size of a data value. In the case of an array bind, this is +the maximum size of any element possible with the actual sizes being specified +in the alenp parameter. +If the OCI_DATA_AT_EXEC mode is specified, valuesz defines the maximum +size of the data that can be ever provided at runtime for data types other than +named data types or REFs. +dty (IN) - the data type of the value(s) being bound. Named data types +(SQLT_NTY) and REFs (SQLT_REF) are valid only if the application has been +initialized in object mode. For named data types, or REFs, additional calls +must be made with the bind handle to set up the datatype-specific attributes. +indp (IN/OUT) - pointer to an indicator variable or array. For scalar data +types, this is a pointer to sb2 or an array of sb2s. For named data types, +this pointer is ignored and the actual pointer to the indicator structure or +an array of indicator structures is initialized by OCIBindObject(). +Ignored for dynamic binds. +See the section "Indicator Variables" on page 2-43 for more information about +indicator variables. +alenp (IN/OUT) - pointer to array of actual lengths of array elements. Each +element in alenp is the length of the data in the corresponding element in the +bind value array before and after the execute. This parameter is ignored for +dynamic binds. +rcodep (OUT) - pointer to array of column level return codes. This parameter +is ignored for dynamic binds. +maxarr_len (IN) - the maximum possible number of elements of type dty in a +PL/SQL binds. This parameter is not required for non-PL/SQL binds. If +maxarr_len is non-zero, then either OCIBindDynamic() or +OCIBindArrayOfStruct() can be invoked to set up additional bind attributes. +curelep(IN/OUT) - a pointer to the actual number of elements. This parameter +is only required for PL/SQL binds. +mode (IN) - the valid modes for this parameter are: +OCI_DEFAULT. This is default mode. +OCI_DATA_AT_EXEC. When this mode is selected, the value_sz +parameter defines the maximum size of the data that can be ever +provided at runtime. The application must be ready to provide the OCI +library runtime IN data buffers at any time and any number of times. +Runtime data is provided in one of the two ways: +callbacks using a user-defined function which must be registered +with a subsequent call to OCIBindDynamic(). +a polling mechanism using calls supplied by the OCI. This mode +is assumed if no callbacks are defined. +For more information about using the OCI_DATA_AT_EXEC mode, see +the section "Runtime Data Allocation and Piecewise Operations" on +page 5-16. +When the allocated buffers are not required any more, they should be +freed by the client. +Related Functions +OCIBindDynamic(), OCIBindObject(), OCIBindArrayOfStruct(), OCIAttrGet() + + + +-------------------------------OCIBindByPos----------------------------------- + + +OCIBindByPos() +Name +OCI Bind by Position +Purpose +Creates an association between a program variable and a placeholder in a SQL +statement or PL/SQL block. +Syntax +sword OCIBindByPos ( + OCIStmt *stmtp, + OCIBind **bindp, + OCIError *errhp, + ub4 position, + void *valuep, + sb4 value_sz, + ub2 dty, + void *indp, + ub2 *alenp, + ub2 *rcodep, + ub4 maxarr_len, + ub4 *curelep, + ub4 mode); + +Description +This call is used to perform a basic bind operation. The bind creates an +association between the address of a program variable and a placeholder in a +SQL statement or PL/SQL block. The bind call also specifies the type of data +which is being bound, and may also indicate the method by which data will be +provided at runtime. +This function also implicitly allocates the bind handle indicated by the bindp +parameter. +Data in an OCI application can be bound to placeholders statically or +dynamically. Binding is static when all the IN bind data and the OUT bind +buffers are well-defined just before the execute. Binding is dynamic when the +IN bind data and the OUT bind buffers are provided by the application on +demand at execute time to the client library. Dynamic binding is indicated by +setting the mode parameter of this call to OCI_DATA_AT_EXEC. +Related Functions: For more information about dynamic binding, see +the section "Runtime Data Allocation and Piecewise Operations" on +page 5-16 +Both OCIBindByName() and OCIBindByPos() take as a parameter a bind handle, +which is implicitly allocated by the bind call A separate bind handle is +allocated for each placeholder the application is binding. +Additional bind calls may be required to specify particular attributes +necessary when binding certain data types or handling input data in certain +ways: +If arrays of structures are being utilized, OCIBindArrayOfStruct() must +be called to set up the necessary skip parameters. +If data is being provided dynamically at runtime, and the application +will be using user-defined callback functions, OCIBindDynamic() must +be called to register the callbacks. +If a named data type is being bound, OCIBindObject() must be called to +specify additional necessary information. +Parameters +stmth (IN/OUT) - the statement handle to the SQL or PL/SQL statement +being processed. +bindp (IN/OUT) - a pointer to a pointer to a bind handle which is implicitly +allocated by this call. The bind handle maintains all the bind information +for this particular input value. The handle is feed implicitly when the +statement handle is deallocated. +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +position (IN) - the placeholder attributes are specified by position if +ocibindp() is being called. +valuep (IN/OUT) - a pointer to a data value or an array of data values of the +type specified in the dty parameter. An array of data values can be specified +for mapping into a PL/SQL table or for providing data for SQL multiple-row +operations. When an array of bind values is provided, this is called an array +bind in OCI terms. Additional attributes of the array bind (not bind to a +column of ARRAY type) are set up in OCIBindArrayOfStruct() call. +For a REF, named data type bind, the valuep parameter is used only for IN +bind data. The pointers to OUT buffers are set in the pgvpp parameter +initialized by OCIBindObject(). For named data type and REF binds, the bind +values are unpickled into the Object Cache. The OCI object navigational calls +can then be used to navigate the objects and the refs in the Object Cache. +If the OCI_DATA_AT_EXEC mode is specified in the mode parameter, valuep +is ignored for all data types. OCIBindArrayOfStruct() cannot be used and +OCIBindDynamic() must be invoked to provide callback functions if desired. +value_sz (IN) - the size of a data value. In the case of an array bind, this is +the maximum size of any element possible with the actual sizes being specified +in the alenp parameter. +If the OCI_DATA_AT_EXEC mode is specified, valuesz defines the maximum +size of the data that can be ever provided at runtime for data types other than +named data types or REFs. +dty (IN) - the data type of the value(s) being bound. Named data types +(SQLT_NTY) and REFs (SQLT_REF) are valid only if the application has been +initialized in object mode. For named data types, or REFs, additional calls +must be made with the bind handle to set up the datatype-specific attributes. +indp (IN/OUT) - pointer to an indicator variable or array. For scalar data +types, this is a pointer to sb2 or an array of sb2s. For named data types, +this pointer is ignored and the actual pointer to the indicator structure or +an array of indicator structures is initialized by OCIBindObject(). Ignored +for dynamic binds. +See the section "Indicator Variables" on page 2-43 for more information about +indicator variables. +alenp (IN/OUT) - pointer to array of actual lengths of array elements. Each +element in alenp is the length of the data in the corresponding element in the +bind value array before and after the execute. This parameter is ignored for +dynamic binds. +rcodep (OUT) - pointer to array of column level return codes. This parameter +is ignored for dynamic binds. +maxarr_len (IN) - the maximum possible number of elements of type dty in a +PL/SQL binds. This parameter is not required for non-PL/SQL binds. If +maxarr_len is non-zero, then either OCIBindDynamic() or +OCIBindArrayOfStruct() can be invoked to set up additional bind attributes. +curelep(IN/OUT) - a pointer to the actual number of elements. This parameter +is only required for PL/SQL binds. +mode (IN) - the valid modes for this parameter are: +OCI_DEFAULT. This is default mode. +OCI_DATA_AT_EXEC. When this mode is selected, the value_sz +parameter defines the maximum size of the data that can be ever +provided at runtime. The application must be ready to provide the OCI +library runtime IN data buffers at any time and any number of times. +Runtime data is provided in one of the two ways: +callbacks using a user-defined function which must be registered +with a subsequent call to OCIBindDynamic() . +a polling mechanism using calls supplied by the OCI. This mode +is assumed if no callbacks are defined. +For more information about using the OCI_DATA_AT_EXEC mode, see +the section "Runtime Data Allocation and Piecewise Operations" on +page 5-16. +When the allocated buffers are not required any more, they should be +freed by the client. +Related Functions +OCIBindDynamic(), OCIBindObject(), OCIBindArrayOfStruct(), OCIAttrGet() + + + +-------------------------------OCIBindDynamic--------------------------------- + +OCIBindDynamic() +Name +OCI Bind Dynamic Attributes +Purpose +This call is used to register user callbacks for dynamic data allocation. +Syntax +sword OCIBindDynamic( OCIBind *bindp, + OCIError *errhp, + void *ictxp, + OCICallbackInBind (icbfp)( + void *ictxp, + OCIBind *bindp, + ub4 iter, + ub4 index, + void **bufpp, + ub4 *alenp, + ub1 *piecep, + void **indp ), + void *octxp, + OCICallbackOutBind (ocbfp)( + void *octxp, + OCIBind *bindp, + ub4 iter, + ub4 index, + void **bufp, + ub4 **alenpp, + ub1 *piecep, + void **indpp, + ub2 **rcodepp) ); +Comments +This call is used to register user-defined callback functions for providing +data for an UPDATE or INSERT if OCI_DATA_AT_EXEC mode was specified in a +previous call to OCIBindByName() or OCIBindByPos(). +The callback function pointers must return OCI_CONTINUE if it the call is +successful. Any return code other than OCI_CONTINUE signals that the client +wishes to abort processing immediately. +For more information about the OCI_DATA_AT_EXEC mode, see the section +"Runtime Data Allocation and Piecewise Operations" on page 5-16. +Parameters +bindp (IN/OUT) - a bind handle returned by a call to OCIBindByName() or +OCIBindByPos(). +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +ictxp (IN) - the context pointer required by the call back function icbfp. +icbfp (IN) - the callback function which returns a pointer to the IN bind +value or piece at run time. The callback takes in the following parameters. +ictxp (IN/OUT) - the context pointer for this callback function. +bindp (IN) - the bind handle passed in to uniquely identify this bind +variable. +iter (IN) - 1-based execute iteration value. +index (IN) - index of the current array, for an array bind. 1 based not +greater than curele parameter of the bind call. +index (IN) - index of the current array, for an array bind. This parameter +is 1-based, and may not be greater than curele parameter of the bind call. +bufpp (OUT) - the pointer to the buffer. +piecep (OUT) - which piece of the bind value. This can be one of the +following values - OCI_ONE_PIECE, OCI_FIRST_PIECE, +OCI_NEXT_PIECE and OCI_LAST_PIECE. +indp (OUT) - contains the indicator value. This is apointer to either an +sb2 value or a pointer to an indicator structure for binding named data +types. +indszp (OUT) - contains the indicator value size. A pointer containing +the size of either an sb2 or an indicator structure pointer. +octxp (IN) - the context pointer required by the callback function ocbfp. +ocbfp (IN) - the callback function which returns a pointer to the OUT bind +value or piece at run time. The callback takes in the following parameters. +octxp (IN/OUT) - the context pointer for this call back function. +bindp (IN) - the bind handle passed in to uniquely identify this bind +variable. +iter (IN) - 1-based execute iteration value. +index (IN) - index of the current array, for an array bind. This parameter +is 1-based, and must not be greater than curele parameter of the bind call. +bufpp (OUT) - a pointer to a buffer to write the bind value/piece. +buflp (OUT) - returns the buffer size. +alenpp (OUT) - a pointer to a storage for OCI to fill in the size of the bind +value/piece after it has been read. +piecep (IN/OUT) - which piece of the bind value. It will be set by the +library to be one of the following values - OCI_ONE_PIECE or +OCI_NEXT_PIECE. The callback function can leave it unchanged or set +it to OCI_FIRST_PIECE or OCI_LAST_PIECE. By default - +OCI_ONE_PIECE. +indpp (OUT) - returns a pointer to contain the indicator value which +either an sb2 value or a pointer to an indicator structure for named data +types. +indszpp (OUT) - returns a pointer to return the size of the indicator +value which is either size of an sb2 or size of an indicator structure. +rcodepp (OUT) - returns a pointer to contains the return code. +Related Functions +OCIAttrGet() + + +---------------------------------OCIBindObject-------------------------------- + + +OCIBindObject() +Name +OCI Bind Object +Purpose +This function sets up additional attributes which are required for a named +data type (object) bind. +Syntax +sword OCIBindObject ( OCIBind *bindp, + OCIError *errhp, + const OCIType *type, + void **pgvpp, + ub4 *pvszsp, + void **indpp, + ub4 *indszp, ); +Comments +This function sets up additional attributes which binding a named data type +or a REF. An error will be returned if this function is called when the OCI +environment has been initialized in non-object mode. +This call takes as a paramter a type descriptor object (TDO) of datatype +OCIType for the named data type being defined. The TDO can be retrieved +with a call to OCITypeByName(). +If the OCI_DATA_AT_EXEC mode was specified in ocibindn() or ocibindp(), the +pointers to the IN buffers are obtained either using the callback icbfp +registered in the OCIBindDynamic() call or by the OCIStmtSetPieceInfo() call. +The buffers are dynamically allocated for the OUT data and the pointers to +these buffers are returned either by calling ocbfp() registered by the +OCIBindDynamic() or by setting the pointer to the buffer in the buffer passed +in by OCIStmtSetPieceInfo() called when OCIStmtExecute() returned +OCI_NEED_DATA. The memory of these client library- allocated buffers must be +freed when not in use anymore by using the OCIObjectFreee() call. +Parameters +bindp ( IN/OUT) - the bind handle returned by the call to OCIBindByName() +or OCIBindByPos(). +errhp ( IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +type ( IN) - points to the TDO which describes the type of the program +variable being bound. Retrieved by calling OCITypeByName(). +pgvpp ( IN/OUT) - points to a pointer to the program variable buffer. For an +array, pgvpp points to an array of pointers. When the bind variable is also an +OUT variable, the OUT Named Data Type value or REF is allocated +(unpickled) in the Object Cache, and a pointer to the value or REF is returned, +At the end of execute, when all OUT values have been received, pgvpp points +to an array of pointer(s) to these newly allocated named data types in the +object cache. +pgvpp is ignored if the OCI_DATA_AT_EXEC mode is set. Then the Named +Data Type buffers are requested at runtime. For static array binds, skip +factors may be specified using the OCIBindArrayOfStruct() call. The skip +factors are used to compute the address of the next pointer to the value, the +indicator structure and their sizes. +pvszsp ( IN/OUT) - points to the size of the program variable. The size of the +named data type is not required on input. For an array, pvszsp is an array of +ub4s. On return, for OUT bind variables, this points to size(s) of the Named +Data Types and REFs received. pvszsp is ignored if the OCI_DATA_AT_EXEC +mode is set. Then the size of the buffer is taken at runtime. +indpp ( IN/OUT) - points to a pointer to the program variable buffer +containing the parallel indicator structure. For an array, points to an array +of pointers. When the bind variable is also an OUT bind variable, memory is +allocated in the object cache, to store the unpickled OUT indicator values. At +the end of the execute when all OUT values have been received, indpp points +to the pointer(s) to these newly allocated indicator structure(s). +indpp is ignored if the OCI_DATA_AT_EXEC mode is set. Then the indicator +is requested at runtime. +indszp ( IN/OUT) - points to the size of the IN indicator structure program +variable. For an array, it is an array of sb2s. On return for OUT bind +variables, this points to size(s) of the received OUT indicator structures. +indszp is ignored if the OCI_DATA_AT_EXEC mode is set. Then the indicator +size is requested at runtime. +Related Functions +OCIAttrGet() + + + +----------------------------------OCIBreak------------------------------------ + + +OCIBreak() +Name +OCI Break +Purpose +This call performs an immediate (asynchronous) abort of any currently +executing OCI function that is associated with a server . +Syntax +sword OCIBreak ( void *hndlp, + OCIError *errhp); +Comments +This call performs an immediate (asynchronous) abort of any currently +executing OCI function that is associated with a server. It is normally used +to stop a long-running OCI call being processed on the server. +This call can take either the service context handle or the server context +handle as a parameter to identify the function to be aborted. +Parameters +hndlp (IN) - the service context handle or the server context handle. +errhp (IN) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +Related Functions + +-----------------------------OCIConnectionPoolCreate -------------------------- +Name: +OCIConnectionPoolCreate + +Purpose: +Creates the connections in the pool + +Syntax: +OCIConnectionPoolCreate (OCIEnv *envhp, OCIError *errhp, OCICPool *poolhp, + OraText **poolName, sb4 *poolNameLen, + const Oratext *dblink, sb4 dblinkLen, + ub4 connMin, ub4 connMax, ub4 connIncr, + const OraText *poolUsername, sb4 poolUserLen, + const OraText *poolPassword, sb4 poolPassLen, + ub4 mode) +Comments: +This call is used to create a connection pool. conn_min connections +to the database are started on calling OCIConnectionPoolCreate. + +Parameters: +envhp (IN/OUT) - A pointer to the environment where the Conencton Pool + is to be created +errhp (IN/OUT) - An error handle which can be passed to OCIErrorGet(). +poolhp (IN/OUT) - An uninitialiazed pool handle. +poolName (OUT) - The connection pool name. +poolNameLen (OUT) - The length of the connection pool name +dblink (IN/OUT) - Specifies the database(server) to connect. This will also + be used as the default pool name. +dblinkLen (IN) - The length of the string pointed to by dblink. +connMin (IN) - Specifies the minimum number of connections in the + Connection Pool at any instant. + connMin number of connections are started when + OCIConnectionPoolCreate() is called. +connMax (IN) - Specifies the maximum number of connections that can be + opened to the database. Once this value is reached, no + more connections are opened. +connIncr (IN) - Allows application to set the next increment for + connections to be opened to the database if the current + number of connections are less than conn_max. +poolUsername (IN/OUT) - Connection pooling requires an implicit proxy + session and this attribute provides a username + for that session. +poolUserLen (IN) - This represents the length of pool_username. +poolPassword (IN/OUT) - The password for the parameter pool_username passed + above. +poolPassLen (IN) - This represents the length of pool_password. + +mode (IN) - The modes supported are OCI_DEFAULT and +OCI_CPOOL_REINITIALIZE + +Related Functions +OCIConnectionPoolDestroy() + +--------------------------------------------------------------------------- + +----------------------------OCIConnectionPoolDestroy------------------------- +Name: +OCIConnectionPoolDestroy + +Purpose: +Terminates the connections in the pool + +Syntax: +OCIConnectionPoolDestroy (OCICPool *poolhp, OCIError *errhp, ub4 mode) + +Comments: +On calling OCIConnectionPoolDestroy, all the open connections in the pool +are closed and the pool is destroyed. + +Parameters: +poolhp (IN/OUT) - An initialiazed pool handle. +errhp (IN/OUT) - An error handle which can be passed to OCIErrorGet(). +mode (IN) - Currently, OCIConnectionPoolDestroy() will support only + the OCI_DEFAULT mode. + +Related Functions: +OCIConnectionPoolCreate() + +----------------------------------------------------------------------------- +----------------------------OCISessionPoolCreate----------------------------- +Name: +OCISessionPoolCreate + +Purpose: +Creates the sessions in the session pool. + +Syntax: +sword OCISessionPoolCreate (OCIEnv *envhp, OCIError *errhp, OCISpool *spoolhp, + OraText **poolName, ub4 *poolNameLen, + const OraText *connStr, ub4 connStrLen, + ub4 sessMin, ub4 sessMax, ub4 sessIncr, + OraText *userid, ub4 useridLen, + OraText *password, ub4 passwordLen, + ub4 mode) + +Comments: +When OCISessionPoolCreate is called, a session pool is initialized for +the associated environment and the database specified by the +connStr parameter. This pool is named uniquely and the name +is returned to the user in the poolname parameter. + +Parameters: +envhp (IN/OUT) - A pointer to the environment handle in which the session + pool needs to be created. +errhp (IN/OUT) - An error handle which can be passed to OCIErrorGet(). +spoolhp (IN/OUT) - A pointer to the session pool handle that is created. +poolName (OUT) - Session pool name returned to the user. +poolNameLen (OUT) - Length of the PoolName +connStr (IN) - The TNS alias of the database to connect to. +connStrLen (IN) - Length of the connStr. +sessMin (IN) - Specifies the minimum number of sessions in the Session Pool. + These are the number of sessions opened in the beginning, if + in Homogeneous mode. Else, the parameter is ignored. +sessMax (IN) - Specifies the maximum number of sessions in the Session Pool. + Once this value is reached, no more sessions are opened, + unless the OCI_ATTR_SPOOL_FORCEGET is set. +userid (IN) - Specifies the userid with which to start up the sessions. +useridLen (IN) - Length of userid. +password (IN) - Specifies the password for the corresponding userid. +passwordLen (IN) - Specifies the length of the password +mode(IN) - May be OCI_DEFAULT, OCI_SPC_SPOOL_REINITIALIZE, or + OCI_SPC_SPOOL_HOMOGENEOUS. + +Returns: +SUCCESS - If pool could be allocated and created successfully. +ERROR - If above conditions could not be met. + +Related Functions: +OCISessionPoolDestroy() +----------------------------------------------------------------------------- +-----------------------------OCISessionPoolDestroy--------------------------- +Name: +OCISessionPoolDestroy + +Purpose: +Terminates all the sessions in the session pool. + +Syntax: +sword OCISessionPoolDestroy (OCISPool *spoolhp, OCIError *errhp, ub4 mode) + +Comments: +spoolhp (IN/OUT) - The pool handle of the session pool to be destroyed. +errhp (IN/OUT) - An error handle which can be passed to OCIErrorGet(). +mode (IN) - Currently only OCI_DEFAULT mode is supported. + +Returns: +SUCCESS - All the sessions could be closed. +ERROR - If the above condition is not met. + +Related Functions: +OCISessionPoolCreate() +----------------------------------------------------------------------------- +-------------------------------OCISessionGet--------------------------------- +Name: +OCISessionGet + +Purpose: +Get a session. This could be from a session pool, connection pool or +a new standalone session. + +Syntax: +sword OCISessionGet(OCIenv *envhp, OCIError *errhp, OCISvcCtx **svchp, + OCIAuthInfo *authhp, + OraText *poolName, ub4 poolName_len, + const OraText *tagInfo, ub4 tagInfo_len, + OraText **retTagInfo, ub4 *retTagInfo_len, + boolean *found, + ub4 mode) + +Comments: +envhp (IN/OUT) - OCI environment handle. +errhp (IN/OUT) - OCI error handle to be passed to OCIErrorGet(). +svchp (IN/OUT) - Address of an OCI service context pointer. This will be + filled with a server and session handle, attached to the + pool. +authhp (IN/OUT) - OCI Authentication Information handle. +poolName (IN) - This indicates the session/connection pool to get the + session/connection from in the OCI_SPOOL/OCI_CPOOL mode. + In the OCI_DEFAULT mode it refers to the connect string. +poolName_len (IN) - length of poolName. +tagInfo (IN) - indicates the tag of the session that the user wants. If the + user wants a default session, he must specify a NULL here. + Only used for Session Pooling. +tagInfo_len (IN) - the length of tagInfo. +retTagInfo (OUT) - This indicates the type of session that is returned to + the user. Only used for Session Pooling. +retTagInfo_len (OUT) - the length of retTagInfo. +found (OUT) - set to true if the user gets a session he had requested, else + set to false. Only used for Session Pooling. +mode (IN) - The supported modes are OCI_DEFAULT, OCI_CRED_PROXY and + OCI_GET_SPOOL_MATCHANY, OCI_SPOOL and OCI_CPOOL. OCI_SPOOL and + OCI_CPOOL are mutually exclusive. + +Returns: +SUCCESS - if a session was successfully returned into svchp. +SUCCESS_WITH_INFO - if a session was successfully returned into svchp and the + total number of sessions > maxsessions. Only valid for + Session Pooling. +ERROR - If a session could not be retrieved. + +Related Functions: +OCISessionRelease() +----------------------------------------------------------------------------- +---------------------------OCISessionRelease--------------------------------- +Name: +OCISessionRelease + +Purpose: +Release the session. + +Syntax: +sword OCISessionRelease ( OCISvcCtx *svchp, OCIError *errhp, + OraText *tag, ub4 tag_len, + ub4 mode); + +Comments: +svchp (IN/OUT) - The service context associated with the session/connection. +errhp (IN/OUT) - OCI error handle to be passed to OCIErrorGet(). +tag (IN) - Only used for Session Pooling. + This parameter will be ignored unless mode OCI_RLS_SPOOL_RETAG is + specified. In this case, the session is labelled with this tag and + returned to the pool. If this is NULL, then the session is untagged. +tag_len (IN) - Length of the tag. This is ignored unless mode + OCI_RLS_SPOOL_RETAG is set. +mode (IN) - The supported modes are OCI_DEFAULT, OCI_RLS_SPOOL_DROPSESS, + OCI_RLS_SPOOL_RETAG. The last 2 are only valid for Session Pooling. + When OCI_RLS_SPOOL_DROPSESS is specified, the session + will be removed from the session pool. If OCI_RLS_SPOOL_RETAG + is set, the tag on the session will be altered. If this mode is + not set, the tag and tag_len parameters will be ignored. + +Returns: +ERROR - If the session could not be released successfully. +SUCCESS - In all other cases. + +Related Functions: +OCISessionGet(). +----------------------------------------------------------------------------- +------------------------------OCIDateTimeAssign -------------------------- +sword OCIDateTimeAssign(void *hndl, OCIError *err, const OCIDateTime *from, + OCIDateTime *to); +NAME: OCIDateTimeAssign - OCIDateTime Assignment +PARAMETERS: +hndl (IN) - Session/Env handle. +err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). +from (IN) - datetime to be assigned +to (OUT) - lhs of assignment +DESCRIPTION: + Performs date assignment. The type of the output will be same as that + of input + +------------------------------OCIDateTimeCheck---------------------------- +sword OCIDateTimeCheck(void *hndl, OCIError *err, const OCIDateTime *date, + ub4 *valid ); +NAME: OCIDateTimeCheck - OCIDateTime CHecK if the given date is valid +PARAMETERS: +hndl (IN) - Session/Env handle. +err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). +date (IN) - date to be checked +valid (OUT) - returns zero for a valid date, otherwise + the ORed combination of all error bits specified below: + Macro name Bit number Error + ---------- ---------- ----- + OCI_DATE_INVALID_DAY 0x1 Bad day + OCI_DATE_DAY_BELOW_VALID 0x2 Bad DAy Low/high bit (1=low) + OCI_DATE_INVALID_MONTH 0x4 Bad MOnth + OCI_DATE_MONTH_BELOW_VALID 0x8 Bad MOnth Low/high bit (1=low) + OCI_DATE_INVALID_YEAR 0x10 Bad YeaR + OCI_DATE_YEAR_BELOW_VALID 0x20 Bad YeaR Low/high bit (1=low) + OCI_DATE_INVALID_HOUR 0x40 Bad HouR + OCI_DATE_HOUR_BELOW_VALID 0x80 Bad HouR Low/high bit (1=low) + OCI_DATE_INVALID_MINUTE 0x100 Bad MiNute + OCI_DATE_MINUTE_BELOW_VALID 0x200 Bad MiNute Low/high bit (1=low) + OCI_DATE_INVALID_SECOND 0x400 Bad SeCond + OCI_DATE_SECOND_BELOW_VALID 0x800 bad second Low/high bit (1=low) + OCI_DATE_DAY_MISSING_FROM_1582 0x1000 Day is one of those "missing" + from 1582 + OCI_DATE_YEAR_ZERO 0x2000 Year may not equal zero + OCI_DATE_INVALID_TIMEZONE 0x4000 Bad Timezone + OCI_DATE_INVALID_FORMAT 0x8000 Bad date format input + + So, for example, if the date passed in was 2/0/1990 25:61:10 in + (month/day/year hours:minutes:seconds format), the error returned + would be OCI_DATE_INVALID_DAY | OCI_DATE_DAY_BELOW_VALID | + OCI_DATE_INVALID_HOUR | OCI_DATE_INVALID_MINUTE + +DESCRIPTION: + Check if the given date is valid. +RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + 'date' and 'valid' pointers are NULL pointers + +------------------------------- OCIDateTimeCompare---------------------------- +sword OCIDateTimeCompare(void *hndl, OCIError *err, const OCIDateTime *date1, + const OCIDateTime *date2, sword *result ); +NAME: OCIDateTimeCompare - OCIDateTime CoMPare dates +PARAMETERS: +hndl (IN) - Session/Env handle. +err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). +date1, date2 (IN) - dates to be compared +result (OUT) - comparison result, 0 if equal, -1 if date1 < date2, + 1 if date1 > date2 +DESCRIPTION: +The function OCIDateCompare compares two dates. It returns -1 if +date1 is smaller than date2, 0 if they are equal, and 1 if date1 is +greater than date2. +RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + invalid date + input dates are not mutually comparable + +------------------------------OCIDateTimeConvert---------------------- +sword OCIDateTimeConvert(void *hndl, OCIError *err, OCIDateTime *indate, + OCIDateTime *outdate); +NAME: OCIDateTimeConvert - Conversion between different DATETIME types +PARAMETERS: +hndl (IN) - Session/Env handle. +err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). +indate (IN) - pointer to input date +outdate (OUT) - pointer to output datetime +DESCRIPTION: Converts one datetime type to another. The result type is + the type of the 'outdate' descriptor. +RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + conversion not possible. + +---------------------------- OCIDateTimeFromText----------------------- +sword OCIDateTimeFromText(void *hndl, OCIError *err, const OraText *date_str, + size_t d_str_length, const OraText *fmt, ub1 fmt_length, + const OraText *lang_name, size_t lang_length, OCIDateTime *date ); +NAME: OCIDateTimeFromText - OCIDateTime convert String FROM Date +PARAMETERS: +hndl (IN) - Session/Env handle. If Session Handle is passed, the + conversion takes place in session NLS_LANGUAGE and + session NLS_CALENDAR, otherwise the default is used. +err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). +date_str (IN) - input string to be converted to Oracle date +d_str_length (IN) - size of the input string, if the length is -1 + then 'date_str' is treated as a null terminated string +fmt (IN) - conversion format; if 'fmt' is a null pointer, then + the string is expected to be in the default format for + the datetime type. +fmt_length (IN) - length of the 'fmt' parameter +lang_name (IN) - language in which the names and abbreviations of + days and months are specified, if null i.e. (OraText *)0, + the default language of session is used, +lang_length (IN) - length of the 'lang_name' parameter +date (OUT) - given string converted to date +DESCRIPTION: + Converts the given string to Oracle datetime type set in the + OCIDateTime descriptor according to the specified format. Refer to + "TO_DATE" conversion function described in "Oracle SQL Language + Reference Manual" for a description of format. +RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + invalid format + unknown language + invalid input string + +--------------------------- OCIDateTimeGetDate------------------------- +sword OCIDateTimeGetDate(void *hndl, OCIError *err, const OCIDateTime *date, + sb2 *year, ub1 *month, ub1 *day ); +NAME: OCIDateTimeGetDate - OCIDateTime Get Date (year, month, day) + portion of DATETIME. +PARAMETERS: +hndl (IN) - Session/Env handle. +err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). +datetime (IN) - Pointer to OCIDateTime +year (OUT) - year value +month (OUT) - month value +day (OUT) - day value + +--------------------------- OCIDateTimeGetTime ------------------------ +sword OCIDateTimeGetTime(void *hndl, OCIError *err, OCIDateTime *datetime, + ub1 *hour, ub1 *minute, ub1 *sec, ub4 *fsec); +NAME: OCIDateTimeGetTime - OCIDateTime Get Time (hour, min, second, + fractional second) of DATETIME. +PARAMETERS: +hndl (IN) - Session/Env handle. +err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). +datetime (IN) - Pointer to OCIDateTime +hour (OUT) - hour value +minute (OUT) - minute value +sec (OUT) - second value +fsec (OUT) - Fractional Second value + +--------------------------- OCIDateTimeGetTimeZoneOffset ---------------------- +sword OCIDateTimeGetTimeZoneOffset(void *hndl,OCIError *err,const + OCIDateTime *datetime,sb1 *hour,sb1 *minute); + +NAME: OCIDateTimeGetTimeZoneOffset - OCIDateTime Get TimeZone (hour, minute) + portion of DATETIME. +PARAMETERS: +hndl (IN) - Session/Env handle. +err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). +datetime (IN) - Pointer to OCIDateTime +hour (OUT) - TimeZone Hour value +minute (OUT) - TimeZone Minute value + +--------------------------- OCIDateTimeSysTimeStamp--------------------- +sword OCIDateTimeSysTimeStamp(void *hndl, OCIError *err, + OCIDateTime *sys_date ); + +NAME: OCIDateTimeSysTimeStamp - Returns system date/time as a TimeStamp with + timezone +PARAMETERS: +hndl (IN) - Session/Env handle. +err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). +sys_date (OUT) - Pointer to output timestamp + +DESCRIPTION: + Gets the system current date and time as a timestamp with timezone +RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + + +------------------------------OCIDateTimeIntervalAdd---------------------- +sword OCIDateTimeIntervalAdd(void *hndl, OCIError *err, OCIDateTime *datetime, + OCIInterval *inter, OCIDateTime *outdatetime); +NAME: OCIDateTimeIntervalAdd - Adds an interval to datetime +PARAMETERS: +hndl (IN) - Session/Env handle. +err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). +datetime (IN) - pointer to input datetime +inter (IN) - pointer to interval +outdatetime (IN) - pointer to output datetime. The output datetime + will be of same type as input datetime +DESCRIPTION: + Adds an interval to a datetime to produce a resulting datetime +RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if: + resulting date is before Jan 1, -4713 + resulting date is after Dec 31, 9999 + +------------------------------OCIDateTimeIntervalSub---------------------- +sword OCIDateTimeIntervalSub(void *hndl, OCIError *err, OCIDateTime *datetime, + OCIInterval *inter, OCIDateTime *outdatetime); +NAME: OCIDateTimeIntervalSub - Subtracts an interval from a datetime +PARAMETERS: +hndl (IN) - Session/Env handle. +err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). +datetime (IN) - pointer to input datetime +inter (IN) - pointer to interval +outdatetime (IN) - pointer to output datetime. The output datetime + will be of same type as input datetime +DESCRIPTION: + Subtracts an interval from a datetime and stores the result in a + datetime +RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if: + resulting date is before Jan 1, -4713 + resulting date is after Dec 31, 9999 + +--------------------------- OCIDateTimeConstruct------------------------- +sword OCIDateTimeConstruct(void *hndl,OCIError *err,OCIDateTime *datetime, + sb2 year,ub1 month,ub1 day,ub1 hour,ub1 min,ub1 sec,ub4 fsec, + OraText *timezone,size_t timezone_length); + +NAME: OCIDateTimeConstruct - Construct an OCIDateTime. Only the relevant + fields for the OCIDateTime descriptor types are used. +PARAMETERS: + hndl (IN) - Session/Env handle. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + datetime (IN) - Pointer to OCIDateTime + year (IN) - year value + month (IN) - month value + day (IN) - day value + hour (IN) - hour value + min (IN) - minute value + sec (IN) - second value + fsec (IN) - Fractional Second value + timezone (IN) - Timezone string + timezone_length(IN) - Length of timezone string + +DESCRIPTION: + Constructs a DateTime descriptor. The type of the datetime is the + type of the OCIDateTime descriptor. Only the relevant fields based + on the type are used. For Types with timezone, the date and time + fields are assumed to be in the local time of the specified timezone. + If timezone is not specified, then session default timezone is + assumed. +RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_ERROR if datetime is not valid. + +------------------------------OCIDateTimeSubtract----------------------- +sword OCIDateTimeSubtract(void *hndl, OCIError *err, OCIDateTime *indate1, + OCIDateTime *indate2, OCIInterval *inter); +NAME: OCIDateTimeSubtract - subtracts two datetimes to return an interval +PARAMETERS: +hndl (IN) - Session/Env handle. +err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). +indate1(IN) - pointer to subtrahend +indate2(IN) - pointer to minuend +inter (OUT) - pointer to output interval +DESCRIPTION: + Takes two datetimes as input and stores their difference in an + interval. The type of the interval is the type of the 'inter' + descriptor. +RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + datetimes are not comparable. + +--------------------------- OCIDateTimeToText-------------------------- +sword OCIDateTimeToText(void *hndl, OCIError *err, const OCIDateTime *date, + const OraText *fmt, ub1 fmt_length, ub1 fsprec, + const OraText *lang_name, size_t lang_length, + ub4 *buf_size, OraText *buf ); +NAME: OCIDateTimeToText - OCIDateTime convert date TO String +PARAMETERS: +hndl (IN) - Session/Env handle. If Session Handle is passed, the + conversion takes place in session NLS_LANGUAGE and + session NLS_CALENDAR, otherwise the default is used. +err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). +date (IN) - Oracle datetime to be converted +fmt (IN) - conversion format, if null string pointer (OraText*)0, then + the date is converted to a character string in the + default format for that type. +fmt_length (IN) - length of the 'fmt' parameter +fsprec (IN) - specifies the fractional second precision in which the + fractional seconds is returned. +lang_name (IN) - specifies the language in which the names and + abbreviations of months and days are returned; + default language of session is used if 'lang_name' + is null i.e. (OraText *)0 +lang_length (IN) - length of the 'nls_params' parameter +buf_size (IN/OUT) - size of the buffer; size of the resulting string + is returned via this parameter +buf (OUT) - buffer into which the converted string is placed +DESCRIPTION: + Converts the given date to a string according to the specified format. + Refer to "TO_DATE" conversion function described in + "Oracle SQL Language Reference Manual" for a description of format + and NLS arguments. The converted null-terminated date string is + stored in the buffer 'buf'. +RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + buffer too small + invalid format + unknown language + overflow error + +----------------------------OCIDateTimeGetTimeZoneName------------------------ +sword OCIDateTimeGetTimeZoneName(void *hndl, + OCIError *err, + const OCIDateTime *datetime, + ub1 *buf, + ub4 *buflen); +NAME OCIDateTimeGetTimeZoneName - OCI DateTime Get the Time Zone Name +PARAMETERS: +hndl (IN) - Session/Env handle. +err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). +datetime (IN) - Pointer to an OCIDateTime. +buf (OUT) - User allocated storage for name string. +buflen (IN/OUT) - length of buf on input, length of name on out +DESCRIPTION: + Returns either the timezone region name or the absolute hour and minute + offset. If the DateTime was created with a region id then the region + name will be returned in the buf. If the region id is zero, then the + hour and minute offset is returned as "[-]HH:MM". +RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + buffer too small + error retrieving timezone data + invalid region + invalid LdiDateTime type + +---------------------------------OCIDateTimeToArray---------------------------- +sword OCIDateTimeToArray(void *hndl, + OCIError *err, + const OCIDateTime *datetime, + const OCIInterval *reftz, + ub1 *outarray, + ub4 *len + ub1 *fsprec); +NAME OCIDateTimeToArray - OCI DateTime convert To Array format +PARAMETERS: +hndl (IN) - Session/Env handle. +err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). +datetime (IN) - Pointer to OCIDateTime to be converted. +outarray (OUT) - Result array storage +len (OUT) - pointer to length of outarray. +fsprec (IN) - Number of fractional seconds digits. +DESCRIPTION: + Returns an array representing the input DateTime descriptor. +RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + buffer too small + error retrieving timezone data + invalid region + invalid LdiDateTime type + +--------------------------------OCIDateTimeFromArray--------------------------- +sword OCIDateTimeFromArray(void *hndl, + OCIError *err, + ub1 *inarray, + ub4 len + ub1 type + OCIDateTime *datetime, + OCIInterval *reftz, + ub1 fsprec); +NAME OCIDateTimeFromArray - OCI DateTime convert From Array format +PARAMETERS: +hndl (IN) - Session/Env handle. +err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). +inarray (IN) - Pointer to input array representtion of DateTime +len (IN) - len of inarray. +type (IN) - One of SQLT_DATE, SQLT_TIME, SQLT_TIME_TZ, SQLT_TIMESTAMP, + SQLT_TIMESTAMP_TZ, or SQLT_TIMESTAMP_LTZ. +datetime (OUT) - Pointer to the result OCIDateTime. +reftz (IN) - timezone interval used with SQLT_TIMESTAMP_LTZ. +fsprec (IN) - fractionl seconds digits of precision (0-9). +DESCRIPTION: + Returns a pointer to an OCIDateTime of type type converted from + the inarray. +RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + buffer too small + error retrieving timezone data + invalid region + invalid LdiDateTime type + +----------------------------------OCIRowidToChar----------------------------- +Name +OCIRowidToChar + +Purpose +Converts physical/logical (universal) ROWID to chracter extended (Base 64) +representation into user provided buffer outbfp of length outbflp. After +execution outbflp contains amount of bytes converted.In case of truncation +error, outbflp contains required size to make this conversion successful +and returns ORA-1405. + +Syntax +sword OCIRowidToChar( OCIRowid *rowidDesc, + OraText *outbfp, + ub2 *outbflp, + OCIError *errhp) + +Comments +After this conversion, ROWID in character format can be bound using +OCIBindByPos or OCIBindByName call and used to query a row at a +desired ROWID. + +Parameters +rowidDesc (IN) - rowid DESCriptor which is allocated from OCIDescritorAlloc + and populated by a prior SQL statement execution +outbfp (OUT) - pointer to the buffer where converted rowid in character + representation is stored after successful execution. +outbflp (IN/OUT) - pointer to output buffer length variable. + Before execution (IN mode) *outbflp contains the size of + outbfp, after execution (OUT mode) *outbflp contains amount + of bytes converted. In an event of truncation during + conversion *outbflp contains the required length to make + conversion successful. +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for + diagnostic information in the event of an error. + +------------------------------OCIDefineArrayOfStruct-------------------------- + + +OCIDefineArrayOfStruct() +Name +OCI Define for Array of Structures +Purpose +This call specifies additional attributes necessary for a static array define. +Syntax +sword OCIDefineArrayOfStruct ( OCIDefine *defnp, + OCIError *errhp, + ub4 pvskip, + ub4 indskip, + ub4 rlskip, + ub4 rcskip ); +Comments +This call specifies additional attributes necessary for an array define, +used in an array of structures (multi-row, multi-column) fetch. +For more information about skip parameters, see the section "Skip Parameters" +on page 4-17. +Parameters +defnp (IN) - the handle to the define structure which was returned by a call +to OCIDefineByPos(). +errhp (IN) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +pvskip (IN) - skip parameter for the next data value. +indskip (IN) - skip parameter for the next indicator location. +rlskip (IN) - skip parameter for the next return length value. +rcskip (IN) - skip parameter for the next return code. +Related Functions +OCIAttrGet() + + + + + +OCIDefineByPos() +Name +OCI Define By Position +Purpose +Associates an item in a select-list with the type and output data buffer. +Syntax +sb4 OCIDefineByPos ( + OCIStmt *stmtp, + OCIDefine **defnp, + OCIError *errhp, + ub4 position, + void *valuep, + sb4 value_sz, + ub2 dty, + void *indp, + ub2 *rlenp, + ub2 *rcodep, + ub4 mode ); +Comments +This call defines an output buffer which will receive data retreived from +Oracle. The define is a local step which is necessary when a SELECT statement +returns data to your OCI application. +This call also implicitly allocates the define handle for the select-list item. +Defining attributes of a column for a fetch is done in one or more calls. The +first call is to OCIDefineByPos(), which defines the minimal attributes +required to specify the fetch. +This call takes as a parameter a define handle, which must have been +previously allocated with a call to OCIHandleAlloc(). +Following the call to OCIDefineByPos() additional define calls may be +necessary for certain data types or fetch modes: +A call to OCIDefineArrayOfStruct() is necessary to set up skip parameters +for an array fetch of multiple columns. +A call to OCIDefineObject() is necessary to set up the appropriate +attributes of a named data type fetch. In this case the data buffer pointer +in ocidefn() is ignored. +Both OCIDefineArrayOfStruct() and OCIDefineObject() must be called +after ocidefn() in order to fetch multiple rows with a column of named +data types. +For a LOB define, the buffer pointer must be a lob locator of type +OCILobLocator , allocated by the OCIDescAlloc() call. LOB locators, and not +LOB values, are always returned for a LOB column. LOB values can then be +fetched using OCI LOB calls on the fetched locator. +For NCHAR (fixed and varying length), the buffer pointer must point to an +array of bytes sufficient for holding the required NCHAR characters. +Nested table columns are defined and fetched like any other named data type. +If the mode parameter is this call is set to OCI_DYNAMIC_FETCH, the client +application can fetch data dynamically at runtime. +Runtime data can be provided in one of two ways: +callbacks using a user-defined function which must be registered with a +subsequent call to OCIDefineDynamic(). When the client library needs a +buffer to return the fetched data, the callback will be invoked and the +runtime buffers provided will return a piece or the whole data. +a polling mechanism using calls supplied by the OCI. This mode is +assumed if no callbacks are defined. In this case, the fetch call returns the +OCI_NEED_DATA error code, and a piecewise polling method is used +to provide the data. +Related Functions: For more information about using the +OCI_DYNAMIC_FETCH mode, see the section "Runtime Data +Allocation and Piecewise Operations" on page 5-16 of Volume 1.. +For more information about the define step, see the section "Defining" +on page 2-30. +Parameters +stmtp (IN) - a handle to the requested SQL query operation. +defnp (IN/OUT) - a pointer to a pointer to a define handle which is implicitly +allocated by this call. This handle is used to store the define information +for this column. +errhp (IN) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +position (IN) - the position of this value in the select list. Positions are +1-based and are numbered from left to right. For example, in the SELECT +statement +SELECT empno, ssn, mgrno FROM employees; +empno is at position 1, ssn is at position 2, and mgrno is at position 3. +valuep (IN/OUT) - a pointer to a buffer or an array of buffers of the type +specified in the dty parameter. A number of buffers can be specified when +results for more than one row are desired in a single fetch call. +value_sz (IN) - the size of each valuep buffer in bytes. If the data is stored +internally in VARCHAR2 format, the number of characters desired, if different +from the buffer size in bytes, may be additionally specified by the using +OCIAttrSet(). +In an NLS conversion environment, a truncation error will be generated if the +number of bytes specified is insufficient to handle the number of characters +desired. +dty (IN) - the data type. Named data type (SQLT_NTY) and REF (SQLT_REF) +are valid only if the environment has been intialized with in object mode. +indp - pointer to an indicator variable or array. For scalar data types, +pointer to sb2 or an array of sb2s. Ignored for named data types. For named +data types, a pointer to a named data type indicator structure or an array of +named data type indicator structures is associated by a subsequent +OCIDefineObject() call. +See the section "Indicator Variables" on page 2-43 for more information about +indicator variables. +rlenp (IN/OUT) - pointer to array of length of data fetched. Each element in +rlenp is the length of the data in the corresponding element in the row after +the fetch. +rcodep (OUT) - pointer to array of column-level return codes +mode (IN) - the valid modes are: +OCI_DEFAULT. This is the default mode. +OCI_DYNAMIC_FETCH. For applications requiring dynamically +allocated data at the time of fetch, this mode must be used. The user may +additionally call OCIDefineDynamic() to set up a callback function that +will be invoked to receive the dynamically allocated buffers and to set +up the memory allocate/free callbacks and the context for the callbacks. +valuep and value_sz are ignored in this mode. +Related Functions +OCIDefineArrayOfStruct(), OCIDefineDynamic(), OCIDefineObject() + + + + +OCIDefineDynamic() +Name +OCI Define Dynamic Fetch Attributes +Purpose +This call is used to set the additional attributes required if the +OCI_DYNAMIC_FETCH mode was selected in OCIDefineByPos(). +Syntax +sword OCIDefineDynamic( OCIDefine *defnp, + OCIError *errhp, + void *octxp, + OCICallbackDefine (ocbfp)( + void *octxp, + OCIDefine *defnp, + ub4 iter, + void **bufpp, + ub4 **alenpp, + ub1 *piecep, + void **indpp, + ub2 **rcodep) ); +Comments +This call is used to set the additional attributes required if the +OCI_DYNAMIC_FETCH mode has been selected in a call to +OCIDefineByPos(). +When the OCI_DYNAMIC_FETCH mode is selected, buffers will be +dynamically allocated for REF, and named data type, values to receive the +data. The pointers to these buffers will be returned. +If OCI_DYNAMIC_FETCH mode was selected, and the call to +OCIDefineDynamic() is skipped, then the application can fetch data piecewise +using OCI calls. +For more information about OCI_DYNAMIC_FETCH mode, see the section +"Runtime Data Allocation and Piecewise Operations" on page 5-16. +Parameters +defnp (IN/OUT) - the handle to a define structure returned by a call to +OCIDefineByPos(). +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +octxp (IN) - points to a context for the callback function. +ocbfp (IN) - points to a callback function. This is invoked at runtime to get +a pointer to the buffer into which the fetched data or a piece of it will be +retreived. The callback also specifies the indicator, the return code and the +lengths of the data piece and indicator. The callback has the following +parameters: +octxp (IN) - a context pointer passed as an argument to all the callback +functions. +defnp (IN) - the define handle. +iter (IN) - which row of this current fetch. +bufpp (OUT) - returns a pointer to a buffer to store the column value, ie. +*bufp points to some appropriate storage for the column value. +alenpp (OUT) - returns a pointer to the length of the buffer. *alenpp +contains the size of the buffer after return from callback. Gets set to +actual data size after fetch. +piecep (IN/OUT) - returns a piece value, as follows: +The IN value can be OCI_ONE_PIECE, OCI_FIRST_PIECE or +OCI_NEXT_PIECE. +The OUT value can be OCI_ONE_PIECE if the IN value was +OCI_ONE_PIECE. +The OUT value can be OCI_ONE_PIECE or OCI_FIRST_PIECE if +the IN value was OCI_FIRST_PIECE. +The OUT value can only be OCI_NEXT_PIECE or +OCI_LAST_PIECE if the IN value was OCI_NEXT_PIECE. +indpp (IN) - indicator variable pointer +rcodep (IN) - return code variable pointer +Related Functions +OCIAttrGet() +OCIDefineObject() + + + + +OCIDefineObject() +Name +OCI Define Named Data Type attributes +Purpose +Sets up additional attributes necessary for a Named Data Type define. +Syntax +sword OCIDefineObject ( OCIDefine *defnp, + OCIError *errhp, + const OCIType *type, + void **pgvpp, + ub4 *pvszsp, + void **indpp, + ub4 *indszp ); +Comments +This call sets up additional attributes necessary for a Named Data Type define. +An error will be returned if this function is called when the OCI environment +has been initialized in non-Object mode. +This call takes as a paramter a type descriptor object (TDO) of datatype +OCIType for the named data type being defined. The TDO can be retrieved +with a call to OCITypeByName(). +See the description of OCIInitialize() on page 13 - 43 for more information +about initializing the OCI process environment. +Parameters +defnp (IN/OUT) - a define handle previously allocated in a call to +OCIDefineByPos(). +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +type (IN, optional) - points to the Type Descriptor Object (TDO) which +describes the type of the program variable. Only used for program variables +of type SQLT_NTY. This parameter is optional, and may be passed as NULL +if it is not being used. +pgvpp (IN/OUT) - points to a pointer to a program variable buffer. For an +array, pgvpp points to an array of pointers. Memory for the fetched named data +type instance(s) is dynamically allocated in the object cache. At the end of +the fetch when all the values have been received, pgvpp points to the +pointer(s) to these newly allocated named data type instance(s). The +application must call OCIObjectMarkDel() to deallocate the named data type +instance(s) when they are no longer needed. +pvszsp (IN/OUT) - points to the size of the program variable. For an array, it +is an array of ub4s. On return points to the size(s) of unpickled fetched +values. +indpp (IN/OUT) - points to a pointer to the program variable buffer +containing the parallel indicator structure. For an array, points to an array +of pointers. Memory is allocated to store the indicator structures in the +object cache. At the end of the fetch when all values have been received, +indpp points to the pointer(s) to these newly allocated indicator structure(s). +indszp (IN/OUT) - points to the size(s) of the indicator structure program +variable. For an array, it is an array of ub4s. On return points to the size(s) +of the unpickled fetched indicator values. +Related Functions +OCIAttrGet() + + + +OCIDescAlloc() +Name +OCI Get DESCriptor or lob locator +Purpose +Allocates storage to hold certain data types. The descriptors can be used as +bind or define variables. +Syntax +sword OCIDescAlloc ( const void *parenth, + void **descpp, + ub4 type, + size_t xtramem_sz, + void **usrmempp); +Comments +Returns a pointer to an allocated and initialized structure, corresponding to +the type specified in type. A non-NULL descriptor or LOB locator is returned +on success. No diagnostics are available on error. +This call returns OCI_SUCCESS if successful, or OCI_INVALID_HANDLE if +an out-of-memory error occurs. +Parameters +parenth (IN) - an environment handle. +descpp (OUT) - returns a descriptor or LOB locator of desired type. +type (IN) - specifies the type of descriptor or LOB locator to be allocated. +The specific types are: +OCI_DTYPE_SNAP - specifies generation of snapshot descriptor of C +type - OCISnapshot +OCI_DTYPE_LOB - specifies generation of a LOB data type locator of C +type - OCILobLocator +OCI_DTYPE_RSET - specifies generation of a descriptor of C type +OCIResult that references a result set (a number of rows as a result of a +query). This descriptor is bound to a bind variable of data type +SQLT_RSET (result set). The descriptor has to be converted into a +statement handle using a function - OCIResultSetToStmt() - which can +then be passed to OCIDefineByPos() and OCIStmtFetch() to retrieve the +rows of the result set. +OCI_DTYPE_ROWID - specifies generation of a ROWID descriptor of C +type OCIRowid. +OCI_DTYPE_COMPLEXOBJECTCOMP - specifies generation of a +complex object retrieval descriptor of C type +OCIComplexObjectComp. +xtramemsz (IN) - specifies an amount of user memory to be allocated for use +by the application. +usrmempp (OUT) - returns a pointer to the user memory of size xtramemsz +allocated by the call for the user. +Related Functions +OCIDescFree() + + + + +OCIDescFree() +Name +OCI Free DESCriptor +Purpose +Deallocates a previously allocated descriptor. +Syntax +sword OCIDescFree ( void *descp, + ub4 type); +Comments +This call frees up storage associated with the descriptor, corresponding to the +type specified in type. Returns OCI_SUCCESS or OCI_INVALID_HANDLE. +All descriptors must be explicitly deallocated. OCI will not deallocate a +descriptor if the environment handle is deallocated. +Parameters +descp (IN) - an allocated descriptor. +type (IN) - specifies the type of storage to be freed. The specific types are: +OCI_DTYPE_SNAP - snapshot descriptor +OCI_DTYPE_LOB - a LOB data type descriptor +OCI_DTYPE_RSET - a descriptor that references a result set (a number +of rows as a result of a query). +OCI_DTYPE_ROWID - a ROWID descriptor +OCI_DTYPE_COMPLEXOBJECTCOMP - a complex object retrieval +descriptor +Related Functions +OCIDescAlloc() + + + +OCIDescribeAny() +Name +OCI DeSCribe Any +Purpose +Describes existing schema objects. +Syntax +sword OCIDescribeAny ( OCISvcCtx *svchp, + OCIError *errhp, + void *objptr, + ub4 objnm_len, + ub1 objptr_typ, + ub1 info_level, + ub1 objtype, + OCIDesc *dschp ); +Comments +This is a generic describe call that describes existing schema objects: tables, +views, synonyms, procedures, functions, packages, sequences, and types. As a +result of this call, the describe handle is populated with the object-specific +attributes which can be obtained through an OCIAttrGet() call. +An OCIParamGet() on the describe handle returns a parameter descriptor for a +specified position. Parameter positions begin with 1. Calling OCIAttrGet() on +the parameter descriptor returns the specific attributes of a stored procedure +or function parameter or a table column descriptor as the case may be. +These subsequent calls do not need an extra round trip to the server because +the entire schema object description cached on the client side by +OCIDescribeAny(). Calling OCIAttrGet() on the describe handle can also return +the total number of positions. +See the section "Describing" on page 2-33 for more information about describe +operations. +Parameters +TO BE UPDATED +svchp (IN/OUT) - a service context handle. +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +objptr (IN) - the name of the object (a null-terminated string) to be +described. Only procedure or function names are valid when connected to an +Oracle7 Server. +objptr_len (IN) - the length of the string. Must be non-zero. +objptr_typ (IN) - Must be OCI_OTYPE_NAME, OCI_OTYPE_REF, or OCI_OTYPE_PTR. +info_level (IN) - reserved for future extensions. Pass OCI_DEFAULT. +objtype (IN/OUT) - object type. +dschp (IN/OUT) - a describe handle that is populated with describe +information about the object after the call. +Related Functions +OCIAttrGet() + + + +OCIEnvCreate() +Name +OCI ENVironment CREATE +Purpose +This function creates and initializes an environment for the rest of +the OCI functions to work under. This call is a replacement for both +the OCIInitialize and OCIEnvInit calls. +Syntax +sword OCIEnvCreate ( OCIEnv **envhpp, + ub4 mode, + const void *ctxp, + const void *(*malocfp) + (void *ctxp, + size_t size), + const void *(*ralocfp) + (void *ctxp, + void *memptr, + size_t newsize), + const void (*mfreefp) + ( void *ctxp, + void *memptr)) + size_t xtramemsz, + void **usrmempp ); + +Comments +This call creates an environment for all the OCI calls using the modes +specified by the user. This call can be used instead of the two calls +OCIInitialize and OCIEnvInit. This function returns an environment handle +which is then used by the remaining OCI functions. There can be multiple +environments in OCI each with its own environment modes. This function +also performs any process level initialization if required by any mode. +For example if the user wants to initialize an environment as OCI_THREADED, +then all libraries that are used by OCI are also initialized in the +threaded mode. + +This call should be invoked before anny other OCI call and should be used +instead of the OCIInitialize and OCIEnvInit calls. This is the recommended +call, although OCIInitialize and OCIEnvInit calls will still be supported +for backward compatibility. + +envpp (OUT) - a pointer to a handle to the environment. +mode (IN) - specifies initialization of the mode. The valid modes are: +OCI_DEFAULT - default mode. +OCI_THREADED - threaded environment. In this mode, internal data +structures are protected from concurrent accesses by multiple threads. +OCI_OBJECT - will use navigational object interface. +ctxp (IN) - user defined context for the memory call back routines. +malocfp (IN) - user-defined memory allocation function. If mode is +OCI_THREADED, this memory allocation routine must be thread safe. +ctxp - context pointer for the user-defined memory allocation function. +size - size of memory to be allocated by the user-defined memory +allocation function +ralocfp (IN) - user-defined memory re-allocation function. If mode is +OCI_THREADED, this memory allocation routine must be thread safe. +ctxp - context pointer for the user-defined memory reallocation +function. +memp - pointer to memory block +newsize - new size of memory to be allocated +mfreefp (IN) - user-defined memory free function. If mode is +OCI_THREADED, this memory free routine must be thread safe. +ctxp - context pointer for the user-defined memory free function. +memptr - pointer to memory to be freed +xtramemsz (IN) - specifies the amount of user memory to be allocated. +usrmempp (OUT) - returns a pointer to the user memory of size xtramemsz +allocated by the call for the user. + +Example + +Related Functions +OCIInitialize, OCIEnvInit + +OCIEnvNlsCreate() +Name +OCI ENVironment CREATE with NLS info +Purpose +This function does almost everything OCIEnvCreate does, plus enabling setting +of charset and ncharset programmatically, except OCI_UTF16 mode. +Syntax +sword OCIEnvNlsCreate(OCIEnv **envhpp, + ub4 mode, + void *ctxp, + void *(*malocfp) + (void *ctxp, + size_t size), + void *(*ralocfp) + (void *ctxp, + void *memptr, + size_t newsize), + void (*mfreefp) + (void *ctxp, + void *memptr), + size_t xtramemsz, + void **usrmempp, + ub2 charset, + ub2 ncharset) +Comments +The charset and ncharset must be both zero or non-zero. +The parameters have the same meaning as the ones in OCIEnvCreate(). +When charset or ncharset is non-zero, the corresponding character set will +be used to replace the ones specified in NLS_LANG or NLS_NCHAR. Moreover, +OCI_UTF16ID is allowed to be set as charset and ncharset. +On the other hand, OCI_UTF16 mode is deprecated with this function. +Applications can achieve the same effects by setting +both charset and ncharset as OCI_UTF16ID. + + +OCIEnvInit() +Name +OCI INITialize environment +Purpose +This call initializes the OCI environment handle. +Syntax +sword OCIEnvInit ( OCIEnv **envp, + ub4 mode, + size_t xtramemsz, + void **usrmempp ); +Comments +Initializes the OCI environment handle. No changes are done on an initialized +handle. If OCI_ERROR or OCI_SUCCESS_WITH_INFO is returned, the +environment handle can be used to obtain ORACLE specific errors and +diagnostics. +This call is processed locally, without a server round-trip. +Parameters +envpp (OUT) - a pointer to a handle to the environment. +mode (IN) - specifies initialization of an environment mode. The only valid +mode is OCI_DEFAULT for default mode +xtramemsz (IN) - specifies the amount of user memory to be allocated. +usrmempp (OUT) - returns a pointer to the user memory of size xtramemsz +allocated by the call for the user. +Example +See the description of OCISessionBegin() on page 13-84 for an example showing +the use of OCIEnvInit(). +Related Functions + + + + +OCIErrorGet() +Name +OCI Get Diagnostic Record +Purpose +Returns an error message in the buffer provided and an ORACLE error. +Syntax +sword OCIErrorGet ( void *hndlp, + ub4 recordno, + OraText *sqlstate, + ub4 *errcodep, + OraText *bufp, + ub4 bufsiz, + ub4 type ); +Comments +Returns an error message in the buffer provided and an ORACLE error. +Currently does not support SQL state. This call can be called a multiple +number of times if there are more than one diagnostic record for an error. +The error handle is originally allocated with a call to OCIHandleAlloc(). +Parameters +hndlp (IN) - the error handle, in most cases, or the environment handle (for +errors on OCIEnvInit(), OCIHandleAlloc()). +recordno (IN) - indicates the status record from which the application seeks +info. Starts from 1. +sqlstate (OUT) - Not supported in Version 8.0. +errcodep (OUT) - an ORACLE Error is returned. +bufp (OUT) - the error message text is returned. +bufsiz (IN) - the size of the buffer provide to get the error message. +type (IN) - the type of the handle. +Related Functions +OCIHandleAlloc() + +OCIExtractInit +Name +OCI Extract Initialize +Purpose +This function initializes the parameter manager. +Syntax +sword OCIExtractInit(void *hndl, OCIError *err); +Comments +It must be called before calling any other parameter manager routine. The NLS +information is stored inside the parameter manager context and used in +subsequent calls to OCIExtract routines. +Returns OCI_SUCCESS, OCI_INVALID_HANDLE, or OCI_ERROR +Parameters +hndl (IN/OUT) - The OCI environment or session handle. +err (IN/OUT) - The OCI error handle. If there is an error, it is recorded in + err and this function returns OCI_ERROR. Diagnostic information + can be obtained by calling OCIErrorGet(). +Related Functions +OCIExtractTerm() + +OCIExtractTerm +Name +OCI Extract Terminate +Purpose +This function releases all dynamically allocated storage and may perform +other internal bookkeeping functions. +Syntax +sword OCIExtractTerm(void *hndl, OCIError *err); +Comments +It must be called when the parameter manager is no longer being used. +Returns OCI_SUCCESS, OCI_INVALID_HANDLE, or OCI_ERROR +Parameters +hndl (IN/OUT) - The OCI environment or session handle. +err (IN/OUT) - The OCI error handle. If there is an error, it is recorded in + err and this function returns OCI_ERROR. Diagnostic information + can be obtained by calling OCIErrorGet(). +Related Functions +OCIExtractInit() + +OCIExtractReset +Name +OCI Extract Reset +Purpose +The memory currently used for parameter storage, key definition storage, and +parameter value lists is freed and the structure is reinitialized. +Syntax +sword OCIExtractReset(void *hndl, OCIError *err); +Comments +Returns OCI_SUCCESS, OCI_INVALID_HANDLE, or OCI_ERROR +Parameters +hndl (IN/OUT) - The OCI environment or session handle. +err (IN/OUT) - The OCI error handle. If there is an error, it is recorded in + err and this function returns OCI_ERROR. Diagnostic information + can be obtained by calling OCIErrorGet(). +Related Functions + +OCIExtractSetNumKeys +Name +OCI Extract Set Number of Keys +Purpose +Informs the parameter manager of the number of keys that will be registered. +Syntax +sword OCIExtractSetNumKeys(void *hndl, OCIError *err, uword numkeys); +Comments +This routine must be called prior to the first call of OCIExtractSetKey(). +Returns OCI_SUCCESS, OCI_INVALID_HANDLE, or OCI_ERROR +Parameters +hndl (IN/OUT) - The OCI environment or session handle. +err (IN/OUT) - The OCI error handle. If there is an error, it is recorded in + err and this function returns OCI_ERROR. Diagnostic information + can be obtained by calling OCIErrorGet(). +numkeys (IN) - The number of keys that will be registered with + OCIExtractSetKey(). +Related Functions +OCIExtractSetKey() + +OCIExtractSetKey +Name +OCI Extract Set Key definition +Purpose +Registers information about a key with the parameter manager. +Syntax +sword OCIExtractSetKey(void *hndl, OCIError *err, const OraText *name, + ub1 type, ub4 flag, const void *defval, + const sb4 *intrange, const OraText *const *strlist); +Comments +This routine must be called after calling OCIExtractSetKey() and before +calling OCIExtractFromFile() or OCIExtractFromStr(). +Returns OCI_SUCCESS, OCI_INVALID_HANDLE, or OCI_ERROR +Parameters +hndl (IN/OUT) - The OCI environment or session handle. +err (IN/OUT) - The OCI error handle. If there is an error, it is recorded in + err and this function returns OCI_ERROR. Diagnostic information + can be obtained by calling OCIErrorGet(). +name (IN) - The name of the key. +type (IN) - The type of the key (OCI_EXTRACT_TYPE_INTEGER, + OCI_EXTRACT_TYPE_OCINUM, OCI_EXTRACT_TYPE_STRING, or + OCI_EXTRACT_TYPE_BOOLEAN). +flag (IN) - Set to OCI_EXTRACT_MULTIPLE if the key can take multiple values + or 0 otherwise. +defval (IN) - Set to the default value for the key. May be NULL if there is + no default. A string default must be a (text*) type, an + integer default must be an (sb4*) type, and a boolean default + must be a (ub1*) type. +intrange (IN) - Starting and ending values for the allowable range of integer + values. May be NULL if the key is not an integer type or if + all integer values are acceptable. +strlist (IN) - List of all acceptable text strings for the key. May be NULL + if the key is not a string type or if all text values are + acceptable. +Related Functions +OCIExtractSetNumKeys() + +OCIExtractFromFile +Name +OCI Extract parameters From File +Purpose +The keys and their values in the given file are processed. +Syntax +sword OCIExtractFromFile(void *hndl, OCIError *err, ub4 flag, + OraText *filename); +Comments +Returns OCI_SUCCESS, OCI_INVALID_HANDLE, or OCI_ERROR +Parameters +hndl (IN/OUT) - The OCI environment or session handle. +err (IN/OUT) - The OCI error handle. If there is an error, it is recorded in + err and this function returns OCI_ERROR. Diagnostic information + can be obtained by calling OCIErrorGet(). +flag (IN) - Zero or has one or more of the following bits set: + OCI_EXTRACT_CASE_SENSITIVE, OCI_EXTRACT_UNIQUE_ABBREVS, or + OCI_EXTRACT_APPEND_VALUES. +filename (IN) - Null-terminated filename string. +Related Functions + +OCIExtractFromStr +Name +OCI Extract parameters From String +Purpose +The keys and their values in the given string are processed. +Syntax +sword OCIExtractFromStr(void *hndl, OCIError *err, ub4 flag, OraText *input); +Comments +Returns OCI_SUCCESS, OCI_INVALID_HANDLE, or OCI_ERROR +Parameters +hndl (IN/OUT) - The OCI environment or session handle. +err (IN/OUT) - The OCI error handle. If there is an error, it is recorded in + err and this function returns OCI_ERROR. Diagnostic information + can be obtained by calling OCIErrorGet(). +flag (IN) - Zero or has one or more of the following bits set: + OCI_EXTRACT_CASE_SENSITIVE, OCI_EXTRACT_UNIQUE_ABBREVS, or + OCI_EXTRACT_APPEND_VALUES. +input (IN) - Null-terminated input string. +Related Functions + +OCIExtractToInt +Name +OCI Extract To Integer +Purpose +Gets the integer value for the specified key. +Syntax +sword OCIExtractToInt(void *hndl, OCIError *err, OraText *keyname, + uword valno, sb4 *retval); +Comments +The valno'th value (starting with 0) is returned. +Returns OCI_SUCCESS, OCI_INVALID_HANDLE, OCI_NO_DATA, or OCI_ERROR. +OCI_NO_DATA means that there is no valno'th value for this key. +Parameters +hndl (IN) - The OCI environment or session handle. +err (IN/OUT) - The OCI error handle. If there is an error, it is recorded in + err and this function returns OCI_ERROR. Diagnostic information + can be obtained by calling OCIErrorGet(). +keyname (IN) - Key name. +valno (IN) - Which value to get for this key. +retval (OUT) - The actual integer value. +Related Functions + +OCIExtractToBool +Name +OCI Extract To Boolean +Purpose +Gets the boolean value for the specified key. +Syntax +sword OCIExtractToBool(void *hndl, OCIError *err, OraText *keyname, + uword valno, ub1 *retval); +Comments +The valno'th value (starting with 0) is returned. +Returns OCI_SUCCESS, OCI_INVALID_HANDLE, OCI_NO_DATA, or OCI_ERROR. +OCI_NO_DATA means that there is no valno'th value for this key. +Parameters +hndl (IN) - The OCI environment or session handle. +err (IN/OUT) - The OCI error handle. If there is an error, it is recorded in + err and this function returns OCI_ERROR. Diagnostic information + can be obtained by calling OCIErrorGet(). +keyname (IN) - Key name. +valno (IN) - Which value to get for this key. +retval (OUT) - The actual boolean value. +Related Functions + +OCIExtractToStr +Name +OCI Extract To String +Purpose +Gets the string value for the specified key. +Syntax +sword OCIExtractToStr(void *hndl, OCIError *err, OraText *keyname, + uword valno, OraText *retval, uword buflen); +Comments +The valno'th value (starting with 0) is returned. +Returns OCI_SUCCESS, OCI_INVALID_HANDLE, OCI_NO_DATA, or OCI_ERROR. +OCI_NO_DATA means that there is no valno'th value for this key. +Parameters +hndl (IN) - The OCI environment or session handle. +err (IN/OUT) - The OCI error handle. If there is an error, it is recorded in + err and this function returns OCI_ERROR. Diagnostic information + can be obtained by calling OCIErrorGet(). +keyname (IN) - Key name. +valno (IN) - Which value to get for this key. +retval (OUT) - The actual null-terminated string value. +buflen (IN) - The length of the buffer for retval. +Related Functions + +Note: The following OCIExtract functions are unavailable in this release + +OCIExtractToOCINum +Name +OCI Extract To OCI Number +Purpose +Gets the OCINumber value for the specified key. +Syntax +sword OCIExtractToOCINum(void *hndl, OCIError *err, OraText *keyname, + uword valno, OCINumber *retval); +Comments +The valno'th value (starting with 0) is returned. +Returns OCI_SUCCESS, OCI_INVALID_HANDLE, OCI_NO_DATA, or OCI_ERROR. +OCI_NO_DATA means that there is no valno'th value for this key. +Parameters +hndl (IN) - The OCI environment or session handle. +err (IN/OUT) - The OCI error handle. If there is an error, it is recorded in + err and this function returns OCI_ERROR. Diagnostic information + can be obtained by calling OCIErrorGet(). +keyname (IN) - Key name. +valno (IN) - Which value to get for this key. +retval (OUT) - The actual OCINumber value. +Related Functions + +OCIExtractToList +Name +OCI Extract To parameter List +Purpose +Generates a list of parameters from the parameter structures that are stored +in memory. +Syntax +sword OCIExtractToList(void *hndl, OCIError *err, uword *numkeys); +Comments +Must be called before OCIExtractValues() is called. +Returns OCI_SUCCESS, OCI_INVALID_HANDLE, or OCI_ERROR +Parameters +hndl (IN) - The OCI environment or session handle. +err (IN/OUT) - The OCI error handle. If there is an error, it is recorded in + err and this function returns OCI_ERROR. Diagnostic information + can be obtained by calling OCIErrorGet(). +numkeys (OUT) - Number of distinct keys stored in memory. +Related Functions +OCIExtractFromList() + +OCIExtractFromList +Name +OCI Extract From parameter List +Purpose +Generates a list of values for the a parameter in the parameter list. +Syntax +sword OCIExtractFromList(void *hndl, OCIError *err, uword index, + OraText *name, ub1 *type, uword *numvals, + void ***values); +Comments +Parameters are specified by an index. OCIExtractToList() must be called prior +to calling this routine to generate the parameter list from the parameter +structures that are stored in memory. +Returns OCI_SUCCESS, OCI_INVALID_HANDLE, or OCI_ERROR +Parameters +hndl (IN) - The OCI environment or session handle. +err (IN/OUT) - The OCI error handle. If there is an error, it is recorded in + err and this function returns OCI_ERROR. Diagnostic information + can be obtained by calling OCIErrorGet(). +name (OUT) - Name of the key for the current parameter. +type (OUT) - Type of the current parameter (OCI_EXTRACT_TYPE_STRING, + OCI_EXTRACT_TYPE_INTEGER, OCI_EXTRACT_TYPE_OCINUM, or + OCI_EXTRACT_TYPE_BOOLEAN) +numvals (OUT) - Number of values for this parameter. +values (OUT) - The values for this parameter. +Related Functions +OCIExtractToList() + + +************************ OCIFileClose() *********************************** + +Name + OCIFileClose - Oracle Call Interface FILE i/o CLOSE + +Purpose + Close a previously opened file. + +Syntax + sword OCIFileClose ( void *hndl, + OCIError *err, + OCIFileObject *filep ) + +Comments + This function will close a previously opened file. If the function succeeds + then OCI_SUCCESS will be returned, else OCI_ERROR. + +Parameters + hndl (IN) - the OCI environment or session handle. + err (OUT) - the OCI error handle + filep (IN) - the OCIFile file object + +Related Functions + OCIFileOpen. + + + +********************* OCIFileExists() ************************************** + +Name + OCIFileExists - Oracle Call Interface FILE i/o EXIST + +Purpose + Check to see if the file exists. + +Syntax + sword OCIFileExists ( void *hndl, + OCIError *err, + OraText *filename, + OraText *path, + ub1 *flag ) + +Comments + This function will set the flag to TRUE if the file exists else it will + be set to FALSE. + The function will return OCI_ERROR if any error is encountered, else + it will return OCI_ERROR. + +Parameters + hndl(IN) - OCI environment or session handle + err(OUT) - OCI error handle + filename(IN) - filename + path(IN) - path of the file + flag(OUT) - whether the file exists or not + +Related Functions. + None. + + + **************************** OCIFileFlush() ****************************** + + +Name + OCIFileFlush - Oracle Call Interface File i/o FLUSH + +Purpose + Flush the buffers associated with the file to the disk. + +Syntax + sword OCIFileFlush ( void *hndl, + OCIError *err, + OCIFileObject *filep ) + +Comments + The function will return OCI_ERROR if any error is encountered, else + it will return OCI_ERROR. + +Parameters + hndl (IN) - the OCI environment or session handle. + err (OUT) - the OCI error handle + filep (IN) - the OCIFile file object + +Related Functions + OCIFileOpen, OCIFileWrite + + + + *************************** OCIFileGetLength() **************************** + +Name + OCIFileGetLength - Oracle Call Interface FILE i/o GET file LENGTH + +Purpose + Get the length of a file. + +Syntax + OCIFileGetLength(void *hndl, + OCIError *err, + OraText *filename, + OraText *path, + ubig_ora *lenp ) + +Comments + The length of the file will be returned in lenp. + The function will return OCI_ERROR if any error is encountered, else + it will return OCI_ERROR. + +Parameters + hndl (IN) - the OCI environment or session handle. + err (OUT) - the OCI error handle. If there is an error, it is recorded + in err and this function returns OCI_ERROR. Diagnostic information can be + obtained by calling OCIErrorGet(). + filename (IN) - file name. + path (IN) - path of the file. + lenp (OUT) - On output, it is the length of the file in bytes. + is the number of bytes in the file. + +Related Functions + None. + + + +******************************** OCIFileInit() ***************************** + +Name + OCIFileInit - Oracle Call Interface FILE i/o INITialize + +Purpose + Initialize the OCI File I/O package and create the OCIFile context. + +Syntax + sword OCIFileInit ( void *hndl, + OCIError *err) + +Comments + This function should be called before any of the OCIFile functions are + used. + The function will return OCI_ERROR if any error is encountered, else + it will return OCI_ERROR. + +Parameters + hndl(IN) - OCI environment or session handle. + err(OUT) - OCI error structure. + +Related Functions + OCIFileTerm + + + +********************************* OCIFileOpen() ***************************** + +Name + OCIFileOpen - Oracle Call Interface File i/o OPEN + +Purpose + Open a file. + +Syntax + sword OCIFileOpen ( void *hndl, + OCIError *err, + OCIFileObject **filep, + OraText *filename, + OraText *path, + ub4 mode, + ub4 create, + ub4 type ) + +Comments + OCIFileOpen returns a handle to the open file in filep if the file is + successfully opened. + If one wants to use the standard file objects (stdin, stdout & stderr) + then OCIFileOpen whould be called with the type filed containing the + appropriate type (see the parameter type). If any of the standard files + are specified then filename, path, mode and create are ignored. + The function will return OCI_ERROR if any error is encountered, else + it will return OCI_ERROR. + +Parameters + hndl (OUT) - the OCI environment or session handle. + err (OUT) - the OCI error handle. If there is an error, it is recorded + in err and this function returns OCI_ERROR. Diagnostic information can be + obtained by calling OCIErrorGet(). + filep (OUT) - the file object to be returned. + filename (IN) - file name (NULL terminated string). + path (IN) - path of the file (NULL terminated string). + mode - mode in which to open the file (valid modes are OCI_FILE_READONLY, + OCI_FILE_WRITEONLY, OCI_FILE_READ_WRITE). + create - should the file be created if it does not exist. Valid values + are: + OCI_FILE_TRUNCATE - create a file regardless of whether or not it exists. + If the file already exists overwrite it. + OCI_FILE_EXIST - open it if it exists, else fail. + OCI_FILE_EXCL - fail if the file exists, else create. + OCI_FILE_CREATE - open the file if it exists, and create it if it doesn't. + OCI_FILE_APPEND - set the file pointer to the end of the file prior to + writing(this flag can be OR'ed with OCI_FILE_EXIST or + OCI_FILE_CREATE). +type - file type. Valid values are OCI_FILE_TEXT, OCI_FILE_BIN, + OCI_FILE_STDIN, OCI_FILE_STDOUT and OCI_FILE_STDERR. + If any of the standard files are specified then filename, path, mode + and create are ignored. + +Related Functions. + OCIFileClose + + + +************************** OCIFileRead() ************************************ + +Name + OCIFileRead - Oracle Call Interface FILE i/o READ + +Purpose + Read from a file into a buffer. + +Syntax + sword OCIFileRead ( void *hndl, + OCIError *err, + OCIFileObject *filep, + void *bufp, + ub4 bufl, + ub4 *bytesread ) + +Comments + Upto bufl bytes from the file will be read into bufp. The user should + allocate memory for the buffer. + The number of bytes read would be in bytesread. + The function will return OCI_ERROR if any error is encountered, else + it will return OCI_ERROR. + +Parameters + hndl (IN) - the OCI environment or session handle. + err (OUT) - the OCI error handle. If there is an error, it is recorded + in err and this function returns OCI_ERROR. Diagnostic information can be + obtained by calling OCIErrorGet(). + filep (IN/OUT) - a File Object that uniquely references the file. + bufp (IN) - the pointer to a buffer into which the data will be read. The + length of the allocated memory is assumed to be bufl. + bufl - the length of the buffer in bytes. + bytesread (OUT) - the number of bytes read. + +Related Functions + OCIFileOpen, OCIFileSeek, OCIFileWrite + + + +****************************** OCIFileSeek() ****************************** + +Name + OCIFileSeek - Oracle Call Interface FILE i/o SEEK + +Purpose + Perfom a seek to a byte position. + +Syntax + sword OCIFileSeek ( void *hndl, + OCIError *err, + OCIFileObject *filep, + uword origin, + ubig_ora offset, + sb1 dir) + +Comments + The function will return OCI_ERROR if any error is encountered, else + it will return OCI_ERROR. + +Parameters + hndl (IN) - the OCI environment or session handle. + err (OUT) - the OCI error handle. If there is an error, it is recorded + in err and this function returns OCI_ERROR. Diagnostic information can be + obtained by calling OCIErrorGet(). + filep (IN/OUT) - a file handle that uniquely references the file. + origin - The starting point we want to seek from. NOTE: The starting + point may be OCI_FILE_SEEK_BEGINNING (beginning), OCI_FILE_SEEK_CURRENT + (current position), or OCI_FILE_SEEK_END (end of file). + offset - The number of bytes from the origin we want to start reading from. + dir - The direction we want to go from the origin. NOTE: The direction + can be either OCI_FILE_FORWARD or OCI_FILE_BACKWARD. + +Related Function + OCIFileOpen, OCIFileRead, OCIFileWrite + + + +*************************** OCIFileTerm() ********************************** + +Name + OCIFileTerm - Oracle Call Interface FILE i/o TERMinate + +Purpose + Terminate the OCI File I/O package and destroy the OCI File context. + +Syntax + sword OCIFileTerm ( void *hndl, + OCIError *err ) + +Comments + After this function has been called no OCIFile function should be used. + The function will return OCI_ERROR if any error is encountered, else + it will return OCI_ERROR. + +Parameters + hndl(IN) - OCI environment or session handle. + err(OUT) - OCI error structure. + +Related Functions + OCIFileInit + + +********************************* OCIFileWrite() **************************** + +Name + OCIFileWrite - Oracle Call Interface FILE i/o WRITE + +Purpose + Write data from buffer into a file. + +Syntax + sword OCIFileWrite ( void *hndl, + OCIError *err, + OCIFileObject *filep, + void *bufp, + ub4 buflen + ub4 *byteswritten ) + +Comments + The number of bytes written will be in *byteswritten. + The function will return OCI_ERROR if any error is encountered, else + it will return OCI_ERROR. + +Parameters + hndl (IN) - the OCI environment or session handle. + err (OUT) - the OCI error handle. If there is an error, it is recorded + in err and this function returns OCI_ERROR. Diagnostic information can be + obtained by calling OCIErrorGet(). + filep (IN/OUT) - a file handle that uniquely references the file. + bufp (IN) - the pointer to a buffer from which the data will be written. + The length of the allocated memory is assumed to be the value passed + in bufl. + bufl - the length of the buffer in bytes. + byteswritten (OUT) - the number of bytes written. + +Related Functions + OCIFileOpen, OCIFileSeek, OCIFileRead + + + + + +OCIHandleAlloc() +Name +OCI Get HaNDLe +Purpose +This call returns a pointer to an allocated and initialized handle. +Syntax +sword OCIHandleAlloc ( const void *parenth, + void **hndlpp, + ub4 type, + size_t xtramem_sz, + void **usrmempp); +Comments +Returns a pointer to an allocated and initialized structure, corresponding to +the type specified in type. A non-NULL handle is returned on success. Bind +handle and define handles are allocated with respect to a statement handle. All +other handles are allocated with respect to an environment handle which is +passed in as a parent handle. +No diagnostics are available on error. This call returns OCI_SUCCESS if +successful, or OCI_INVALID_HANDLE if an out-of-memory error occurs. +Handles must be allocated using OCIHandleAlloc() before they can be passed +into an OCI call. +Parameters +parenth (IN) - an environment or a statement handle. +hndlpp (OUT) - returns a handle to a handle type. +type (IN) - specifies the type of handle to be allocated. The specific types +are: +OCI_HTYPE_ERROR - specifies generation of an error report handle of +C type OCIError +OCI_HTYPE_SVCCTX - specifies generation of a service context handle +of C type OCISvcCtx +OCI_HTYPE_STMT - specifies generation of a statement (application +request) handle of C type OCIStmt +OCI_HTYPE_BIND - specifies generation of a bind information handle +of C type OCIBind +OCI_HTYPE_DEFINE - specifies generation of a column definition +handle of C type OCIDefine +OCI_HTYPE_DESCRIBE - specifies generation of a select list +description handle of C type OCIDesc +OCI_HTYPE_SERVER - specifies generation of a server context handle +of C type OCIServer +OCI_HTYPE_SESSION - specifies generation of an authentication +context handle of C type OCISession +OCI_HTYPE_TRANS - specifies generation of a transaction context +handle of C type OCITrans +OCI_HTYPE_COMPLEXOBJECT - specifies generation of a complex +object retrieval handle of C type OCIComplexObject +OCI_HTYPE_SECURITY - specifies generation of a security handle of C +type OCISecurity +xtramem_sz (IN) - specifies an amount of user memory to be allocated. +usrmempp (OUT) - returns a pointer to the user memory of size xtramemsz +allocated by the call for the user. +Related Functions +OCIHandleFree() + + + +OCIHandleFree() +Name +OCI Free HaNDLe +Purpose +This call explicitly deallocates a handle. +Syntax +sword OCIHandleFree ( void *hndlp, + ub4 type); +Comments +This call frees up storage associated with a handle, corresponding to the type +specified in the type parameter. +This call returns either OCI_SUCCESS or OCI_INVALID_HANDLE. +All handles must be explicitly deallocated. OCI will not deallocate a child +handle if the parent is deallocated. +Parameters +hndlp (IN) - an opaque pointer to some storage. +type (IN) - specifies the type of storage to be allocated. The specific types +are: +OCI_HTYPE_ENV - an environment handle +OCI_HTYPE_ERROR - an error report handle +OCI_HTYPE_SVCCTX - a service context handle +OCI_HTYPE_STMT - a statement (application request) handle +OCI_HTYPE_BIND - a bind information handle +OCI_HTYPE_DEFINE - a column definition handle +OCI_HTYPE_DESCRIBE - a select list description handle +OCI_HTYPE_SERVER - a server handle +OCI_HTYPE_SESSION - a user authentication handle +OCI_HTYPE_TRANS - a transaction handle +OCI_HTYPE_COMPLEXOBJECT - a complex object retrieval handle +OCI_HTYPE_SECURITY - a security handle +Related Functions +OCIHandleAlloc() + + + + +OCIInitialize() +Name +OCI Process Initialize +Purpose +Initializes the OCI process environment. +Syntax +sword OCIInitialize ( ub4 mode, + const void *ctxp, + const void *(*malocfp) + ( void *ctxp, + size_t size ), + const void *(*ralocfp) + ( void *ctxp, + void *memp, + size_t newsize ), + const void (*mfreefp) + ( void *ctxp, + void *memptr )); +Comments +This call initializes the OCI process environment. +OCIInitialize() must be invoked before any other OCI call. +Parameters +mode (IN) - specifies initialization of the mode. The valid modes are: +OCI_DEFAULT - default mode. +OCI_THREADED - threaded environment. In this mode, internal data +structures are protected from concurrent accesses by multiple threads. +OCI_OBJECT - will use navigational object interface. +ctxp (IN) - user defined context for the memory call back routines. +malocfp (IN) - user-defined memory allocation function. If mode is +OCI_THREADED, this memory allocation routine must be thread safe. +ctxp - context pointer for the user-defined memory allocation function. +size - size of memory to be allocated by the user-defined memory +allocation function +ralocfp (IN) - user-defined memory re-allocation function. If mode is +OCI_THREADED, this memory allocation routine must be thread safe. +ctxp - context pointer for the user-defined memory reallocation +function. +memp - pointer to memory block +newsize - new size of memory to be allocated +mfreefp (IN) - user-defined memory free function. If mode is +OCI_THREADED, this memory free routine must be thread safe. +ctxp - context pointer for the user-defined memory free function. +memptr - pointer to memory to be freed +Example +See the description of OCIStmtPrepare() on page 13-96 for an example showing +the use of OCIInitialize(). +Related Functions + +-------------------------------OCITerminate------------------------------------ + +OCITerminate() +Name +OCI process Terminate +Purpose +Do cleanup before process termination +Syntax +sword OCITerminate (ub4 mode); + +Comments +This call performs OCI related clean up before the OCI process terminates. +If the process is running in shared mode then the OCI process is disconnected +from the shared memory subsystem. + +OCITerminate() should be the last OCI call in any process. + +Parameters +mode (IN) - specifies different termination modes. + +OCI_DEFAULT - default mode. + +Example + +Related Functions +OCIInitialize() + +------------------------ OCIAppCtxSet-------------------------------------- +Name +OCI Application context Set +Purpose +Set an attribute and its value for a particular application context + namespace +Syntax + (sword) OCIAppCtxSet((void *) sesshndl, (void *)nsptr,(ub4) nsptrlen, + (void *)attrptr, (ub4) attrptrlen, (void *)valueptr, + (ub4) valueptrlen, errhp, (ub4)mode); + +Comments +Please note that the information set on the session handle is sent to the +server during the next OCIStatementExecute or OCISessionBegin. + +This information is cleared from the session handle, once the information + has been sent over to the server,and should be setup again if needed. + +Parameters + sesshndl (IN/OUT) - Pointer to a session handle + nsptr (IN) - Pointer to namespace string + nsptrlen (IN) - length of the nsptr + attrptr (IN) - Pointer to attribute string + attrptrlen (IN) - length of the attrptr + valueptr (IN) - Pointer to value string + valueptrlen(IN) - length of the valueptr + errhp (OUT) - Error from the API + mode (IN) - mode of operation (OCI_DEFAULT) + +Returns + error if any +Example + +Related Functions + OCIAppCtxClearAll + + +------------------------ OCIAppCtxClearAll--------------------------------- +Name + OCI Application Context Clear all attributes in a namespace +Purpose + To clear the values all attributes in a namespace +Syntax + (sword) OCIAppCtxClearAll((void *) sesshndl, (void *)nsptr, (ub4) nsptrlen, + (OCIError *)errhp, (ub4)mode); + +Comments +This will clean up the context information on the server side during the +next piggy-back to the server. + +Parameters + sesshndl (IN/OUT) - Pointer to a session handle + nsptr (IN) - Pointer to namespace string where the values of all + attributes are cleared + nsptrlen (IN) - length of the nsptr + errhp (OUT) - Error from the API + mode (IN) - mode of operation (OCI_DEFAULT) +Example + +Returns + error if any + +Related Functions + OCIAppCtxSet +---------------------- OCIIntervalAssign --------------------------------- +sword OCIIntervalAssign(void *hndl, OCIError *err, + const OCIInterval *inpinter, OCIInterval *outinter ); + + DESCRIPTION + Copies one interval to another to create a replica + PARAMETERS + hndl (IN) - Session/Env handle. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + (IN) inpinter - Input Interval + (OUT) outinter - Output Interval + RETURNS + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_SUCCESS otherwise + + ---------------------- OCIIntervalCheck ------------------------------------ +sword OCIIntervalCheck(void *hndl, OCIError *err, const OCIInterval *interval, + ub4 *valid ); + + DESCRIPTION + Checks the validity of an interval + PARAMETERS + hndl (IN) - Session/Env handle. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + (IN) interval - Interval to be checked + (OUT) valid - Zero if the interval is valid, else returns an Ored + combination of the following codes. + + Macro name Bit number Error + ---------- ---------- ----- + OCI_INTER_INVALID_DAY 0x1 Bad day + OCI_INTER_DAY_BELOW_VALID 0x2 Bad DAy Low/high bit (1=low) + OCI_INTER_INVALID_MONTH 0x4 Bad MOnth + OCI_INTER_MONTH_BELOW_VALID 0x8 Bad MOnth Low/high bit (1=low) + OCI_INTER_INVALID_YEAR 0x10 Bad YeaR + OCI_INTER_YEAR_BELOW_VALID 0x20 Bad YeaR Low/high bit (1=low) + OCI_INTER_INVALID_HOUR 0x40 Bad HouR + OCI_INTER_HOUR_BELOW_VALID 0x80 Bad HouR Low/high bit (1=low) + OCI_INTER_INVALID_MINUTE 0x100 Bad MiNute + OCI_INTER_MINUTE_BELOW_VALID 0x200 Bad MiNute Low/high bit(1=low) + OCI_INTER_INVALID_SECOND 0x400 Bad SeCond + OCI_INTER_SECOND_BELOW_VALID 0x800 bad second Low/high bit(1=low) + OCI_INTER_INVALID_FRACSEC 0x1000 Bad Fractional second + OCI_INTER_FRACSEC_BELOW_VALID 0x2000 Bad fractional second Low/High + + + RETURNS + OCI_SUCCESS if interval is okay + OCI_INVALID_HANDLE if 'err' is NULL. + + ---------------------- OCIIntervalCompare ----------------------------------- +sword OCIIntervalCompare(void *hndl, OCIError *err, OCIInterval *inter1, + OCIInterval *inter2, sword *result ); + + DESCRIPTION + Compares two intervals, returns 0 if equal, -1 if inter1 < inter2, + 1 if inter1 > inter2 + PARAMETERS + hndl (IN) - Session/Env handle. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + inter1 (IN) - Interval to be compared + inter2 (IN) - Interval to be compared + result (OUT) - comparison result, 0 if equal, -1 if inter1 < inter2, + 1 if inter1 > inter2 + + RETURNS + OCI_SUCCESS on success + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + the two input datetimes are not mutually comparable. + +---------------------- OCIIntervalDivide ------------------------------------ +sword OCIIntervalDivide(void *hndl, OCIError *err, OCIInterval *dividend, + OCINumber *divisor, OCIInterval *result ); + + DESCRIPTION + Divides an interval by an Oracle Number to produce an interval + PARAMETERS + hndl (IN) - Session/Env handle. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + dividend (IN) - Interval to be divided + divisor (IN) - Oracle Number dividing `dividend' + result (OUT) - resulting interval (dividend / divisor) + RETURNS + OCI_SUCCESS on success + OCI_INVALID_HANDLE if 'err' is NULL. + + ---------------------- OCIIntervalFromNumber -------------------- +sword OCIIntervalFromNumber(void *hndl, OCIError *err, + OCIInterval *inter, OCINumber *number); + DESCRIPTION + Converts an interval to an Oracle Number + PARAMETERS + hndl (IN) - Session/Env handle. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + (OUT) interval - Interval to be converted + (IN) number - Oracle number result (in years for YEARMONTH interval + and in days for DAYSECOND) + RETURNS + OCI_SUCCESS on success + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR on error. + NOTES + Fractional portions of the date (for instance, minutes and seconds if + the unit chosen is hours) will be included in the Oracle number produced. + Excess precision will be truncated. + + ---------------------- OCIIntervalFromText --------------------------------- +sword OCIIntervalFromText( void *hndl, OCIError *err, const OraText *inpstr, + size_t str_len, OCIInterval *result ); + + DESCRIPTION + Given an interval string produce the interval represented by the string. + The type of the interval is the type of the 'result' descriptor. + PARAMETERS + + hndl (IN) - Session/Env handle. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + (IN) inpstr - Input string + (IN) str_len - Length of input string + (OUT) result - Resultant interval + RETURNS + OCI_SUCCESS on success + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + there are too many fields in the literal string + the year is out of range (-4713 to 9999) + if the month is out of range (1 to 12) + if the day of month is out of range (1 to 28...31) + if hour is not in range (0 to 23) + if hour is not in range (0 to 11) + if minute is not in range (0 to 59) + if seconds in minute not in range (0 to 59) + if seconds in day not in range (0 to 86399) + if the interval is invalid + + + ---------------------- OCIIntervalGetDaySecond -------------------- + + DESCRIPTION + Gets values of day second interval + PARAMETERS + hndl (IN) - Session/Env handle. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + day (OUT) - number of days + hour (OUT) - number of hours + min (OUT) - number of mins + sec (OUT) - number of secs + fsec (OUT) - number of fractional seconds + result (IN) - resulting interval + RETURNS + OCI_SUCCESS on success + OCI_INVALID_HANDLE if 'err' is NULL. + + + ---------------------- OCIIntervalGetYearMonth -------------------- + + DESCRIPTION + Gets year month from an interval + PARAMETERS + hndl (IN) - Session/Env handle. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + year (OUT) - year value + month (OUT) - month value + result (IN) - resulting interval + RETURNS + OCI_SUCCESS on success + OCI_INVALID_HANDLE if 'err' is NULL. + + + +-------------------------- OCIIntervalAdd ------------------------------ +sword OCIIntervalAdd(void *hndl, OCIError *err, OCIInterval *addend1, + OCIInterval *addend2, OCIInterval *result ); +NAME OCIIntervalAdd - Adds two intervals +PARAMETERS +hndl (IN) - Session/Env handle. +err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). +addend1 (IN) - Interval to be added +addend2 (IN) - Interval to be added +result (OUT) - resulting interval (addend1 + addend2) +DESCRIPTION + Adds two intervals to produce a resulting interval +RETURNS + OCI_SUCCESS on success + OCI_ERROR if: + the two input intervals are not mutually comparable. + the resulting year would go above SB4MAXVAL + the resulting year would go below SB4MINVAL + OCI_INVALID_HANDLE if 'err' is NULL. +NOTES + The two input intervals must be mutually comparable + + ---------------------- OCIIntervalSubtract ------------------------------- +sword OCIIntervalSubtract(void *hndl, OCIError *err, OCIInterval *minuend, + OCIInterval *subtrahend, OCIInterval *result ); +NAME - OCIIntervalSubtract - subtracts two intervals +PARAMETERS +hndl (IN) - Session/Env handle. +err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). +minuend (IN) - interval to be subtracted from +subtrahend (IN) - interval subtracted from minuend +result (OUT) - resulting interval (minuend - subtrahend) +DESCRIPTION + Subtracts two intervals and stores the result in an interval +RETURNS + OCI_SUCCESS on success + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if: + the two input intervals are not mutually comparable. + the resulting leading field would go below SB4MINVAL + the resulting leading field would go above SB4MAXVAL + +---------------------- OCIIntervalMultiply --------------------------------- +sword OCIIntervalMultiply(void *hndl, OCIError *err, const OCIInterval *inter, + OCINumber *nfactor, OCIInterval *result ); + + DESCRIPTION + Multiplies an interval by an Oracle Number to produce an interval + PARAMETERS + hndl (IN) - Session/Env handle. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + inter (IN) - Interval to be multiplied + nfactor (IN) - Oracle Number to be multiplied + result (OUT) - resulting interval (ifactor * nfactor) + RETURNS + OCI_SUCCESS on success + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if: + the resulting year would go above SB4MAXVAL + the resulting year would go below SB4MINVAL + + + ---------------------- OCIIntervalSetDaySecond -------------------- + + DESCRIPTION + Sets day second interval + PARAMETERS + hndl (IN) - Session/Env handle. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + day (IN) - number of days + hour (IN) - number of hours + min (IN) - number of mins + sec (IN) - number of secs + fsec (IN) - number of fractional seconds + result (OUT) - resulting interval + RETURNS + OCI_SUCCESS on success + OCI_INVALID_HANDLE if 'err' is NULL. + + + ---------------------- OCIIntervalSetYearMonth -------------------- + + DESCRIPTION + Sets year month interval + PARAMETERS + hndl (IN) - Session/Env handle. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + year (IN) - year value + month (IN) - month value + result (OUT) - resulting interval + RETURNS + OCI_SUCCESS on success + OCI_INVALID_HANDLE if 'err' is NULL. + + +----------------------- OCIIntervalToNumber --------------------------------- +sword OCIIntervalToNumber(void *hndl, OCIError *err, const OCIInterval *inter, + OCINumber *number); + + DESCRIPTION + Converts an interval to an Oracle Number + PARAMETERS + hndl (IN) - Session/Env handle. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + (IN) inter - Interval to be converted + (OUT) number - Oracle number result (in years for YEARMONTH interval + and in days for DAYSECOND) + RETURNS + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_SUCCESS on success + NOTES + Fractional portions of the date (for instance, minutes and seconds if + the unit chosen is hours) will be included in the Oracle number produced. + Excess precision will be truncated. + +------------------------------- OCIIntervalToText ------------------------- +sword OCIIntervalToText( void *hndl, OCIError *err, const OCIInterval *inter, + ub1 lfprec, ub1 fsprec, OraText *buffer, + size_t buflen, size_t *resultlen ); + + DESCRIPTION + Given an interval, produces a string representing the interval. + PARAMETERS + hndl (IN) - Session/Env handle. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + (IN) inter - Interval to be converted + (IN) lfprec - Leading field precision. Number of digits used to + represent the leading field. + (IN) fsprec - Fractional second precision of the interval. Number of + digits used to represent the fractional seconds. + (OUT) buffer - buffer to hold result + (IN) buflen - length of above buffer + (OUT) resultlen - length of result placed into buffer + + RETURNS + OCI_SUCCESS on success + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR + if the buffer is not large enough to hold the result + NOTES + The interval literal will be output as `year' or `[year-]month' for + YEAR-MONTH intervals and as `seconds' or `minutes[:seconds]' or + `hours[:minutes[:seconds]]' or `days[ hours[:minutes[:seconds]]]' for + DAY-TIME intervals (where optional fields are surrounded by brackets). + + ---------------------- OCIIntervalFromTZ -------------------- +sword OCIIntervalFromTZ(void *hndl, OCIError *err, const oratext *inpstring, + size_t str_len, OCIInterval *result); + + DESCRIPTION + Retuns an OCI_DTYPE_INTERVAL_DS OCIInterval with the region id (if + the region is specified in the input string) set and the current + absolute offset or an absolut offset with the region id set to 0. + PARAMETERS + hndl (IN) - Session/Env handle. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + inpstring (IN) - pointer to the input string + str_len (IN) - inpstring length + result - Output Interval + RETURNS + OCI_SUCCESS on success + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR on error + Bad interval type + Timezone errors + NOTES + The input string must be of the form [+/-]TZH:TZM or 'TZR [TZD]' + + ----------------------- OCIKerbAttrSet --------------------- +sword OCIKerbAttrSet(OCISession *trgthndlp, ub4 auth_mode, + ub1 *ftgt_ticket, ub4 ftgt_ticket_len, + ub1 *ftgt_sesskey, ub4 ftgt_sesskey_len, + ub2 ftgt_keytype, ub4 ftgt_ticket_flags, + sb4 ftgt_auth_time, sb4 ftgt_start_time, + sb4 ftgt_end_time, sb4 ftgt_renew_time, + oratext *ftgt_principal, ub4 ftgt_principal_len, + oratext *ftgt_realm, ub4 ftgt_realm_len, + OCIError *errhp); + + DESCRIPTION + This call sets the attributes required for Kerberos authentication + on the user handle. + + PARAMETERS + trgthndlp (IN) - The pointer to a user handle. + auth_mode (IN) - Indicates what type of Kerberos credentials should + be set. Options are: + + OCI_KERBCRED_PROXY + - Set Kerberos credentials for use with + proxy authentication. + OCI_KERBCRED_CLIENT_IDENTIFIER + - Set Kerberos credentials for use + with secure client identifier. + + ftgt_ticket (IN) - Forwardable Ticket Granting Ticket (FTGT). + ftgt_ticket_len (IN) - Length of FTGT. + ftgt_sesskey(IN) - Session Key associated with FTGT. + ftgt_sesskey_len (IN) - Length of session key. + ftgt_keytype (IN) - Type of encryption key used to encrypt FTGT. + ftgt_ticket_flags (IN) - Flags associated with encryption of FTGT. + ftgt_auth_time (IN) - Authentication time compatible with that in FTGT. + ftgt_start_time (IN) - Start time compatible with that indicated in FTGT. + ftgt_end_time (IN) - End time compatible with that indicated in FTGT. + ftgt_renew_time (IN) - Renew time compatible with that indicated in FTGT. + ftgt_principal (IN) - Client principal name from FTGT. + ftgt_principal_len (IN) - Length of client principal name. + ftgt_realm (IN) - Client realm name from FTGT. + ftgt_realm_len (IN) - Client realm name length. + errhp (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + RETURNS + OCI_SUCCESS on success + OCI_ERROR on error + NOTES + +OCILdaToSvcCtx() +Name +OCI toggle version 7 Lda_Def to SerVice context handle +Purpose +Converts a V7 Lda_Def to a V8 service context handle. +Syntax +sword OCILdaToSvcCtx ( OCISvcCtx **svchpp, + OCIError *errhp, + Lda_Def *ldap ); +Comments +Converts a V7 Lda_Def to a V8 service context handle. The action of this call +can be reversed by passing the resulting service context handle to the +OCISvcCtxToLda() function. +Parameters +svchpp (IN/OUT) - the service context handle. +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +ldap (IN/OUT) - the V7 logon data area returned by OCISvcCtxToLda() from +this service context. +Related Functions +OCISvcCtxToLda() + + + + +OCILobAppend() + +Name +OCI Lob APpend + +Purpose +Appends a LOB value at the end of another LOB. + +Syntax +sword OCILobAppend ( OCISvcCtx *svchp, + OCIError *errhp, + OCILobLocator *dst_locp, + OCILobLocator *src_locp ); +Comments +Appends a LOB value at the end of LOB. The data is +copied from the source to the destination at the end of the destination. The +source and the destination must already exist. The destination LOB is +extended to accommodate the newly written data. + +It is an error to extend the destination LOB beyond the maximum length +allowed or to try to copy from a NULL LOB. + +Parameters +svchp (IN) - the service context handle. +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +dst_locp (IN/OUT) - a locator uniquely referencing the destination LOB. +src_locp (IN/OUT) - a locator uniquely referencing the source LOB. + +Related Functions +OCILobTrim() +OCIErrorGet() +OCILobWrite() +OCILobCopy() + + + +OCILobAssign() + +Name +OCI Lob ASsiGn + +Purpose +Assigns one LOB/FILE locator to another. + +Syntax +sword OCILobAssign ( OCIEnv *envhp, + OCIError *errhp, + const OCILobLocator *src_locp, + OCILobLocator **dst_locpp ); + +Comments +Assign source locator to destination locator. After the assignment, both +locators refer to the same LOB data. For internal LOBs, the source locator's +LOB data gets copied to the destination locator's LOB data only when the +destination locator gets stored in the table. Therefore, issuing a flush of +the object containing the destination locator will copy the LOB data. For +FILEs only the locator that refers to the OS file is copied to the table. The +OS file is not copied. +Note: The only difference between this and OCILobLocatorAssign is that this +takes an environment handle whereas OCILobLocatorAssign takes an OCI service +handle + +Parameters +envhp (IN/OUT) - OCI environment handle initialized in object mode. +errhp (IN/OUT) - The OCI error handle. If there is an error, it is recorded +in errhp and this function returns OCI_ERROR. Diagnostic information can be +obtained by calling OCIErrorGet(). +src_locp (IN) - LOB locator to copy from. +dst_locpp (IN/OUT) - LOB locator to copy to. The caller must allocate space +for the OCILobLocator by calling OCIDescriptorAlloc(). + +See also +OCIErrorGet() +OCILobIsEqual() +OCILobLocatorIsInit() +OCILobLocatorAssign() + + +OCILobCharSetForm() + +Name +OCI Lob Get Character Set Form + +Purpose +Gets the LOB locator's character set fpr,, if any. + +Syntax +sword OCILobCharSetForm ( OCIEnv *envhp, + OCIError *errhp, + const OCILobLocator *locp, + ub1 *csfrm ); + +Comments +Returns the character set form of the input LOB locator in the csfrm output +parameter. + +Parameters +envhp (IN/OUT) - OCI environment handle initialized in object mode. +errhp (IN/OUT) - error handle. The OCI error handle. If there is an error, it +is recorded in err and this function returns OCI_ERROR. Diagnostic +information can be obtained by calling OCIErrorGet(). +locp (IN) - LOB locator for which to get the character set form. +csfrm(OUT) - character set form of the input LOB locator. If the input +locator is for a BLOB or a BFILE, csfrm is set to 0 since there is no concept +of a character set for binary LOBs/FILEs. The caller must allocate space for +the csfrm (ub1) and not write into the space. +See also +OCIErrorGet(), OCILobCharSetId(), OCILobLocatorIsInit + + + +OCILobCharSetId() + +Name +OCI Lob get Character Set IDentifier + +Purpose +Gets the LOB locator's character set ID, if any. + +Syntax +sword OCILobCharSetId ( OCIEnv *envhp, + OCIError *errhp, + const OCILobLocator *locp, + ub2 *csid ); + +Comments +Returns the character set ID of the input LOB locator in the cid output +parameter. + +Parameters +envhp (IN/OUT) - OCI environment handle initialized in object mode. +errhp (IN/OUT) - error handle. The OCI error handle. If there is an error, it +is recorded in err and this function returns OCI_ERROR. Diagnostic +information can be obtained by calling OCIErrorGet(). +locp (IN) - LOB locator for which to get the character set ID. +csid (OUT) - character set ID of the input LOB locator. If the input locator +is for a BLOB or a BFILE, csid is set to 0 since there is no concept of a +character set for binary LOBs/FILEs. The caller must allocate space for the +character set id of type ub2 and not write into the space. + +See also +OCIErrorGet(), OCILobCharSetForm(), OCILobLocatorIsInit() + + + +OCILobCopy() + +Name +OCI Lob Copy + +Purpose +Copies a portion of a LOB value into another LOB value. + +Syntax +sword OCILobCopy ( OCISvcCtx *svchp, + OCIError *errhp, + OCILobLocator *dst_locp, + OCILobLocator *src_locp, + ub4 amount, + ub4 dst_offset, + ub4 src_offset ); + +Comments +Copies a portion of a LOB value into another LOB as specified. The data +is copied from the source to the destination. The source (src_locp) and the +destination (dlopb) LOBs must already exist. +If the data already exists at the destination's start position, it is +overwritten with the source data. If the destination's start position is +beyond the end of the current data, a hole is created from the end of the data +to the beginning of the newly written data from the source. The destination +LOB is extended to accommodate the newly written data if it extends +beyond the current length of the destination LOB. +It is an error to extend the destination LOB beyond the maximum length +allowed or to try to copy from a NULL LOB. +Parameters +svchp (IN) - the service context handle. +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +dst_locp (IN/OUT) - a locator uniquely referencing the destination LOB. +src_locp (IN/OUT) - a locator uniquely referencing the source LOB. +amount (IN) - the number of character or bytes, as appropriate, to be copied. +dst_offset (IN) - this is the absolute offset for the destination LOB. +For character LOBs it is the number of characters from the beginning of the +LOB at which to begin writing. For binary LOBs it is the number of bytes from +the beginning of the lob from which to begin reading. The offset starts at 1. +src_offset (IN) - this is the absolute offset for the source LOB. +For character LOBs it is the number of characters from the beginning of the +LOB, for binary LOBs it is the number of bytes. Starts at 1. + +See Also +OCIErrorGet(), OCILobAppend(), OCILobWrite(), OCILobTrim() + +OCILobCreateTemporary() + +Name +OCI Lob Create Temporary + +Purpose +Create a Temporary Lob + +Syntax +sword OCILobCreateTemporary(OCISvcCtx *svchp, + OCIError *errhp, + OCILobLocator *locp, + ub2 csid, + ub1 csfrm, + ub1 lobtype, + boolean cache, + OCIDuration duration); + + +Comments +svchp (IN) - the service context handle. +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +locp (IN/OUT) - a locator which points to the temporary Lob +csid (IN) - the character set id +csfrm(IN) - the character set form +lobtype (IN) - the lob type - one of the three constants OCI_TEMP_BLOB, + OCI_TEMP_CLOB and OCI_TEMP_NCLOB +cache(IN)- TRUE if the temporary LOB goes through the cache; FALSE, if not. +duration(IN)- duration of the temporary LOB; Can be a valid duration id or one + of the values: OCI_DURATION_SESSION, OCI_DURATION_CALL + Note: OCI_DURATION_TRANSACTION is NOT supported in 8.1 +Related functions +OCILobFreeTemporary() +OCILobIsTemporary() + +OCILobDisableBuffering() + +Name +OCI Lob Disable Buffering + +Purpose +Disable lob buffering for the input locator. + + +Syntax +sword OCILobDisableBuffering ( OCISvcCtx *svchp, + OCIError *errhp, + OCILobLocator *locp); + +Comments + +Disable lob buffering for the input locator. The next time data is +read/written from/to the lob through the input locator, the lob +buffering subsystem is *not* used. Note that this call does *not* +implicitly flush the changes made in the buffering subsystem. The +user must explicitly call OCILobFlushBuffer() to do this. + +Parameters +svchp (IN) - the service context handle. +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +locp (IN/OUT) - a locator uniquely referencing the LOB. + +Related Functions +OCILobEnableBuffering() +OCIErrorGet() +OCILobFlushBuffer() + + + + +OCILobEnableBuffering() + +Name +OCI Lob Enable Buffering + +Purpose +Enable lob buffering for the input locator. + + +Syntax +sword OCILobEnableBuffering ( OCISvcCtx *svchp, + OCIError *errhp, + OCILobLocator *locp); + +Comments + +Enable lob buffering for the input locator. The next time data is +read/written from/to the lob through the input locator, the lob +buffering subsystem is used. + +Once lob buffering is enabled for a locator, if that locator is passed to +one of the following routines, an error is returned: + OCILobCopy, OCILobAppend, OCILobErase, OCILobGetLength, OCILobTrim + +Parameters +svchp (IN) - the service context handle. +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +locp (IN/OUT) - a locator uniquely referencing the LOB. + +Related Functions +OCILobDisableBuffering() +OCIErrorGet() +OCILobWrite() +OCILobRead() +OCILobFlushBuffer() + + + + +OCILobErase() + +Name +OCI Lob ERase + +Purpose +Erases a specified portion of the LOB data starting at a specified offset. + +Syntax +sword OCILobErase ( OCISvcCtx *svchp, + OCIError *errhp, + OCILobLocator *locp, + ub4 *amount, + ub4 offset ); + +Comments +Erases a specified portion of the LOB data starting at a specified offset. +The actual number of characters/bytes erased is returned. The actual number +of characters/bytes and the requested number of characters/bytes will differ +if the end of the LOB data is reached before erasing the requested number of +characters/bytes. +If a section of data from the middle of the LOB data is erased, a hole is +created. When data from that hole is read, 0's are returned. If the LOB is +NULL, this routine will indicate that 0 characters/bytes were erased. + +Parameters +svchp (IN) - the service context handle. +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +locp (IN/OUT) - the LOB for which to erase a section of data. +amount (IN/OUT) - On IN, the number of characters/bytes to erase. On OUT, +the actual number of characters/bytes erased. +offset (IN) - absolute offset from the beginning of the LOB data from which +to start erasing data. Starts at 1. + +See Also +OCIErrorGet(), OCILobRead(), OCILobWrite() + +OCILobOpen() + +Name +OCI Lob Open + +Purpose +Opens an internal or external Lob. + +Syntax +sword OCILobOpen( OCISvcCtx *svchp, + OCIError *errhp, + OCILobLocator *locp, + ub1 mode ); + +Comments +It is an error if the same lob is opened more than once in +the same transaction. Lobs are opened implicitly if they are +not opened before using them. A LOB has to be closed before +the transaction commits else the transaction is rolled back. +Open locators are closed if the transaction aborts. Multiple +users can open the same lob on different locators. +Parameters +svchp (IN) - the service context handle. +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +locp (IN/OUT) - locator points to the LOB to be opened +mode (IN) - mode in which to open the lob. The valid modes are +read-only - OCI_FILE_READONLY, read-write - OCI_FILE_READWRITE + +OCILobClose() + +Name +OCI Lob Close + +Purpose +Closes an open internal or external Lob. + +Syntax +sword OCILobClose( OCISvcCtx *svchp, + OCIError *errhp, + OCILobLocator *locp ); + + +Comments +It is an error if the lob is not open at this time. All LOBs +that have been opened in a transaction have to be closed +before the transaction commits, else the transaction gets +rolled back. + +Parameters +svchp (IN) - the service context handle. +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +locp (IN) - A locator that was opened using OCILobOpen() + + +OCILobFileClose() + +Name +OCI Lob File CLoSe + +Purpose +Closes a previously opened FILE. + +Syntax +sword OCILobFileClose ( OCISvcCtx *svchp, + OCIError *errhp, + OCILobLocator *filep ); + +Comments +Closes a previously opened FILE. It is an error if this function is called for +an internal LOB. No error is returned if the FILE exists but is not opened. +Parameters +svchp (IN) - the service context handle. +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +filep (IN/OUT) - a pointer to a FILE locator to be closed. + +See Also +OCIErrorGet(), OCILobFileOpen(), OCILobFileCloseAll(), OCILobFileIsOpen(), +OCILobFileExists(), CREATE DIRECTORY DDL + + + + +OCILobFileCloseAll() + +Name +OCI LOB FILE Close All + +Purpose +Closes all open FILEs on a given service context. + +Syntax +sword OCILobFileCLoseAll ( OCISvcCtx *svchp, + OCIError *errhp ); + +Comments +Closes all open FILEs on a given service context. + +Parameters +svchp (IN) - the service context handle. +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. + +See also +OCILobFileClose(), +OCIErrorGet(), OCILobFileOpen(), OCILobFileIsOpen(), +OCILobFileExists(), CREATE DIRECTORY DDL + + + + +OCILobFileExists() + +Name +OCI LOB FILE exists + +Purpose +Tests to see if the FILE exists on the server + +Syntax +sword OCILobFileExists ( OCISvcCtx *svchp, + OCIError *errhp, + OCILobLocator *filep, + boolean *flag ); + +Comments +Checks to see if a FILE exists for on the server. + +Parameters +svchp (IN) - the OCI service context handle. +errhp (IN/OUT) - error handle. The OCI error handle. If there is an error, +it is recorded in err and this function returns OCI_ERROR. Diagnostic +information can be obtained by calling OCIErrorGet(). +filep (IN) - pointer to the FILE locator that refers to the file. +flag (OUT) - returns TRUE if the FILE exists; FALSE if it does not. + +See also +OCIErrorGet, CREATE DIRECTORY (DDL) + + + + +OCILobFileGetName() + +Name +OCI LOB FILE Get file Name + +Purpose +Gets the FILE locator's directory alias and file name. + +Syntax +sword OCILobFileGetName ( OCIEnv *envhp, + OCIError *errhp, + const OCILobLocator *filep, + OraText *dir_alias, + ub2 *d_length, + OraText *filename, + ub2 *f_length ); + +Comments +Returns the directory alias and file name associated with this file locator. + +Parameters +envhp (IN/OUT) - OCI environment handle initialized in object mode. +errhp (IN/OUT) -The OCI error handle. If there is an error, it is recorded in +errhp and this function returns OCI_ERROR. Diagnostic information can be +obtained by calling OCIErrorGet(). +filep (IN) - FILE locator for which to get the directory alias and file name. +dir_alias (OUT) - buffer into which the directory alias name is placed. The +caller must allocate enough space for the directory alias name and must not +write into the space. +d_length (IN/OUT) + - IN: length of the input dir_alias string; + - OUT: length of the returned dir_alias string. +filename (OUT) - buffer into which the file name is placed. The caller must +allocate enough space for the file name and must not write into the space. +f_length (IN/OUT) + - IN: length of the input filename string; + - OUT: lenght of the returned filename string. + +See also +OCILobFileSetName(), OCIErrorGet() + + + + +OCILobFileIsOpen() + +Name +OCI LOB FILE Is Open? + +Purpose +Tests to see if the FILE is open + +Syntax +sword OCILobFileIsOpen ( OCISvcCtx *svchp, + OCIError *errhp, + OCILobLocator *filep, + boolean *flag ); + +Comments +Checks to see if the FILE on the server is open for a given LobLocator. + +Parameters +svchp (IN) - the OCI service context handle. +errhp (IN/OUT) - error handle. The OCI error handle. If there is an error, it +is recorded in err and this function returns OCI_ERROR. Diagnostic +information can be obtained by calling OCIErrorGet(). +filep (IN) - pointer to the FILE locator being examined. If the input file +locator was never passed to OCILobFileOpen(), the file is considered not to +be opened by this locator. However, a different locator may have opened the +file. More than one file opens can be performed on the same file using +different locators. +flag (OUT) - returns TRUE if the FILE is opened using this locator; FALSE if +it is not. + +See also +OCIErrorGet, OCILobFileOpen, OCILobFileClose, OCILobFileCloseAll, CREATE +DIRECTORY SQL command + + +OCILobFileOpen() + +Name +OCI LOB FILE open + +Purpose +Opens a FILE for read-only access + +Syntax +sword OCILobFileOpen ( OCISvcCtx *svchp, + OCIError *errhp, + OCILobLocator *filep, + ub1 mode ); + +Comments +Opens a FILE. The FILE can be opened for read-only access only. FILEs may not +be written to throough ORACLE. + +Parameters +svchp (IN) - the service context handle. +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +filep (IN/OUT) - the FILE to open. Error if the locator does not refer to a +FILE. +mode (IN) - mode in which to open the file. The only valid mode is +read-only - OCI_FILE_READONLY. + +See Also +OCILobFileClose, OCIErrorGet, OCILobFileCloseAll, OCILobFileIsOpen, +OCILobFileSetName, CREATE DIRECTORY + + + + +OCILobFileSetName() + +Name +OCI Lob File Set NaMe + +Purpose +Sets directory alias and file name in the FILE locator. + +Syntax +sword OCILobFileSetName ( OCIEnv *envhp, + OCIError *errhp, + OCILobLocator **filepp, + OraText *dir_alias, + ub2 d_length, + OraText *filename, + ub2 f_length ); +Comments +Sets the directory alias and file name in the LOB file locator. +Parameters +envhp (IN/OUT) - OCI environment handle initialized in object mode. +errhp (IN/OUT) - The OCI error handle. If there is an error, it is recorded +in errhp and this function returns OCI_ERROR. Diagnostic information can be +obtained by calling OCIErrorGet(). +filepp (IN/OUT) - FILE locator for which to set the directory alias name. +The caller must have already allocated space for the locator by calling +OCIDescriptorAlloc(). +dir_alias (IN) - buffer that contains the directory alias name to set in the +locator. +d_length (IN) - length of the input dir_alias parameter. +filename (IN) - buffer that contains the file name is placed. +f_length (IN) - length of the input filename parameter. +See also +OCILobFileGetName, OCIErrorGet, CREATE DIRECTORY + + + + +OCILobFlushBuffer() + +Name +OCI Lob Flush all Buffers for this lob. + +Purpose +Flush/write all buffers for this lob to the server. + + +Syntax +sword OCILobFlushBuffer ( OCISvcCtx *svchp, + OCIError *errhp, + OCILobLocator *locp, + ub4 flag); + +Comments + +Flushes to the server, changes made to the buffering subsystem that +are associated with the lob referenced by the input locator. This +routine will actually write the data in the buffer to the lob in +the database. Lob buffering must have already been enabled for the +input lob locator. + +This routine, by default, does not free the buffer resources for +reallocation to another buffered LOB operation. However, if you +want to free the buffer explicitly, you can set the flag parameter +to OCI_LOB_BUFFER_FREE. + +Parameters +svchp (IN/OUT) - the service context handle. +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +locp (IN/OUT) - a locator uniquely referencing the LOB. +flag (IN) - to indicate if the buffer resources need to be freed + after a flush. Default value is OCI_LOB_BUFFER_NOFREE. + Set it to OCI_LOB_BUFFER_FREE if you want the buffer + resources to be freed. +Related Functions +OCILobEnableBuffering() +OCILobDisableBuffering() +OCIErrorGet() +OCILobWrite() +OCILobRead() + + +OCILobFreeTemporary() + +Name +OCI Lob Free Temporary + +Purpose +Free a temporary LOB + +Syntax +sword OCILobFreeTemporary(OCISvcCtx *svchp, + OCIError *errhp, + OCILobLocator *locp); + +Comments + Frees the contents of the temporary Lob this locator is pointing to. Note + that the locator itself is not freed until a OCIDescriptorFree is done. + +Parameters +svchp (IN/OUT) - the service context handle. +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +locp (IN/OUT) - a locator uniquely referencing the LOB + +Related functions +OCILobCreateTemporary() +OCILobIsTemporary() + + +Name +OCI Lob/File Get Chunk Size + +Purpose +When creating the table, the user can specify the chunking factor, which can +be a multiple of Oracle blocks. This corresponds to the chunk size used by the +LOB data layer when accessing/modifying the LOB value. Part of the chunk is +used to store system-related information and the rest stores the LOB value. +This function returns the amount of space used in the LOB chunk to store +the LOB value. + +Syntax +sword OCILobGetChunkSize ( OCISvcCtx *svchp, + OCIError *errhp, + OCILobLocator *locp, + ub4 *chunksizep ); + +Comments + Performance will be improved if the user issues read/write +requests using a multiple of this chunk size. For writes, there is an added +benefit since LOB chunks are versioned and, if all writes are done on chunk +basis, no extra/excess versioning is done nor duplicated. Users could batch +up the write until they have enough for a chunk instead of issuing several +write calls for the same chunk. + +Parameters +svchp (IN) - the service context handle. +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +locp (IN/OUT) - a LOB locator that uniquely references the LOB. For internal +LOBs, this locator must be a locator that was obtained from the server +specified by svchp. For FILEs, this locator can be initialized by a Select or +OCILobFileSetName. +chunksizep (OUT) - On output, it is the length of the LOB if not NULL - for +character LOBs it is the number of characters, for binary LOBs it is the +number of bytes in the LOB. + +Related Functions + +OCILobGetLength() + +Name +OCI Lob/File Length + +Purpose +Gets the length of a LOB/FILE. + +Syntax +sword OCILobGetLength ( OCISvcCtx *svchp, + OCIError *errhp, + OCILobLocator *locp, + ub4 *lenp ); + +Comments +Gets the length of a LOB/FILE. If the LOB/FILE is NULL, the length is +undefined. + +Parameters +svchp (IN) - the service context handle. +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +locp (IN/OUT) - a LOB locator that uniquely references the LOB. For internal +LOBs, this locator must be a locator that was obtained from the server +specified by svchp. For FILEs, this locator can be initialized by a Select or +OCILobFileSetName. +lenp (OUT) - On output, it is the length of the LOB if not NULL - for +character LOBs it is the number of characters, for binary LOBs it is the +number of bytes in the LOB. + +Related Functions +OCIErrorGet, OCIFileSetName + + + +OCILobIsEqual() + +Name + +OCI Lob Is Equal + +Purpose +Compares two LOB locators for equality. + +Syntax +sword OCILobIsEqual ( OCIEnv *envhp, + const OCILobLocator *x, + const OCILobLocator *y, + boolean *is_equal ); + +Comments +Compares the given LOB locators for equality. Two LOB locators are equal if +and only if they both refer to the same LOB data. +Two NULL locators are considered not equal by this function. +Parameters +envhp (IN) - the OCI environment handle. +x (IN) - LOB locator to compare. +y (IN) - LOB locator to compare. +is_equal (OUT) - TRUE, if the LOB locators are equal; FALSE if they are not. + +See also +OCILobAssign, OCILobLocatorIsInit +OCILobLocatorAssign, +OCILobIsOpen() + +Name + +OCI Lob Is Open +sword OCILobIsOpen(svchp, errhp, locp, flag) +OCISvcCtx *svchp; +OCIError *errhp; +OCILobLocator *locp; +boolean *flag; + +Comments + Checks if the LOB locator was opened before. flag is set to TRUE + if opened; FALSE otherwise + + +Parameters +svchp (IN) - the service context handle. +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +locp (IN) - the locator to test for temporary LOB +flag(OUT) - TRUE, if the LOB locator points to is open + FALSE, if not. + +OCILobIsTemporary() + +Name + +OCI Lob Is Temporary + +Purpose + Tests if this locator points to a temporary LOB + +Syntax +sword OCILobIsTemporary(OCIEnv *envhp, + OCIError *errhp, + OCILobLocator *locp, + boolean *is_temporary); + +Comments +Tests the locator to determine if it points to a temporary LOB. +If so, is_temporary is set to TRUE. If not, is_temporary is set +to FALSE. + +Parameters +envhp (IN) - the environment handle. +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +locp (IN) - the locator to test for temporary LOB +is_temporary(OUT) - TRUE, if the LOB locator points to a temporary LOB; + FALSE, if not. + +See Also +OCILobCreateTemporary, OCILobFreeTemporary + + +OCILobLoadFromFile() + +Name +OCI Lob Load From File + +Purpose +Load/copy all or a portion of the file into an internal LOB. + +Syntax +sword OCILobLoadFromFile ( OCISvcCtx *svchp, + OCIError *errhp, + OCILobLocator *dst_locp, + OCILobLocator *src_filep, + ub4 amount, + ub4 dst_offset, + ub4 src_offset ); + +Comments +Loads/copies a portion or all of a file value into an internal LOB as +specified. The data is copied from the source file to the destination +internal LOB (BLOB/CLOB). No character set conversions are performed +when copying the bfile data to a clob/nclob. The bfile data must already +be in the same character set as the clob/nclob in the database. No +error checking is performed to verify this. +The source (src_filep) and the destination (dst_locp) LOBs must already exist. +If the data already exists at the destination's start position, it is +overwritten with the source data. If the destination's start position is +beyond the end of the current data, a hole is created from the end of the data +to the beginning of the newly written data from the source. The destination +LOB is extended to accommodate the newly written data if it extends +beyond the current length of the destination LOB. +It is an error to extend the destination LOB beyond the maximum length +allowed or to try to copy from a NULL LOB. +Parameters +svchp (IN) - the service context handle. +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +dst_locp (IN/OUT) - a locator uniquely referencing the destination internal +LOB which may be of type blob, clob, or nclob. +src_filep (IN/OUT) - a locator uniquely referencing the source BFILE. +amount (IN) - the number of bytes to be copied. +dst_offset (IN) - this is the absolute offset for the destination LOB. +For character LOBs it is the number of characters from the beginning of the +LOB at which to begin writing. For binary LOBs it is the number of bytes from +the beginning of the lob from which to begin reading. The offset starts at 1. +src_offset (IN) - this is the absolute offset for the source BFILE. It is +the number of bytes from the beginning of the LOB. The offset starts at 1. + +See Also +OCIErrorGet(), OCILobAppend(), OCILobWrite(), OCILobTrim(), OCILobCopy() + +OCILobLocatorAssign() + +Name +OCI Lob LOCATOR ASsiGn + +Purpose +Assigns one LOB/FILE locator to another. + +Syntax +sword OCILobLocatorAssign ( OCISvcCtx *svchp, + OCIError *errhp, + const OCILobLocator *src_locp, + OCILobLocator **dst_locpp ); + +Comments +Assign source locator to destination locator. After the assignment, both +locators refer to the same LOB data. For internal LOBs, the source locator's +LOB data gets copied to the destination locator's LOB data only when the +destination locator gets stored in the table. Therefore, issuing a flush of +the object containing the destination locator will copy the LOB data. For +FILEs only the locator that refers to the OS file is copied to the table. The +OS file is not copied. +Note : the only difference between this and OCILobAssign is that this takes +a OCI service handle pointer instead of a OCI environment handle pointer + +Parameters +svchp (IN/OUT) - OCI service handle initialized in object mode. +errhp (IN/OUT) - The OCI error handle. If there is an error, it is recorded +in errhp and this function returns OCI_ERROR. Diagnostic information can be +obtained by calling OCIErrorGet(). +src_locp (IN) - LOB locator to copy from. +dst_locpp (IN/OUT) - LOB locator to copy to. The caller must allocate space +for the OCILobLocator by calling OCIDescriptorAlloc(). + +See also +OCIErrorGet() +OCILobIsEqual() +OCILobLocatorIsInit() +OCILobAssign() + + + + +OCILobLocatorIsInit() + +Name +OCI LOB locator is initialized? + +Purpose +Tests to see if a given LOB locator is initialized. + +Syntax +sword OCILobLocatorIsInit ( OCIEnv *envhp, + OCIError *errhp, + const OCILobLocator *locp, + boolean *is_initialized ); + +Comments +Tests to see if a given LOB locator is initialized. + +Parameters +envhp (IN/OUT) - OCI environment handle initialized in object mode. +errhp (IN/OUT) - error handle. The OCI error handle. If there is an error, it +is recorded in err and this function returns OCI_ERROR. Diagnostic +information can be obtained by calling OCIErrorGet(). +locp (IN) - the LOB locator being tested +is_initialized (OUT) - returns TRUE if the given LOB locator is initialized; +FALSE if it is not. + +See also +OCIErrorGet, OCILobIsEqual + + + + +OCILobRead() + +Name +OCI Lob/File ReaD + +Purpose +Reads a portion of a LOB/FILE as specified by the call into a buffer. + +Syntax +sword OCILobRead ( OCISvcCtx *svchp, + OCIError *errhp, + OCILobLocator *locp, + ub4 offset, + ub4 *amtp, + void *bufp, + ub4 bufl, + void *ctxp, + OCICallbackLobRead cbfp, + ub2 csid, + ub1 csfrm ); + +Comments +Reads a portion of a LOB/FILE as specified by the call into a buffer. Data +read from a hole is returned as 0s. It is an error to try to read from a NULL +LOB/FILE. The OS FILE must already exist on the server and must have been +opened using the input locator. Oracle must hav epermission to read the OS +file and user must have read permission on the directory object. + +Parameters +svchp (IN/OUT) - the service context handle. +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +locp (IN/OUT) - a LOB locator that uniquely references a LOB. +offset (IN) - On input, it is the absolute offset, for character LOBs in the +number of characters from the beginning of the LOB, for binary LOBs it is the +number of bytes. Starts from 1. +amtp (IN/OUT) - On input, the number of character or bytes to be read. On +output, the actual number of bytes or characters read. +If the amount of bytes to be read is larger than the buffer length it is +assumed that the LOB is being read in a streamed mode. On input if this value +is 0, then the data shall be read in streamed mode from the LOB until the end +of LOB. If the data is read in pieces, *amtp always contains the length of +the last piece read. If a callback function is defined, then this callback +function will be invoked each time bufl bytes are read off the pipe. Each +piece will be written into bufp. +If the callback function is not defined, then OCI_NEED_DATA error code will +be returned. The application must invoke the LOB read over and over again to +read more pieces of the LOB until the OCI_NEED_DATA error code is not +returned. The buffer pointer and the length can be different in each call +if the pieces are being read into different sizes and location. +bufp (IN) - the pointer to a buffer into which the piece will be read. The +length of the allocated memory is assumed to be bufl. +bufl (IN) - the length of the buffer in octets. +ctxp (IN) - the context for the call back function. Can be NULL. +cbfp (IN) - a callback that may be registered to be called for each piece. If +this is NULL, then OCI_NEED_DATA will be returned for each piece. +The callback function must return OCI_CONTINUE for the read to continue. +If any other error code is returned, the LOB read is aborted. + ctxp (IN) - the context for the call back function. Can be NULL. + bufp (IN) - a buffer pointer for the piece. + len (IN) - the length of length of current piece in bufp. + piece (IN) - which piece - OCI_FIRST_PIECE, OCI_NEXT_PIECE or + OCI_LAST_PIECE. +csid - the character set ID of the buffer data +csfrm - the character set form of the buffer data + +Related Functions +OCIErrorGet, OCILobWrite, OCILobFileOpen, OCILobFileSetName, CREATE DIRECTORY + + + + +OCILobTrim() + +Name + +OCI Lob Trim + +Purpose +Trims the lob value to a shorter length + +Syntax +sword OCILobTrim ( OCISvcCtx *svchp, + OCIError *errhp, + OCILobLocator *locp, + ub4 newlen ); + +Comments +Truncates LOB data to a specified shorter length. + +Parameters +svchp (IN) - the service context handle. +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +locp (IN/OUT) - a LOB locator that uniquely references the LOB. This locator +must be a locator that was obtained from the server specified by svchp. +newlen (IN) - the new length of the LOB data, which must be less than or equal +to the current length. + +Related Functions +OCIErrorGet, OCILobWrite, OCiLobErase, OCILobAppend, OCILobCopy + + + + + +OCILobWrite() + +Name +OCI Lob Write + +Purpose +Writes a buffer into a LOB + +Syntax +sword OCILobWrite ( OCISvcCtx *svchp, + OCIError *errhp, + OCILobLocator *locp, + ub4 offset, + ub4 *amtp, + void *bufp, + ub4 buflen, + ub1 piece, + void *ctxp, + OCICallbackLobWrite (cbfp) + ( + void *ctxp, + void *bufp, + ub4 *lenp, + ub1 *piecep ) + ub2 csid + ub1 csfrm ); + + +Comments +Writes a buffer into a LOB as specified. If LOB data already exists +it is overwritten with the data stored in the buffer. +The buffer can be written to the LOB in a single piece with this call, or +it can be provided piecewise using callbacks or a standard polling method. +If this value of the piece parameter is OCI_FIRST_PIECE, data must be +provided through callbacks or polling. +If a callback function is defined in the cbfp parameter, then this callback +function will be invoked to get the next piece after a piece is written to +the pipe. Each piece will be written from bufp. +If no callback function is defined, then OCILobWrite() returns the +OCI_NEED_DATA error code. The application must all OCILobWrite() again +to write more pieces of the LOB. In this mode, the buffer pointer and the +length can be different in each call if the pieces are of different sizes and +from different locations. A piece value of OCI_LAST_PIECE terminates the +piecewise write. + +Parameters +svchp (IN/OUT) - the service context handle. +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +locp (IN/OUT) - a LOB locator that uniquely references a LOB. +offset (IN) - On input, it is the absolute offset, for character LOBs in +the number of characters from the beginning of the LOB, for binary LOBs it +is the number of bytes. Starts at 1. +bufp (IN) - the pointer to a buffer from which the piece will be written. The +length of the allocated memory is assumed to be the value passed in bufl. +Even if the data is being written in pieces, bufp must contain the first +piece of the LOB when this call is invoked. +bufl (IN) - the length of the buffer in bytes. +Note: This parameter assumes an 8-bit byte. If your platform uses a +longer byte, the value of bufl must be adjusted accordingly. +piece (IN) - which piece of the buffer is being written. The default value for +this parameter is OCI_ONE_PIECE, indicating the buffer will be written in a +single piece. +The following other values are also possible for piecewise or callback mode: +OCI_FIRST_PIECE, OCI_NEXT_PIECE and OCI_LAST_PIECE. +amtp (IN/OUT) - On input, takes the number of character or bytes to be +written. On output, returns the actual number of bytes or characters written. +If the data is written in pieces, *amtp will contain the total length of the +pieces written at the end of the call (last piece written) and is undefined in +between. +(Note it is different from the piecewise read case) +ctxp (IN) - the context for the call back function. Can be NULL. +cbfp (IN) - a callback that may be registered to be called for each piece in +a piecewise write. If this is NULL, the standard polling method will be used. +The callback function must return OCI_CONTINUE for the write to continue. +If any other error code is returned, the LOB write is aborted. The +callback takes the following parameters: + ctxp (IN) - the context for the call back function. Can be NULL. + bufp (IN/OUT) - a buffer pointer for the piece. + lenp (IN/OUT) - the length of the buffer (in octets) and the length of + current piece in bufp (out octets). + piecep (OUT) - which piece - OCI_NEXT_PIECE or OCI_LAST_PIECE. +csid - the character set ID of the buffer data +csfrm - the character set form of the buffer data +Related Functions + +OCILobWriteAppend() + +Name +OCI Lob Write Append + +Purpose +Writes data to the end of a LOB value. This call provides the ability +to get the length of the data and append it to the end of the LOB in +a single round trip to the server. + +Syntax +sword OCILobWriteAppend ( OCISvcCtx *svchp, + OCIError *errhp, + OCILobLocator *locp, + ub4 *amtp, + void *bufp, + ub4 buflen, + ub1 piece, + void *ctxp, + OCICallbackLobWrite (cbfp) + ( + void *ctxp, + void *bufp, + ub4 *lenp, + ub1 *piecep ) + ub2 csid + ub1 csfrm ); + + +Comments +Writes a buffer to the end of a LOB as specified. If LOB data already exists +it is overwritten with the data stored in the buffer. +The buffer can be written to the LOB in a single piece with this call, or +it can be provided piecewise using callbacks or a standard polling method. +If this value of the piece parameter is OCI_FIRST_PIECE, data must be +provided through callbacks or polling. +If a callback function is defined in the cbfp parameter, then this callback +function will be invoked to get the next piece after a piece is written to the +pipe. Each piece will be written from bufp. +If no callback function is defined, then OCILobWriteAppend() returns the +OCI_NEED_DATA error code. The application must all OCILobWriteAppend() again +to write more pieces of the LOB. In this mode, the buffer pointer and the +length can be different in each call if the pieces are of different sizes and +from different locations. A piece value of OCI_LAST_PIECE terminates the +piecewise write. + +Parameters +svchp (IN/OUT) - the service context handle. +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +locp (IN/OUT) - a LOB locator that uniquely references a LOB. +bufp (IN) - the pointer to a buffer from which the piece will be written. The +length of the allocated memory is assumed to be the value passed in bufl. Even +if the data is being written in pieces, bufp must contain the first piece of +the LOB when this call is invoked. +bufl (IN) - the length of the buffer in bytes. +Note: This parameter assumes an 8-bit byte. If your platform uses a +longer byte, the value of bufl must be adjusted accordingly. +piece (IN) - which piece of the buffer is being written. The default value for +this parameter is OCI_ONE_PIECE, indicating the buffer will be written in a +single piece. +The following other values are also possible for piecewise or callback mode: +OCI_FIRST_PIECE, OCI_NEXT_PIECE and OCI_LAST_PIECE. +amtp (IN/OUT) - On input, takes the number of character or bytes to be +written. On output, returns the actual number of bytes or characters written. +If the data is written in pieces, *amtp will contain the total length of the +pieces written at the end of the call (last piece written) and is undefined in +between. +(Note it is different from the piecewise read case) +ctxp (IN) - the context for the call back function. Can be NULL. +cbfp (IN) - a callback that may be registered to be called for each piece in a +piecewise write. If this is NULL, the standard polling method will be used. +The callback function must return OCI_CONTINUE for the write to continue. +If any other error code is returned, the LOB write is aborted. The +callback takes the following parameters: + ctxp (IN) - the context for the call back function. Can be NULL. + bufp (IN/OUT) - a buffer pointer for the piece. + lenp (IN/OUT) - the length of the buffer (in octets) and the length of + current piece in bufp (out octets). + piecep (OUT) - which piece - OCI_NEXT_PIECE or OCI_LAST_PIECE. +csid - the character set ID of the buffer data +csfrm - the character set form of the buffer data +Related Functions + + + + +OCILobGetStorageLimit() + +Name +OCI Lob Get Storage Limit + +Purpose +To get the maximum Length of a LOB in bytes that can be stored in the database. + +Syntax +sword OCILobGetStorageLimit ( OCISvcCtx *svchp, + OCIError *errhp, + OCILobLocator *locp, + oraub8 *limitp); + + +Comments +With unlimited size LOB support the limit for a LOB is no longer restricted +to 4GB. +This interface should be used to get the actual limit for storing data for +a specific +LOB locator. Note that if the compatibality is set to 9.2 or older the limit +would still be 4GB. + +Parameters +svchp (IN/OUT) - the service context handle. +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +locp (IN/OUT) - a LOB locator that uniquely references a LOB. +limitp (OUT) - The storage limit for a LOB in bytes. +Related Functions + + + + +OCILobGetOptions() + +Name +OCI Lob Get Options + +Purpose +To get the current options set for the given SecureFile. + +Syntax +sword OCILobGetOptions ( OCISvcCtx *svchp, + OCIError *errhp, + OCILobLocator *locp, + ub4 optypes, + void *optionsp, + ub4 *optionslenp, + ub4 mode); + + +Comments +This function only works on SecureFiles. All others will get an error. + +Parameters +svchp (IN/OUT) - the service context handle. +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +locp (IN/OUT) - a LOB locator that uniquely references a LOB. +optypes (IN) - the types of options flags to be retrieved. +optionsp (OUT) - the options flags or value for the given types. +optionslenp (IN/OUT) - the length of option_value buffer +mode (IN) - for future use (pass 0 for now). +Related Functions +OCISetOptions() + +OCILobSetOptions() + +Name +OCI Lob Set Options + +Purpose +To set the options for the given SecureFile Lob. + +Syntax +sword OCILobSetOptions ( OCISvcCtx *svchp, + OCIError *errhp, + OCILobLocator *locp, + ub4 optypes, + void *optionsp, + ub4 optionslen, + ub4 mode); + + +Comments +This function only works on SecureFile Lobs. All others will get an error. + +Parameters +svchp (IN/OUT) - the service context handle. +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +locp (IN/OUT) - a LOB locator that uniquely references a LOB. +optypes (IN) - the types of options flags to be set. +optionsp (IN) - the options flags or value to be set for the given types. +optionslen (IN) - then length of option_value buffer +mode (IN) - for future use (pass 0 for now). +Related Functions +OCILobGetOptions() + +OCILobGetContentType() + +Name +OCI Lob Get Content Type + +Purpose +To get the current contenttype set for the given SecureFile. + +Syntax +sword OCILobGetContentType (OCISvcCtx *svchp, + OCIError *errhp, + OCILobLocator *locp, + oratext *contenttypep, + ub4 *contenttypelenp, + ub4 mode); + + +Comments +This function only works on SecureFiles. All others will get an error. +If the securefile does not have a contenttype associated with it, +the contenttype length (= *contenttypelenp) is returned as 0 without +modifying the buffer contenttypep. +Parameters +svchp (IN/OUT) - the service context handle. +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for + diagnostic information in the event of an error. +locp (IN/OUT) - a LOB locator that uniquely references a LOB. +contenttypep(IN/OUT)- pointer to the buffer where the contenttype is stored + after successful execution. + The caller needs to allocate the buffer before calling + this function. The size of the allocated buffer should + be >= OCI_LOB_CONTENTTYPE_MAXSIZE bytes +contenttypelenp(IN/OUT)- The caller should set this field to the size + of contenttypep buffer. + After the call successfully executes, it will hold the + size of the contenttype returned. +mode (IN) - for future use (pass 0 for now). +Related Functions +OCISetContentType() + +OCILobSetContentType() + +Name +OCI Lob Set Content Type + +Purpose +To set the contenttype for the given SecureFile Lob. + +Syntax +sword OCILobSetContentType (OCISvcCtx *svchp, + OCIError *errhp, + OCILobLocator *locp, + const oratext *contenttypep, + ub4 contenttypelen, + ub4 mode); + + +Comments +This function only works on SecureFiles. All others will get an error. +To clear an existing contenttype set on a securefile, the user will +invoke OCILobSetContentType API with contenttypep set to (oratext *)0, +and contenttypelen set to 0. +Parameters +svchp (IN/OUT) - the service context handle. +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +locp (IN/OUT) - a LOB locator that uniquely references a LOB. +contenttypep (IN) - the contenttype to be set for the given LOB. +contenttypelen(IN) - the size of contenttype in bytes. The size of the + contenttype should be <= OCI_LOB_CONTENTTYPE_MAXSIZE + bytes. +mode (IN) - for future use (pass 0 for now). +Related Functions +OCILobGetContentType() + + +OCILogoff() +Name +OCI simplified Logoff +Purpose +This function is used to terminate a session created with OCILogon() or +OCILogon2(). +Syntax +sword OCILogoff ( OCISvcCtx *svchp + OCIError *errhp ); +Comments +This call is used to terminate a session which was created with OCILogon() or +OCILogon2(). +This call implicitly deallocates the server, authentication, and service +context handles. +Note: For more information on logging on and off in an application, +refer to the section "Application Initialization, Connection, and +Authorization" on page 2-16. +Parameters +svchp (IN) - the service context handle which was used in the call to +OCILogon() or OCILogon2(). +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +See Also +OCILogon(), OCILogon2(). + + + + + + +OCILogon() +Name +OCI Service Context Logon +Purpose +This function is used to create a simple logon session. +Syntax +sword OCILogon ( OCIEnv *envhp, + OCIError *errhp, + OCISvcCtx *svchp, + const OraText *username, + ub4 uname_len, + const OraText *password, + ub4 passwd_len, + const OraText *dbname, + ub4 dbname_len ); +Comments +This function is used to create a simple logon session for an application. +Note: Users requiring more complex session (e.g., TP monitor +applications) should refer to the section "Application Initialization, +Connection, and Authorization" on page 2-16. +This call allocates the error and service context handles which are passed to +it. This call also implicitly allocates server and authentication handles +associated with the session. These handles can be retrieved by calling +OCIAttrGet() on the service context handle. +Parameters +envhp (IN) - the OCI environment handle. +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +svchp (OUT) - the service context pointer. +username (IN) - the username. +uname_len (IN) - the length of username. +password (IN) - the user's password. +passwd_len (IN) - the length of password. +dbname (IN) - the name of the database to connect to. +dbname_len (IN) - the length of dbname. +See Also +OCILogoff() + + + + + +OCILogon2() +Name +OCI Service Context Logon +Purpose +This function is used to create a logon session in connection pooling mode. +Syntax +sword OCILogon2 ( OCIEnv *envhp, + OCIError *errhp, + OCISvcCtx **svchp, + const OraText *username, + ub4 uname_len, + const OraText *password, + ub4 passwd_len, + const OraText *dbname, + ub4 dbname_len, + ub4 mode); +Comments +This function is used to create a simple logon session for an application in +Connection Pooling mode. The valid values for mode are currently OCI_POOL and +OCI_DEFAULT. Call to this function with OCI_DEFAULT mode is equivalent to +OCILogon() call. +This call allocates the error and service context handles which are passed to +it. This call also implicitly allocates server and authentication handles +associated with the session. These handles can be retrieved by calling +OCIAttrGet() on the service context handle. This call assumes that +OCIConnectionPoolCreate() has already been called for the same dbname. +Parameters +envhp (IN) - the OCI environment handle. +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +svchp (OUT) - the service context pointer. +username (IN) - the username. +uname_len (IN) - the length of username. +password (IN) - the user's password. If this is null, it is assumed that a + proxy session has to be created and the required grants on + the database are already done. +passwd_len (IN) - the length of password. +dbname (IN) - the name of the database to connect to. +dbname_len (IN) - the length of dbname. +mode (IN) - the mode for doing the server attach. Should be OCI_POOL for + using Connection Pooling. + + +See Also +OCILogoff() + + + + + +OCIMemoryFree() +Name +OCI FREE Memory +Purpose +Frees up storage associated with the pointer. +Syntax +void OCIMemoryFree ( const OCIStmt *stmhp, + void *memptr); +Comments +Frees up dynamically allocated data pointers associated with the pointer using +either the default memory free function or the registered memory free +function, as the case may be. +A user-defined memory free function can be registered during the initial call +to OCIInitialize(). +This call is always successful. +Parameters +stmhp (IN) - statement handle which returned this data buffer. +memptr (IN) - pointer to data allocated by the client library. +Related Functions +OCIInitialize() + + + + + +OCIParamGet() +Name +OCI Get PARaMeter +Purpose +Returns a descriptor of a parameter specified by position in the describe +handle or statement handle. +Syntax +sword OCIParamGet ( const void *hndlp, + ub4 htype, + OCIError *errhp, + void **parmdpp, + ub4 pos ); +Comments +This call returns a descriptor of a parameter specified by position in the +describe handle or statement handle. Parameter descriptors are always +allocated internally by the OCI library. They are read-only. +OCI_NO_DATA may be returned if there are no parameter descriptors for this +position. +See Appendix B for more detailed information about parameter descriptor +attributes. +Parameters +hndlp (IN) - a statement handle or describe handle. The OCIParamGet() +function will return a parameter descriptor for this handle. +htype (IN) - the type of the handle passed in the handle parameter. Valid +types are OCI_HTYPE_DESCRIBE, for a describe handle OCI_HTYPE_STMT, for a +statement handle +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +parmdpp (OUT) - a descriptor of the parameter at the position given in the pos +parameter. +pos (IN) - position number in the statement handle or describe handle. A +parameter descriptor will be returned for this position. +Note: OCI_NO_DATA may be returned if there are no parameter +descriptors for this position. +Related Functions +OCIAttrGet(), OCIAttrSet() + + + + + +OCIParamSet() +Name +OCI Parameter Set in handle +Purpose +Used to set a complex object retrieval descriptor into a complex object +retrieval handle. +Syntax +sword OCIParamGet ( void *hndlp, + ub4 htyp, + OCIError *errhp, + const void *dscp, + ub4 dtyp, + ub4 pos ); +Comments +This call sets a given complex object retrieval descriptor into a complex +object retrieval handle. +The handle must have been previously allocated using OCIHandleAlloc(), and +the descriptor must have been previously allocated using OCIDescAlloc(). +Attributes of the descriptor are set using OCIAttrSet(). +Parameters +hndlp (IN/OUT) - handle pointer. +htype (IN) - handle type. +errhp (IN/OUT) - error handle. +dscp (IN) - complex object retrieval descriptor pointer. +dtyp (IN) - +pos (IN) - position number. +See Also + + + + + +OCIPasswordChange() +Name +OCI Change PassWord +Purpose +This call allows the password of an account to be changed. +Syntax +sword OCIPasswordChange ( OCISvcCtx *svchp, + OCIError *errhp, + const OraText *user_name, + ub4 usernm_len, + const OraText *opasswd, + ub4 opasswd_len, + const OraText *npasswd, + sb4 npasswd_len, + ub4 mode); +Comments +This call allows the password of an account to be changed. This call is +similar to OCISessionBegin() with the following differences: +If the user authentication is already established, it authenticates +the account using the old password and then changes the +password to the new password +If the user authentication is not established, it establishes a user +authentication and authenticates the account using the old +password, then changes the password to the new password. +This call is useful when the password of an account is expired and +OCISessionBegin() returns an error or warning which indicates that the +password has expired. +Parameters +svchp (IN/OUT) - a handle to a service context. The service context handle +must be initialized and have a server context handle associated with it. +errhp (IN) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +user_name (IN) - specifies the user name. It points to a character string, +whose length is specified in usernm_len. This parameter must be NULL if the +service context has been initialized with an authentication handle. +usernm_len (IN) - the length of the user name string specified in user_name. +For a valid user name string, usernm_len must be non-zero. +opasswd (IN) - specifies the user's old password. It points to a character +string, whose length is specified in opasswd_len . +opasswd_len (IN) - the length of the old password string specified in opasswd. +For a valid password string, opasswd_len must be non-zero. +npasswd (IN) - specifies the user's new password. It points to a character +string, whose length is specified in npasswd_len which must be non-zero for a +valid password string. If the password complexity verification routine is +specified in the user's profile to verify the new password's complexity, the +new password must meet the complexity requirements of the verification +function. +npasswd_len (IN) - then length of the new password string specified in +npasswd. For a valid password string, npasswd_len must be non-zero. +mode - pass as OCI_DEFAULT. +Related Functions +OCISessionBegin() + + +----------------------------------OCIReset------------------------------------ + + +OCIReset() +Name +OCI Reset +Purpose +Resets the interrupted asynchronous operation and protocol. Must be called +if a OCIBreak call had been issued while a non-blocking operation was in +progress. +Syntax +sword OCIReset ( void *hndlp, + OCIError *errhp); +Comments +This call is called in non-blocking mode ONLY. Resets the interrupted +asynchronous operation and protocol. Must be called if a OCIBreak call +had been issued while a non-blocking operation was in progress. +Parameters +hndlp (IN) - the service context handle or the server context handle. +errhp (IN) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +Related Functions + + +OCIResultSetToStmt() +Name +OCI convert Result Set to Statement Handle +Purpose +Converts a descriptor to statement handle for fetching rows. +Syntax +sword OCIResultSetToStmt ( OCIResult *rsetdp, + OCIError *errhp ); +Comments +Converts a descriptor to statement handle for fetching rows. +A result set descriptor can be allocated with a call to OCIDescAlloc(). +Parameters +rsetdp (IN/OUT) - a result set descriptor pointer. +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +Related Functions +OCIDescAlloc() + + + + +OCIServerAttach() +Name +OCI ATtaCH to server +Purpose +Creates an access path to a data source for OCI operations. +Syntax +sword OCIServerAttach ( OCIServer *srvhp, + OCIError *errhp, + const OraText *dblink, + sb4 dblink_len, + ub4 mode); +Comments +This call is used to create an association between an OCI application and a +particular server. +This call initializes a server context handle, which must have been previously +allocated with a call to OCIHandleAlloc(). +The server context handle initialized by this call can be associated with a +service context through a call to OCIAttrSet(). Once that association has been +made, OCI operations can be performed against the server. +If an application is operating against multiple servers, multiple server +context handles can be maintained. OCI operations are performed against +whichever server context is currently associated with the service context. +Parameters +srvhp (IN/OUT) - an uninitialized server context handle, which gets +initialized by this call. Passing in an initialized server handle causes an +error. +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +dblink (IN) - specifies the database (server) to use. This parameter points to +a character string which specifies a connect string or a service point. If the +connect string is NULL, then this call attaches to the default host. The length +of connstr is specified in connstr_len. The connstr pointer may be freed by the +caller on return. +dblink_len (IN) - the length of the string pointed to by connstr. For a valid +connect string name or alias, connstr_len must be non-zero. +mode (IN) - specifies the various modes of operation. For release 8.0, pass as +OCI_DEFAULT - in this mode, calls made to the server on this server context +are made in blocking mode. +Example +See the description of OCIStmtPrepare() on page 13-96 for an example showing +the use of OCIServerAttach(). +Related Functions +OCIServerDetach() + + + +OCIServerDetach() +Name +OCI DeTaCH server +Purpose +Deletes an access to a data source for OCI operations. +Syntax +sword OCIServerDetach ( OCIServer *svrhp, + OCIError *errhp, + ub4 mode); +Comments +This call deletes an access to data source for OCI operations, which was +established by a call to OCIServerAttach(). +Parameters +srvhp (IN) - a handle to an initialized server context, which gets reset to +uninitialized state. The handle is not de-allocated. +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +mode (IN) - specifies the various modes of operation. The only valid mode is +OCI_DEFAULT for the default mode. +Related Functions +OCIServerAttach() + + + +OCIServerVersion() +Name +OCI VERSion +Purpose +Returns the version string of the Oracle server. +Syntax +sword OCIServerVersion ( void *hndlp, + OCIError *errhp, + OraText *bufp, + ub4 bufsz + ub1 hndltype ); +Comments +This call returns the version string of the Oracle server. +For example, the following might be returned as the version string if your +application is running against a 7.3.2 server: +Oracle7 Server Release 7.3.2.0.0 - Production Release +PL/SQL Release 2.3.2.0.0 - Production +CORE Version 3.5.2.0.0 - Production +TNS for SEQUENT DYNIX/ptx: Version 2.3.2.0.0 - Production +NLSRTL Version 3.2.2.0.0 - Production + +Parameters +hndlp (IN) - the service context handle or the server context handle. +errhp (IN) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +bufp (IN) - the buffer in which the version information is returned. +bufsz (IN) - the length of the buffer. +hndltype (IN) - the type of handle passed to the function. +Related Functions + + + + + +OCISessionBegin() +Name +OCI Session Begin and authenticate user +Purpose +Creates a user authentication and begins a user session for a given server. +Syntax +sword OCISessionBegin ( OCISvcCtx *svchp, + OCIError *errhp, + OCISession *usrhp, + ub4 credt, + ub4 mode); + +Comments +For Oracle8, OCISessionBegin() must be called for any given server handle +before requests can be made against it. Also, OCISessionBegin() only supports +authenticating the user for access to the Oracle server specified by the +server handle in the service context. In other words, after OCIServerAttach() +is called to initialize a server handle, OCISessionBegin() must be called to +authenticate the user for that given server. +When OCISessionBegin() is called for the first time for the given server +handle, the initialized authentication handle is called a primary +authentication context. A primary authentication context may not be created +with the OCI_MIGRATE mode. Also, only one primary authentication context can +be created for a given server handle and the primary authentication context c +an only ever be used with that server handle. If the primary authentication +context is set in a service handle with a different server handle, then an +error will result. +After OCISessionBegin() has been called for the server handle, and the primary +authentication context is set in the service handle, OCISessionBegin() may be +called again to initialize another authentication handle with different (or +the same) credentials. When OCISessionBegin() is called with a service handle +set with a primary authentication context, the returned authentication context +in authp is called a user authentication context. As many user authentication +contexts may be initialized as desired. +User authentication contexts may be created with the OCI_MIGRATE mode. +If the OCI_MIGRATE mode is not specified, then the user authentication +context can only ever be used with the same server handle set in svchp. If +OCI_MIGRATE mode is specified, then the user authentication may be set +with different server handles. However, the user authentication context is +restricted to use with only server handles which resolve to the same database +instance and that have equivalent primary authentication contexts. Equivalent +authentication contexts are those which were authenticated as the same +database user. +OCI_SYSDBA, OCI_SYSOPER, OCI_SYSASM, and OCI_PRELIM_AUTH may only be used +with a primary authentication context. +To provide credentials for a call to OCISessionBegin(), one of two methods are +supported. The first is to provide a valid username and password pair for +database authentication in the user authentication handle passed to +OCISessionBegin(). This involves using OCIAttrSet() to set the +OCI_ATTR_USERNAME and OCI_ATTR_PASSWORD attributes on the +authentication handle. Then OCISessionBegin() is called with +OCI_CRED_RDBMS. +Note: When the authentication handle is terminated using +OCISessionEnd(), the username and password attributes remain +unchanged and thus can be re-used in a future call to OCISessionBegin(). +Otherwise, they must be reset to new values before the next +OCISessionBegin() call. +The second type of credentials supported are external credentials. No +attributes need to be set on the authentication handle before calling +OCISessionBegin(). The credential type is OCI_CRED_EXT. This is equivalent +to the Oracle7 `connect /' syntax. If values have been set for +OCI_ATTR_USERNAME and OCI_ATTR_PASSWORD, then these are +ignored if OCI_CRED_EXT is used. +Parameters +svchp (IN) - a handle to a service context. There must be a valid server +handle set in svchp. +errhp (IN) - an error handle to the retrieve diagnostic information. +usrhp (IN/OUT) - a handle to an authentication context, which is initialized +by this call. +credt (IN) - specifies the type of credentials to use for authentication. +Valid values for credt are: +OCI_CRED_RDBMS - authenticate using a database username and +password pair as credentials. The attributes OCI_ATTR_USERNAME +and OCI_ATTR_PASSWORD should be set on the authentication +context before this call. +OCI_CRED_EXT - authenticate using external credentials. No username +or password is provided. +mode (IN) - specifies the various modes of operation. Valid modes are: +OCI_DEFAULT - in this mode, the authentication context returned may +only ever be set with the same server context specified in svchp. This +establishes the primary authentication context. +OCI_MIGRATE - in this mode, the new authentication context may be +set in a service handle with a different server handle. This mode +establishes the user authentication context. +OCI_SYSDBA - in this mode, the user is authenticated for SYSDBA +access. +OCI_SYSOPER - in this mode, the user is authenticated for SYSOPER +access. +OCI_SYSASM - in this mode, the user is authenticated for SYSASM +access. Note that only an ASM instance can grant SYSASM access. +OCI_PRELIM_AUTH - this mode may only be used with OCI_SYSDBA, OCI_SYSASM, +or OCI_SYSOPER to authenticate for certain administration tasks. +Related Functions +OCISessionEnd() + + + + + + +OCISessionEnd() +Name +OCI Terminate user Authentication Context +Purpose +Terminates a user authentication context created by OCISessionBegin() +Syntax +sword OCISessionEnd ( OCISvcCtx *svchp, + OCIError *errhp, + OCISession *usrhp, + ub4 mode); + +Comments +The user security context associated with the service context is invalidated +by this call. Storage for the authentication context is not freed. The +transaction specified by the service context is implicitly committed. The +transaction handle, if explicitly allocated, may be freed if not being used. +Resources allocated on the server for this user are freed. +The authentication handle may be reused in a new call to OCISessionBegin(). +Parameters +svchp (IN/OUT) - the service context handle. There must be a valid server +handle and user authentication handle associated with svchp. +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +usrhp (IN) - de-authenticate this user. If this parameter is passed as NULL, +the user in the service context handle is de-authenticated. +mode (IN) - the only valid mode is OCI_DEFAULT. +Example +In this example, an authentication context is destroyed. +Related Functions +OCISessionBegin() + + + + +OCIStmtExecute() +Name +OCI EXECute +Purpose +This call associates an application request with a server. +Syntax +sword OCIStmtExecute ( OCISvcCtx *svchp, + OCIStmt *stmtp, + OCIError *errhp, + ub4 iters, + ub4 rowoff, + const OCISnapshot *snap_in, + OCISnapshot *snap_out, + ub4 mode ); +Comments +This function is used to execute a prepared SQL statement. +Using an execute call, the application associates a request with a server. On +success, OCI_SUCCESS is returned. +If a SELECT statement is executed, the description of the select list follows +implicitly as a response. This description is buffered on the client side for +describes, fetches and define type conversions. Hence it is optimal to +describe a select list only after an execute. +Also for SELECT statements, some results are available implicitly. Rows will +be received and buffered at the end of the execute. For queries with small row +count, a prefetch causes memory to be released in the server if the end of +fetch is reached, an optimization that may result in memory usage reduction. +Set attribute call has been defined to set the number of rows to be prefetched +per result set. +For SELECT statements, at the end of the execute, the statement handle +implicitly maintains a reference to the service context on which it is +executed. It is the user's responsibility to maintain the integrity of the +service context. If the attributes of a service context is changed for +executing some operations on this service context, the service context must +be restored to have the same attributes, that a statement was executed with, +prior to a fetch on the statement handle. The implicit reference is maintained +until the statement handle is freed or the fetch is cancelled or an end of +fetch condition is reached. +Note: If output variables are defined for a SELECT statement before a +call to OCIStmtExecute(), the number of rows specified by iters will be +fetched directly into the defined output buffers and additional rows +equivalent to the prefetch count will be prefetched. If there are no +additional rows, then the fetch is complete without calling +OCIStmtFetch(). +The execute call will return errors if the statement has bind data types that +are not supported in an Oracle7 server. +Parameters +svchp (IN/OUT) - service context handle. +stmtp (IN/OUT) - an statement handle - defines the statement and the +associated data to be executed at the server. It is invalid to pass in a +statement handle that has bind of data types only supported in release 8.0 +when srvchp points to an Oracle7 server. +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. If the statement is being +batched and it is successful, then this handle will contain this particular +statement execution specific errors returned from the server when the batch is +flushed. +iters (IN) - the number of times this statement is executed for non-Select +statements. For Select statements, if iters is non-zero, then defines must +have been done for the statement handle. The execution fetches iters rows into +these predefined buffers and prefetches more rows depending upon the prefetch +row count. This function returns an error if iters=0 for non-SELECT +statements. +rowoff (IN) - the index from which the data in an array bind is relevant for +this multiple row execution. +snap_in (IN) - this parameter is optional. if supplied, must point to a +snapshot descriptor of type OCI_DTYPE_SNAP. The contents of this descriptor +must be obtained from the snap_out parameter of a previous call. The +descriptor is ignored if the SQL is not a SELECT. This facility allows +multiple service contexts to ORACLE to see the same consistent snapshot of the +database's committed data. However, uncommitted data in one context is not +visible to another context even using the same snapshot. +snap_out (OUT) - this parameter optional. if supplied, must point to a +descriptor of type OCI_DTYPE_SNAP. This descriptor is filled in with an +opaque representation which is the current ORACLE "system change +number" suitable as a snap_in input to a subsequent call to OCIStmtExecute(). +This descriptor should not be used any longer than necessary in order to avoid +"snapshot too old" errors. +mode (IN) - The modes are: +If OCI_DEFAULT_MODE, the default mode, is selected, the request is +immediately executed. Error handle contains diagnostics on error if any. +OCI_EXACT_FETCH - if the statement is a SQL SELECT, this mode is +only valid if the application has set the prefetch row count prior to this +call. In this mode, the OCI library will get up to the number of rows +specified (i.e., prefetch row count plus iters). If the number of rows +returned by the query is greater than this value, OCI_ERROR will be +returned with ORA-01422 as the implementation specific error in a +diagnostic record. If the number of rows returned by the query is +smaller than the prefetch row count, OCI_SUCCESS_WITH_INFO will +be returned with ORA-01403 as the implementation specific error. The +prefetch buffer size is ignored and the OCI library tries to allocate all the +space required to contain the prefetched rows. The exact fetch semantics +apply to only the top level rows. No more rows can be fetched for this +query at the end of the call. +OCI_KEEP_FETCH_STATE - the result set rows (not yet fetched) of this +statement executed in this transaction will be maintained when the +transaction is detached for migration. By default, a query is cancelled +when a transaction is detached for migration. This mode is the default +mode when connected to a V7 server. +Related Functions +OCIStmtPrepare() + + + + + +OCIStmtFetch() +Name +OCI FetCH +Purpose +Fetches rows from a query. +Syntax +sword OCIStmtFetch ( OCIStmt *stmtp, + OCIError *errhp, + ub4 nrows, + ub2 orientation, + ub4 mode); +Comments +The fetch call is a local call, if prefetched rows suffice. However, this is +transparent to the application. If LOB columns are being read, LOB locators +are fetched for subsequent LOB operations to be performed on these locators. +Prefetching is turned off if LONG columns are involved. +A fetch with nrows set to 0 rows effectively cancels the fetch for this +statement. +Parameters +stmtp (IN) - a statement (application request) handle. +errhp (IN) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +nrows (IN) - number of rows to be fetched from the current position. +orientation (IN) - for release 8.0, the only acceptable value is +OCI_FETCH_NEXT, which is also the default value. +mode (IN) - for release 8.0, beta-1, the following mode is defined. +OCI_DEFAULT - default mode +OCI_EOF_FETCH - indicates that it is the last fetch from the result set. +If nrows is non-zero, setting this mode effectively cancels fetching after +retrieving nrows, otherwise it cancels fetching immediately. +Related Functions +OCIAttrGet() + +OCIStmtFetch2() +Name +OCI FetCH2 +Purpose +Fetches rows from a query. +Syntax +sword OCIStmtFetch2 ( OCIStmt *stmtp, + OCIError *errhp, + ub4 nrows, + ub2 orientation, + ub4 scrollOffset, + ub4 mode); +Comments +The fetch call works similar to the OCIStmtFetch call with the +addition of the fetchOffset parameter. It can be used on any +statement handle, whether it is scrollable or not. For a +non-scrollable statement handle, the only acceptable value +will be OCI_FETCH_NEXT, and the fetchOffset parameter will be +ignored. Applications are encouraged to use this new call. + +A fetchOffset with OCI_FETCH_RELATIVE is equivalent to +OCI_FETCH_CURRENT with a value of 0, is equivalent to +OCI_FETCH_NEXT with a value of 1, and equivalent to +OCI_FETCH_PRIOR with a value of -1. Note that the range of +accessible rows is [1,OCI_ATTR_ROW_COUNT] beyond which an +error could be raised if sufficient rows do not exist in + +The fetch call is a local call, if prefetched rows suffice. However, this is +transparent to the application. If LOB columns are being read, LOB locators +are fetched for subsequent LOB operations to be performed on these locators. +Prefetching is turned off if LONG columns are involved. +A fetch with nrows set to 0 rows effectively cancels the fetch for this +statement. +Parameters +stmtp (IN) - a statement (application request) handle. +errhp (IN) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +nrows (IN) - number of rows to be fetched from the current position. +It defaults to 1 for orientation OCI_FETCH_LAST. +orientation (IN) - The acceptable values are as follows, with +OCI_FETCH_NEXT being the default value. +OCI_FETCH_CURRENT gets the current row, +OCI_FETCH_NEXT gets the next row from the current position, +OCI_FETCH_FIRST gets the first row in the result set, +OCI_FETCH_LAST gets the last row in the result set, +OCI_FETCH_PRIOR gets the previous row from the current row in the result set, +OCI_FETCH_ABSOLUTE will fetch the row number (specified by fetchOffset +parameter) in the result set using absolute positioning, +OCI_FETCH_RELATIVE will fetch the row number (specified by fetchOffset +parameter) in the result set using relative positioning. +scrollOffset(IN) - offset used with the OCI_FETCH_ABSOLUTE and +OCI_FETCH_RELATIVE orientation parameters only. It specify +the new current position for scrollable result set. It is +ignored for non-scrollable result sets. +mode (IN) - for release 8.0, beta-1, the following mode is defined. +OCI_DEFAULT - default mode +OCI_EOF_FETCH - indicates that it is the last fetch from the result set. +If nrows is non-zero, setting this mode effectively cancels fetching after +retrieving nrows, otherwise it cancels fetching immediately. +Related Functions +OCIAttrGet() + + + +OCIStmtGetPieceInfo() +Name +OCI Get Piece Information +Purpose +Returns piece information for a piecewise operation. +Syntax +sword OCIStmtGetPieceInfo( const OCIStmt *stmtp, + OCIError *errhp, + void **hndlpp, + ub4 *typep, + ub1 *in_outp, + ub4 *iterp, + ub4 *idxp, + ub1 *piecep ); + +Comments +When an execute/fetch call returns OCI_NEED_DATA to get/return a +dynamic bind/define value or piece, OCIStmtGetPieceInfo() returns the +relevant information: bind/define handle, iteration or index number and +which piece. +See the section "Runtime Data Allocation and Piecewise Operations" on page +5-16 for more information about using OCIStmtGetPieceInfo(). +Parameters +stmtp (IN) - the statement when executed returned OCI_NEED_DATA. +errhp (OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +hndlpp (OUT) - returns a pointer to the bind or define handle of the bind or +define whose runtime data is required or is being provided. +typep (OUT) - the type of the handle pointed to by hndlpp: OCI_HTYPE_BIND +(for a bind handle) or OCI_HTYPE_DEFINE (for a define handle). +in_outp (OUT) - returns OCI_PARAM_IN if the data is required for an IN bind +value. Returns OCI_PARAM_OUT if the data is available as an OUT bind +variable or a define position value. +iterp (OUT) - returns the row number of a multiple row operation. +idxp (OUT) - the index of an array element of a PL/SQL array bind operation. +piecep (OUT) - returns one of the following defined values - +OCI_ONE_PIECE, OCI_FIRST_PIECE, OCI_NEXT_PIECE and +OCI_LAST_PIECE. The default value is always OCI_ONE_PIECE. +Related Functions +OCIAttrGet(), OCIAttrGet(), OCIStmtExecute(), OCIStmtFetch(), +OCIStmtSetPieceInfo() + + + + +OCIStmtPrepare() +Name +OCI Statement REQuest +Purpose +This call defines the SQL/PLSQL statement to be executed. +Syntax +sword OCIStmtPrepare ( OCIStmt *stmtp, + OCIError *errhp, + const OraText *stmt, + ub4 stmt_len, + ub4 language, + ub4 mode); +Comments +This call is used to prepare a SQL or PL/SQL statement for execution. The +OCIStmtPrepare() call defines an application request. +This is a purely local call. Data values for this statement initialized in +subsequent bind calls will be stored in a bind handle which will hang off this +statement handle. +This call does not create an association between this statement handle and any +particular server. +See the section "Preparing Statements" on page 2-21 for more information +about using this call. +Parameters +stmtp (IN) - a statement handle. +errhp (IN) - an error handle to retrieve diagnostic information. +stmt (IN) - SQL or PL/SQL statement to be executed. Must be a null-terminated +string. The pointer to the OraText of the statement must be available as long +as the statement is executed. +stmt_len (IN) - length of the statement. Must not be zero. +language (IN) - V7, V8, or native syntax. Possible values are: +OCI_V7_SYNTAX - V7 ORACLE parsing syntax +OCI_V8_SYNTAX - V8 ORACLE parsing syntax +OCI_NTV_SYNTAX - syntax depending upon the version of the server. +mode (IN) - the only defined mode is OCI_DEFAULT for default mode. +Example +This example demonstrates the use of OCIStmtPrepare(), as well as the OCI +application initialization calls. +Related Functions +OCIAttrGet(), OCIStmtExecute() + + +OCIStmtPrepare2() +Name +OCI Statement REQuest with (a) early binding to svchp and/or +(b) stmt caching +Purpose +This call defines the SQL/PLSQL statement to be executed. +Syntax +sword OCIStmtPrepare2 ( OCISvcCtx *svchp, + OCIStmt **stmtp, + OCIError *errhp, + const OraText *stmt, + ub4 stmt_len, + const OraText *key, + ub4 key_len, + ub4 language, + ub4 mode); +Comments +This call is used to prepare a SQL or PL/SQL statement for execution. The +OCIStmtPrepare() call defines an application request. +This is a purely local call. Data values for this statement initialized in +subsequent bind calls will be stored in a bind handle which will hang off this +statement handle. +This call creates an association between the statement handle and a service +context. It differs from OCIStmtPrepare in that respect.It also supports +stmt caching. The stmt will automatically be cached if the authp of the stmt +has enabled stmt caching. +Parameters +svchp (IN) - the service context handle that contains the session that + this stmt handle belongs to. +stmtp (OUT) - an unallocated stmt handle must be pased in. An allocated + and prepared statement handle will be returned. +errhp (IN) - an error handle to retrieve diagnostic information. +stmt (IN) - SQL or PL/SQL statement to be executed. Must be a null- + terminated string. The pointer to the OraText of the statement + must be available as long as the statement is executed. +stmt_len (IN) - length of the statement. Must not be zero. +key (IN) - This is only Valid for OCI Stmt Caching. It indicates the + key to search with. It thus optimizes the search in the cache. +key_len (IN) - the length of the key. This, too, is onlly valid for stmt + caching. +language (IN) - V7, V8, or native syntax. Possible values are: +OCI_V7_SYNTAX - V7 ORACLE parsing syntax +OCI_V8_SYNTAX - V8 ORACLE parsing syntax +OCI_NTV_SYNTAX - syntax depending upon the version of the server. +mode (IN) - the defined modes are OCI_DEFAULT and OCI_PREP2_CACHE_SEARCHONLY. +Example +Related Functions +OCIStmtExecute(), OCIStmtRelease() + + +OCIStmtRelease() +Name +OCI Statement Release. This call is used to relesae the stmt that +was retreived using OCIStmtPrepare2(). If the stmt is release +using this call, OCIHandleFree() must not be called on the stmt +handle. +Purpose +This call releases the statement obtained by OCIStmtPrepare2 +Syntax +sword OCIStmtRelease ( OCIStmt *stmtp, + OCIError *errhp, + cONST OraText *key, + ub4 key_len, + ub4 mode); +Comments +This call is used to release a handle obtained via OCIStmtPrepare2(). +It also frees the memory associated with the handle. +This is a purely local call. +Parameters +stmtp (IN/OUT) - The statement handle to be released/freed. +errhp (IN) - an error handle to retrieve diagnostic information. +key (IN) - This is only Valid for OCI Stmt Caching. It indicates the + key to tag the stmt with. +key_len (IN) - the length of the key. This, too, is only valid for stmt + caching. +mode (IN) - the defined modes are OCI_DEFAULT for default mode and + OCI_STRLS_CACHE_DELETE (only used for Stmt Caching). +Example +Related Functions +OCIStmtExecute(), OCIStmtPrepare2() + + +OCIStmtSetPieceInfo() +Name +OCI Set Piece Information +Purpose +Sets piece information for a piecewise operation. +Syntax +sword OCIStmtSetPieceInfo ( void *hndlp, + ub4 type, + OCIError *errhp, + const void *bufp, + ub4 *alenp, + ub1 piece, + const void *indp, + ub2 *rcodep ); +Comments +When an execute call returns OCI_NEED_DATA to get a dynamic IN/OUT +bind value or piece, OCIStmtSetPieceInfo() sets the piece information: the +buffer, the length, the indicator and which piece is currently being processed. +For more information about using OCIStmtSetPieceInfo() see the section +"Runtime Data Allocation and Piecewise Operations" on page 5-16. +Parameters +hndlp (IN/OUT) - the bind/define handle. +type (IN) - type of the handle. +errhp (OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +bufp (IN/OUT) - bufp is a pointer to a storage containing the data value or +the piece when it is an IN bind variable, otherwise bufp is a pointer to +storage for getting a piece or a value for OUT binds and define variables. For +named data types or REFs, a pointer to the object or REF is returned. +alenp (IN/OUT) - the length of the piece or the value. +piece (IN) - the piece parameter. The following are valid values: +OCI_ONE_PIECE, OCI_FIRST_PIECE, OCI_NEXT_PIECE, or +OCI_LAST_PIECE. +The default value is OCI_ONE_PIECE. This parameter is used for IN bind +variables only. +indp (IN/OUT) - indicator. A pointer to a sb2 value or pointer to an indicator +structure for named data types (SQLT_NTY) and REFs (SQLT_REF), i.e., *indp +is either an sb2 or a void * depending upon the data type. +rcodep (IN/OUT) - return code. +Related Functions +OCIAttrGet(), OCIAttrGet(), OCIStmtExecute(), OCIStmtFetch(), +OCIStmtGetPieceInfo() + + +OCIFormatInit +Name +OCIFormat Package Initialize +Purpose +Initializes the OCIFormat package. +Syntax +sword OCIFormatInit(void *hndl, OCIError *err); +Comments +This routine must be called before calling any other OCIFormat routine. +Returns OCI_SUCCESS, OCI_INVALID_HANDLE, or OCI_ERROR +Parameters +hndl (IN/OUT) - OCI environment or session handle +err (IN/OUT) - OCI error handle +Related Functions +OCIFormatTerm() + + +OCIFormatString +Name +OCIFormat Package Format String +Purpose +Writes a text string into the supplied text buffer using the argument +list submitted to it and in accordance with the format string given. +Syntax +sword OCIFormatString(void *hndl, OCIError *err, OraText *buffer, + sbig_ora bufferLength, sbig_ora *returnLength, + const OraText *formatString, ...); +Comments +The first call to this routine must be preceded by a call to the +OCIFormatInit routine that initializes the OCIFormat package +for use. When this routine is no longer needed then terminate +the OCIFormat package by a call to the OCIFormatTerm routine. +Returns OCI_SUCCESS, OCI_INVALID_HANDLE, or OCI_ERROR +Parameters +hndl (IN/OUT) - OCI environment or session handle +err (IN/OUT) - OCI error handle +buffer (OUT) - text buffer for the string +bufferLength (IN) - length of the text buffer +returnLength (OUT) - length of the formatted string +formatString (IN) - format specification string +... (IN) - variable argument list +Related Functions + + +OCIFormatTerm +Name +OCIFormat Package Terminate +Purpose +Terminates the OCIFormat package. +Syntax +sword OCIFormatTerm(void *hndl, OCIError *err); +Comments +It must be called after the OCIFormat package is no longer being used. +Returns OCI_SUCCESS, OCI_INVALID_HANDLE, or OCI_ERROR +Parameters +hndl (IN/OUT) - OCI environment or session handle +err (IN/OUT) - OCI error handle +Related Functions +OCIFormatInit() + + +OCIFormatTUb1 +Name +OCIFormat Package ub1 Type +Purpose +Return the type value for the ub1 type. +Syntax +sword OCIFormatTUb1(void); +Comments +None +Parameters +None +Related Functions +None + + +OCIFormatTUb2 +Name +OCIFormat Package ub2 Type +Purpose +Return the type value for the ub2 type. +Syntax +sword OCIFormatTUb2(void); +Comments +None +Parameters +None +Related Functions +None + + +OCIFormatTUb4 +Name +OCIFormat Package ub4 Type +Purpose +Return the type value for the ub4 type. +Syntax +sword OCIFormatTUb4(void); +Comments +None +Parameters +None +Related Functions +None + + +OCIFormatTUword +Name +OCIFormat Package uword Type +Purpose +Return the type value for the uword type. +Syntax +sword OCIFormatTUword(void); +Comments +None +Parameters +None +Related Functions +None + + +OCIFormatTUbig_ora +Name +OCIFormat Package ubig_ora Type +Purpose +Return the type value for the ubig_ora type. +Syntax +sword OCIFormatTUbig_ora(void); +Comments +None +Parameters +None +Related Functions +None + + +OCIFormatTSb1 +Name +OCIFormat Package sb1 Type +Purpose +Return the type value for the sb1 type. +Syntax +sword OCIFormatTSb1(void); +Comments +None +Parameters +None +Related Functions +None + + +OCIFormatTSb2 +Name +OCIFormat Package sb2 Type +Purpose +Return the type value for the sb2 type. +Syntax +sword OCIFormatTSb2(void); +Comments +None +Parameters +None +Related Functions +None + + +OCIFormatTSb4 +Name +OCIFormat Package sb4 Type +Purpose +Return the type value for the sb4 type. +Syntax +sword OCIFormatTSb4(void); +Comments +None +Parameters +None +Related Functions +None + + +OCIFormatTSword +Name +OCIFormat Package sword Type +Purpose +Return the type value for the sword type. +Syntax +sword OCIFormatTSword(void); +Comments +None +Parameters +None +Related Functions +None + + +OCIFormatTSbig_ora +Name +OCIFormat Package sbig_ora Type +Purpose +Return the type value for the sbig_ora type. +Syntax +sword OCIFormatTSbig_ora(void); +Comments +None +Parameters +None +Related Functions +None + + +OCIFormatTEb1 +Name +OCIFormat Package eb1 Type +Purpose +Return the type value for the eb1 type. +Syntax +sword OCIFormatTEb1(void); +Comments +None +Parameters +None +Related Functions +None + + +OCIFormatTEb2 +Name +OCIFormat Package eb2 Type +Purpose +Return the type value for the eb2 type. +Syntax +sword OCIFormatTEb2(void); +Comments +None +Parameters +None +Related Functions +None + + +OCIFormatTEb4 +Name +OCIFormat Package eb4 Type +Purpose +Return the type value for the eb4 type. +Syntax +sword OCIFormatTEb4(void); +Comments +None +Parameters +None +Related Functions +None + + +OCIFormatTEword +Name +OCIFormat Package eword Type +Purpose +Return the type value for the eword type. +Syntax +sword OCIFormatTEword(void); +Comments +None +Parameters +None +Related Functions +None + + +OCIFormatTChar +Name +OCIFormat Package text Type +Purpose +Return the type value for the text type. +Syntax +sword OCIFormatTChar(void); +Comments +None +Parameters +None +Related Functions +None + + +OCIFormatTText +Name +OCIFormat Package *text Type +Purpose +Return the type value for the *text type. +Syntax +sword OCIFormatTText(void); +Comments +None +Parameters +None +Related Functions +None + + +OCIFormatTDouble +Name +OCIFormat Package double Type +Purpose +Return the type value for the double type. +Syntax +sword OCIFormatTDouble(void); +Comments +None +Parameters +None +Related Functions +None + + +OCIFormatDvoid +Name +OCIFormat Package void Type +Purpose +Return the type value for the void type. +Syntax +sword OCIFormatTDvoid(void); +Comments +None +Parameters +None +Related Functions +None + + +OCIFormatTEnd +Name +OCIFormat Package end Type +Purpose +Return the list terminator's "type". +Syntax +sword OCIFormatTEnd(void); +Comments +None +Parameters +None +Related Functions +None + + +OCISvcCtxToLda() +Name +OCI toggle SerVice context handle to Version 7 Lda_Def +Purpose +Toggles between a V8 service context handle and a V7 Lda_Def. +Syntax +sword OCISvcCtxToLda ( OCISvcCtx *srvhp, + OCIError *errhp, + Lda_Def *ldap ); +Comments +Toggles between an Oracle8 service context handle and an Oracle7 Lda_Def. +This function can only be called after a service context has been properly +initialized. +Once the service context has been translated to an Lda_Def, it can be used in +release 7.x OCI calls (e.g., obindps(), ofen()). +Note: If there are multiple service contexts which share the same server +handle, only one can be in V7 mode at any time. +The action of this call can be reversed by passing the resulting Lda_Def to +the OCILdaToSvcCtx() function. +Parameters +svchp (IN/OUT) - the service context handle. +errhp (IN/OUT) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +ldap (IN/OUT) - a Logon Data Area for V7-style OCI calls which is initialized +by this call. +Related Functions +OCILdaToSvcCtx() + + + + +OCITransCommit() +Name +OCI TX (transaction) CoMmit +Purpose +Commits the transaction associated with a specified service context. +Syntax +sword OCITransCommit ( OCISvcCtx *srvcp, + OCIError *errhp, + ub4 flags ); +Comments +The transaction currently associated with the service context is committed. If +it is a distributed transaction that the server cannot commit, this call +additionally retrieves the state of the transaction from the database to be +returned to the user in the error handle. +If the application has defined multiple transactions, this function operates +on the transaction currently associated with the service context. If the +application is working with only the implicit local transaction created when +database changes are made, that implicit transaction is committed. +If the application is running in the object mode, then the modified or updated +objects in the object cache for this transaction are also committed. +The flags parameter is used for one-phase commit optimization in distributed +transactions. If the transaction is non-distributed, the flags parameter is +ignored, and OCI_DEFAULT can be passed as its value. OCI applications +managing global transactions should pass a value of +OCI_TRANS_TWOPHASE to the flags parameter for a two-phase commit. The +default is one-phase commit. +Under normal circumstances, OCITransCommit() returns with a status +indicating that the transaction has either been committed or rolled back. With +distributed transactions, it is possible that the transaction is now in-doubt +(i.e., neither committed nor aborted). In this case, OCITransCommit() +attempts to retrieve the status of the transaction from the server. +The status is returned. +Parameters +srvcp (IN) - the service context handle. +errhp (IN) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +flags -see the "Comments" section above. +Related Functions +OCITransRollback() + + + + +OCITransDetach() +Name +OCI TX (transaction) DeTach +Purpose +Detaches a transaction. +Syntax +sword OCITransDetach ( OCISvcCtx *srvcp, + OCIError *errhp, + ub4 flags); +Comments +Detaches a global transaction from the service context handle. The transaction +currently attached to the service context handle becomes inactive at the end +of this call. The transaction may be resumed later by calling OCITransStart(), +specifying a flags value of OCI_TRANS_RESUME. +When a transaction is detached, the value which was specified in the timeout +parameter of OCITransStart() when the transaction was started is used to +determine the amount of time the branch can remain inactive before being +deleted by the server's PMON process. +Note: The transaction can be resumed by a different process than the one +that detached it, provided that the transaction has the same +authorization. +Parameters +srvcp (IN) - the service context handle. +errhp (IN) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +flags (IN) - you must pass a value of OCI_DEFAULT for this parameter. +Related Functions +OCITransStart() + + + +OCITransForget() +Name +OCI TX (transaction) ForGeT +Purpose +Causes the server to forget a heuristically completed global transaction. +Syntax +sword OCITransForget ( OCISvcCtx *svchp, + OCIError *errhp, + ub4 flags); + +Comments + +Forgets a heuristically completed global transaction. The server deletes the +status of the transaction from the system's pending transaction table. +The XID of the transaction to be forgotten is set as an attribute of the +transaction handle (OCI_ATTR_XID). +Parameters +srvcp (IN) - the service context handle - the transaction is rolled back. +errhp (IN) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +flags (IN) - you must pass OCI_DEFAULT for this parameter. +Related Functions +OCITransCommit(), OCITransRollback() + + +OCITransMultiPrepare() +Name +OCI Trans(action) Multi-Branch Prepare +Purpose +Prepares a transaction with multiple branches in a single call. +Syntax +sword OCITransMultiPrepare ( OCISvcCtx *svchp, + ub4 numBranches, + OCITrans **txns, + OCIError **errhp); + +Comments + +Prepares the specified global transaction for commit. +This call is valid only for distributed transactions. +This call is an advanced performance feature intended for use only in +situations where the caller is responsible for preparing all the branches +in a transaction. +Parameters +srvcp (IN) - the service context handle. +numBranches (IN) - This is the number of branches expected. It is also the +array size for the next two parameters. +txns (IN) - This is the array of transaction handles for the branches to +prepare. They should all have the OCI_ATTR_XID set. The global transaction +ID should be the same. +errhp (IN) - This is the array of error handles. If OCI_SUCCESS is not +returned, then these will indicate which branches received which errors. +Related Functions +OCITransPrepare() + + +OCITransPrepare() +Name +OCI TX (transaction) PREpare +Purpose +Prepares a transaction for commit. +Syntax +sword OCITransPrepare ( OCISvcCtx *svchp, + OCIError *errhp, + ub4 flags); + +Comments + +Prepares the specified global transaction for commit. +This call is valid only for distributed transactions. +The call returns OCI_SUCCESS_WITH_INFO if the transaction has not made +any changes. The error handle will indicate that the transaction is read-only. +The flag parameter is not currently used. +Parameters +srvcp (IN) - the service context handle. +errhp (IN) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +flags (IN) - you must pass OCI_DEFAULT for this parameter. +Related Functions +OCITransCommit(), OCITransForget() + + + + +OCITransRollback() +Name +OCI TX (transaction) RoLlback +Purpose +Rolls back the current transaction. +Syntax +sword OCITransRollback ( void *svchp, + OCIError *errhp, + ub4 flags ); +Comments +The current transaction- defined as the set of statements executed since the +last OCITransCommit() or since OCISessionBegin()-is rolled back. +If the application is running under object mode then the modified or updated +objects in the object cache for this transaction are also rolled back. +An error is returned if an attempt is made to roll back a global transaction +that is not currently active. +Parameters +svchp (IN) - a service context handle. The transaction currently set in the +service context handle is rolled back. +errhp -(IN) - an error handle which can be passed to OCIErrorGet() for +diagnostic information in the event of an error. +flags - you must pass a value of OCI_DEFAULT for this parameter. +Related Functions +OCITransCommit() + + + + +OCITransStart() +Name +OCI TX (transaction) STart +Purpose +Sets the beginning of a transaction. +Syntax +sword OCITransStart ( OCISvcCtx *svchp, + OCIError *errhp, + uword timeout, + ub4 flags); + +Comments +This function sets the beginning of a global or serializable transaction. The +transaction context currently associated with the service context handle is +initialized at the end of the call if the flags parameter specifies that a new +transaction should be started. +The XID of the transaction is set as an attribute of the transaction handle +(OCI_ATTR_XID) +Parameters +svchp (IN/OUT) - the service context handle. The transaction context in the +service context handle is initialized at the end of the call if the flag +specified a new transaction to be started. +errhp (IN/OUT) - The OCI error handle. If there is an error, it is recorded in +err and this function returns OCI_ERROR. Diagnostic information can be +obtained by calling OCIErrorGet(). +timeout (IN) - the time, in seconds, to wait for a transaction to become +available for resumption when OCI_TRANS_RESUME is specified. When +OCI_TRANS_NEW is specified, this value is stored and may be used later by +OCITransDetach(). +flags (IN) - specifies whether a new transaction is being started or an +existing transaction is being resumed. Also specifies serializiability or +read-only status. More than a single value can be specified. By default, +a read/write transaction is started. The flag values are: +OCI_TRANS_NEW - starts a new transaction branch. By default starts a +tightly coupled and migratable branch. +OCI_TRANS_TIGHT - explicitly specifies a tightly coupled branch +OCI_TRANS_LOOSE - specifies a loosely coupled branch +OCI_TRANS_RESUME - resumes an existing transaction branch. +OCI_TRANS_READONLY - start a readonly transaction +OCI_TRANS_SERIALIZABLE - start a serializable transaction +Related Functions +OCITransDetach() + + + + + +******************************************************************************/ +/*-----------------------Dynamic Callback Function Pointers------------------*/ + + +typedef sb4 (*OCICallbackInBind)(void *ictxp, OCIBind *bindp, ub4 iter, + ub4 index, void **bufpp, ub4 *alenp, + ub1 *piecep, void **indp); + +typedef sb4 (*OCICallbackOutBind)(void *octxp, OCIBind *bindp, ub4 iter, + ub4 index, void **bufpp, ub4 **alenp, + ub1 *piecep, void **indp, + ub2 **rcodep); + +typedef sb4 (*OCICallbackDefine)(void *octxp, OCIDefine *defnp, ub4 iter, + void **bufpp, ub4 **alenp, ub1 *piecep, + void **indp, ub2 **rcodep); + +typedef sword (*OCIUserCallback)(void *ctxp, void *hndlp, ub4 type, + ub4 fcode, ub4 when, sword returnCode, + sb4 *errnop, va_list arglist); + +typedef sword (*OCIEnvCallbackType)(OCIEnv *env, ub4 mode, + size_t xtramem_sz, void *usrmemp, + OCIUcb *ucbDesc); + +typedef sb4 (*OCICallbackLobRead)(void *ctxp, const void *bufp, + ub4 len, ub1 piece); + +typedef sb4 (*OCICallbackLobWrite)(void *ctxp, void *bufp, + ub4 *lenp, ub1 *piece); + +#ifdef ORAXB8_DEFINED + +typedef sb4 (*OCICallbackLobRead2)(void *ctxp, const void *bufp, oraub8 len, + ub1 piece, void **changed_bufpp, + oraub8 *changed_lenp); + +typedef sb4 (*OCICallbackLobWrite2)(void *ctxp, void *bufp, oraub8 *lenp, + ub1 *piece, void **changed_bufpp, + oraub8 *changed_lenp); + +typedef sb4 (*OCICallbackLobArrayRead)(void *ctxp, ub4 array_iter, + const void *bufp, oraub8 len, + ub1 piece, void **changed_bufpp, + oraub8 *changed_lenp); + +typedef sb4 (*OCICallbackLobArrayWrite)(void *ctxp, ub4 array_iter, + void *bufp, oraub8 *lenp, + ub1 *piece, void **changed_bufpp, + oraub8 *changed_lenp); +#endif + +typedef sb4 (*OCICallbackLobGetDeduplicateRegions)(void *ctxp, + OCILobRegion *regions, + ub4 count, ub1 piece, + OCILobRegion **changed_reg, + ub4 *changed_count); + +typedef sb4 (*OCICallbackAQEnq)(void *ctxp, void **payload, + void **payload_ind); + +typedef sb4 (*OCICallbackAQEnqStreaming)(void *ctxp, void **payload, + void **payload_ind, + OCIAQMsgProperties **msgprop, + OCIType **tdo); + +typedef sb4 (*OCICallbackAQDeq)(void *ctxp, void **payload, + void **payload_ind); + +/*--------------------------Failover Callback Structure ---------------------*/ +typedef sb4 (*OCICallbackFailover)(void *svcctx, void *envctx, + void *fo_ctx, ub4 fo_type, + ub4 fo_event); + +typedef struct +{ + OCICallbackFailover callback_function; + void *fo_ctx; +} +OCIFocbkStruct; + +/*---------------------Statement Cache callback function ------------------*/ + +typedef sword (*OCICallbackStmtCache)(void *ctx, OCIStmt *stmt, ub4 mode); + +/*--------------------------HA Callback Structure ---------------------*/ +typedef void (*OCIEventCallback)(void *evtctx, OCIEvent *eventhp); + + +/*------------------------- Round Trip Callback Structure --------------------*/ +typedef sword (*OCIRoundTripCallback)(void *rtctx, OCISvcCtx *svch, + OCISession *userh); + + +/***************************************************************************** + ACTUAL PROTOTYPE DECLARATIONS +******************************************************************************/ + +sword OCIInitialize (ub4 mode, void *ctxp, + void *(*malocfp)(void *ctxp, size_t size), + void *(*ralocfp)(void *ctxp, void *memptr, size_t newsize), + void (*mfreefp)(void *ctxp, void *memptr) ); + +sword OCITerminate( ub4 mode); + +sword OCIEnvCreate (OCIEnv **envp, ub4 mode, void *ctxp, + void *(*malocfp)(void *ctxp, size_t size), + void *(*ralocfp)(void *ctxp, void *memptr, size_t newsize), + void (*mfreefp)(void *ctxp, void *memptr), + size_t xtramem_sz, void **usrmempp); + +sword OCIEnvNlsCreate (OCIEnv **envp, ub4 mode, void *ctxp, + void *(*malocfp)(void *ctxp, size_t size), + void *(*ralocfp)(void *ctxp, void *memptr, size_t newsize), + void (*mfreefp)(void *ctxp, void *memptr), + size_t xtramem_sz, void **usrmempp, + ub2 charset, ub2 ncharset); + +sword OCIFEnvCreate (OCIEnv **envp, ub4 mode, void *ctxp, + void *(*malocfp)(void *ctxp, size_t size), + void *(*ralocfp)(void *ctxp, void *memptr, size_t newsize), + void (*mfreefp)(void *ctxp, void *memptr), + size_t xtramem_sz, void **usrmempp, void *fupg); + +sword OCIHandleAlloc(const void *parenth, void **hndlpp, const ub4 type, + const size_t xtramem_sz, void **usrmempp); + +sword OCIHandleFree(void *hndlp, const ub4 type); + + +sword OCIDescriptorAlloc(const void *parenth, void **descpp, + const ub4 type, const size_t xtramem_sz, + void **usrmempp); + +sword OCIArrayDescriptorAlloc(const void *parenth, void **descpp, + const ub4 type, ub4 array_size, + const size_t xtramem_sz, void **usrmempp); + +sword OCIDescriptorFree(void *descp, const ub4 type); + +sword OCIArrayDescriptorFree(void **descp, const ub4 type); + +sword OCIEnvInit (OCIEnv **envp, ub4 mode, + size_t xtramem_sz, void **usrmempp); + +sword OCIServerAttach (OCIServer *srvhp, OCIError *errhp, + const OraText *dblink, sb4 dblink_len, ub4 mode); + +sword OCIServerDetach (OCIServer *srvhp, OCIError *errhp, ub4 mode); + +sword OCISessionBegin (OCISvcCtx *svchp, OCIError *errhp, OCISession *usrhp, + ub4 credt, ub4 mode); + +sword OCISessionEnd (OCISvcCtx *svchp, OCIError *errhp, OCISession *usrhp, + ub4 mode); + +sword OCILogon (OCIEnv *envhp, OCIError *errhp, OCISvcCtx **svchp, + const OraText *username, ub4 uname_len, + const OraText *password, ub4 passwd_len, + const OraText *dbname, ub4 dbname_len); + +sword OCILogon2 (OCIEnv *envhp, OCIError *errhp, OCISvcCtx **svchp, + const OraText *username, ub4 uname_len, + const OraText *password, ub4 passwd_len, + const OraText *dbname, ub4 dbname_len, + ub4 mode); + +sword OCILogoff (OCISvcCtx *svchp, OCIError *errhp); + + +sword OCIPasswordChange (OCISvcCtx *svchp, OCIError *errhp, + const OraText *user_name, ub4 usernm_len, + const OraText *opasswd, ub4 opasswd_len, + const OraText *npasswd, ub4 npasswd_len, + ub4 mode); + +sword OCIStmtPrepare (OCIStmt *stmtp, OCIError *errhp, const OraText *stmt, + ub4 stmt_len, ub4 language, ub4 mode); + +sword OCIStmtPrepare2 ( OCISvcCtx *svchp, OCIStmt **stmtp, OCIError *errhp, + const OraText *stmt, ub4 stmt_len, const OraText *key, + ub4 key_len, ub4 language, ub4 mode); + +sword OCIStmtRelease ( OCIStmt *stmtp, OCIError *errhp, const OraText *key, + ub4 key_len, ub4 mode); + +sword OCIBindByPos (OCIStmt *stmtp, OCIBind **bindp, OCIError *errhp, + ub4 position, void *valuep, sb4 value_sz, + ub2 dty, void *indp, ub2 *alenp, ub2 *rcodep, + ub4 maxarr_len, ub4 *curelep, ub4 mode); + +sword OCIBindByName (OCIStmt *stmtp, OCIBind **bindp, OCIError *errhp, + const OraText *placeholder, sb4 placeh_len, + void *valuep, sb4 value_sz, ub2 dty, + void *indp, ub2 *alenp, ub2 *rcodep, + ub4 maxarr_len, ub4 *curelep, ub4 mode); + +sword OCIBindObject (OCIBind *bindp, OCIError *errhp, const OCIType *type, + void **pgvpp, ub4 *pvszsp, void **indpp, + ub4 *indszp); + +sword OCIBindDynamic (OCIBind *bindp, OCIError *errhp, void *ictxp, + OCICallbackInBind icbfp, void *octxp, + OCICallbackOutBind ocbfp); + +sword OCIBindArrayOfStruct (OCIBind *bindp, OCIError *errhp, + ub4 pvskip, ub4 indskip, + ub4 alskip, ub4 rcskip); + +sword OCIStmtGetPieceInfo (OCIStmt *stmtp, OCIError *errhp, + void **hndlpp, ub4 *typep, + ub1 *in_outp, ub4 *iterp, ub4 *idxp, + ub1 *piecep); + +sword OCIStmtSetPieceInfo (void *hndlp, ub4 type, OCIError *errhp, + const void *bufp, ub4 *alenp, ub1 piece, + const void *indp, ub2 *rcodep); + +sword OCIStmtExecute (OCISvcCtx *svchp, OCIStmt *stmtp, OCIError *errhp, + ub4 iters, ub4 rowoff, const OCISnapshot *snap_in, + OCISnapshot *snap_out, ub4 mode); + +sword OCIDefineByPos (OCIStmt *stmtp, OCIDefine **defnp, OCIError *errhp, + ub4 position, void *valuep, sb4 value_sz, ub2 dty, + void *indp, ub2 *rlenp, ub2 *rcodep, ub4 mode); + +sword OCIDefineObject (OCIDefine *defnp, OCIError *errhp, + const OCIType *type, void **pgvpp, + ub4 *pvszsp, void **indpp, ub4 *indszp); + +sword OCIDefineDynamic (OCIDefine *defnp, OCIError *errhp, void *octxp, + OCICallbackDefine ocbfp); + +sword OCIRowidToChar (OCIRowid *rowidDesc, OraText *outbfp, ub2 *outbflp, + OCIError *errhp); + +sword OCIDefineArrayOfStruct (OCIDefine *defnp, OCIError *errhp, ub4 pvskip, + ub4 indskip, ub4 rlskip, ub4 rcskip); + +sword OCIStmtFetch (OCIStmt *stmtp, OCIError *errhp, ub4 nrows, + ub2 orientation, ub4 mode); + +sword OCIStmtFetch2 (OCIStmt *stmtp, OCIError *errhp, ub4 nrows, + ub2 orientation, sb4 scrollOffset, ub4 mode); + +sword OCIStmtGetBindInfo (OCIStmt *stmtp, OCIError *errhp, ub4 size, + ub4 startloc, + sb4 *found, OraText *bvnp[], ub1 bvnl[], + OraText *invp[], ub1 inpl[], ub1 dupl[], + OCIBind **hndl); + +sword OCIDescribeAny (OCISvcCtx *svchp, OCIError *errhp, + void *objptr, + ub4 objnm_len, ub1 objptr_typ, ub1 info_level, + ub1 objtyp, OCIDescribe *dschp); + +sword OCIParamGet (const void *hndlp, ub4 htype, OCIError *errhp, + void **parmdpp, ub4 pos); + +sword OCIParamSet(void *hdlp, ub4 htyp, OCIError *errhp, const void *dscp, + ub4 dtyp, ub4 pos); + +sword OCITransStart (OCISvcCtx *svchp, OCIError *errhp, + uword timeout, ub4 flags ); + +sword OCITransDetach (OCISvcCtx *svchp, OCIError *errhp, ub4 flags ); + +sword OCITransCommit (OCISvcCtx *svchp, OCIError *errhp, ub4 flags); + +sword OCITransRollback (OCISvcCtx *svchp, OCIError *errhp, ub4 flags); + +sword OCITransPrepare (OCISvcCtx *svchp, OCIError *errhp, ub4 flags); + +sword OCITransMultiPrepare (OCISvcCtx *svchp, ub4 numBranches, + OCITrans **txns, OCIError **errhp); + +sword OCITransForget (OCISvcCtx *svchp, OCIError *errhp, ub4 flags); + +sword OCIErrorGet (void *hndlp, ub4 recordno, OraText *sqlstate, + sb4 *errcodep, OraText *bufp, ub4 bufsiz, ub4 type); + +sword OCILobAppend (OCISvcCtx *svchp, OCIError *errhp, + OCILobLocator *dst_locp, + OCILobLocator *src_locp); + +sword OCILobAssign (OCIEnv *envhp, OCIError *errhp, + const OCILobLocator *src_locp, + OCILobLocator **dst_locpp); + +sword OCILobCharSetForm (OCIEnv *envhp, OCIError *errhp, + const OCILobLocator *locp, ub1 *csfrm); + +sword OCILobCharSetId (OCIEnv *envhp, OCIError *errhp, + const OCILobLocator *locp, ub2 *csid); + +sword OCILobCopy (OCISvcCtx *svchp, OCIError *errhp, OCILobLocator *dst_locp, + OCILobLocator *src_locp, ub4 amount, ub4 dst_offset, + ub4 src_offset); + +sword OCILobCreateTemporary(OCISvcCtx *svchp, + OCIError *errhp, + OCILobLocator *locp, + ub2 csid, + ub1 csfrm, + ub1 lobtype, + boolean cache, + OCIDuration duration); + + +sword OCILobClose( OCISvcCtx *svchp, + OCIError *errhp, + OCILobLocator *locp ); + + +sword OCILobDisableBuffering (OCISvcCtx *svchp, + OCIError *errhp, + OCILobLocator *locp); + +sword OCILobEnableBuffering (OCISvcCtx *svchp, + OCIError *errhp, + OCILobLocator *locp); + +sword OCILobErase (OCISvcCtx *svchp, OCIError *errhp, OCILobLocator *locp, + ub4 *amount, ub4 offset); + +sword OCILobFileClose (OCISvcCtx *svchp, OCIError *errhp, + OCILobLocator *filep); + +sword OCILobFileCloseAll (OCISvcCtx *svchp, OCIError *errhp); + +sword OCILobFileExists (OCISvcCtx *svchp, OCIError *errhp, + OCILobLocator *filep, + boolean *flag); + +sword OCILobFileGetName (OCIEnv *envhp, OCIError *errhp, + const OCILobLocator *filep, + OraText *dir_alias, ub2 *d_length, + OraText *filename, ub2 *f_length); + +sword OCILobFileIsOpen (OCISvcCtx *svchp, OCIError *errhp, + OCILobLocator *filep, + boolean *flag); + +sword OCILobFileOpen (OCISvcCtx *svchp, OCIError *errhp, + OCILobLocator *filep, + ub1 mode); + +sword OCILobFileSetName (OCIEnv *envhp, OCIError *errhp, + OCILobLocator **filepp, + const OraText *dir_alias, ub2 d_length, + const OraText *filename, ub2 f_length); + +sword OCILobFlushBuffer (OCISvcCtx *svchp, + OCIError *errhp, + OCILobLocator *locp, + ub4 flag); + +sword OCILobFreeTemporary(OCISvcCtx *svchp, + OCIError *errhp, + OCILobLocator *locp); + +sword OCILobGetChunkSize(OCISvcCtx *svchp, + OCIError *errhp, + OCILobLocator *locp, + ub4 *chunksizep); + +sword OCILobGetLength (OCISvcCtx *svchp, OCIError *errhp, + OCILobLocator *locp, + ub4 *lenp); + +sword OCILobIsEqual (OCIEnv *envhp, const OCILobLocator *x, + const OCILobLocator *y, + boolean *is_equal); + +sword OCILobIsOpen( OCISvcCtx *svchp, + OCIError *errhp, + OCILobLocator *locp, + boolean *flag); + +sword OCILobIsTemporary(OCIEnv *envp, + OCIError *errhp, + OCILobLocator *locp, + boolean *is_temporary); + +sword OCILobLoadFromFile (OCISvcCtx *svchp, OCIError *errhp, + OCILobLocator *dst_locp, + OCILobLocator *src_filep, + ub4 amount, ub4 dst_offset, + ub4 src_offset); + +sword OCILobLocatorAssign (OCISvcCtx *svchp, OCIError *errhp, + const OCILobLocator *src_locp, + OCILobLocator **dst_locpp); + + +sword OCILobLocatorIsInit (OCIEnv *envhp, OCIError *errhp, + const OCILobLocator *locp, + boolean *is_initialized); + +sword OCILobOpen( OCISvcCtx *svchp, + OCIError *errhp, + OCILobLocator *locp, + ub1 mode ); + +sword OCILobRead (OCISvcCtx *svchp, OCIError *errhp, OCILobLocator *locp, + ub4 *amtp, ub4 offset, void *bufp, ub4 bufl, void *ctxp, + OCICallbackLobRead cbfp, ub2 csid, ub1 csfrm); + +sword OCILobTrim (OCISvcCtx *svchp, OCIError *errhp, OCILobLocator *locp, + ub4 newlen); + +sword OCILobWrite (OCISvcCtx *svchp, OCIError *errhp, OCILobLocator *locp, + ub4 *amtp, ub4 offset, void *bufp, ub4 buflen, + ub1 piece, void *ctxp, OCICallbackLobWrite cbfp, + ub2 csid, ub1 csfrm); + +sword OCILobGetDeduplicateRegions(OCISvcCtx *svchp, OCIError *errhp, + OCILobLocator *locp, + OCILobRegion *regp, ub4 *count, ub1 piece, + void *ctxp, + OCICallbackLobGetDeduplicateRegions cbfp); + +sword OCILobWriteAppend(OCISvcCtx *svchp, OCIError *errhp, OCILobLocator *lobp, + ub4 *amtp, void *bufp, ub4 bufl, ub1 piece, + void *ctxp, OCICallbackLobWrite cbfp, ub2 csid, + ub1 csfrm); + +sword OCIBreak (void *hndlp, OCIError *errhp); + +sword OCIReset (void *hndlp, OCIError *errhp); + +sword OCIServerVersion (void *hndlp, OCIError *errhp, OraText *bufp, + ub4 bufsz, + ub1 hndltype); + +sword OCIServerRelease (void *hndlp, OCIError *errhp, OraText *bufp, + ub4 bufsz, + ub1 hndltype, ub4 *version); + +sword OCIAttrGet (const void *trgthndlp, ub4 trghndltyp, + void *attributep, ub4 *sizep, ub4 attrtype, + OCIError *errhp); + +sword OCIAttrSet (void *trgthndlp, ub4 trghndltyp, void *attributep, + ub4 size, ub4 attrtype, OCIError *errhp); + +sword OCISvcCtxToLda (OCISvcCtx *svchp, OCIError *errhp, Lda_Def *ldap); + +sword OCILdaToSvcCtx (OCISvcCtx **svchpp, OCIError *errhp, Lda_Def *ldap); + +sword OCIResultSetToStmt (OCIResult *rsetdp, OCIError *errhp); + +sword OCIFileClose ( void *hndl, OCIError *err, OCIFileObject *filep ); + +sword OCIUserCallbackRegister(void *hndlp, ub4 type, void *ehndlp, + OCIUserCallback callback, void *ctxp, + ub4 fcode, ub4 when, OCIUcb *ucbDesc); + +sword OCIUserCallbackGet(void *hndlp, ub4 type, void *ehndlp, + ub4 fcode, ub4 when, OCIUserCallback *callbackp, + void **ctxpp, OCIUcb *ucbDesc); + +sword OCISharedLibInit(void *metaCtx, void *libCtx, ub4 argfmt, sword argc, + void **argv, OCIEnvCallbackType envCallback); + +sword OCIFileExists ( void *hndl, OCIError *err, OraText *filename, + OraText *path, ub1 *flag ); + +sword OCIFileFlush( void *hndl, OCIError *err, OCIFileObject *filep ); + + +sword OCIFileGetLength( void *hndl, OCIError *err, OraText *filename, + OraText *path, ubig_ora *lenp ); + +sword OCIFileInit ( void *hndl, OCIError *err ); + +sword OCIFileOpen ( void *hndl, OCIError *err, OCIFileObject **filep, + OraText *filename, OraText *path, ub4 mode, ub4 create, + ub4 type ); + +sword OCIFileRead ( void *hndl, OCIError *err, OCIFileObject *filep, + void *bufp, ub4 bufl, ub4 *bytesread ); + +sword OCIFileSeek ( void *hndl, OCIError *err, OCIFileObject *filep, + uword origin, ubig_ora offset, sb1 dir ); + +sword OCIFileTerm ( void *hndl, OCIError *err ); + + +sword OCIFileWrite ( void *hndl, OCIError *err, OCIFileObject *filep, + void *bufp, ub4 buflen, ub4 *byteswritten ); + + +#ifdef ORAXB8_DEFINED + +sword OCILobCopy2 (OCISvcCtx *svchp, OCIError *errhp, + OCILobLocator *dst_locp, + OCILobLocator *src_locp, oraub8 amount, + oraub8 dst_offset, + oraub8 src_offset); + +sword OCILobErase2 (OCISvcCtx *svchp, OCIError *errhp, OCILobLocator *locp, + oraub8 *amount, oraub8 offset); + +sword OCILobGetLength2 (OCISvcCtx *svchp, OCIError *errhp, + OCILobLocator *locp, oraub8 *lenp); + +sword OCILobLoadFromFile2 (OCISvcCtx *svchp, OCIError *errhp, + OCILobLocator *dst_locp, + OCILobLocator *src_filep, + oraub8 amount, oraub8 dst_offset, + oraub8 src_offset); + +sword OCILobRead2 (OCISvcCtx *svchp, OCIError *errhp, OCILobLocator *locp, + oraub8 *byte_amtp, oraub8 *char_amtp, oraub8 offset, + void *bufp, oraub8 bufl, ub1 piece, void *ctxp, + OCICallbackLobRead2 cbfp, ub2 csid, ub1 csfrm); + +sword OCILobArrayRead (OCISvcCtx *svchp, OCIError *errhp, ub4 *array_iter, + OCILobLocator **lobp_arr, oraub8 *byte_amt_arr, + oraub8 *char_amt_arr, oraub8 *offset_arr, + void **bufp_arr, oraub8 *bufl_arr, ub1 piece, + void *ctxp, OCICallbackLobArrayRead cbfp, ub2 csid, + ub1 csfrm); + +sword OCILobTrim2 (OCISvcCtx *svchp, OCIError *errhp, OCILobLocator *locp, + oraub8 newlen); + +sword OCILobWrite2 (OCISvcCtx *svchp, OCIError *errhp, OCILobLocator *locp, + oraub8 *byte_amtp, oraub8 *char_amtp, oraub8 offset, + void *bufp, oraub8 buflen, ub1 piece, void *ctxp, + OCICallbackLobWrite2 cbfp, ub2 csid, ub1 csfrm); + +sword OCILobArrayWrite (OCISvcCtx *svchp, OCIError *errhp, ub4 *array_iter, + OCILobLocator **lobp_arr, oraub8 *byte_amt_arr, + oraub8 *char_amt_arr, oraub8 *offset_arr, + void **bufp_arr, oraub8 *bufl_arr, ub1 piece, + void *ctxp, OCICallbackLobArrayWrite cbfp, ub2 csid, + ub1 csfrm); + +sword OCILobWriteAppend2 (OCISvcCtx *svchp, OCIError *errhp, + OCILobLocator *lobp, + oraub8 *byte_amtp, oraub8 *char_amtp, void *bufp, + oraub8 bufl, ub1 piece, void *ctxp, + OCICallbackLobWrite2 cbfp, ub2 csid, ub1 csfrm); + +sword OCILobGetStorageLimit (OCISvcCtx *svchp, OCIError *errhp, + OCILobLocator *lobp, oraub8 *limitp); + +sword OCILobGetOptions (OCISvcCtx *svchp, OCIError *errhp, + OCILobLocator *lobp, + ub4 optypes, void *optionsp, ub4 *optionslenp, + ub4 mode); + +sword OCILobSetOptions (OCISvcCtx *svchp, OCIError *errhp, + OCILobLocator *lobp, + ub4 optypes, void *optionsp, ub4 optionslen, + ub4 mode); + +sword OCILobGetContentType (OCISvcCtx *svchp, + OCIError *errhp, OCILobLocator *lobp, + oratext *contenttypep, ub4 *contenttypelenp, + ub4 mode); + +sword OCILobSetContentType (OCISvcCtx *svchp, + OCIError *errhp, OCILobLocator *lobp, + const oratext *contenttypep, ub4 contenttypelen, + ub4 mode); + +#endif + +/* + ** Initialize the security package + */ +sword OCISecurityInitialize (OCISecurity *sechandle, OCIError *error_handle); + +sword OCISecurityTerminate (OCISecurity *sechandle, OCIError *error_handle); + +sword OCISecurityOpenWallet(OCISecurity *osshandle, + OCIError *error_handle, + size_t wrllen, + OraText *wallet_resource_locator, + size_t pwdlen, + OraText *password, + nzttWallet *wallet); + +sword OCISecurityCloseWallet(OCISecurity *osshandle, + OCIError *error_handle, + nzttWallet *wallet); + +sword OCISecurityCreateWallet(OCISecurity *osshandle, + OCIError *error_handle, + size_t wrllen, + OraText *wallet_resource_locator, + size_t pwdlen, + OraText *password, + nzttWallet *wallet); + +sword OCISecurityDestroyWallet(OCISecurity *osshandle, + OCIError *error_handle, + size_t wrllen, + OraText *wallet_resource_locator, + size_t pwdlen, + OraText *password); + +sword OCISecurityStorePersona(OCISecurity *osshandle, + OCIError *error_handle, + nzttPersona **persona, + nzttWallet *wallet); + +sword OCISecurityOpenPersona(OCISecurity *osshandle, + OCIError *error_handle, + nzttPersona *persona); + +sword OCISecurityClosePersona(OCISecurity *osshandle, + OCIError *error_handle, + nzttPersona *persona); + +sword OCISecurityRemovePersona(OCISecurity *osshandle, + OCIError *error_handle, + nzttPersona **persona); + +sword OCISecurityCreatePersona(OCISecurity *osshandle, + OCIError *error_handle, + nzttIdentType identity_type, + nzttCipherType cipher_type, + nzttPersonaDesc *desc, + nzttPersona **persona); + +sword OCISecuritySetProtection(OCISecurity *osshandle, + OCIError *error_handle, + nzttPersona *persona, + nzttcef crypto_engine_function, + nztttdufmt data_unit_format, + nzttProtInfo *protection_info); + +sword OCISecurityGetProtection(OCISecurity *osshandle, + OCIError *error_handle, + nzttPersona *persona, + nzttcef crypto_engine_function, + nztttdufmt * data_unit_format_ptr, + nzttProtInfo *protection_info); + +sword OCISecurityRemoveIdentity(OCISecurity *osshandle, + OCIError *error_handle, + nzttIdentity **identity_ptr); + +sword OCISecurityCreateIdentity(OCISecurity *osshandle, + OCIError *error_handle, + nzttIdentType type, + nzttIdentityDesc *desc, + nzttIdentity **identity_ptr); + +sword OCISecurityAbortIdentity(OCISecurity *osshandle, + OCIError *error_handle, + nzttIdentity **identity_ptr); + +sword OCISecurityFreeIdentity(OCISecurity *osshandle, + OCIError *error_handle, + nzttIdentity **identity_ptr); + + +sword OCISecurityStoreTrustedIdentity(OCISecurity *osshandle, + OCIError *error_handle, + nzttIdentity **identity_ptr, + nzttPersona *persona); + +sword OCISecuritySign(OCISecurity *osshandle, + OCIError *error_handle, + nzttPersona *persona, + nzttces signature_state, + size_t input_length, + ub1 *input, + nzttBufferBlock *buffer_block); + +sword OCISecuritySignExpansion(OCISecurity *osshandle, + OCIError *error_handle, + nzttPersona *persona, + size_t inputlen, + size_t *signature_length); + +sword OCISecurityVerify(OCISecurity *osshandle, + OCIError *error_handle, + nzttPersona *persona, + nzttces signature_state, + size_t siglen, + ub1 *signature, + nzttBufferBlock *extracted_message, + boolean *verified, + boolean *validated, + nzttIdentity **signing_party_identity); + +sword OCISecurityValidate(OCISecurity *osshandle, + OCIError *error_handle, + nzttPersona *persona, + nzttIdentity *identity, + boolean *validated); + +sword OCISecuritySignDetached(OCISecurity *osshandle, + OCIError *error_handle, + nzttPersona *persona, + nzttces signature_state, + size_t input_length, + ub1 * input, + nzttBufferBlock *signature); + +sword OCISecuritySignDetExpansion(OCISecurity *osshandle, + OCIError *error_handle, + nzttPersona *persona, + size_t input_length, + size_t *required_buffer_length); + +sword OCISecurityVerifyDetached(OCISecurity *osshandle, + OCIError *error_handle, + nzttPersona *persona, + nzttces signature_state, + size_t data_length, + ub1 *data, + size_t siglen, + ub1 *signature, + boolean *verified, + boolean *validated, + nzttIdentity **signing_party_identity); + +sword OCISecurity_PKEncrypt(OCISecurity *osshandle, + OCIError *error_handle, + nzttPersona *persona, + size_t number_of_recipients, + nzttIdentity *recipient_list, + nzttces encryption_state, + size_t input_length, + ub1 *input, + nzttBufferBlock *encrypted_data); + +sword OCISecurityPKEncryptExpansion(OCISecurity *osshandle, + OCIError *error_handle, + nzttPersona *persona, + size_t number_recipients, + size_t input_length, + size_t *buffer_length_required); + +sword OCISecurityPKDecrypt(OCISecurity *osshandle, + OCIError *error_handle, + nzttPersona *persona, + nzttces encryption_state, + size_t input_length, + ub1 *input, + nzttBufferBlock *encrypted_data); + +sword OCISecurityEncrypt(OCISecurity *osshandle, + OCIError *error_handle, + nzttPersona *persona, + nzttces encryption_state, + size_t input_length, + ub1 *input, + nzttBufferBlock *encrypted_data); + +sword OCISecurityEncryptExpansion(OCISecurity *osshandle, + OCIError *error_handle, + nzttPersona *persona, + size_t input_length, + size_t *encrypted_data_length); + +sword OCISecurityDecrypt(OCISecurity *osshandle, + OCIError *error_handle, + nzttPersona *persona, + nzttces decryption_state, + size_t input_length, + ub1 *input, + nzttBufferBlock *decrypted_data); + +sword OCISecurityEnvelope(OCISecurity *osshandle, + OCIError *error_handle, + nzttPersona *persona, + size_t number_of_recipients, + nzttIdentity *identity, + nzttces encryption_state, + size_t input_length, + ub1 *input, + nzttBufferBlock *enveloped_data); + +sword OCISecurityDeEnvelope(OCISecurity *osshandle, + OCIError *error_handle, + nzttPersona *persona, + nzttces decryption_state, + size_t input_length, + ub1 *input, + nzttBufferBlock *output_message, + boolean *verified, + boolean *validated, + nzttIdentity **sender_identity); + +sword OCISecurityKeyedHash(OCISecurity *osshandle, + OCIError *error_handle, + nzttPersona *persona, + nzttces hash_state, + size_t input_length, + ub1 *input, + nzttBufferBlock *keyed_hash); + +sword OCISecurityKeyedHashExpansion(OCISecurity *osshandle, + OCIError *error_handle, + nzttPersona *persona, + size_t input_length, + size_t *required_buffer_length); + +sword OCISecurityHash(OCISecurity *osshandle, + OCIError *error_handle, + nzttPersona *persona, + nzttces hash_state, + size_t input, + ub1 *input_length, + nzttBufferBlock *hash); + +sword OCISecurityHashExpansion(OCISecurity *osshandle, + OCIError *error_handle, + nzttPersona *persona, + size_t input_length, + size_t *required_buffer_length); + +sword OCISecuritySeedRandom(OCISecurity *osshandle, + OCIError *error_handle, + nzttPersona *persona, + size_t seed_length, + ub1 *seed); + +sword OCISecurityRandomBytes(OCISecurity *osshandle, + OCIError *error_handle, + nzttPersona *persona, + size_t number_of_bytes_desired, + nzttBufferBlock *random_bytes); + +sword OCISecurityRandomNumber(OCISecurity *osshandle, + OCIError *error_handle, + nzttPersona *persona, + uword *random_number_ptr); + +sword OCISecurityInitBlock(OCISecurity *osshandle, + OCIError *error_handle, + nzttBufferBlock *buffer_block); + +sword OCISecurityReuseBlock(OCISecurity *osshandle, + OCIError *error_handle, + nzttBufferBlock *buffer_block); + +sword OCISecurityPurgeBlock(OCISecurity *osshandle, + OCIError *error_handle, + nzttBufferBlock *buffer_block); + +sword OCISecuritySetBlock(OCISecurity *osshandle, + OCIError *error_handle, + uword flags_to_set, + size_t buffer_length, + size_t used_buffer_length, + ub1 *buffer, + nzttBufferBlock *buffer_block); + +sword OCISecurityGetIdentity(OCISecurity *osshandle, + OCIError *error_handle, + size_t namelen, + OraText *distinguished_name, + nzttIdentity **identity); + +sword OCIAQEnq(OCISvcCtx *svchp, OCIError *errhp, OraText *queue_name, + OCIAQEnqOptions *enqopt, OCIAQMsgProperties *msgprop, + OCIType *payload_tdo, void **payload, void **payload_ind, + OCIRaw **msgid, ub4 flags); + +sword OCIAQDeq(OCISvcCtx *svchp, OCIError *errhp, OraText *queue_name, + OCIAQDeqOptions *deqopt, OCIAQMsgProperties *msgprop, + OCIType *payload_tdo, void **payload, void **payload_ind, + OCIRaw **msgid, ub4 flags); + +sword OCIAQEnqArray(OCISvcCtx *svchp, OCIError *errhp, OraText *queue_name, + OCIAQEnqOptions *enqopt, ub4 *iters, + OCIAQMsgProperties **msgprop, OCIType *payload_tdo, + void **payload, void **payload_ind, OCIRaw **msgid, + void *ctxp, OCICallbackAQEnq enqcbfp, ub4 flags); + +sword OCIAQEnqStreaming(OCISvcCtx *svchp, OCIError *errhp, OraText *queue_name, + OCIAQEnqOptions *enqopt, OCIType *payload_tdo, + void *ctxp, OCICallbackAQEnqStreaming enqcbfp, + ub4 flags); + +sword OCIAQDeqArray(OCISvcCtx *svchp, OCIError *errhp, OraText *queue_name, + OCIAQDeqOptions *deqopt, ub4 *iters, + OCIAQMsgProperties **msgprop, OCIType *payload_tdo, + void **payload, void **payload_ind, OCIRaw **msgid, + void *ctxp, OCICallbackAQDeq deqcbfp, ub4 flags); + +sword OCIAQListen(OCISvcCtx *svchp, OCIError *errhp, + OCIAQAgent **agent_list, ub4 num_agents, + sb4 wait, OCIAQAgent **agent, + ub4 flags); + +sword OCIAQListen2(OCISvcCtx *svchp, OCIError *errhp, + OCIAQAgent **agent_list, ub4 num_agents, + OCIAQListenOpts *lopts, OCIAQAgent **agent, + OCIAQLisMsgProps *lmops, ub4 flags); + +sword OCIAQGetReplayInfo(OCISvcCtx *svchp, OCIError *errhp, + OraText *queue_name, OCIAQAgent *sender, + ub4 replay_attribute, OraText *correlation, + ub2 *corr_len); + +sword OCIAQResetReplayInfo(OCISvcCtx *svchp, OCIError *errhp, + OraText *queue_name, OCIAQAgent *sender, + ub4 replay_attribute); + +sword OCIExtractInit(void *hndl, OCIError *err); + +sword OCIExtractTerm(void *hndl, OCIError *err); + +sword OCIExtractReset(void *hndl, OCIError *err); + +sword OCIExtractSetNumKeys(void *hndl, OCIError *err, uword numkeys); + +sword OCIExtractSetKey(void *hndl, OCIError *err, const OraText *name, + ub1 type, ub4 flag, const void *defval, + const sb4 *intrange, const OraText *const *strlist); + +sword OCIExtractFromFile(void *hndl, OCIError *err, ub4 flag, + OraText *filename); + +sword OCIExtractFromStr(void *hndl, OCIError *err, ub4 flag, OraText *input); + +sword OCIExtractToInt(void *hndl, OCIError *err, OraText *keyname, + uword valno, sb4 *retval); + +sword OCIExtractToBool(void *hndl, OCIError *err, OraText *keyname, + uword valno, ub1 *retval); + +sword OCIExtractToStr(void *hndl, OCIError *err, OraText *keyname, + uword valno, OraText *retval, uword buflen); + +sword OCIExtractToOCINum(void *hndl, OCIError *err, OraText *keyname, + uword valno, OCINumber *retval); + +sword OCIExtractToList(void *hndl, OCIError *err, uword *numkeys); + +sword OCIExtractFromList(void *hndl, OCIError *err, uword index, + OraText **name, + ub1 *type, uword *numvals, void ***values); + +/* Memory Related Service Interfaces */ + +sword OCIMemoryAlloc(void *hdl, OCIError *err, void **mem, + OCIDuration dur, ub4 size, ub4 flags); + +sword OCIMemoryResize(void *hdl, OCIError *err, void **mem, + ub4 newsize, ub4 flags); + +sword OCIMemoryFree(void *hdl, OCIError *err, void *mem); + +sword OCIContextSetValue(void *hdl, OCIError *err, OCIDuration duration, + ub1 *key, ub1 keylen, void *ctx_value); + +sword OCIContextGetValue(void *hdl, OCIError *err, ub1 *key, + ub1 keylen, void **ctx_value); + +sword OCIContextClearValue(void *hdl, OCIError *err, ub1 *key, + ub1 keylen); + +sword OCIContextGenerateKey(void *hdl, OCIError *err, ub4 *key); + +sword OCIMemorySetCurrentIDs(void *hdl, OCIError *err, + ub4 curr_session_id, ub4 curr_trans_id, + ub4 curr_stmt_id); + +sword OCIPicklerTdsCtxInit(OCIEnv *env, OCIError *err, + OCIPicklerTdsCtx **tdsc); + +sword OCIPicklerTdsCtxFree(OCIEnv *env, OCIError *err, OCIPicklerTdsCtx *tdsc); + +sword OCIPicklerTdsInit(OCIEnv *env, OCIError *err, OCIPicklerTdsCtx *tdsc, + OCIPicklerTds **tdsh); + +sword OCIPicklerTdsFree(OCIEnv *env, OCIError *err, OCIPicklerTds *tdsh); + +sword OCIPicklerTdsCreateElementNumber(OCIEnv *env, OCIError *err, + OCIPicklerTds *tdsh, ub1 prec, + sb1 scale, OCIPicklerTdsElement *elt); + +sword OCIPicklerTdsCreateElementChar(OCIEnv *env, OCIError *err, + OCIPicklerTds *tdsh, ub2 len, + OCIPicklerTdsElement *elt); + +sword OCIPicklerTdsCreateElementVarchar(OCIEnv *env, OCIError *err, + OCIPicklerTds *tdsh, ub2 len, + OCIPicklerTdsElement *elt); + +sword OCIPicklerTdsCreateElementRaw(OCIEnv *env, OCIError *err, + OCIPicklerTds *tdsh, ub2 len, + OCIPicklerTdsElement *elt); + +sword OCIPicklerTdsCreateElement(OCIEnv *env, OCIError *err, + OCIPicklerTds *tdsh, OCITypeCode dty, + OCIPicklerTdsElement *elt); + +sword OCIPicklerTdsAddAttr(OCIEnv *env, OCIError *err, + OCIPicklerTds *tdsh, OCIPicklerTdsElement elt); + +sword OCIPicklerTdsGenerate(OCIEnv *env, OCIError *err, + OCIPicklerTds *tdsh); + +sword OCIPicklerTdsGetAttr(OCIEnv *env, OCIError *err, + const OCIPicklerTds *tdsh, ub1 attrno, + OCITypeCode *typ, ub2 *len); + +sword OCIPicklerFdoInit(OCIEnv *env, OCIError *err, + OCIPicklerFdo **fdoh); + +sword OCIPicklerFdoFree(OCIEnv *env, OCIError *err, + OCIPicklerFdo *fdoh); + +sword OCIPicklerImageInit(OCIEnv *env, OCIError *err, + OCIPicklerFdo *fdoh, + OCIPicklerTds *tdsh, + OCIPicklerImage **imgh); + +sword OCIPicklerImageFree(OCIEnv *env, OCIError *err, + OCIPicklerImage *imgh); + +sword OCIPicklerImageAddScalar(OCIEnv *env, OCIError *err, + OCIPicklerImage *imgh, + void *scalar, ub4 len); + +sword OCIPicklerImageAddNullScalar(OCIEnv *env, OCIError *err, + OCIPicklerImage *imgh); + +sword OCIPicklerImageGenerate(OCIEnv *env, OCIError *err, + OCIPicklerImage *imgh); + +sword OCIPicklerImageGetScalarSize(OCIEnv *env, OCIError *err, + OCIPicklerImage *imgh, + ub4 attrno, ub4 *size); + +sword OCIPicklerImageGetScalar(OCIEnv *env, OCIError *err, + OCIPicklerImage *imgh, ub4 attrno, + void *buf, ub4 *len, OCIInd *ind); + +sword OCIPicklerImageCollBegin(OCIEnv *env, OCIError *err, + OCIPicklerImage *imgh, const OCIPicklerTds *colltdsh); + +sword OCIPicklerImageCollAddScalar( OCIEnv *env, OCIError *err, + OCIPicklerImage *imgh, void *scalar, + ub4 buflen, OCIInd ind); + +sword OCIPicklerImageCollEnd(OCIEnv *env, OCIError *err, + OCIPicklerImage *imgh); + +/* should take svcctx for locator stuff */ +sword OCIPicklerImageCollBeginScan(OCIEnv *env, OCIError *err, + OCIPicklerImage *imgh, const OCIPicklerTds *coll_tdsh, + ub4 attrnum, ub4 startidx, OCIInd *ind); + +sword OCIPicklerImageCollGetScalarSize(OCIEnv *env, OCIError *err, + const OCIPicklerTds *coll_tdsh, ub4 *size); + +sword OCIPicklerImageCollGetScalar(OCIEnv *env, OCIError *err, + OCIPicklerImage *imgh, void *buf, + ub4 *buflen, OCIInd *ind); + +sword OCIAnyDataGetType(OCISvcCtx *svchp, OCIError *errhp, OCIAnyData *sdata, + OCITypeCode *tc, OCIType **type); + +sword OCIAnyDataIsNull(OCISvcCtx *svchp, OCIError *errhp, OCIAnyData *sdata, + boolean *isnull); + +sword OCIAnyDataConvert(OCISvcCtx *svchp, OCIError *errhp, OCITypeCode tc, + OCIType *type, OCIDuration dur, void *ind, void *data_val, + ub4 len, OCIAnyData **sdata); + +sword OCIAnyDataBeginCreate(OCISvcCtx *svchp, OCIError *errhp, OCITypeCode tc, + OCIType *type, OCIDuration dur, OCIAnyData **sdata); + +sword OCIAnyDataDestroy(OCISvcCtx *svchp, OCIError *errhp, OCIAnyData *sdata); + +sword OCIAnyDataAttrSet(OCISvcCtx *svchp, OCIError *errhp, OCIAnyData *sdata, + OCITypeCode tc, OCIType *type, void *ind, void *attr_val, + ub4 length, boolean is_any); + +sword OCIAnyDataCollAddElem(OCISvcCtx *svchp, OCIError *errhp, + OCIAnyData *sdata, OCITypeCode tc, OCIType *type, void *ind, + void *attr_val, ub4 length, boolean is_any, boolean last_elem); + +sword OCIAnyDataEndCreate(OCISvcCtx *svchp, OCIError *errhp, + OCIAnyData *sdata); + +sword OCIAnyDataAccess(OCISvcCtx *svchp, OCIError *errhp, OCIAnyData *sdata, + OCITypeCode tc, OCIType *type, void *ind, void *attr_val, + ub4 *length); + +sword OCIAnyDataGetCurrAttrNum(OCISvcCtx *svchp, OCIError *errhp, + OCIAnyData *sdata, ub4 *attrnum); + +sword OCIAnyDataAttrGet(OCISvcCtx *svchp, OCIError *errhp, OCIAnyData *sdata, + OCITypeCode tc, OCIType *type, void *ind, void *attr_val, + ub4 *length, boolean is_any); + +sword OCIAnyDataCollGetElem(OCISvcCtx *svchp, OCIError *errhp, + OCIAnyData *sdata, + OCITypeCode tc, OCIType *type, void *ind, void *celem_val, + ub4 *length, boolean is_any); + + +/*------------------------ OCIAnyDataSet interfaces -------------------------*/ + +/* + NAME + OCIAnyDataSetBeginCreate - OCIAnyDataSet Begin Creation + PARAMETERS + svchp (IN/OUT) - The OCI service context. + errhp (IN/OUT) - The OCI error handle. If there is an error, it is + recorded in errhp and this function returns OCI_ERROR. + Diagnostic information can be obtained by calling + OCIErrorGet(). + typecode - typecode corresponding to the OCIAnyDataSet. + type (IN) - type corresponding to the OCIAnyDataSet. If the typecode + corresponds to a built-in type (OCI_TYPECODE_NUMBER etc.) + , this parameter can be NULL. It should be non NULL for + user defined types (OCI_TYPECODE_OBJECT, + OCI_TYPECODE_REF, collection types etc.) + dur (IN) - duration for which OCIAnyDataSet is allocated. + data_set (OUT) - Initialized OCIAnyDataSet. + RETURNS - error code + NOTES + This call allocates an OCIAnyDataSet for the duration of dur and + initializes it with the type information. The OCIAnyDataSet can hold + multiple instances of the given type. For performance reasons, the + OCIAnyDataSet will end up pointing to the passed in OCIType parameter. + It is the responsibility of the caller to ensure that the OCIType is + longer lived (has allocation duration >= the duration of the OCIAnyData + if the OCIType is a transient one, allocation/pin duration >= duration of + the OCIAnyData if the OCIType is a persistent one). + +*/ +sword OCIAnyDataSetBeginCreate(OCISvcCtx *svchp, OCIError *errhp, + OCITypeCode typecode, const OCIType *type, OCIDuration dur, + OCIAnyDataSet ** data_set); + +/* + NAME + OCIAnyDataSetDestroy - OCIAnyDataSet Destroy + DESCRIPTION + This call frees the OCIAnyDataSet allocated using + OCIAnyDataSetBeginCreate(). + RETURNS + error code. + PARAMETERS + svchp (IN/OUT) - The OCI service context. + errhp (IN/OUT) - The OCI Error handle. + data_set (IN/OUT) - OCIAnyDataSet to be freed. +*/ +sword OCIAnyDataSetDestroy(OCISvcCtx *svchp, OCIError *errhp, + OCIAnyDataSet *data_set); + + +/* + NAME + OCIAnyDataSetAddInstance - OCIAnyDataSet Add an instance + DESCRIPTION + This call adds a new skeleton instance to the OCIAnyDataSet and all the + attributes of the instance are set to NULL. It returns this skeleton + instance through the OCIAnyData parameter which can be constructed + subsequently by invoking the OCIAnyData API. + RETURNS + error code. + PARAMETERS + svchp (IN/OUT) - The OCI service context. + errhp (IN/OUT) - The OCI Error handle. + data_set (IN/OUT) - OCIAnyDataSet to which a new instance is added. + data (IN/OUT) - OCIAnyData corresponding to the newly added + instance. If (*data) is NULL, a new OCIAnyData will + be allocated for same duration as the OCIAnyDataSet. + If (*data) is not NULL, it will get reused. This + OCIAnyData can be subseqently constructed using the + OCIAnyDataConvert() call or it can be constructed + piece-wise using the OCIAnyDataAttrSet and + OCIAnyDataCollAddElem calls. + NOTES + No Destruction of the old value is done here. It is the responsibility of + the caller to destroy the old value pointed to by (*data) and set (*data) + to a null pointer before beginning to make a sequence of this call. No + deep copying (of OCIType information nor the data part.) is done in the + returned OCIAnyData. This OCIAnyData cannot be used beyond the allocation + duration of the OCIAnyDataSet (it is like a reference into the + OCIAnyDataSet). The returned OCIAnyData can be reused on subsequent calls + to this function, to sequentially add new data instances to the + OCIAnyDataSet. +*/ +sword OCIAnyDataSetAddInstance(OCISvcCtx *svchp, OCIError *errhp, + OCIAnyDataSet *data_set, OCIAnyData **data); + +/* + NAME + OCIAnyDataSetEndCreate - OCIAnyDataSet End Creation process. + DESCRIPTION + This call marks the end of OCIAnyDataSet creation. It should be called + after constructing all of its instance(s). + RETURNS + error code. + PARAMETERS + svchp (IN/OUT) - The OCI service context. + errhp (IN/OUT) - The OCI error handle. If there is an error, it is + recorded in errhp and this function returns + OCI_ERROR. Diagnostic information can be obtained + by calling OCIErrorGet(). + data_set (IN/OUT) - OCIAnyDataSet that has been fully constructed. +*/ +sword OCIAnyDataSetEndCreate(OCISvcCtx *svchp, OCIError *errhp, + OCIAnyDataSet *data_set); + +/* + NAME + OCIAnyDataSetGetType - OCIAnyDataSet Get Type of an OCIAnyDataSet + DESCRIPTION + Gets the Type corresponding to an OCIAnyDataSet. It returns the actual + pointer to the type maintained inside an OCIAnyDataSet. No copying is + done for performance reasons. The client is responsible for not using + this type once the OCIAnyDataSet is freed (or its duration ends). + RETURNS + error code. + PARAMETERS + svchp (IN/OUT) - The OCI service context. + errhp (IN/OUT) - The OCI Error handle. + data_set (IN) - Initialized OCIAnyDataSet. + tc (OUT) - The typecode of the type. + type (OUT) - The type corresponding to the OCIAnyDataSet. This + could be null if the OCIAnyData corresponds to a + built-in type. +*/ +sword OCIAnyDataSetGetType (OCISvcCtx *svchp, OCIError *errhp, + OCIAnyDataSet *data_set, OCITypeCode *tc, OCIType **type); + +/* + NAME + OCIAnyDataSetGetCount - OCIAnyDataSet Get Count of instances. + DESCRIPTION + This call gets the number of instances in the OCIAnyDataSet. + RETURNS + error code. + PARAMETERS + svchp (IN/OUT) - OCI Service Context + errhp (IN/OUT) - OCI Error handle + data_set (IN) - Well formed OCIAnyDataSet. + count (OUT) - number of instances in OCIAnyDataSet +*/ +sword OCIAnyDataSetGetCount(OCISvcCtx *svchp, OCIError *errhp, + OCIAnyDataSet *data_set, ub4 *count); + +/* + NAME + OCIAnyDataSetGetInstance - OCIAnyDataSet Get next instance. + DESCRIPTION + Only sequential access to the instances in an OCIAnyDataSet is allowed. + This call returns the OCIAnyData corresponding to an instance at the + current position and updates the current position. Subsequently, the + OCIAnyData access routines may be used to access the instance. + RETURNS + error code. Returns OCI_NO_DATA if the current position is at the end of + the set, OCI_SUCCESS otherwise. + PARAMETERS + svchp (IN/OUT) - OCI Service Context + errhp (IN/OUT) - OCI Error handle + data_set (IN) - Well formed OCIAnyDataSet + data (IN/OUT) - OCIAnyData corresponding to the instance. If (*data) + is NULL, a new OCIAnyData will be allocated for same + duration as the OCIAnyDataSet. If (*data) is not NULL + , it will get reused. This OCIAnyData can be + subsequently accessed using the OCIAnyDataAccess() + call or piece-wise by using the OCIAnyDataAttrGet() + call. + NOTE + No Destruction of the old value is done here. It is the responsibility of + the caller to destroy the old value pointed to by (*data) and set (*data) + to a null pointer before beginning to make a sequence of this call. No deep + copying (of OCIType information nor the data part.) is done in the returned + OCIAnyData. This OCIAnyData cannot be used beyond the allocation duration + of the OCIAnyDataSet (it is like a reference into the OCIAnyDataSet). The + returned OCIAnyData can be reused on subsequent calls to this function to + sequentially access the OCIAnyDataSet. +*/ +sword OCIAnyDataSetGetInstance(OCISvcCtx *svchp, OCIError *errhp, + OCIAnyDataSet *data_set, OCIAnyData **data); + +/*--------------------- End of OCIAnyDataSet interfaces ---------------------*/ + +sword OCIFormatInit(void *hndl, OCIError *err); + +sword OCIFormatString(void *hndl, OCIError *err, OraText *buffer, + sbig_ora bufferLength, sbig_ora *returnLength, + const OraText *formatString, ...); + +sword OCIFormatTerm(void *hndl, OCIError *err); + +sword OCIFormatTUb1(void); +sword OCIFormatTUb2(void); +sword OCIFormatTUb4(void); +sword OCIFormatTUword(void); +sword OCIFormatTUbig_ora(void); +sword OCIFormatTSb1(void); +sword OCIFormatTSb2(void); +sword OCIFormatTSb4(void); +sword OCIFormatTSword(void); +sword OCIFormatTSbig_ora(void); +sword OCIFormatTEb1(void); +sword OCIFormatTEb2(void); +sword OCIFormatTEb4(void); +sword OCIFormatTEword(void); +sword OCIFormatTChar(void); +sword OCIFormatTText(void); +sword OCIFormatTDouble(void); +sword OCIFormatTDvoid(void); +sword OCIFormatTEnd(void); + +/*-------------------------- Extensions to XA interface ---------------------*/ +/* ------------------------- xaosvch ----------------------------------------*/ +/* + NAME + xaosvch - XA Oracle get SerViCe Handle + DESCRIPTION + Given a database name return the service handle that is used by the + XA library + NOTE + This macro has been provided for backward compatibilty with 8.0.2 +*/ +OCISvcCtx *xaosvch(OraText *dbname); + +/* ------------------------- xaoSvcCtx --------------------------------------*/ +/* + NAME + xaoSvcCtx - XA Oracle get SerViCe ConTeXt + DESCRIPTION + Given a database name return the service handle that is used by the + XA library + NOTE + This routine has been provided for APs to get access to the service + handle that XA library uses. Without this routine APs must use SQLLIB + routine sqlld2 to get access to the Logon data area registered by the + XA library +*/ +OCISvcCtx *xaoSvcCtx(OraText *dbname); + +/* ------------------------- xaoEnv -----------------------------------------*/ +/* + NAME + xaoEnv - XA Oracle get ENvironment Handle + DESCRIPTION + Given a database name return the environment handle that is used by the + XA library + NOTE + This routine has been provided for APs to get access to the environment + handle that XA library uses. Without this routine APs must use SQLLIB + routine sqlld2 to get access to the Logon data area registered by the + XA library +*/ +OCIEnv *xaoEnv(OraText *dbname); + +/* ------------------------- xaosterr ---------------------------------------*/ +/* + NAME + xaosterr - XA Oracle get xa STart ERRor code + DESCRIPTION + Given an oracle error code return the XA error code + */ +int xaosterr(OCISvcCtx *svch, sb4 error); +/*-------------------------- End Extensions ---------------------------------*/ +/*---------------------- Extensions to NLS cartridge service ----------------*/ +/* ----------------------- OCINlsGetInfo ------------------------------------*/ +/* + NAME + OCINlsGetInfo - Get NLS info from OCI environment handle + REMARKS + This function generates language information specified by item from OCI + environment handle envhp into an array pointed to by buf within size + limitation as buflen. + RETURNS + OCI_SUCCESS, OCI_INVALID_HANDLE, or OCI_ERROR on wrong item. + envhp(IN/OUT) + OCI environment handle. + errhp(IN/OUT) + The OCI error handle. If there is an error, it is record in errhp and + this function returns a NULL pointer. Diagnostic information can be + obtained by calling OCIErrorGet(). + buf(OUT) + Pointer to the destination buffer. + buflen(IN) + The size of destination buffer. The maximum length for each information + is 32 bytes. + item(IN) + It specifies to get which item in OCI environment handle and can be one + of following values: + OCI_NLS_DAYNAME1 : Native name for Monday. + OCI_NLS_DAYNAME2 : Native name for Tuesday. + OCI_NLS_DAYNAME3 : Native name for Wednesday. + OCI_NLS_DAYNAME4 : Native name for Thursday. + OCI_NLS_DAYNAME5 : Native name for Friday. + OCI_NLS_DAYNAME6 : Native name for for Saturday. + OCI_NLS_DAYNAME7 : Native name for for Sunday. + OCI_NLS_ABDAYNAME1 : Native abbreviated name for Monday. + OCI_NLS_ABDAYNAME2 : Native abbreviated name for Tuesday. + OCI_NLS_ABDAYNAME3 : Native abbreviated name for Wednesday. + OCI_NLS_ABDAYNAME4 : Native abbreviated name for Thursday. + OCI_NLS_ABDAYNAME5 : Native abbreviated name for Friday. + OCI_NLS_ABDAYNAME6 : Native abbreviated name for for Saturday. + OCI_NLS_ABDAYNAME7 : Native abbreviated name for for Sunday. + OCI_NLS_MONTHNAME1 : Native name for January. + OCI_NLS_MONTHNAME2 : Native name for February. + OCI_NLS_MONTHNAME3 : Native name for March. + OCI_NLS_MONTHNAME4 : Native name for April. + OCI_NLS_MONTHNAME5 : Native name for May. + OCI_NLS_MONTHNAME6 : Native name for June. + OCI_NLS_MONTHNAME7 : Native name for July. + OCI_NLS_MONTHNAME8 : Native name for August. + OCI_NLS_MONTHNAME9 : Native name for September. + OCI_NLS_MONTHNAME10 : Native name for October. + OCI_NLS_MONTHNAME11 : Native name for November. + OCI_NLS_MONTHNAME12 : Native name for December. + OCI_NLS_ABMONTHNAME1 : Native abbreviated name for January. + OCI_NLS_ABMONTHNAME2 : Native abbreviated name for February. + OCI_NLS_ABMONTHNAME3 : Native abbreviated name for March. + OCI_NLS_ABMONTHNAME4 : Native abbreviated name for April. + OCI_NLS_ABMONTHNAME5 : Native abbreviated name for May. + OCI_NLS_ABMONTHNAME6 : Native abbreviated name for June. + OCI_NLS_ABMONTHNAME7 : Native abbreviated name for July. + OCI_NLS_ABMONTHNAME8 : Native abbreviated name for August. + OCI_NLS_ABMONTHNAME9 : Native abbreviated name for September. + OCI_NLS_ABMONTHNAME10 : Native abbreviated name for October. + OCI_NLS_ABMONTHNAME11 : Native abbreviated name for November. + OCI_NLS_ABMONTHNAME12 : Native abbreviated name for December. + OCI_NLS_YES : Native string for affirmative response. + OCI_NLS_NO : Native negative response. + OCI_NLS_AM : Native equivalent string of AM. + OCI_NLS_PM : Native equivalent string of PM. + OCI_NLS_AD : Native equivalent string of AD. + OCI_NLS_BC : Native equivalent string of BC. + OCI_NLS_DECIMAL : decimal character. + OCI_NLS_GROUP : group separator. + OCI_NLS_DEBIT : Native symbol of debit. + OCI_NLS_CREDIT : Native sumbol of credit. + OCI_NLS_DATEFORMAT : Oracle date format. + OCI_NLS_INT_CURRENCY: International currency symbol. + OCI_NLS_LOC_CURRENCY : Locale currency symbol. + OCI_NLS_LANGUAGE : Language name. + OCI_NLS_ABLANGUAGE : Abbreviation for language name. + OCI_NLS_TERRITORY : Territory name. + OCI_NLS_CHARACTER_SET : Character set name. + OCI_NLS_LINGUISTIC : Linguistic name. + OCI_NLS_CALENDAR : Calendar name. + OCI_NLS_DUAL_CURRENCY : Dual currency symbol. +*/ +sword OCINlsGetInfo(void *envhp, OCIError *errhp, OraText *buf, + size_t buflen, ub2 item); + +/* ----------------------- OCINlsNumericInfoGet -----------------------------*/ +/* + NAME + OCINlsNumericInfoGet - Get NLS numeric info from OCI environment handle + REMARKS + This function generates numeric language information specified by item + from OCI environment handle envhp into an output number variable. + RETURNS + OCI_SUCCESS, OCI_INVALID_HANDLE, or OCI_ERROR on wrong item. + envhp(IN/OUT) + OCI environment handle. If handle invalid, returns OCI_INVALID_HANDLE. + errhp(IN/OUT) + The OCI error handle. If there is an error, it is record in errhp and + this function returns a NULL pointer. Diagnostic information can be + obtained by calling OCIErrorGet(). + val(OUT) + Pointer to the output number variable. On OCI_SUCCESS return, it will + contain the requested NLS numeric info. + item(IN) + It specifies to get which item in OCI environment handle and can be one + of following values: + OCI_NLS_CHARSET_MAXBYTESZ : Maximum character byte size for OCI + environment or session handle charset + OCI_NLS_CHARSET_FIXEDWIDTH: Character byte size for fixed-width charset; + 0 for variable-width charset +*/ +sword OCINlsNumericInfoGet(void *envhp, OCIError *errhp, sb4 *val, ub2 item); + +/* ----------------------- OCINlsCharSetNameToId ----------------------------*/ +/* + NAME + OCINlsCharSetNameToId - Get Oracle charset id given Oracle charset name + REMARKS + This function will get the Oracle character set id corresponding to + the given Oracle character set name. + RETURNS + Oracle character set id for the given Oracle character set name if + character set name and OCI handle are valid; otherwise returns 0. + envhp(IN/OUT) + OCI environment handle. + name(IN) + Pointer to a null-terminated Oracle character set name whose id + will be returned. +*/ +ub2 OCINlsCharSetNameToId(void *envhp, const oratext *name); + +/* ----------------------- OCINlsCharSetIdToName ----------------------------*/ +/* + NAME + OCINlsCharSetIdToName - Get Oracle charset name given Oracle charset id + REMARKS + This function will get the Oracle character set name corresponding to + the given Oracle character set id. + RETURNS + OCI_SUCCESS, OCI_INVALID_HANDLE, or OCI_ERROR + envhp(IN/OUT) + OCI environment handle. If handle invalid, returns OCI_INVALID_HANDLE. + buf(OUT) + Pointer to the destination buffer. On OCI_SUCCESS return, it will contain + the null-terminated string for character set name. + buflen(IN) + Size of destination buffer. Recommended size is OCI_NLS_MAXBUFSZ for + guarantee to store an Oracle character set name. If it's smaller than + the length of the character set name, the function will return OCI_ERROR. + id(IN) + Oracle character set id. +*/ +sword OCINlsCharSetIdToName(void *envhp, oratext *buf, size_t buflen, ub2 id); + +/* ----------------------- OCINlsNameMap ------------------------------------*/ +/* + NAME + OCINlsNameMap - Map NLS naming from Oracle to other standards and vice + versa + REMARKS + This function will map NLS naming from Oracle to other standards (such + as ISO, IANA) and vice versa. + RETURNS + OCI_SUCCESS, OCI_INVALID_HANDLE, or OCI_ERROR + envhp(IN/OUT) + OCI environment handle. If handle invalid, returns OCI_INVALID_HANDLE. + buf(OUT) + Pointer to the destination buffer. On OCI_SUCCESS return, it will + contain null-terminated string for requested mapped name. + buflen(IN) + The size of destination buffer. Recommended size is OCI_NLS_MAXBUFSZ + for guarantee to store an NLS name. If it is smaller than the length + of the name, the function will return OCI_ERROR. + srcbuf(IN) + Pointer to null-terminated NLS name. If it is not a valid name in its + define scope, the function will return OCI_ERROR. + flag(IN) + It specifies name mapping direction and can take the following values: + OCI_NLS_CS_IANA_TO_ORA : Map character set name from IANA to Oracle + OCI_NLS_CS_ORA_TO_IANA : Map character set name from Oracle to IANA + OCI_NLS_LANG_ISO_TO_ORA : Map language name from ISO to Oracle + OCI_NLS_LANG_ORA_TO_ISO : Map language name from Oracle to ISO + OCI_NLS_TERR_ISO_TO_ORA : Map territory name from ISO to Oracle + OCI_NLS_TERR_ORA_TO_ISO : Map territory name from Oracle to ISO + OCI_NLS_TERR_ISO3_TO_ORA : Map territory name from 3-letter ISO + abbreviation to Oracle + OCI_NLS_TERR_ORA_TO_ISO3 : Map territory name from Oracle to 3-letter + ISO abbreviation +*/ +sword OCINlsNameMap(void *envhp, oratext *buf, size_t buflen, + const oratext *srcbuf, ub4 flag); + +/* -------------------- OCIMultiByteToWideChar ------------------------------*/ +/* + NAME + OCIMultiByteToWideChar - Convert a null terminated multibyte string into + wchar + REMARKS + This routine converts an entire null-terminated string into the wchar + format. The wchar output buffer will be null-terminated. + RETURNS + OCI_SUCCESS, OCI_INVALID_HANDLE or OCI_ERROR + envhp(IN/OUT) + OCI environment handle to determine the character set of string. + dst (OUT) + Destination buffer for wchar. + src (IN) + Source string to be converted. + rsize (OUT) + Number of characters converted including null-terminator. + If it is a NULL pointer, no number return +*/ +sword OCIMultiByteToWideChar(void *envhp, OCIWchar *dst, const OraText *src, + size_t *rsize); + + +/* --------------------- OCIMultiByteInSizeToWideChar -----------------------*/ +/* + NAME + OCIMultiByteInSizeToWideChar - Convert a mulitbyte string in length into + wchar + REMARKS + This routine converts part of string into the wchar format. It will + convert as many complete characters as it can until it reaches output + buffer size or input buffer size or it reaches a null-terminator in + source string. The output buffer will be null-terminated if space permits. + If dstsz is zero, this function will only return number of characters not + including ending null terminator for converted string. + RETURNS + OCI_SUCCESS, OCI_INVALID_HANDLE or OCI_ERROR + envhp(IN/OUT) + OCI environment handle to determine the character set of string. + dst (OUT) + Pointer to a destination buffer for wchar. It can be NULL pointer when + dstsz is zero. + dstsz(IN) + Destination buffer size in character. If it is zero, this function just + returns number of characters will be need for the conversion. + src (IN) + Source string to be converted. + srcsz(IN) + Length of source string in byte. + rsize(OUT) + Number of characters written into destination buffer, or number of + characters for converted string is dstsz is zero. + If it is NULL pointer, nothing to return. +*/ +sword OCIMultiByteInSizeToWideChar(void *envhp, OCIWchar *dst, + size_t dstsz, const OraText *src, + size_t srcsz, size_t *rsize); + + +/* ---------------------- OCIWideCharToMultiByte ----------------------------*/ +/* + NAME + OCIWideCharToMultiByte - Convert a null terminated wchar string into + multibyte + REMARKS + This routine converts an entire null-terminated wide character string into + multi-byte string. The output buffer will be null-terminated. + RETURNS + OCI_SUCCESS, OCI_INVALID_HANDLE or OCI_ERROR + envhp(IN/OUT) + OCI environment handle to determine the character set of string. + dst (OUT) + Destination buffer for multi-byte string. + src (IN) + Source wchar string to be converted. + rsize (OUT) + Number of bytes written into the destination buffer. + If it is NULL pointer, nothing to return. +*/ +sword OCIWideCharToMultiByte(void *envhp, OraText *dst, const OCIWchar *src, + size_t *rsize); + + +/* ---------------------- OCIWideCharInSizeToMultiByte ----------------------*/ +/* + NAME + OCIWideCharInSizeToMultiByte - Convert a wchar string in length into + mulitbyte + REMARKS + This routine converts part of wchar string into the multi-byte format. + It will convert as many complete characters as it can until it reaches + output buffer size or input buffer size or it reaches a null-terminator + in source string. The output buffer will be null-terminated if space + permits. If dstsz is zero, the function just returns the size of byte not + including ending null-terminator need to store the converted string. + RETURNS + OCI_SUCCESS, OCI_INVALID_HANDLE or OCI_ERROR + envhp(IN/OUT) + OCI environment handle to determine the character set of string. + dst (OUT) + Destination buffer for multi-byte. It can be NULL pointer if dstsz is + zero. + dstsz(IN) + Destination buffer size in byte. If it is zero, it just returns the size + of bytes need for converted string. + src (IN) + Source wchar string to be converted. + srcsz(IN) + Length of source string in character. + rsize(OUT) + Number of bytes written into destination buffer, or number of bytes need + to store the converted string if dstsz is zero. + If it is NULL pointer, nothing to return. +*/ +sword OCIWideCharInSizeToMultiByte(void *envhp, OraText *dst, + size_t dstsz, const OCIWchar *src, + size_t srcsz, size_t *rsize); + + + +/* ----------------------- OCIWideCharIsAlnum -------------------------------*/ +/* + NAME + OCIWideCharIsAlnum - test whether wc is a letter or decimal digit + REMARKS + It tests whether wc is a letter or decimal digit. + RETURNS + TRUE or FLASE. + envhp(IN/OUT) + OCI environment handle to determine the character set . + wc(IN) + Wchar for testing. +*/ +boolean OCIWideCharIsAlnum(void *envhp, OCIWchar wc); + + +/* ----------------------- OCIWideCharIsAlpha -------------------------------*/ +/* + NAME + OCIWideCharIsAlpha - test whether wc is an alphabetic letter + REMARKS + It tests whether wc is an alphabetic letter + RETURNS + TRUE or FLASE. + envhp(IN/OUT) + OCI environment handle to determine the character set . + wc(IN) + Wchar for testing. +*/ +boolean OCIWideCharIsAlpha(void *envhp, OCIWchar wc); + + +/* --------------------- OCIWideCharIsCntrl ---------------------------------*/ +/* + NAME + OCIWideCharIsCntrl - test whether wc is a control character + REMARKS + It tests whether wc is a control character. + RETURNS + TRUE or FLASE. + envhp(IN/OUT) + OCI environment handle to determine the character set . + wc(IN) + Wchar for testing. +*/ +boolean OCIWideCharIsCntrl(void *envhp, OCIWchar wc); + + +/* ----------------------- OCIWideCharIsDigit -------------------------------*/ +/* + NAME + OCIWideCharIsDigit - test whether wc is a decimal digit character + REMARKS + It tests whether wc is a decimal digit character. + RETURNS + TRUE or FLASE. + envhp(IN/OUT) + OCI environment handle to determine the character set . + wc(IN) + Wchar for testing. +*/ +boolean OCIWideCharIsDigit(void *envhp, OCIWchar wc); + + +/* ----------------------- OCIWideCharIsGraph -------------------------------*/ +/* + NAME + OCIWideCharIsGraph - test whether wc is a graph character + REMARKS + It tests whether wc is a graph character. A graph character is character + with a visible representation and normally includes alphabetic letter, + decimal digit, and punctuation. + RETURNS + TRUE or FLASE. + envhp(IN/OUT) + OCI environment handle to determine the character set . + wc(IN) + Wchar for testing. +*/ +boolean OCIWideCharIsGraph(void *envhp, OCIWchar wc); + + +/* ----------------------- OCIWideCharIsLower -------------------------------*/ +/* + NAME + OCIWideCharIsLower - test whether wc is a lowercase letter + REMARKS + It tests whether wc is a lowercase letter. + RETURNS + TRUE or FLASE. + envhp(IN/OUT) + OCI environment handle to determine the character set . + wc(IN) + Wchar for testing. +*/ +boolean OCIWideCharIsLower(void *envhp, OCIWchar wc); + + +/* ----------------------- OCIWideCharIsPrint -------------------------------*/ +/* + NAME + OCIWideCharIsPrint - test whether wc is a printable character + REMARKS + It tests whether wc is a printable character. + RETURNS + TRUE or FLASE. + envhp(IN/OUT) + OCI environment handle to determine the character set . + wc(IN) + Wchar for testing. +*/ +boolean OCIWideCharIsPrint(void *envhp, OCIWchar wc); + + +/* ----------------------- OCIWideCharIsPunct -------------------------------*/ +/* + NAME + OCIWideCharIsPunct - test whether wc is a punctuation character + REMARKS + It tests whether wc is a punctuation character. + RETURNS + TRUE or FLASE. + envhp(IN/OUT) + OCI environment handle to determine the character set . + wc(IN) + Wchar for testing. +*/ +boolean OCIWideCharIsPunct(void *envhp, OCIWchar wc); + + +/* ----------------------- OCIWideCharIsSpace -------------------------------*/ +/* + NAME + OCIWideCharIsSpace - test whether wc is a space character + REMARKS + It tests whether wc is a space character. A space character only causes + white space in displayed text(for example, space, tab, carriage return, + newline, vertical tab or form feed). + RETURNS + TRUE or FLASE. + envhp(IN/OUT) + OCI environment handle to determine the character set . + wc(IN) + Wchar for testing. +*/ +boolean OCIWideCharIsSpace(void *envhp, OCIWchar wc); + + +/* ----------------------- OCIWideCharIsUpper -------------------------------*/ +/* + NAME + OCIWideCharIsUpper - test whether wc is a uppercase letter + REMARKS + It tests whether wc is a uppercase letter. + RETURNS + TRUE or FLASE. + envhp(IN/OUT) + OCI environment handle to determine the character set . + wc(IN) + Wchar for testing. +*/ +boolean OCIWideCharIsUpper(void *envhp, OCIWchar wc); + + +/*----------------------- OCIWideCharIsXdigit -------------------------------*/ +/* + NAME + OCIWideCharIsXdigit - test whether wc is a hexadecimal digit + REMARKS + It tests whether wc is a hexadecimal digit ( 0-9, A-F, a-f ). + RETURNS + TRUE or FLASE. + envhp(IN/OUT) + OCI environment handle to determine the character set . + wc(IN) + Wchar for testing. +*/ +boolean OCIWideCharIsXdigit(void *envhp, OCIWchar wc); + + +/* --------------------- OCIWideCharIsSingleByte ----------------------------*/ +/* + NAME + OCIWideCharIsSingleByte - test whether wc is a single-byte character + REMARKS + It tests whether wc is a single-byte character when converted into + multi-byte. + RETURNS + TRUE or FLASE. + envhp(IN/OUT) + OCI environment handle to determine the character set . + wc(IN) + Wchar for testing. +*/ +boolean OCIWideCharIsSingleByte(void *envhp, OCIWchar wc); + + +/* ----------------------- OCIWideCharToLower -------------------------------*/ +/* + NAME + OCIWideCharToLower - Convert a wchar into the lowercase + REMARKS + If there is a lower-case character mapping for wc in the specified locale, + it will return the lower-case in wchar, else return wc itself. + RETURNS + A wchar + envhp(IN/OUT) + OCI environment handle to determine the character set . + wc(IN) + Wchar for lowercase mapping. +*/ +OCIWchar OCIWideCharToLower(void *envhp, OCIWchar wc); + + +/* ----------------------- OCIWideCharToUpper -------------------------------*/ +/* + NAME + OCIWideCharToUpper - Convert a wchar into the uppercase + REMARKS + If there is a upper-case character mapping for wc in the specified locale, + it will return the upper-case in wchar, else return wc itself. + RETURNS + A wchar + envhp(IN/OUT) + OCI environment handle to determine the character set . + wc(IN) + Wchar for uppercase mapping. +*/ +OCIWchar OCIWideCharToUpper(void *envhp, OCIWchar wc); + + +/* ----------------------- OCIWideCharStrcmp --------------------------------*/ +/* + NAME + OCIWideCharStrcmp - compare two null terminated wchar string + REMARKS + It compares two wchar string in binary ( based on wchar encoding value ), + linguistic, or case-insensitive. + RETURNS + 0, if wstr1 == wstr2. + Positive, if wstr1 > wstr2. + Negative, if wstr1 < wstr2. + envhp(IN/OUT) + OCI environment handle to determine the character set. + wstr1(IN) + Pointer to a null-terminated wchar string. + wstr2(IN) + Pointer to a null-terminated wchar string. + flag(IN) + It is used to decide the comparison method. It can be taken one of the + following values: + OCI_NLS_BINARY : for the binary comparison, this is default value. + OCI_NLS_LINGUISTIC : for linguistic comparison specified in the locale. + This flag can be ORed with OCI_NLS_CASE_INSENSITIVE for case-insensitive + comparison. +*/ +int OCIWideCharStrcmp(void *envhp, const OCIWchar *wstr1, + const OCIWchar *wstr2, int flag); + + +/* ----------------------- OCIWideCharStrncmp -------------------------------*/ +/* + NAME + OCIWideCharStrncmp - compare twe wchar string in length + REMARKS + This function is similar to OCIWideCharStrcmp(), except that at most len1 + characters from wstr1 and len2 characters from wstr1 are compared. The + null-terminator will be taken into the comparison. + RETURNS + 0, if wstr1 = wstr2 + Positive, if wstr1 > wstr2 + Negative, if wstr1 < wstr2 + envhp(IN/OUT) + OCI environment handle to determine the character set . + wstr1(IN) + Pointer to the first wchar string + len1(IN) + The length for the first string for comparison + wstr2(IN) + Pointer to the second wchar string + len2(IN) + The length for the second string for comparison. + flag(IN) + It is used to decide the comparison method. It can be taken one of the + following values: + OCI_NLS_BINARY : for the binary comparison, this is default value. + OCI_NLS_LINGUISTIC : for linguistic comparison specified in the locale. + This flag can be ORed with OCI_NLS_CASE_INSENSITIVE for case-insensitive + comparison. +*/ +int OCIWideCharStrncmp(void *envhp, const OCIWchar *wstr1, size_t len1, + const OCIWchar *wstr2, size_t len2, int flag); + + +/* ----------------------- OCIWideCharStrcat --------------------------------*/ +/* + NAME + OCIWideCharStrcat - concatenate two wchar strings + REMARKS + This function appends a copy of the wchar string pointed to by wsrcstr, + including the null-terminator to the end of wchar string pointed to by + wdststr. It returns the number of character in the result string not + including the ending null-terminator. + RETURNS + number of characters in the result string not including the ending + null-terminator. + envhp(IN/OUT) + OCI environment handle to determine the character set . + wdststr(IN/OUT) + Pointer to the destination wchar string for appending. + wsrcstr(IN) + Pointer to the source wchar string to append. +*/ +size_t OCIWideCharStrcat(void *envhp, OCIWchar *wdststr, + const OCIWchar *wsrcstr); + + +/* ----------------------- OCIWideCharStrchr --------------------------------*/ +/* + NAME + OCIWideCharStrchr - Search the first occurrence of wchar in a wchar string + REMARKS + This function searchs for the first occurrence of wc in the wchar string + pointed to by wstr. It returns a pointer to the whcar if successful, or + a null pointer. + RETURNS + wchar pointer if successful, otherwise a null pointer. + envhp(IN/OUT) + OCI environment handle to determine the character set . + wstr(IN) + Pointer to the wchar string to search + wc(IN) + Wchar to search for. +*/ +OCIWchar *OCIWideCharStrchr(void *envhp, const OCIWchar *wstr, + OCIWchar wc); + + +/* ----------------------- OCIWideCharStrcpy --------------------------------*/ +/* + NAME + OCIWideCharStrcpy - copy a wchar string + REMARKS + This function copies the wchar string pointed to by wsrcstr, including the + null-terminator, into the array pointed to by wdststr. It returns the + number of character copied not including the ending null-terminator. + RETURNS + number of characters copied not including the ending null-terminator. + envhp(IN/OUT) + OCI environment handle to determine the character set . + wdststr(OUT) + Pointer to the destination wchar buffer. + wsrcstr(IN) + Pointer to the source wchar string. +*/ +size_t OCIWideCharStrcpy(void *envhp, OCIWchar *wdststr, + const OCIWchar *wsrcstr); + + +/* ----------------------- OCIWideCharStrlen --------------------------------*/ +/* + NAME + OCIWideCharStrlen - Return number of character in a wchar string + REMARKS + This function computes the number of characters in the wchar string + pointed to by wstr, not including the null-terminator, and returns + this number. + RETURNS + number of characters not including ending null-terminator. + envhp(IN/OUT) + OCI environment handle to determine the character set . + wstr(IN) + Pointer to the source wchar string. +*/ +size_t OCIWideCharStrlen(void *envhp, const OCIWchar *wstr); + + +/* ----------------------- OCIWideCharStrncat -------------------------------*/ +/* + NAME + OCIWideCharStrncat - Concatenate wchar string in length + REMARKS + This function is similar to OCIWideCharStrcat(), except that at most n + characters from wsrcstr are appended to wdststr. Note that the + null-terminator in wsrcstr will stop appending. wdststr will be + null-terminated.. + RETURNS + Number of characters in the result string not including the ending + null-terminator. + envhp(IN/OUT) + OCI environment handle to determine the character set . + wdststr(IN/OUT) + Pointer to the destination wchar string for appending. + wsrcstr(IN) + Pointer to the source wchar string to append. + n(IN) + Number of characters from wsrcstr to append. +*/ +size_t OCIWideCharStrncat(void *envhp, OCIWchar *wdststr, + const OCIWchar *wsrcstr, size_t n); + + +/* ----------------------- OCIWideCharStrncpy -------------------------------*/ +/* + NAME + OCIWideCharStrncpy - Copy wchar string in length + REMARKS + This function is similar to OCIWideCharStrcpy(), except that at most n + characters are copied from the array pointed to by wsrcstr to the array + pointed to by wdststr. Note that the null-terminator in wdststr will + stop coping and result string will be null-terminated. + RETURNS + number of characters copied not including the ending null-terminator. + envhp(IN/OUT) + OCI environment handle to determine the character set . + wdststr(OUT) + Pointer to the destination wchar buffer. + wsrcstr(IN) + Pointer to the source wchar string. + n(IN) + Number of characters from wsrcstr to copy. +*/ +size_t OCIWideCharStrncpy(void *envhp, OCIWchar *wdststr, + const OCIWchar *wsrcstr, size_t n); + + +/* ----------------------- OCIWideCharStrrchr -------------------------------*/ +/* + NAME + OCIWideCharStrrchr - search the last occurrence of a wchar in wchar string + REMARKS + This function searchs for the last occurrence of wc in the wchar string + pointed to by wstr. It returns a pointer to the whcar if successful, or + a null pointer. + RETURNS + wchar pointer if successful, otherwise a null pointer. + envhp(IN/OUT) + OCI environment handle to determine the character set . + wstr(IN) + Pointer to the wchar string to search + wc(IN) + Wchar to search for. +*/ +OCIWchar *OCIWideCharStrrchr(void *envhp, const OCIWchar *wstr, + OCIWchar wc); + + +/* --------------------- OCIWideCharStrCaseConversion -----------------------*/ +/* + NAME + OCIWideCharStrCaseConversion - convert a wchar string into lowercase or + uppercase + REMARKS + This function convert the wide char string pointed to by wsrcstr into the + uppercase or lowercase specified by flag and copies the result into the + array pointed to by wdststr. The result string will be null-terminated. + RETURNS + number of characters for result string not including null-terminator. + envhp(IN/OUT) + OCI environment handle. + wdststr(OUT) + Pointer to destination array. + wsrcstr(IN) + Pointer to source string. + flag(IN) + Specify the case to convert: + OCI_NLS_UPPERCASE : convert to uppercase. + OCI_NLS_LOWERCASE: convert to lowercase. + This flag can be ORed with OCI_NLS_LINGUISTIC to specify that the + linguistic setting in the locale will be used for case conversion. +*/ +size_t OCIWideCharStrCaseConversion(void *envhp, OCIWchar *wdststr, + const OCIWchar *wsrcstr, ub4 flag); + + +/*---------------------- OCIWideCharDisplayLength ---------------------------*/ +/* + NAME + OCIWideCharDisplayLength - Calculate the display length for a wchar + REMARKS + This function determines the number of column positions required for wc + in display. It returns number of column positions, or 0 if wc is + null-terminator. + RETURNS + Number of display positions. + envhp(IN/OUT) + OCI environment handle to determine the character set . + wc(IN) + Wchar character. +*/ +size_t OCIWideCharDisplayLength(void *envhp, OCIWchar wc ); + + +/*---------------------- OCIWideCharMultiByteLength -------------------------*/ +/* + NAME + OCIWideCharMultiByteLength - Determine byte size in multi-byte encoding + REMARKS + This function determines the number of byte required for wc in multi-byte + encoding. It returns number of bytes in multi-byte for wc. + RETURNS + Number of bytes. + envhp(IN/OUT) + OCI environment handle to determine the character set . + wc(IN) + Wchar character. +*/ +size_t OCIWideCharMultiByteLength(void *envhp, OCIWchar wc); + + +/* ----------------------- OCIMultiByteStrcmp -------------------------------*/ +/* + NAME + OCIMultiByteStrcmp - Compare two multi-byte strings + REMARKS + It compares two multi-byte strings in binary ( based on encoding value ), + linguistic, or case-insensitive. + RETURNS + 0, if str1 == str2. + Positive, if str1 > str2. + Negative, if str1 < str2. + envhp(IN/OUT) + OCI environment handle to determine the character set. + str1(IN) + Pointer to a null-terminated string. + str2(IN) + Pointer to a null-terminated string. + flag(IN) + It is used to decide the comparison method. It can be taken one of the + following values: + OCI_NLS_BINARY: for the binary comparison, this is default value. + OCI_NLS_LINGUISTIC: for linguistic comparison specified in the locale. + This flag can be ORed with OCI_NLS_CASE_INSENSITIVE for case-insensitive + comparison. +*/ +int OCIMultiByteStrcmp(void *envhp, const OraText *str1, + const OraText *str2, int flag); + + +/*----------------------- OCIMultiByteStrncmp -------------------------------*/ +/* + NAME + OCIMultiByteStrncmp - compare two strings in length + REMARKS + This function is similar to OCIMultiBytestrcmp(), except that at most + len1 bytes from str1 and len2 bytes from str2 are compared. The + null-terminator will be taken into the comparison. + RETURNS + 0, if str1 = str2 + Positive, if str1 > str2 + Negative, if str1 < str2 + envhp(IN/OUT) + OCI environment handle to determine the character set. + str1(IN) + Pointer to the first string + len1(IN) + The length for the first string for comparison + str2(IN) + Pointer to the second string + len2(IN) + The length for the second string for comparison. + flag(IN) + It is used to decide the comparison method. It can be taken one of the + following values: + OCI_NLS_BINARY: for the binary comparison, this is default value. + OCI_NLS_LINGUISTIC: for linguistic comparison specified in the locale. + This flag can be ORed with OCI_NLS_CASE_INSENSITIVE for case-insensitive + comparison. +*/ +int OCIMultiByteStrncmp(void *envhp, const OraText *str1, size_t len1, + OraText *str2, size_t len2, int flag); + + +/*----------------------- OCIMultiByteStrcat --------------------------------*/ +/* + NAME + OCIMultiByteStrcat - concatenate multibyte strings + REMARKS + This function appends a copy of the multi-byte string pointed to by + srcstr, including the null-terminator to the end of string pointed to by + dststr. It returns the number of bytes in the result string not including + the ending null-terminator. + RETURNS + number of bytes in the result string not including the ending + null-terminator. + envhp(IN/OUT) + Pointer to OCI environment handle + dststr(IN/OUT) + Pointer to the destination multi-byte string for appending. + srcstr(IN) + Pointer to the source string to append. +*/ +size_t OCIMultiByteStrcat(void *envhp, OraText *dststr, + const OraText *srcstr); + + +/*------------------------- OCIMultiByteStrcpy ------------------------------*/ +/* + NAME + OCIMultiByteStrcpy - copy multibyte string + REMARKS + This function copies the multi-byte string pointed to by srcstr, + including the null-terminator, into the array pointed to by dststr. It + returns the number of bytes copied not including the ending + null-terminator. + RETURNS + number of bytes copied not including the ending null-terminator. + envhp(IN/OUT) + Pointer to the OCI environment handle. + srcstr(OUT) + Pointer to the destination buffer. + dststr(IN) + Pointer to the source multi-byte string. +*/ +size_t OCIMultiByteStrcpy(void *envhp, OraText *dststr, + const OraText *srcstr); + + +/*----------------------- OCIMultiByteStrlen --------------------------------*/ +/* + NAME + OCIMultiByteStrlen - Calculate multibyte string length + REMARKS + This function computes the number of bytes in the multi-byte string + pointed to by str, not including the null-terminator, and returns this + number. + RETURNS + number of bytes not including ending null-terminator. + str(IN) + Pointer to the source multi-byte string. +*/ +size_t OCIMultiByteStrlen(void *envhp, const OraText *str); + + +/*----------------------- OCIMultiByteStrncat -------------------------------*/ +/* + NAME + OCIMultiByteStrncat - concatenate string in length + REMARKS + This function is similar to OCIMultiBytestrcat(), except that at most n + bytes from srcstr are appended to dststr. Note that the null-terminator in + srcstr will stop appending and the function will append as many character + as possible within n bytes. dststr will be null-terminated. + RETURNS + Number of bytes in the result string not including the ending + null-terminator. + envhp(IN/OUT) + Pointer to OCI environment handle. + srcstr(IN/OUT) + Pointer to the destination multi-byte string for appending. + dststr(IN) + Pointer to the source multi-byte string to append. + n(IN) + Number of bytes from srcstr to append. +*/ +size_t OCIMultiByteStrncat(void *envhp, OraText *dststr, + const OraText *srcstr, size_t n); + + +/*----------------------- OCIMultiByteStrncpy -------------------------------*/ +/* + NAME + OCIMultiByteStrncpy - copy multibyte string in length + REMARKS + This function is similar to OCIMultiBytestrcpy(), except that at most n + bytes are copied from the array pointed to by srcstr to the array pointed + to by dststr. Note that the null-terminator in srcstr will stop coping and + the function will copy as many character as possible within n bytes. The + result string will be null-terminated. + RETURNS + number of bytes copied not including the ending null-terminator. + envhp(IN/OUT) + Pointer to a OCI environment handle. + dststr(IN) + Pointer to the source multi-byte string. + srcstr(OUT) + Pointer to the destination buffer. + n(IN) + Number of bytes from srcstr to copy. +*/ +size_t OCIMultiByteStrncpy(void *envhp, OraText *dststr, + const OraText *srcstr, size_t n); + + +/*----------------------- OCIMultiByteStrnDisplayLength ---------------------*/ +/* + NAME + OCIMultiByteStrnDisplayLength - calculate the display length for a + multibyt string + REMARKS + This function returns the number of display positions occupied by the + complete characters within the range of n bytes. + RETURNS + number of display positions. + envhp(IN/OUT) + OCI environment handle. + str(IN) + Pointer to a multi-byte string. + n(IN) + Number of bytes to examine. +*/ +size_t OCIMultiByteStrnDisplayLength(void *envhp, const OraText *str1, + size_t n); + + +/*---------------------- OCIMultiByteStrCaseConversion ---------------------*/ +/* + NAME + OCIMultiByteStrCaseConversion + REMARKS + This function convert the multi-byte string pointed to by srcstr into the + uppercase or lowercase specified by flag and copies the result into the + array pointed to by dststr. The result string will be null-terminated. + RETURNS + number of bytes for result string not including null-terminator. + envhp(IN/OUT) + OCI environment handle. + dststr(OUT) + Pointer to destination array. + srcstr(IN) + Pointer to source string. + flag(IN) + Specify the case to convert: + OCI_NLS_UPPERCASE: convert to uppercase. + OCI_NLS_LOWERCASE: convert to lowercase. + This flag can be ORed with OCI_NLS_LINGUISTIC to specify that the + linguistic setting in the locale will be used for case conversion. +*/ +size_t OCIMultiByteStrCaseConversion(void *envhp, OraText *dststr, + const OraText *srcstr, ub4 flag); + + +/*------------------------- OCICharSetToUnicode -----------------------------*/ +/* + NAME + OCICharSetToUnicode - convert multibyte string into Unicode as UCS2 + REMARKS + This function converts a multi-byte string pointed to by src to Unicode + into the array pointed to by dst. The conversion will stop when it reach + to the source limitation or destination limitation. + The function will return number of characters converted into Unicode. + If dstlen is zero, it will just return the number of characters for the + result without real conversion. + RETURNS + OCI_SUCCESS, OCI_INVALID_HANDLE or OCI_ERROR + envhp(IN/OUT) + Pointer to an OCI environment handle + dst(OUT) + Pointer to a destination buffer + dstlen(IN) + Size of destination buffer in character + src(IN) + Pointer to multi-byte source string. + srclen(IN) + Size of source string in bytes. + rsize(OUT) + Number of characters converted. + If it is a NULL pointer, nothing to return. +*/ +sword OCICharSetToUnicode(void *envhp, ub2 *dst, size_t dstlen, + const OraText *src, size_t srclen, size_t *rsize); + + +/*------------------------- OCIUnicodeToCharSet -----------------------------*/ +/* + NAME + OCIUnicodeToCharSet - convert Unicode into multibyte + REMARKS + This function converts a Unicode string pointed to by src to multi-byte + into the array pointed to by dst. The conversion will stop when it reach + to the source limitation or destination limitation. The function will + return number of bytes converted into multi-byte. If dstlen is zero, it + will just return the number of bytes for the result without real + conversion. If a Unicode character is not convertible for the character + set specified in OCI environment handle, a replacement character will be + used for it. In this case, OCICharSetConversionIsReplacementUsed() will + return ture. + RETURNS + OCI_SUCCESS, OCI_INVALID_HANDLE or OCI_ERROR + envhp(IN/OUT) + Pointer to an OCI environment handle. + dst(OUT) + Pointer to a destination buffer. + dstlen(IN) + Size of destination buffer in byte. + src(IN) + Pointer to a Unicode string. + srclen(IN) + Size of source string in characters. + rsize(OUT) + Number of bytes converted. + If it is a NULL pointer, nothing to return. +*/ +sword OCIUnicodeToCharSet(void *envhp, OraText *dst, size_t dstlen, + const ub2 *src, size_t srclen, size_t *rsize); + +/*----------------------- OCINlsCharSetConvert ------------------------------*/ +/* + NAME + OCINlsCharSetConvert - convert between any two character set. + REMARKS + This function converts a string pointed to by src in the character set + specified with srcid to the array pointed to by dst in the character set + specified with dstid. The conversion will stop when it reaches the source + limitation or destination limitation. The function will return the number + of bytes converted into the destination buffer. Even though either source + or destination character set id is OCI_UTF16ID, given and return data + length will be represented with the byte length as this function is + intended for generic purpose. Note the conversion will not stop at null + data. + To get character set id from name, OCINlsCharSetNameToId can be used. + To check if derived data in the destination buffer contains any + replacement character resulting from conversion failure, + OCICharSetConversionIsReplacementUsed can be used to get the status. + Data alignment should be guaranteed by a caller. For example, UTF-16 data + should be aligned to ub2 type. + + RETURNS + OCI_SUCCESS or OCI_ERROR. + errhp(IN/OUT) + OCI error handle. If there is an error, it is recorded in errhp and this + function returns a NULL pointer. Diagnostic information can be obtained + by calling OCIErrorGet(). + dstid(IN) + Character set id for the destination buffer. + dstp(OUT) + Pointer to the destination buffer. + dstlen(IN) + The maximum byte size of destination buffer. + srcid(IN) + Character set id for the source buffer. + srcp(IN) + Pointer to the source buffer. + srclen(IN) + The length byte size of source buffer. + rsize(OUT) + The number of characters converted. If it is a NULL pointer, nothing to + return. +*/ +sword OCINlsCharSetConvert(void *envhp, OCIError *errhp, + ub2 dstid, void *dstp, size_t dstlen, + ub2 srcid, const void *srcp, size_t srclen, + size_t *rsize); + + +/* ------------------- OCICharsetConversionIsReplacementUsed ----------------*/ +/* + NAME + OCICharsetConversionIsReplacementUsed - chech if replacement is used in + conversion + REMARKS + This function indicates whether or not the replacement character was used + for nonconvertible characters in character set conversion in last invoke + of OCICharsetUcs2ToMb(). + RETURNS + TRUE is the replacement character was used in last OCICharsetUcs2ToMb() + invoking, else FALSE. + envhp(IN/OUT) + OCI environment handle. This should be the first handle passed to + OCICharsetUcs2ToMb(). +*/ +boolean OCICharSetConversionIsReplacementUsed(void *envhp); + +/*------------------- OCINlsEnvironmentVariableGet -----------------*/ +/* + NAME + OCINlsEnvironmentVariableGet - get a value of NLS environment variable. + + DESCRIPTION + This function retrieves a value of NLS environment variable to the buffer + pointed to by val. Data type is determined by the parameter specified by + item. Either numeric data or string data can be retrieved. + + RETURNS + OCI_SUCCESS or OCI_ERROR. + + PARAMETERS + valp(OUT) - + Pointer to the buffer. + size(IN) - + Size of the buffer. This argument is only applicable to string data type, + but not to numerical data, in such case, it is ignored. + item(IN) - + NLS item value, which can be one of following values: + OCI_NLS_CHARSET_ID - NLS_LANG character set id in ub2 data type. + OCI_NLS_NCHARSET_ID - NLS_NCHAR character set id in ub2 data type. + charset(IN) - + Character set id for retrieved string data. If it is 0, NLS_LANG will be + used. OCI_UTF16ID is a valid id. In case of numeric data, this argument + is ignored. + rsize(OUT) - + Size of return value. + + NOTE + This functions is mainly used for retrieving character set id from either + NLS_LANG or NLS_NCHAR environment variables. If NLS_LANG is not set, + the default character set id is returned. + For future extension, the buffer is capable for storing other data types. +*/ +sword OCINlsEnvironmentVariableGet(void *valp, size_t size, ub2 item, + ub2 charset, size_t *rsize); + + +/*------------------------- OCIMessageOpen ----------------------------------*/ +/* + NAME + OCIMessageOpen - open a locale message file + REMARKS + This function opens a message handle for facility of product in a language + pointed to by envhp. It first try to open the message file corresponding + to envhp for the facility. If it successes, it will use that file to + initialize a message handle, else it will use the default message file + which is for American language for the facility. The function return a + pointer pointed to a message handle into msghp parameter. + RETURNS + OCI_SUCCESS, OCI_INVALID_HANDLE or OCI_ERROR + envhp(IN/OUT) + A pointer to OCI environment handle for message language. + errhp(IN/OUT) + The OCI error handle. If there is an error, it is record in errhp and this + function returns a NULL pointer. Diagnostic information can be obtained by + calling OCIErrorGet(). + msghp(OUT) + a message handle for return + product(IN) + A pointer to a product name. Product name is used to locate the directory + for message in a system dependent way. For example, in Solaris, the + directory of message files for the product `rdbms' is + `${ORACLE_HOME}/rdbms'. + facility(IN) + A pointer to a facility name in the product. It is used to construct a + message file name. A message file name follows the conversion with + facility as prefix. For example, the message file name for facility + `img' in American language will be `imgus.msb' where `us' is the + abbreviation of American language and `msb' as message binary file + extension. + dur(IN) + Duration for memory allocation for the return message handle. It can be + the following values: + OCI_DURATION_CALL + OCI_DURATION_STATEMENT + OCI_DURATION_SESSION + OCI_DURATION_TRANSACTION + For the detail description, please refer to Memory Related Service + Interfaces section. +*/ +sword OCIMessageOpen(void *envhp, OCIError *errhp, OCIMsg **msghp, + const OraText *product, const OraText *facility, + OCIDuration dur); + + +/*------------------------- OCIMessageGet -----------------------------------*/ +/* + NAME + OCIMessageGet - get a locale message from a message handle + REMARKS + This function will get message with message number identified by msgno and + if buflen is not zero, the function will copy the message into the buffer + pointed to by msgbuf. If buflen is zero, the message will be copied into + a message buffer inside the message handle pointed to by msgh. For both + cases. it will return the pointer to the null-terminated message string. + If it cannot get the message required, it will return a NULL pointer. + RETURNS + A pointer to a null-terminated message string on success, otherwise a NULL + pointer. + msgh(IN/OUT) + Pointer to a message handle which was previously opened by + OCIMessageOpen(). + msgno(IN) + The message number for getting message. + msgbuf(OUT) + Pointer to a destination buffer to the message retrieved. If buflen is + zero, it can be NULL pointer. + buflen(IN) + The size of the above destination buffer. +*/ +OraText *OCIMessageGet(OCIMsg *msgh, ub4 msgno, OraText *msgbuf, + size_t buflen); + +/*------------------------- OCIMessageClose ---------------------------------*/ +/* + NAME + OCIMessageClose - close a message handle + REMARKS + This function closes a message handle pointed to by msgh and frees any + memory associated with this handle. + RETURNS + OCI_SUCCESS, OCI_INVALID_HANDLE or OCI_ERROR + envhp(IN/OUT) + A pointer to OCI environment handle for message language. + errhp(IN/OUT) + The OCI error handle. If there is an error, it is record in errhp and this + function returns a NULL pointer. Diagnostic information can be obtained by + calling OCIErrorGet(). + msghp(IN/OUT) + A pointer to a message handle which was previously opened by + OCIMessageOpen(). +*/ +sword OCIMessageClose(void *envhp, OCIError *errhp, OCIMsg *msghp); + +/*--------------- End of Extensions to NLS cartridge service ----------------*/ + + +/*----------------- Extensions to OCI Thread interface ---------------------*/ +/***************************************************************************** + DESCRIPTION +****************************************************************************** +1 Threads Interface + +The OCIThread package provides a number of commonly used threading +primitives for use by Oracle customers. It offers a portable interface to +threading capabilities native to various platforms. It does not implement +threading on platforms which do not have native threading capability. + +OCIThread does not provide a portable implementation of multithreaded +facilities. It only serves as a set of portable covers for native +multithreaded facilities. Therefore, platforms that do not have native +support for multi-threading will only be able to support a limited +implementation of OCIThread. As a result, products that rely on all of +OCIThread's functionality will not port to all platforms. Products that must +port to all platforms must use only a subset of OCIThread's functionality. +This issue is discussed further in later sections of this document. + +The OCIThread API is split into four main parts. Each part is described +briefly here. The following subsections describe each in greater detail. + + 1. Initialization and Termination Calls + + These calls deal with the initialization and termination of OCIThread. + Initialization of OCIThread initializes the OCIThread context which is + a member of the OCI environment or session handle. This context is + required for other OCIThread calls. + + 2. Passive Threading Primitives + + The passive threading primitives include primitives to manipulate mutual + exclusion (mutex) locks, thread ID's, and thread-specific data keys. + + The reason that these primitives are described as 'passive' is that while + their specifications allow for the existence of multiple threads, they do + not require it. This means that it is possible for these primitives to + be implemented according to specification in both single-threaded and + multi-threaded environments. + + As a result, OCIThread clients that use only these primitives will not + require the existence of multiple threads in order to work correctly, + i.e., they will be able to work in single-threaded environments without + branching code. + + 3. Active Threading Primitives + + Active threading primitives include primitives dealing with the creation, + termination, and other manipulation of threads. + + The reason that these primitives are described as 'active' is that they + can only be used in true multi-threaded environments. Their + specifications explicitly require that it be possible to have multiple + threads. If you need to determine at runtime whether or not you are in a + multi-threaded environment, call OCIThreadIsMulti() before calling an + OCIThread active primitive. + + +1.1 Initialization & Termination +================================== + +The types and functions described in this section are associated with the +initialization and termination of the OCIThread package. OCIThread must +be properly initialized before any of its functionality can be used. +OCIThread's process initialization function, 'OCIThreadProcessInit()', +must be called with care; see below. + +The observed behavior of the initialization and termination functions is the +same regardless of whether OCIThread is in single-threaded or multi-threaded +environment. It is OK to call the initialization functions from both generic +and operating system specific (OSD) code. + +1.1.1 Types + + OCIThreadContext - OCIThread Context + ------------------------------------- + + Most calls to OCIThread functions take the OCI environment or session + handle as a parameter. The OCIThread context is part of the OCI + environment or session handle and it must be initialized by calling + 'OCIThreadInit()'. Termination of the OCIThread context occurs by calling + 'OCIThreadTerm()'. + + The OCIThread context is a private data structure. Clients must NEVER + attempt to examine the contents of the context. + +1.1.2 OCIThreadProcessInit + + OCIThreadProcessInit - OCIThread Process INITialization + -------------------------------------------------------- + + Description + + This function should be called to perform OCIThread process + initialization. + + Prototype + + void OCIThreadProcessInit(); + + Returns + + Nothing. + + Notes + + Whether or not this function needs to be called depends on how OCI + Thread is going to be used. + + * In a single-threaded application, calling this function is optional. + If it is called at all, the first call to it must occur before calls + to any other OCIThread functions. Subsequent calls can be made + without restriction; they will not have any effect. + + * In a multi-threaded application, this function MUST be called. The + first call to it MUST occur 'strictly before' any other OCIThread + calls; i.e., no other calls to OCIThread functions (including other + calls to this one) can be concurrent with the first call. + Subsequent calls to this function can be made without restriction; + they will not have any effect. + + +1.1.3 OCIThreadInit + + OCIThreadInit - OCIThread INITialize + ------------------------------------- + + Description + + This initializes OCIThread context. + + Prototype + + sword OCIThreadInit(void *hndl, OCIError *err); + + hndl(IN/OUT): The OCI environment or session handle. + + err(IN/OUT): The OCI error handle. If there is an error and OCI_ERROR + is returned, the error is recorded in err and diagnostic + information can be obtained by calling OCIErrorGet(). + + Returns + + OCI_SUCCESS, OCI_ERROR or OCI_INVALID_HANDLE. + + Notes + + It is illegal for OCIThread clients to try an examine the memory + pointed to by the returned pointer. + + It is safe to make concurrent calls to 'OCIThreadInit()'. Unlike + 'OCIThreadProcessInit()', there is no need to have a first call + that occurs before all the others. + + The first time 'OCIThreadInit()' is called, it initilaizes the OCI + Thread context. It also saves a pointer to the context in some system + dependent manner. Subsequent calls to 'OCIThreadInit()' will return + the same context. + + Each call to 'OCIThreadInit()' must eventually be matched by a call to + 'OCIThreadTerm()'. + + OCIThreadTerm - OCIThread TERMinate + ------------------------------------ + + Description + + This should be called to release the OCIThread context. It should be + called exactly once for each call made to 'OCIThreadInit()'. + + Prototype + + sword OCIThreadTerm(void *hndl, OCIError *err); + + hndl(IN/OUT): The OCI environment or session handle. + + err(IN/OUT): The OCI error handle. If there is an error and OCI_ERROR + is returned, the error is recorded in err and diagnostic + information can be obtained by calling OCIErrorGet(). + + Returns + + OCI_SUCCESS, OCI_ERROR or OCI_INVALID_HANDLE. + + Notes + + It is safe to make concurrent calls to 'OCIThreadTerm()'. + + 'OCIThreadTerm()' will not do anything until it has been called as + many times as 'OCIThreadInit()' has been called. When that happens, + it terminates the OCIThread layer and frees the memory allocated for + the context. Once this happens, the context should not be re-used. + It will be necessary to obtain a new one by calling 'OCIThreadInit()'. + + + OCIThreadIsMulti - OCIThread Is Multi-Threaded? + ------------------------------------------------ + + Description + + This tells the caller whether the application is running in a + multi-threaded environment or a single-threaded environment. + + Prototype + boolean OCIThreadIsMulti(void); + + Returns + + TRUE if the environment is multi-threaded; + FALSE if the environment is single-threaded. + + +1.2 Passive Threading Primitives +================================== + +1.2.1 Types + +The passive threading primitives deal with the manipulation of mutex, +thread ID's, and thread-specific data. Since the specifications of these +primitives do not require the existence of multiple threads, they can be +used both on multithreaded and single-threaded platforms. + +1.2.1.1 OCIThreadMutex - OCIThread Mutual Exclusion Lock +----------------------------------------------------------- + + The type 'OCIThreadMutex' is used to represent a mutual exclusion lock + (mutex). A mutex is typically used for one of two purposes: (i) to + ensure that only one thread accesses a given set of data at a time, or + (ii) to ensure that only one thread executes a given critical section of + code at a time. + + Mutexes pointer can be declared as parts of client structures or as + stand-alone variables. Before they can be used, they must be initialized + using 'OCIThreadMutexInit()'. Once they are no longer needed, they must be + destroyed using 'OCIThreadMutexDestroy()'. A mutex pointer must NOT be + used after it is destroyed. + + A thread can acquire a mutex by using either 'OCIThreadMutexAcquire()' or + 'OCIThreadMutexTry()'. They both ensure that only one thread at a time is + allowed to hold a given mutex. A thread that holds a mutex can release it + by calling 'OCIThreadMutexRelease()'. + + +1.2.1.2 OCIThreadKey - OCIThread Key for Thread-Specific Data +---------------------------------------------------------------- + + A key can be thought of as a process-wide variable that has a + thread-specific value. What this means is that all the threads in a + process can use any given key. However, each thread can examine or modify + that key independently of the other threads. The value that a thread sees + when it examines the key will always be the same as the value that it last + set for the key. It will not see any values set for the key by the other + threads. + + The type of the value held by a key is a 'void *' generic pointer. + + Keys can be created using 'OCIThreadKeyInit()'. When a key is created, its + value is initialized to 'NULL' for all threads. + + A thread can set a key's value using 'OCIThreadKeySet()'. A thread can + get a key's value using 'OCIThreadKeyGet()'. + + The OCIThread key functions will save and retrieve data SPECIFIC TO THE + THREAD. When clients maintain a pool of threads and assign the threads to + different tasks, it *may not* be appropriate for a task to use OCIThread + key functions to save data associated with it. Here is a scenario of how + things can fail: A thread is assigned to execute the initialization of a + task. During the initialization, the task stored some data related to it + in the thread using OCIThread key functions. After the initialization, + the thread is returned back to the threads pool. Later, the threads pool + manager assigned another thread to perform some operations on the task, + and the task needs to retrieve those data it stored earlier in + initialization. Since the task is running in another thread, it will not + be able to retrieve the same data back! Applications that use thread + pools should be aware of this and be cautious when using OCIThread key + functions. + + +1.2.1.3 OCIThreadKeyDestFunc - OCIThread Key Destructor Function Type +------------------------------------------------------------------------ + + This is the type of a pointer to a key's destructor routine. Keys can be + associated with a destructor routine when they are created (see + 'OCIThreadKeyInit()'). + + A key's destructor routine will be called whenever a thread that has a + non-NULL value for the key terminates. + + The destructor routine returns nothing and takes one parameter. The + parameter will be the value that was set for key when the thread + terminated. + + The destructor routine is guaranteed to be called on a thread's value + in the key after the termination of the thread and before process + termination. No more precise guarantee can be made about the timing + of the destructor routine call; thus no code in the process may assume + any post-condition of the destructor routine. In particular, the + destructor is not guaranteed to execute before a join call on the + terminated thread returns. + + +1.2.1.4 OCIThreadId - OCIThread Thread ID +-------------------------------------------- + + Type 'OCIThreadId' is the type that will be used to identify a thread. + At any given time, no two threads will ever have the same 'OCIThreadId'. + However, 'OCIThreadId' values can be recycled; i.e., once a thread dies, + a new thread may be created that has the same 'OCIThreadId' as the one + that died. In particular, the thread ID must uniquely identify a thread + T within a process, and it must be consistent and valid in all threads U + of the process for which it can be guaranteed that T is running + concurrently with U. The thread ID for a thread T must be retrievable + within thread T. This will be done via OCIThreadIdGet(). + + The 'OCIThreadId' type supports the concept of a NULL thread ID: the NULL + thread ID will never be the same as the ID of an actual thread. + + + +1.2.2 Function prototypes for passive primitives +-------------------------------------------------- + +1.2.2.1 Mutex functions +------------------------- + + OCIThreadMutexInit - OCIThread MuteX Initialize + ----------------------------------------------- + + Description + + This allocate and initializes a mutex. All mutexes must be + initialized prior to use. + + Prototype + + sword OCIThreadMutexInit(void *hndl, OCIError *err, + OCIThreadMutex **mutex); + + hndl(IN/OUT): The OCI environment or session handle. + + err(IN/OUT): The OCI error handle. If there is an error and OCI_ERROR + is returned, the error is recorded in err and diagnostic + information can be obtained by calling OCIErrorGet(). + + mutex(OUT): The mutex to initialize. + + Returns + + OCI_SUCCESS, OCI_ERROR or OCI_INVALID_HANDLE. + + Notes + + Multiple threads must not initialize the same mutex simultaneously. + Also, a mutex must not be reinitialized until it has been destroyed (see + 'OCIThreadMutexDestroy()'). + + OCIThreadMutexDestroy - OCIThread MuteX Destroy + ----------------------------------------------- + + Description + + This destroys and deallocate a mutex. Each mutex must be destroyed + once it is no longer needed. + + Prototype + + sword OCIThreadMutexDestroy(void *hndl, OCIError *err, + OCIThreadMutex **mutex); + + hndl(IN/OUT): The OCI environment or session handle. + + err(IN/OUT): The OCI error handle. If there is an error and OCI_ERROR + is returned, the error is recorded in err and diagnostic + information can be obtained by calling OCIErrorGet(). + + mutex(IN/OUT): The mutex to destroy. + + Returns + + OCI_SUCCESS, OCI_ERROR or OCI_INVALID_HANDLE. + + Notes + + It is not legal to destroy a mutex that is uninitialized or is currently + held by a thread. The destruction of a mutex must not occur concurrently + with any other operations on the mutex. A mutex must not be used after + it has been destroyed. + + + OCIThreadMutexAcquire - OCIThread MuteX Acquire + ----------------------------------------------- + + Description + + This acquires a mutex for the thread in which it is called. If the mutex + is held by another thread, the calling thread is blocked until it can + acquire the mutex. + + Prototype + + sword OCIThreadMutexAcquire(void *hndl, OCIError *err, + OCIThreadMutex *mutex); + + hndl(IN/OUT): The OCI environment or session handle. + + err(IN/OUT): The OCI error handle. If there is an error, it is + recorded in err and this function returns OCI_ERROR. + Diagnostic information can be obtained by calling + OCIErrorGet(). + + mutex(IN/OUT): The mutex to acquire. + + Returns + + OCI_SUCCESS, OCI_ERROR or OCI_INVALID_HANDLE. + + Notes + + It is illegal to attempt to acquire an uninitialized mutex. + + This function's behavior is undefined if it is used by a thread to + acquire a mutex that is already held by that thread. + + + + OCIThreadMutexRelease - OCIThread MuteX Release + ----------------------------------------------- + + Description + + This releases a mutex. If there are any threads blocked on the mutex, + one of them will acquire it and become unblocked. + + Prototype + + sword OCIThreadMutexRelease(void *hndl, OCIError *err, + OCIThreadMutex *mutex); + + hndl(IN/OUT): The OCI environment or session handle. + + err(IN/OUT): The OCI error handle. If there is an error and OCI_ERROR + is returned, the error is recorded in err and diagnostic + information can be obtained by calling OCIErrorGet(). + + mutex(IN/OUT): The mutex to release. + + Returns + + OCI_SUCCESS, OCI_ERROR or OCI_INVALID_HANDLE. + + Notes + + It is illegal to attempt to release an uninitialized mutex. It is also + illegal for a thread to release a mutex that it does not hold. + + + OCIThreadKeyInit - OCIThread KeY Initialize + ------------------------------------------- + + Description + + This creates a key. Each call to this routine allocate and generates + a new key that is distinct from all other keys. + + Prototype + + sword OCIThreadKeyInit(void *hndl, OCIError *err, OCIThreadKey **key, + OCIThreadKeyDestFunc destFn); + + hndl(IN/OUT): The OCI environment or session handle. + + err(IN/OUT): The OCI error handle. If there is an error and OCI_ERROR + is returned, the error is recorded in err and diagnostic + information can be obtained by calling OCIErrorGet(). + + key(OUT): The 'OCIThreadKey' in which to create the new key. + + destFn(IN): The destructor for the key. NULL is permitted. + + Returns + + OCI_SUCCESS, OCI_ERROR or OCI_INVALID_HANDLE. + + Notes + + Once this function executes successfully, a pointer to an allocated and + initialized key is return. That key can be used with 'OCIThreadKeyGet()' + and 'OCIThreadKeySet()'. The initial value of the key will be 'NULL' for + all threads. + + It is illegal for this function to be called more than once to create the + same key (i.e., to be called more than once with the same value for the + 'key' parameter). + + If the 'destFn' parameter is not NULL, the routine pointed to by 'destFn' + will be called whenever a thread that has a non-NULL value for the key + terminates. The routine will be called with one parameter. The + parameter will be the key's value for the thread at the time at which the + thread terminated. + If the key does not need a destructor function, pass NULL for 'destFn'. + + + OCIThreadKeyDestroy - OCIThread KeY DESTROY + ------------------------------------------- + + Description + + Destroy and deallocate the key pointed to by 'key'. + + Prototype + + sword OCIThreadKeyDestroy(void *hndl, OCIError *err, + OCIThreadKey **key); + + hndl(IN/OUT): The OCI environment or session handle. + + err(IN/OUT): The OCI error handle. If there is an error and OCI_ERROR + is returned, the error is recorded in err and diagnostic + information can be obtained by calling OCIErrorGet(). + + key(IN/OUT): The 'OCIThreadKey' in which to destroy the key. + + Returns + + OCI_SUCCESS, OCI_ERROR or OCI_INVALID_HANDLE. + + Notes + + This is different from the destructor function callback passed to the + key create routine. This new destroy function 'OCIThreadKeyDestroy' is + used to terminate any resources OCI THREAD acquired when it created + 'key'. [The 'OCIThreadKeyDestFunc' callback type is a key VALUE + destructor; it does in no way operate on the key itself.] + + This must be called once the user has finished using the key. Not + calling the key destroy function may result in memory leaks. + + + + +1.2.2.2 Thread Key operations +------------------------------- + + OCIThreadKeyGet - OCIThread KeY Get value + ----------------------------------------- + + Description + + This gets the calling thread's current value for a key. + + Prototype + + sword OCIThreadKeyGet(void *hndl, OCIError *err, OCIThreadKey *key, + void **pValue); + + hndl(IN/OUT): The OCI environment or session handle. + + err(IN/OUT): The OCI error handle. If there is an error and OCI_ERROR + is returned, the error is recorded in err and diagnostic + information can be obtained by calling OCIErrorGet(). + + key(IN): The key. + + pValue(IN/OUT): The location in which to place the thread-specific + key value. + + Returns + + OCI_SUCCESS, OCI_ERROR or OCI_INVALID_HANDLE. + + Notes + + It is illegal to use this function on a key that has not been created + using 'OCIThreadKeyInit()'. + + If the calling thread has not yet assigned a value to the key, 'NULL' is + placed in the location pointed to by 'pValue'. + + + OCIThreadKeySet - OCIThread KeY Set value + ----------------------------------------- + + Description + + This sets the calling thread's value for a key. + + Prototype + + sword OCIThreadKeySet(void *hndl, OCIError *err, OCIThreadKey *key, + void *value); + + hndl(IN/OUT): The OCI environment or session handle. + + err(IN/OUT): The OCI error handle. If there is an error and OCI_ERROR + is returned, the error is recorded in err and diagnostic + information can be obtained by calling OCIErrorGet(). + + key(IN/OUT): The key. + + value(IN): The thread-specific value to set in the key. + + Returns + + OCI_SUCCESS, OCI_ERROR or OCI_INVALID_HANDLE. + + Notes + + It is illegal to use this function on a key that has not been created + using 'OCIThreadKeyInit()'. + +1.2.2.3 Thread Id +-------------------- + + OCIThreadIdInit - OCIThread Thread Id INITialize + -------------------------------------------------- + + Description + + Allocate and initialize the thread id 'tid'. + + Prototype + + sword OCIThreadIdInit(void *hndl, OCIError *err, OCIThreadId **tid); + + hndl(IN/OUT): The OCI environment or session handle. + + err(IN/OUT): The OCI error handle. If there is an error and OCI_ERROR + is returned, the error is recorded in err and diagnostic + information can be obtained by calling OCIErrorGet(). + + tid (OUT): Pointer to the thread ID to initialize. + + Returns + + OCI_SUCCESS, OCI_ERROR or OCI_INVALID_HANDLE. + + + OCIThreadIdDestroy - OCIThread Thread Id DESTROY + -------------------------------------------------- + + Description + + Destroy and deallocate the thread id 'tid'. + + Prototype + + sword OCIThreadIdDestroy(void *hndl, OCIError *err, OCIThreadId **tid); + + hndl(IN/OUT): The OCI environment or session handle. + + err(IN/OUT): The OCI error handle. If there is an error and OCI_ERROR + is returned, the error is recorded in err and diagnostic + information can be obtained by calling OCIErrorGet(). + + tid(IN/OUT): Pointer to the thread ID to destroy. + + Returns + + OCI_SUCCESS, OCI_ERROR or OCI_INVALID_HANDLE. + + Note + + 'tid' should be initialized by OCIThreadIdInit(). + + + OCIThreadIdSet - OCIThread Thread Id Set + ----------------------------------------- + + Description + + This sets one 'OCIThreadId' to another. + + Prototype + + sword OCIThreadIdSet(void *hndl, OCIError *err, + OCIThreadId *tidDest, + OCIThreadId *tidSrc); + + hndl(IN/OUT): The OCI environment or session handle. + + err(IN/OUT): The OCI error handle. If there is an error and OCI_ERROR + is returned, the error is recorded in err and diagnostic + information can be obtained by calling OCIErrorGet(). + + tidDest(OUT): This should point to the location of the 'OCIThreadId' + to be set to. + + tidSrc(IN): This should point to the 'OCIThreadId' to set from. + + Returns + + OCI_SUCCESS, OCI_ERROR or OCI_INVALID_HANDLE. + + Notes + + 'tid' should be initialized by OCIThreadIdInit(). + + + OCIThreadIdSetNull - OCIThread Thread Id Set Null + --------------------------------------------------------- + + Description + + This sets the NULL thread ID to a given 'OCIThreadId'. + + Prototype + + sword OCIThreadIdSetNull(void *hndl, OCIError *err, + OCIThreadId *tid); + + hndl(IN/OUT): The OCI environment or session handle. + + err(IN/OUT): The OCI error handle. If there is an error, it is + recorded in err and this function returns OCI_ERROR. + Diagnostic information can be obtained by calling + OCIErrorGet(). + + tid(OUT): This should point to the 'OCIThreadId' in which to put + the NULL thread ID. + + Returns + + OCI_SUCCESS, OCI_ERROR or OCI_INVALID_HANDLE. + + Notes + + 'tid' should be initialized by OCIThreadIdInit(). + + + OCIThreadIdGet - OCIThread Thread Id Get + ------------------------------------------ + + Description + + This retrieves the 'OCIThreadId' of the thread in which it is called. + + Prototype + + sword OCIThreadIdGet(void *hndl, OCIError *err, + OCIThreadId *tid); + + hndl(IN/OUT): The OCI environment or session handle. + + err(IN/OUT): The OCI error handle. If there is an error and OCI_ERROR + is returned, the error is recorded in err and diagnostic + information can be obtained by calling OCIErrorGet(). + + tid(OUT): This should point to the location in which to place the + ID of the calling thread. + + Returns + + OCI_SUCCESS, OCI_ERROR or OCI_INVALID_HANDLE. + + Notes + + 'tid' should be initialized by OCIThreadIdInit(). + + When OCIThread is used in a single-threaded environment, + OCIThreadIdGet() will always place the same value in the location + pointed to by 'tid'. The exact value itself is not important. The + important thing is that it is not the same as the NULL thread ID and + that it is always the same value. + + + OCIThreadIdSame - OCIThread Thread Ids Same? + ---------------------------------------------- + + Description + + This determines whether or not two 'OCIThreadId's represent the same + thread. + + Prototype + + sword OCIThreadIdSame(void *hndl, OCIError *err, + OCIThreadId *tid1, OCIThreadId *tid2, + boolean *result); + + hndl(IN/OUT): The OCI environment or session handle. + + err(IN/OUT): The OCI error handle. If there is an error and OCI_ERROR + is returned, the error is recorded in err and diagnostic + information can be obtained by calling OCIErrorGet(). + + tid1(IN): Pointer to the first 'OCIThreadId'. + + tid2(IN): Pointer to the second 'OCIThreadId'. + + result(IN/OUT): Pointer to the result. + + Returns + + OCI_SUCCESS, OCI_ERROR or OCI_INVALID_HANDLE. + + Notes + + If 'tid1' and 'tid2' represent the same thread, 'result' is set to TRUE. + Otherwise, 'result' is set to FALSE. + + 'result' is set to TRUE if both 'tid1' and 'tid2' are the NULL thread ID. + + 'ti1d' and 'tid2' should be initialized by OCIThreadIdInit(). + + + OCIThreadIdNull - OCIThread Thread Id NULL? + --------------------------------------------- + + Description + + This determines whether or not a given 'OCIThreadId' is the NULL thread + ID. + + Prototype + + sword OCIThreadIdNull(void *hndl, OCIError *err, + OCIThreadId *tid, + boolean *result); + + hndl(IN/OUT): The OCI environment or session handle. + + err(IN/OUT): The OCI error handle. If there is an error and OCI_ERROR + is returned, the error is recorded in err and diagnostic + information can be obtained by calling OCIErrorGet(). + + tid(IN): Pointer to the 'OCIThreadId' to check. + + result(IN/OUT): Pointer to the result. + + Returns + + OCI_SUCCESS, OCI_ERROR or OCI_INVALID_HANDLE. + + Notes + + If 'tid' is the NULL thread ID, 'result' is set to TRUE. Otherwise, + 'result' is set to FALSE. + + 'tid' should be initialized by OCIThreadIdInit(). + + +1.3 Active Threading Primitives +================================= + +The active threading primitives deal with the manipulation of actual +threads. Because the specifications of most of these primitives require +that it be possible to have multiple threads, they work correctly only in +the enabled OCIThread; In the disabled OCIThread, they always return +failure. The exception is OCIThreadHandleGet(); it may be called in a +single-threaded environment, in which case it will have no effect. + +Active primitives should only be called by code running in a multi-threaded +environment. You can call OCIThreadIsMulti() to determine whether the +environment is multi-threaded or single-threaded. + + +1.3.1 Types +-------------- + +1.3.1.1 OCIThreadHandle - OCIThread Thread Handle +------------------------------------------------------ + + Type 'OCIThreadHandle' is used to manipulate a thread in the active + primitives: OCIThreadJoin()and OCIThreadClose(). A thread handle opened by + OCIThreadCreate() must be closed in a matching call to + OCIThreadClose(). A thread handle is invalid after the call to + OCIThreadClose(). + + The distinction between a thread ID and a thread handle in OCIThread usage + follows the distinction between the thread ID and the thread handle on + Windows NT. On many platforms, the underlying native types are the same. + + +1.3.2 Functions +------------------ + + OCIThreadHndInit - OCIThread HaNDle Initialize + ---------------------------------------------- + + Description + + Allocate and initialize the thread handle. + + Prototype + + sword OCIThreadHndInit(void *hndl, OCIError *err, + OCIThreadHandle **thnd); + + hndl(IN/OUT): The OCI environment or session handle. + + err(IN/OUT): The OCI error handle. If there is an error and OCI_ERROR + is returned, the error is recorded in err and diagnostic + information can be obtained by calling OCIErrorGet(). + + thnd(OUT): The address of pointer to the thread handle to initialize. + + Returns + + OCI_SUCCESS, OCI_ERROR or OCI_INVALID_HANDLE. + + + OCIThreadHndDestroy - OCIThread HaNDle Destroy + ---------------------------------------------- + + Description + + Destroy and deallocate the thread handle. + + Prototype + + sword OCIThreadHndDestroy(void *hndl, OCIError *err, + OCIThreadHandle **thnd); + + hndl(IN/OUT): The OCI environment or session handle. + + err(IN/OUT): The OCI error handle. If there is an error and OCI_ERROR + is returned, the error is recorded in err and diagnostic + information can be obtained by calling OCIErrorGet(). + + thnd(IN/OUT): The address of pointer to the thread handle to destroy. + + Returns + + OCI_SUCCESS, OCI_ERROR or OCI_INVALID_HANDLE. + + Notes + + 'thnd' should be initialized by OCIThreadHndInit(). + + + OCIThreadCreate - OCIThread Thread Create + ----------------------------------------- + + Description + + This creates a new thread. + + Prototype + + sword OCIThreadCreate(void *hndl, OCIError *err, + void (*start)(void *), void *arg, + OCIThreadId *tid, OCIThreadHandle *tHnd); + + hndl(IN/OUT): The OCI environment or session handle. + + err(IN/OUT): The OCI error handle. If there is an error and OCI_ERROR + is returned, the error is recorded in err and diagnostic + information can be obtained by calling OCIErrorGet(). + + start(IN): The function in which the new thread should begin + execution. + + arg(IN): The argument to give the function pointed to by 'start'. + + tid(IN/OUT): If not NULL, gets the ID for the new thread. + + tHnd(IN/OUT): If not NULL, gets the handle for the new thread. + + Returns + + OCI_SUCCESS, OCI_ERROR or OCI_INVALID_HANDLE. + + Notes + + The new thread will start by executing a call to the function pointed + to by 'start' with the argument given by 'arg'. When that function + returns, the new thread will terminate. The function should not + return a value and should accept one parameter, a 'void *'. + + The call to OCIThreadCreate() must be matched by a call to + OCIThreadClose() if and only if tHnd is non-NULL. + + If tHnd is NULL, a thread ID placed in *tid will not be valid in the + calling thread because the timing of the spawned thread's termination + is unknown. + + 'tid' should be initialized by OCIThreadIdInit(). + + 'thnd' should be initialized by OCIThreadHndInit(). + + + + OCIThreadJoin - OCIThread Thread Join + ------------------------------------- + + Description + + This function allows the calling thread to 'join' with another thread. + It blocks the caller until the specified thread terminates. + + Prototype + + sword OCIThreadJoin(void *hndl, OCIError *err, OCIThreadHandle *tHnd); + + hndl(IN/OUT): The OCI environment or session handle. + + err(IN/OUT): The OCI error handle. If there is an error and OCI_ERROR + is returned, the error is recorded in err and diagnostic + information can be obtained by calling OCIErrorGet(). + + tHnd(IN): The 'OCIThreadHandle' of the thread to join with. + + Returns + + OCI_SUCCESS, OCI_ERROR or OCI_INVALID_HANDLE. + + Notes + + 'thnd' should be initialized by OCIThreadHndInit(). + + The result of multiple threads all trying to join with the same thread is + undefined. + + + OCIThreadClose - OCIThread Thread Close + --------------------------------------- + + Description + + This function should be called to close a thread handle. + + Prototype + + sword OCIThreadClose(void *hndl, OCIError *err, OCIThreadHandle *tHnd); + + hndl(IN/OUT): The OCI environment or session handle. + + err(IN/OUT): The OCI error handle. If there is an error and OCI_ERROR + is returned, the error is recorded in err and diagnostic + information can be obtained by calling OCIErrorGet(). + + tHnd(IN/OUT): The OCIThread thread handle to close. + + Returns + + OCI_SUCCESS, OCI_ERROR or OCI_INVALID_HANDLE. + + Notes + + 'thnd' should be initialized by OCIThreadHndInit(). + + Both thread handle and the thread ID that was returned by the same call + to OCIThreadCreate() are invalid after the call to OCIThreadClose(). + + + + OCIThreadHandleGet - OCIThread Thread Get Handle + ------------------------------------------------ + + Description + + Retrieve the 'OCIThreadHandle' of the thread in which it is called. + + Prototype + + sword OCIThreadHandleGet(void *hndl, OCIError *err, + OCIThreadHandle *tHnd); + + hndl(IN/OUT): The OCI environment or session handle. + + err(IN/OUT): The OCI error handle. If there is an error and OCI_ERROR + is returned, the error is recorded in err and diagnostic + information can be obtained by calling OCIErrorGet(). + + tHnd(IN/OUT): If not NULL, the location to place the thread + handle for the thread. + + Returns + + OCI_SUCCESS, OCI_ERROR or OCI_INVALID_HANDLE. + + Notes + + 'thnd' should be initialized by OCIThreadHndInit(). + + The thread handle 'tHnd' retrieved by this function must be closed + with OCIThreadClose() and destroyed by OCIThreadHndDestroy() after it + is used. + + + + +1.4 Using OCIThread +===================== + +This section summarizes some of the more important details relating to the use +of OCIThread. + + * Process initialization + + OCIThread only requires that the process initialization function + ('OCIThreadProcessInit()') be called when OCIThread is being used in a + multi-threaded application. Failing to call 'OCIThreadProcessInit()' in + a single-threaded application is not an error. + + * OCIThread initialization + + Separate calls to 'OCIThreadInit()' will all return the same OCIThread + context. + + Also, remember that each call to 'OCIThreadInit()' must eventually be + matched by a call to 'OCIThreadTerm()'. + + * Active vs. Passive Threading primitives + + OCIThread client code written without using any active primitives can be + compiled and used without change on both single-threaded and + multi-threaded platforms. + + OCIThread client code written using active primitives will only work + correctly on multi-threaded platforms. In order to write a version of the + same application to run on single-threaded platform, it is necessary to + branch the your code, whether by branching versions of the source file or + by branching at runtime with the OCIThreadIsMulti() call. + +******************************************************************************/ + +/***************************************************************************** + ACTUAL PROTOTYPE DECLARATIONS +******************************************************************************/ + +void OCIThreadProcessInit(); + +sword OCIThreadInit(void *hndl, OCIError *err); + +sword OCIThreadTerm(void *hndl, OCIError *err); + +boolean OCIThreadIsMulti(); + +sword OCIThreadMutexInit(void *hndl, OCIError *err, + OCIThreadMutex **mutex); + +sword OCIThreadMutexDestroy(void *hndl, OCIError *err, + OCIThreadMutex **mutex); + +sword OCIThreadMutexAcquire(void *hndl, OCIError *err, + OCIThreadMutex *mutex); + +sword OCIThreadMutexRelease(void *hndl, OCIError *err, + OCIThreadMutex *mutex); + +sword OCIThreadKeyInit(void *hndl, OCIError *err, OCIThreadKey **key, + OCIThreadKeyDestFunc destFn); + +sword OCIThreadKeyDestroy(void *hndl, OCIError *err, + OCIThreadKey **key); + +sword OCIThreadKeyGet(void *hndl, OCIError *err, OCIThreadKey *key, + void **pValue); + +sword OCIThreadKeySet(void *hndl, OCIError *err, OCIThreadKey *key, + void *value); + +sword OCIThreadIdInit(void *hndl, OCIError *err, OCIThreadId **tid); + +sword OCIThreadIdDestroy(void *hndl, OCIError *err, OCIThreadId **tid); + +sword OCIThreadIdSet(void *hndl, OCIError *err, + OCIThreadId *tidDest, OCIThreadId *tidSrc); + +sword OCIThreadIdSetNull(void *hndl, OCIError *err, OCIThreadId *tid); + +sword OCIThreadIdGet(void *hndl, OCIError *err, OCIThreadId *tid); + +sword OCIThreadIdSame(void *hndl, OCIError *err, + OCIThreadId *tid1, OCIThreadId *tid2, + boolean *result); + +sword OCIThreadIdNull(void *hndl, OCIError *err, + OCIThreadId *tid, boolean *result); + +sword OCIThreadHndInit(void *hndl, OCIError *err, OCIThreadHandle **thnd); + +sword OCIThreadHndDestroy(void *hndl, OCIError *err, OCIThreadHandle **thnd); + +sword OCIThreadCreate(void *hndl, OCIError *err, + void (*start)(void *), void *arg, + OCIThreadId *tid, OCIThreadHandle *tHnd); + +sword OCIThreadJoin(void *hndl, OCIError *err, OCIThreadHandle *tHnd); + +sword OCIThreadClose(void *hndl, OCIError *err, OCIThreadHandle *tHnd); + +sword OCIThreadHandleGet(void *hndl, OCIError *err, OCIThreadHandle *tHnd); +/*----------------- End OCI Thread interface Extensions ---------------------*/ + +/*------------------ Begin OCI Row Callback Interfaces ----------------------*/ + +typedef sword (*OCIBindRowCallback)(void *ctx); +typedef sword (*OCIFetchRowCallback)(void *ctx); + +/*------------------ Begin OCI Row Callback Interfaces ----------------------*/ + +/*--------------- Begin OCI Client Notification Interfaces ------------------*/ + +typedef ub4 (*OCISubscriptionNotify)(void *ctx, OCISubscription *subscrhp, + void *pay, ub4 payl, + void *desc, ub4 mode); + +sword OCISubscriptionRegister(OCISvcCtx *svchp, OCISubscription **subscrhpp, + ub2 count, OCIError *errhp, ub4 mode); + + +sword OCISubscriptionPost(OCISvcCtx *svchp, OCISubscription **subscrhpp, + ub2 count, OCIError *errhp, ub4 mode); + +sword OCISubscriptionUnRegister(OCISvcCtx *svchp, OCISubscription *subscrhp, + OCIError *errhp, ub4 mode); + +sword OCISubscriptionDisable(OCISubscription *subscrhp, + OCIError *errhp, ub4 mode); + +sword OCISubscriptionEnable(OCISubscription *subscrhp, + OCIError *errhp, ub4 mode); + +/*------------------- End OCI Publish/Subscribe Interfaces ------------------*/ + +/*----------------- Extensions to Datetime interfaces -----------------------*/ +/*--------------------- Actual Prototypes -----------------------------------*/ +sword OCIDateTimeGetTime(void *hndl, OCIError *err, OCIDateTime *datetime, + ub1 *hr, ub1 *mm, ub1 *ss, ub4 *fsec); + +sword OCIDateTimeGetDate(void *hndl, OCIError *err, const OCIDateTime *date, + sb2 *yr, ub1 *mnth, ub1 *dy ); + +sword OCIDateTimeGetTimeZoneOffset(void *hndl,OCIError *err, + const OCIDateTime *datetime, + sb1 *hr,sb1 *mm); + +sword OCIDateTimeConstruct(void *hndl,OCIError *err,OCIDateTime *datetime, + sb2 yr,ub1 mnth,ub1 dy,ub1 hr,ub1 mm,ub1 ss,ub4 fsec, + OraText *timezone,size_t timezone_length); + +sword OCIDateTimeSysTimeStamp(void *hndl, OCIError *err, + OCIDateTime *sys_date ); + +sword OCIDateTimeAssign(void *hndl, OCIError *err, const OCIDateTime *from, + OCIDateTime *to); + +sword OCIDateTimeToText(void *hndl, OCIError *err, const OCIDateTime *date, + const OraText *fmt, ub1 fmt_length, ub1 fsprec, + const OraText *lang_name, size_t lang_length, + ub4 *buf_size, OraText *buf ); + +sword OCIDateTimeFromText(void *hndl, OCIError *err, const OraText *date_str, + size_t dstr_length, const OraText *fmt, ub1 fmt_length, + const OraText *lang_name, size_t lang_length, OCIDateTime *date ); + +sword OCIDateTimeCompare(void *hndl, OCIError *err, const OCIDateTime *date1, + const OCIDateTime *date2, sword *result ); + +sword OCIDateTimeCheck(void *hndl, OCIError *err, const OCIDateTime *date, + ub4 *valid ); + +sword OCIDateTimeConvert(void *hndl, OCIError *err, OCIDateTime *indate, + OCIDateTime *outdate); + +sword OCIDateTimeSubtract(void *hndl, OCIError *err, OCIDateTime *indate1, + OCIDateTime *indate2, OCIInterval *inter); + +sword OCIDateTimeIntervalAdd(void *hndl, OCIError *err, OCIDateTime *datetime, + OCIInterval *inter, OCIDateTime *outdatetime); + +sword OCIDateTimeIntervalSub(void *hndl, OCIError *err, OCIDateTime *datetime, + OCIInterval *inter, OCIDateTime *outdatetime); + +sword OCIIntervalSubtract(void *hndl, OCIError *err, OCIInterval *minuend, + OCIInterval *subtrahend, OCIInterval *result ); + +sword OCIIntervalAdd(void *hndl, OCIError *err, OCIInterval *addend1, + OCIInterval *addend2, OCIInterval *result ); + +sword OCIIntervalMultiply(void *hndl, OCIError *err, const OCIInterval *inter, + OCINumber *nfactor, OCIInterval *result ); + +sword OCIIntervalDivide(void *hndl, OCIError *err, OCIInterval *dividend, + OCINumber *divisor, OCIInterval *result ); + +sword OCIIntervalCompare(void *hndl, OCIError *err, OCIInterval *inter1, + OCIInterval *inter2, sword *result ); + +sword OCIIntervalFromNumber(void *hndl, OCIError *err, OCIInterval *inter, + OCINumber *number); + +sword OCIIntervalFromText( void *hndl, OCIError *err, const OraText *inpstr, + size_t str_len, OCIInterval *result ); + +sword OCIIntervalToText( void *hndl, OCIError *err, const OCIInterval *inter, + ub1 lfprec, ub1 fsprec, + OraText *buffer, size_t buflen, size_t *resultlen ); + +sword OCIIntervalToNumber(void *hndl, OCIError *err,const OCIInterval *inter, + OCINumber *number); + +sword OCIIntervalCheck(void *hndl, OCIError *err, const OCIInterval *interval, + ub4 *valid ); + +sword OCIIntervalAssign(void *hndl, OCIError *err, const OCIInterval *ininter, + OCIInterval *outinter ); + +sword OCIIntervalSetYearMonth(void *hndl, OCIError *err, sb4 yr, sb4 mnth, + OCIInterval *result ); + +sword OCIIntervalGetYearMonth(void *hndl, OCIError *err, sb4 *yr, sb4 *mnth, + const OCIInterval *result ); + +sword OCIIntervalSetDaySecond(void *hndl, OCIError *err, sb4 dy, sb4 hr, + sb4 mm, sb4 ss, sb4 fsec, OCIInterval *result ); + +sword OCIIntervalGetDaySecond(void *hndl, OCIError *err, sb4 *dy, sb4 *hr, + sb4 *mm, sb4 *ss, sb4 *fsec, const OCIInterval *result ); + +sword OCIDateTimeToArray(void *hndl, OCIError *err, + const OCIDateTime *datetime, const OCIInterval *reftz, + ub1 *outarray, ub4 *len, ub1 fsprec); + +sword OCIDateTimeFromArray(void *hndl, OCIError *err, ub1 *inarray, ub4 len, + ub1 type, OCIDateTime *datetime, + const OCIInterval *reftz, ub1 fsprec); + +sword OCIDateTimeGetTimeZoneName(void *hndl, OCIError *err, + const OCIDateTime *datetime, + ub1 *buf, ub4 *buflen); + +sword OCIIntervalFromTZ(void *hndl, OCIError *err, const oratext *inpstring, + size_t str_len, OCIInterval *result); + +/*----------------- End Datetime interface Extensions -----------------------*/ + +/*----------------- Connection Pooling prototypes ---------------------------*/ +sword OCIConnectionPoolCreate(OCIEnv *envhp, OCIError *errhp, OCICPool *poolhp, + OraText **poolName, sb4 *poolNameLen, + const OraText *dblink, sb4 dblinkLen, + ub4 connMin, ub4 connMax, ub4 connIncr, + const OraText *poolUserName, sb4 poolUserLen, + const OraText *poolPassword, sb4 poolPassLen, + ub4 mode); + +sword OCIConnectionPoolDestroy(OCICPool *poolhp, + OCIError *errhp, ub4 mode); + +/*----------------- End Connection Pooling prototypes -----------------------*/ + +/*-------------------- Session Pooling prototypes ---------------------------*/ + +sword OCISessionPoolCreate (OCIEnv *envhp, OCIError *errhp, OCISPool *spoolhp, + OraText **poolName, ub4 *poolNameLen, + const OraText *connStr, ub4 connStrLen, + ub4 sessMin, ub4 sessMax, ub4 sessIncr, + OraText *userid, ub4 useridLen, + OraText *password, ub4 passwordLen, + ub4 mode); + +sword OCISessionPoolDestroy (OCISPool *spoolhp, + OCIError *errhp, + ub4 mode); + +sword OCISessionGet (OCIEnv *envhp, OCIError *errhp, OCISvcCtx **svchp, + OCIAuthInfo *authhp, + OraText *poolName, ub4 poolName_len, + const OraText *tagInfo, ub4 tagInfo_len, + OraText **retTagInfo, ub4 *retTagInfo_len, + boolean *found, ub4 mode); + +sword OCISessionRelease (OCISvcCtx *svchp, OCIError *errhp, + OraText *tag, ub4 tag_len, + ub4 mode); + +/*-------------------- End Session Pooling prototypes -----------------------*/ + +/* --------------------- OCI Application Context --------------------------*/ + + +sword OCIAppCtxSet(void * sesshndl, void *nsptr, ub4 nsptrlen, + void *attrptr, ub4 attrptrlen, + void *valueptr, ub4 valueptrlen, + OCIError *errhp, ub4 mode); + +sword OCIAppCtxClearAll(void *sesshndl, void *nsptr, ub4 nsptrlen, + OCIError *errhp, ub4 mode); + +/*-------------------------------- OCIMemStats ------------------------------*/ +sword OCIMemStats(void *hndlp, OCIError *errhp, OCIEnv **envhp, + ub4 mode, ub4 mode1, oratext *tabname); + +/*-------------------------------- OCIPing ----------------------------------*/ +sword OCIPing (OCISvcCtx *svchp, OCIError *errhp, ub4 mode); + +/*----------------- Kerberos Authentication prototypes ----------------------*/ + +sword OCIKerbAttrSet(OCISession *trgthndlp, ub4 cred_use, ub1 *ftgt_ticket, + ub4 ticket_len, ub1 *session_key, ub4 skey_len, + ub2 ftgt_keytype, ub4 ftgt_ticket_flags, + sb4 ftgt_auth_time, sb4 ftgt_start_time, + sb4 ftgt_end_time, sb4 ftgt_renew_time, + oratext *ftgt_client_principal, + ub4 ftgt_client_principal_len, oratext *ftgt_client_realm, + ub4 ftgt_client_realm_len, OCIError *errhp); + +/*------------------- End Kerberos Authentication prototypes ----------------*/ + +/*------------------- Database Startup/Shutdown prototypes ------------------*/ + +sword OCIDBStartup (OCISvcCtx *svchp, + OCIError *errhp, + OCIAdmin *admhp, + ub4 mode, + ub4 flags); + +sword OCIDBShutdown(OCISvcCtx *svchp, + OCIError *errhp, + OCIAdmin *admhp, + ub4 mode); + +/*------------------ End Database Startup/Shutdown prototypes ---------------*/ + +/*----------------------- OCIClientVersion ------------------------------*/ +void OCIClientVersion(sword *major_version, + sword *minor_version, + sword *update_num, + sword *patch_num, + sword *port_update_num); +/*----------------------- End OCIClientVersion --------------------------*/ + +/*----------------------- HA Event prototypes ------------------------------*/ + +sword OCIInitEventHandle(OCIError *errhp, + OCIEvent *event, + text *str, + ub4 size); + +/*----------------------- End HA Event prototypes --------------------------*/ + +/*--------------------------------------------------------------------------- + PRIVATE FUNCTIONS + ---------------------------------------------------------------------------*/ + + /* the following functions are depracated and should not be used */ +#ifdef NEVER +sword OCIStmtBindByPos (OCIStmt *stmtp, OCIBind *bindp, OCIError *errhp, + ub4 position, void *valuep, sb4 value_sz, + ub2 dty, void *indp, ub2 *alenp, ub2 *rcodep, + ub4 maxarr_len, ub4 *curelep, ub4 mode); + + +sword OCIStmtBindByName (OCIStmt *stmtp, OCIBind *bindp, OCIError *errhp, + const OraText *placeholder, sb4 placeh_len, void *valuep, + sb4 value_sz, ub2 dty, void *indp, ub2 *alenp, + ub2 *rcodep, ub4 maxarr_len, ub4 *curelep, ub4 mode); + +sword ocidefn (OCIStmt *stmtp, OCIDefine *defnp, OCIError *errhp, + ub4 position, void *valuep, sb4 value_sz, ub2 dty, + void *indp, ub2 *rlenp, ub2 *rcodep, ub4 mode); +#endif /* NEVER */ + +#endif /* OCIAP_ORACLE */ diff --git a/sdk/include/ociapr.h b/sdk/include/ociapr.h new file mode 100755 index 0000000..2f25c52 --- /dev/null +++ b/sdk/include/ociapr.h @@ -0,0 +1,155 @@ +/* Copyright (c) 1991, 2005, Oracle. All rights reserved. */ +/* + NAME + ociapr.h + MODIFIED (MM/DD/YY) + mbastawa 09/16/05 - dbhygiene + dmukhin 06/29/05 - ANSI prototypes; miscellaneous cleanup + dsaha 05/19/00 - Fix lint + sgollapu 05/19/98 - Change text to OraText + dchatter 11/10/95 - add ognfd() - get native fd + lchidamb 04/06/95 - drop maxdsz from obindps/odefinps + slari 04/07/95 - add opinit + dchatter 03/08/95 - osetpi and ogetpi + lchidamb 12/09/94 - add obindps() and odefinps() + dchatter 03/06/95 - merge changes from branch 1.1.720.2 + dchatter 11/14/94 - merge changes from branch 1.1.720.1 + dchatter 02/08/95 - olog call; drop onblon + dchatter 10/31/94 - new functions for non-blocking oci + rkooi2 11/27/92 - Changing datatypes to agree with ocidef.h + rkooi2 10/26/92 - More portability mods + rkooi2 10/18/92 - Changed to agree with oci.c + sjain 03/16/92 - Creation +*/ +/* + * Declare the OCI functions. + * Prototype information is included. + * Use this header for ANSI C compilers. + */ + +#ifndef OCIAPR +#define OCIAPR + +#ifndef ORATYPES +#include +#endif + +#ifndef OCIDFN +#include +#endif + +/* + * Oci BIND (Piecewise or with Skips) + */ +sword obindps(struct cda_def *cursor, ub1 opcode, OraText *sqlvar, + sb4 sqlvl, ub1 *pvctx, sb4 progvl, + sword ftype, sword scale, + sb2 *indp, ub2 *alen, ub2 *arcode, + sb4 pv_skip, sb4 ind_skip, sb4 alen_skip, sb4 rc_skip, + ub4 maxsiz, ub4 *cursiz, + OraText *fmt, sb4 fmtl, sword fmtt); +sword obreak(struct cda_def *lda); +sword ocan (struct cda_def *cursor); +sword oclose(struct cda_def *cursor); +sword ocof (struct cda_def *lda); +sword ocom (struct cda_def *lda); +sword ocon (struct cda_def *lda); + + +/* + * Oci DEFINe (Piecewise or with Skips) + */ +sword odefinps(struct cda_def *cursor, ub1 opcode, sword pos,ub1 *bufctx, + sb4 bufl, sword ftype, sword scale, + sb2 *indp, OraText *fmt, sb4 fmtl, sword fmtt, + ub2 *rlen, ub2 *rcode, + sb4 pv_skip, sb4 ind_skip, sb4 alen_skip, sb4 rc_skip); +sword odessp(struct cda_def *cursor, OraText *objnam, size_t onlen, + ub1 *rsv1, size_t rsv1ln, ub1 *rsv2, size_t rsv2ln, + ub2 *ovrld, ub2 *pos, ub2 *level, OraText **argnam, + ub2 *arnlen, ub2 *dtype, ub1 *defsup, ub1* mode, + ub4 *dtsiz, sb2 *prec, sb2 *scale, ub1 *radix, + ub4 *spare, ub4 *arrsiz); +sword odescr(struct cda_def *cursor, sword pos, sb4 *dbsize, + sb2 *dbtype, sb1 *cbuf, sb4 *cbufl, sb4 *dsize, + sb2 *prec, sb2 *scale, sb2 *nullok); +sword oerhms (struct cda_def *lda, sb2 rcode, OraText *buf, + sword bufsiz); +sword oermsg (sb2 rcode, OraText *buf); +sword oexec (struct cda_def *cursor); +sword oexfet (struct cda_def *cursor, ub4 nrows, + sword cancel, sword exact); +sword oexn (struct cda_def *cursor, sword iters, sword rowoff); +sword ofen (struct cda_def *cursor, sword nrows); +sword ofetch (struct cda_def *cursor); +sword oflng (struct cda_def *cursor, sword pos, ub1 *buf, + sb4 bufl, sword dtype, ub4 *retl, sb4 offset); +sword ogetpi (struct cda_def *cursor, ub1 *piecep, void **ctxpp, + ub4 *iterp, ub4 *indexp); +sword oopt (struct cda_def *cursor, sword rbopt, sword waitopt); +sword opinit (ub4 mode); +sword olog (struct cda_def *lda, ub1* hda, + OraText *uid, sword uidl, + OraText *pswd, sword pswdl, + OraText *conn, sword connl, + ub4 mode); +sword ologof (struct cda_def *lda); +sword oopen (struct cda_def *cursor, struct cda_def *lda, + OraText *dbn, sword dbnl, sword arsize, + OraText *uid, sword uidl); +sword oparse (struct cda_def *cursor, OraText *sqlstm, sb4 sqllen, + sword defflg, ub4 lngflg); +sword orol (struct cda_def *lda); +sword osetpi (struct cda_def *cursor, ub1 piece, void *bufp, ub4 *lenp); + +void sqlld2 (struct cda_def *lda, OraText *cname, sb4 *cnlen); +void sqllda (struct cda_def *lda); + +/* non-blocking functions */ +sword onbset (struct cda_def *lda ); +sword onbtst (struct cda_def *lda ); +sword onbclr (struct cda_def *lda ); +sword ognfd (struct cda_def *lda, void *fdp); + + +/* + * OBSOLETE CALLS + */ + +/* + * OBSOLETE BIND CALLS + */ +sword obndra(struct cda_def *cursor, OraText *sqlvar, sword sqlvl, + ub1 *progv, sword progvl, sword ftype, sword scale, + sb2 *indp, ub2 *alen, ub2 *arcode, ub4 maxsiz, + ub4 *cursiz, OraText *fmt, sword fmtl, sword fmtt); +sword obndrn(struct cda_def *cursor, sword sqlvn, ub1 *progv, + sword progvl, sword ftype, sword scale, sb2 *indp, + OraText *fmt, sword fmtl, sword fmtt); +sword obndrv(struct cda_def *cursor, OraText *sqlvar, sword sqlvl, + ub1 *progv, sword progvl, sword ftype, sword scale, + sb2 *indp, OraText *fmt, sword fmtl, sword fmtt); + +/* + * OBSOLETE DEFINE CALLS + */ +sword odefin(struct cda_def *cursor, sword pos, ub1 *buf, + sword bufl, sword ftype, sword scale, sb2 *indp, + OraText *fmt, sword fmtl, sword fmtt, ub2 *rlen, ub2 *rcode); + +/* older calls ; preferred equivalent calls above */ + +sword oname (struct cda_def *cursor, sword pos, sb1 *tbuf, + sb2 *tbufl, sb1 *buf, sb2 *bufl); +sword orlon (struct cda_def *lda, ub1 *hda, + OraText *uid, sword uidl, + OraText *pswd, sword pswdl, + sword audit); +sword olon (struct cda_def *lda, OraText *uid, sword uidl, + OraText *pswd, sword pswdl, sword audit); +sword osql3 (struct cda_def *cda, OraText *sqlstm, sword sqllen); +sword odsc (struct cda_def *cursor, sword pos, sb2 *dbsize, + sb2 *fsize, sb2 *rcode, sb2 *dtype, sb1 *buf, + sb2 *bufl, sb2 *dsize); + +#endif /* OCIAPR */ diff --git a/sdk/include/ocidef.h b/sdk/include/ocidef.h new file mode 100755 index 0000000..9fde50b --- /dev/null +++ b/sdk/include/ocidef.h @@ -0,0 +1,886 @@ +/* Copyright (c) 1981, 2005, Oracle. All rights reserved. */ +/* Copyright (c) 1984, 2005, Oracle. All rights reserved. */ + +/* +NAME + ocidef +CONTENTS + Oracle Call Interface cursor area and LDA definitions +NOTES + none +OWNER + Oates +DATE + 09/07/82 +MODIFIED + mbastawa 09/16/05 - dbhygiene + dmukhin 06/29/05 - ANSI prototypes; miscellaneous cleanup + srseshad 03/25/03 - convert oci public api to ansi + csteinba 11/05/02 - bug 2521931: redefine OTYACL + aahluwal 06/03/02 - bug 2360115 + bpalaval 02/08/01 - Change text to oratext. + chliang 02/01/01 - fix olint error. + bpalaval 11/16/00 - Bug 1244685 : Fix ALTER CLUSTER issue.. + slari 11/08/00 - remove functions duplicated in ociapr.h + whe 09/01/99 - 976457:check __cplusplus for C++ code + skmishra 04/23/97 - Provide C++ compatibility + lchidamb 06/26/96 - put upidef.h, riddef.h within #ifndef + slari 06/12/96 - add ocigft_getFcnType + dchatter 11/10/95 - ocignfd - oci get native file descriptor + slari 05/11/95 - change OCIEVDEF/OCIEVTSF to UPIEVDEF/UPIEVTSF + dchatter 04/06/95 - add ifdef flags around OCI_flags + lchidamb 04/06/95 - drop maxdsz from ocibndps/ocidfnps + slari 04/07/95 - rename opinit to ocipin + slari 03/13/95 - thread safety changes + dchatter 03/08/95 - piece definitions OCI_*_PIECE + lchidamb 12/06/94 - add support for binding/defining with skips + dchatter 03/06/95 - merge changes from branch 1.12.720.1 + dchatter 02/06/95 - add defines for login mode parameters + dchatter 07/06/94 - Deleting CRSCHK, with refcursor, no way to set this + dchatter 06/13/94 - add a new LDA flag LDANBL + rkooi 11/18/92 - update ocidpr interface + mmoore 10/31/92 - add ocidpr + gpongrac 11/17/92 - fix oexfet prototype + sjain 01/03/92 - Add ocibra + rjenkins 11/04/91 - adding prototypes for oparse and oexfet + sjain 04/15/91 - Change ocistf proto + sjain 04/01/91 - Rearrange oty codes. Add new ones + Jain 12/03/90 - Add #define for new describe call + Jain 11/29/90 - Add new function code for the new oci calls + Mendels 01/20/89 - fix 19170: make ocitbl CONST_DATA + Kabcene 01/27/88 - change interfaces to match V5 + Navab 12/09/87 - add a parameter to ocierr call + Navab 11/30/87 - add ocierr, rename ocioer + Navab 10/08/87 - add prototypes for procedure declarations + Howard 09/07/87 - endif blah + Howard 05/11/87 - Add OTY types + Howard 04/27/87 - move ocldef defines here + Oates 10/15/85 - Add OCANCEL + Oates 09/30/85 - Implement ORA*Net + Oates 06/27/85 - Make datatype compatible with upidef.h + Andy 05/07/85 - delete CSRFBPIC +*/ + +#ifndef UPIDEF +#include +#endif + +#ifndef RIDDEF +#include +#endif + +#include + +#ifndef OCIDEF +#define OCIDEF + + +#define CSRCHECK 172 /* csrdef is a cursor */ +#define LDACHECK 202 /* csrdef is a login data area */ +struct csrdef +{ + sb2 csrrc; /* return code: v2 codes, v4 codes negative */ + ub2 csrft; /* function type */ + ub4 csrrpc; /* rows processed count */ + ub2 csrpeo; /* parse error offset */ + ub1 csrfc; /* function code */ + ub1 csrlfl; /* lda flag to indicate type of login */ + ub2 csrarc; /* actual untranslated return code */ + ub1 csrwrn; /* warning flags */ + ub1 csrflg; /* error action */ + sword csrcn; /* cursor number */ + riddef csrrid; /* rowid structure */ + sword csrose; /* os dependent error code */ + ub1 csrchk; /* check byte = CSRCHECK - in cursor */ + /* check byte = LDACHECK - in LDA */ + struct hstdef *csrhst; /* pointer to the hst */ +}; +typedef struct csrdef csrdef; +typedef struct csrdef ldadef; /* lda is the same as a csr */ + + +/* values for csrlfl */ +#define LDAFLG 1 /* ...via ologon */ +#define LDAFLO 2 /* ...via olon or orlon */ +#define LDANBL 3 /* ...nb logon in progress */ + +/* valuses for crsfc */ +#define csrfpa 2 /* ...OSQL */ +#define csrfex 4 /* ...OEXEC */ +#define csrfbi 6 /* ...OBIND */ +#define csrfdb 8 /* ...ODFINN */ +#define csrfdi 10 /* ...ODSRBN */ +#define csrffe 12 /* ...OFETCH */ +#define csrfop 14 /* ...OOPEN */ +#define csrfcl 16 /* ...OCLOSE */ +#define csrfds 22 /* ...ODSC */ +#define csrfnm 24 /* ...ONAME */ +#define csrfp3 26 /* ...OSQL3 */ +#define csrfbr 28 /* ...OBNDRV */ +#define csrfbx 30 /* ...OBNDRN */ +/*#defe csrfdf 32*/ /* ???? */ +#define csrfso 34 /* ...OOPT */ +#define csrfre 36 /* ...ORESUM */ +#define csrfbn 50 /* ...OBINDN */ +#define csrfca 52 /* ..OCANCEL */ +#define csrfsd 54 /* ..OSQLD */ +#define csrfef 56 /* ..OEXFEN */ +#define csrfln 58 /* ..OFLNG */ +#define csrfdp 60 /* ..ODSCSP */ +#define csrfba 62 /* ..OBNDRA */ +#define csrfbps 63 /*..OBINDPS */ +#define csrfdps 64 /*..ODEFINPS */ +#define csrfgpi 65 /* ...OGETPI */ +#define csrfspi 66 /* ...OSETPI */ + +/* values for csrwrn */ +#define CSRWANY 0x01 /* there is a warning flag set */ +#define CSRWTRUN 0x02 /* a data item was truncated */ +#define CSRWNVIC 0x04 /* NULL values were used in an aggregate function */ +#define CSRWITCE 0x08 /* column count not equal to into list count */ +#define CSRWUDNW 0x10 /* update or delete without where clause */ +#define CSRWRSV0 0x20 +#define CSRWROLL 0x40 /* rollback required */ +#define CSRWRCHG 0x80 /* change after query start on select for update */ + +/* values fro csrflg */ +#define CSRFSPND 0x01 /* current operation suspended */ +#define CSRFATAL 0x02 /* fatal operation: transaction rolled back */ +#define CSRFBROW 0x04 /* current row backed out */ +#define CSRFREFC 0x08 /* ref cursor type CRSCHK disabled for this cursor */ +#define CSRFNOAR 0x10 /* ref cursor type binds, so no array bind/execute */ + +/* define function codes; in order of octdef.h */ +#define OTYCTB 1 /* CREATE TABLE */ +#define OTYSER 2 /* set role */ +#define OTYINS 3 /* INSERT */ +#define OTYSEL 4 /* SELECT */ +#define OTYUPD 5 /* UPDATE */ +#define OTYDRO 6 /* drop role */ +#define OTYDVW 7 /* DROP VIEW */ + /* once was validate index */ + /* once was create partition */ + /* once was alter partition */ +#define OTYDTB 8 /* DROP TABLE */ + /* once was alter space */ + /* once was drop space */ +#define OTYDEL 9 /* DELETE */ +#define OTYCVW 10 /* create view */ +#define OTYDUS 11 /* drop user */ +#define OTYCRO 12 /* create role */ +#define OTYCSQ 13 /* create sequence */ +#define OTYASQ 14 /* alter sequence */ +#define OTYACL 15 /* alter cluster */ +#define OTYDSQ 16 /* drop sequence */ +#define OTYCSC 17 /* create schema */ +#define OTYCCL 18 /* CREATE CLUSTER */ + /* once was alter cluster */ +#define OTYCUS 19 /* create user */ +#define OTYCIX 20 /* CREATE INDEX */ +#define OTYDIX 21 /* DROP INDEX */ +#define OTYDCL 22 /* DROP CLUSTER */ +#define OTYVIX 23 /* validate index */ +#define OTYCPR 24 /* create procedure */ +#define OTYAPR 25 /* alter procedure */ +#define OTYATB 26 /* alter table */ + /* once was evaluate */ +#define OTYXPL 27 /* explain */ +#define OTYGRA 28 /* grant */ +#define OTYREV 29 /* revoke */ +#define OTYCSY 30 /* create synonym */ +#define OTYDSY 31 /* drop synonym */ +#define OTYASY 32 /* alter system switch log */ +#define OTYSET 33 /* set transaction */ +#define OTYPLS 34 /* pl/sql execute */ +#define OTYLTB 35 /* lock */ +#define OTYNOP 36 /* noop */ +#define OTYRNM 37 /* rename */ +#define OTYCMT 38 /* comment */ +#define OTYAUD 39 /* audit */ +#define OTYNOA 40 /* no audit */ +#define OTYAIX 41 /* ALTER INDEX */ +#define OTYCED 42 /* create external database */ +#define OTYDED 43 /* drop external database */ +#define OTYCDB 44 /* create database */ +#define OTYADB 45 /* alter database */ +#define OTYCRS 46 /* create rollback segment */ +#define OTYARS 47 /* alter rollback segment */ +#define OTYDRS 48 /* drop rollback segment */ +#define OTYCTS 49 /* create tablespace */ +#define OTYATS 50 /* alter tablespace */ +#define OTYDTS 51 /* drop tablespace */ +#define OTYASE 52 /* alter session */ +#define OTYAUR 53 /* alter user */ +#define OTYCWK 54 /* commit (work) */ +#define OTYROL 55 /* rollback */ +#define OTYSPT 56 /* savepoint */ + +/* For number greater than 56 the the type is the same as defined in +** octdef.h for that number. So for completion look at octdef.h +*/ + +#define OTYDEV OTYCVW /* old DEFINE VIEW = create view */ + +/* FUNCTION CODES */ +#define OCLFPA 2 /* parse - OSQL */ +#define OCLFEX 4 /* execute - OEXEC */ +#define OCLFBI 6 /* BIND by name - OBIND */ +#define OCLFDB 8 /* define buffer - ODEFIN */ +#define OCLFDI 10 /* describe item - ODSC */ +#define OCLFFE 12 /* fetch - OFETCH */ +#define OCLFOC 14 /* open cursor - OOPEN */ +# define OCLFLI OCLFOC /* old name for open cursor - OOPEN */ +#define OCLFCC 16 /* close cursor - OCLOSE */ +# define OCLFLO OCLFCC /* old name for close cursor - OCLOSE */ +#define OCLFDS 22 /* describe - ODSC */ +#define OCLFON 24 /* get table and column names - ONAME */ +#define OCLFP3 26 /* parse - OSQL3 */ +#define OCLFBR 28 /* bind reference by name - OBNDRV */ +#define OCLFBX 30 /* bind referecne numeric - OBNDRN */ +#define OCLFSO 34 /* special function - OOPT */ +#define OCLFRE 36 /* resume - ORESUM */ +#define OCLFBN 50 /* bindn */ +#define OCLFMX 52 /* maximum function number */ + +#ifdef NEVER /* unused codes */ +# define OCLFLK 18 /* open for kernel operations */ +# define OCLFEK 20 /* execute kernel operations */ +# define OCLFOK 22 /* kernel close */ +# define OCLFIN 28 /* logon to oracle */ +# define OCLFOF 30 /* logoff from oracle */ +# define OCLFAX 32 /* allocate a context area */ +# define OCLFPI 34 /* page in context area */ +# define OCLFIS 36 /* special system logon */ +# define OCLFCO 38 /* cancel the current operation */ +# define OCLFGI 40 /* get database id */ +# define OCLFJN 42 /* journal operation */ +# define OCLFCL 44 /* cleanup prior execute operation */ +# define OCLFMC 46 /* map a cursor area */ +# define OCLFUC 48 /* unmap cursor and restore user maping */ +#endif /*NEVER *//* obsolete codes */ + + +/* values for ocimode in ocipin call */ + +#define OCIEVDEF UPIEVDEF /* default : non-thread safe enivronment */ +#define OCIEVTSF UPIEVTSF /* thread-safe environment */ + + +/* OCIL* flags used to determine the mode of login, using ocilog(). +** Currently defined only for non-blocking and thread-safe logins. +*/ + +#define OCILMDEF UPILMDEF /* default, regular login */ +#define OCILMNBL UPILMNBL /* non-blocking logon */ +#define OCILMESY UPILMESY /* thread safe but external sync */ +#define OCILMISY UPILMISY /* internal sync, we do it */ +#define OCILMTRY UPILMTRY /* try to, but do not block on mutex */ + + +/* + * since sqllib uses both ocidef and ocidfn the following defines + * need to be guarded + */ +#ifndef OCI_FLAGS +#define OCI_FLAGS + +/* OCI_*_PIECE defines the piece types that are returned or set +*/ + +#define OCI_ONE_PIECE UPI_ONE_PIECE /* there or this is the only piece */ +#define OCI_FIRST_PIECE UPI_FIRST_PIECE /* the first of many pieces */ +#define OCI_NEXT_PIECE UPI_NEXT_PIECE /* the next of many pieces */ +#define OCI_LAST_PIECE UPI_LAST_PIECE /* the last piece of this column */ +#endif + +/* +** OCITAB: define return code pairs for version 2 to 3 conversions +*/ +struct ocitab +{ + sb2 ocitv3; /* Version 3/4 return code */ + sb2 ocitv2; /* Version 2 equivalent return code */ +}; +typedef struct ocitab ocitab; + +externref const ocitab ocitbl[]; + +/* macros to check cursors and LDA's. */ +/* macros to set error codes */ + +# define CRSCHK(c) if ((c->csrchk != CSRCHECK)\ + && !bit(c->csrflg, CSRFREFC))\ + return(ocir32(c, OER(1001))) +# define ldaerr(l, e) ( l->csrrc = (sb2)(-( l->csrarc = (ub2)(e)) ) ) +# define LDACHK(l) if (l->csrchk != LDACHECK) \ + return(ldaerr(l, OER(1001))) + + +/************************************************/ +/* OCI PROCEDURE DECLARATIONS */ +/************************************************/ + + + + +/*****************************/ +/* Database logon/logout */ +/*****************************/ +sword ocilog( ldadef *lda, struct hstdef *hst, oratext *uid, sword uidl, + oratext *psw, sword pswl, oratext* conn, sword connl, + ub4 mode ); +sword ocilon( ldadef *lda, oratext *uid, sword uidl, oratext *psw, + sword pswl, sword audit ); +sword ocilgi( ldadef *lda, sb2 areacount ); +sword ocirlo( ldadef *lda, struct hstdef *hst, oratext *uid, sword uidl, + oratext *psw, sword pswl, sword audit ); + /* ocilon - logon to oracle + ** ocilgi - version 2 compatible ORACLE logon call. + ** no login to ORACLE is performed: the LDA is initialized + ** ocirlo - version 5 compatible ORACLE Remote Login call, + ** oracle login is executed. + ** lda - pointer to ldadef + ** uid - user id [USER[/PASSWORD]] + ** uidl - length of uid, if -1 strlen(uid) is used + ** psw - password string; ignored if specified in uid + ** pswl - length of psw, if -1 strlen(psw) is used + ** audit - is not supported; the only permissible value is 0 + ** areacount - unused + */ + +sword ocilof( ldadef *lda ); + /* + ** ocilof - disconnect from ORACLE + ** lda - pointer to ldadef + */ + + +/*********************/ +/* Error Messages */ +/*********************/ +sword ocierr( ldadef *lda, sb2 rcode, oratext *buffer, sword bufl ); +sword ocidhe( sb2 rcode, oratext *buffer ); + /* + ** Move the text explanation for an ORACLE error to a user defined buffer + ** ocierr - will return the message associated with the hstdef stored + ** in the lda. + ** ocidhe - will return the message associated with the default host. + ** lda - lda associated with the login session + ** rcode - error code as returned by V3 call interface + ** buffer - address of a user buffer of at least 132 characters + */ + + +/***********************/ +/* Cursor Open/Close */ +/***********************/ +sword ociope( struct csrdef *cursor, ldadef *lda, oratext *dbn, sword dbnl, + sword areasize, oratext *uid, sword uidl ); + +sword ociclo( struct csrdef *cursor ); + /* + ** open or close a cursor. + ** cursor - pointer to csrdef + ** ldadef - pointer to ldadef + ** dbn - unused + ** dbnl - unused + ** areasize - if (areasize == -1) areasize <- system default initial size + ** else if (areasize IN [1..256]) areasize <- areasize * 1024; + ** most applications should use the default size since context + ** areas are extended as needed until memory is exhausted. + ** uid - user id + ** uidl - userid length + */ + +/***********************************/ +/* CONTROL AND OPTIONS */ +/***********************************/ +sword ocibre( ldadef *lda ); + /* + ** ocibrk - Oracle Call Interface send BReaK Sends a break to + ** oracle. If oracle is active, the current operation is + ** cancelled. May be called asynchronously. DOES NOT SET + ** OERRCD in the hst. This is because ocibrk may be called + ** asynchronously. Callers must test the return code. + ** lda - pointer to a ldadef + */ + +sword ocican( struct csrdef *cursor ); + /* + ** cancel the operation on the cursor, no additional OFETCH calls + ** will be issued for the existing cursor without an intervening + ** OEXEC call. + ** cursor - pointer to csrdef + */ + +sword ocisfe( struct csrdef *cursor, sword erropt, sword waitopt ); + /* + ** ocisfe - user interface set error options + ** set the error and cursor options. + ** allows user to set the options for dealing with fatal dml errors + ** and other cursor related options + ** see oerdef for valid settings + ** cursor - pointer to csrdef + ** erropt - error optionsn + ** waitopr - wait options + */ + + +/***************************************/ +/* COMMIT/ROLLBACK/AUTOCOMMIT */ +/***************************************/ +sword ocicom( ldadef *lda ); +sword ocirol( ldadef *lda ); + /* + ** ocicom - commit the current transaction + ** ocirol - roll back the current transaction + */ + +sword ocicon( ldadef *lda ); +sword ocicof( ldadef *lda ); + /* + ** ocicon - auto Commit ON + ** ocicof - auto Commit OFf + */ + + + +/************************/ +/* parsing */ +/************************/ +sword ocisq3(struct csrdef *cursor, oratext * /* sqlstm */, sword sqllen); + /* + ** ocisq3 - user interface parse sql statement + ** cursor - pointer to csrdef + ** sqlstm - pointer to SQL statement + ** sqllen - length of SQL statement. if -1, strlen(sqlstm) is used + */ + + + +/***************************/ +/* BINDING */ +/***************************/ +/* these are for the opcode in ocibndps, ocidfnps */ +#define OCI_PCWS 0 +#define OCI_SKIP 1 + +sword ocibin( struct csrdef *cursor, oratext *sqlvar, sword sqlvl, + ub1 *progv, sword progvl, sword ftype, sword scale, + oratext *fmt, sword fmtl, sword fmtt ); +sword ocibrv( struct csrdef *cursor, oratext *sqlvar, sword sqlvl, + ub1 *progv, sword progvl, sword ftype, sword scale, sb2 *indp, + oratext *fmt, sword fmtl, sword fmtt ); +sword ocibra( struct csrdef *cursor, oratext *sqlvar, sword sqlvl, + ub1 *progv, sword progvl, sword ftype, sword scale, + sb2 *indp, ub2 *aln, ub2 *rcp, ub4 mal, ub4 *cal, + oratext *fmt, sword fmtl, sword fmtt ); +sword ocibndps( struct csrdef *cursor, ub1 opcode, oratext *sqlvar, + sb4 sqlvl, ub1 *progv, sb4 progvl, sword ftype, + sword scale, sb2 *indp, ub2 *aln, ub2 *rcp, sb4 pv_skip, + sb4 ind_skip, sb4 len_skip, sb4 rc_skip, ub4 mal, + ub4 *cal, oratext *fmt, sb4 fmtl, sword fmtt ); +sword ocibnn ( struct csrdef *cursor, ub2 sqlvn, ub1 *progv, sword progvl, + sword ftype, sword scale, oratext *fmt, sword fmtl, + sword fmtt ); +sword ocibrn( struct csrdef *cursor, sword sqlvn, ub1 *progv, sword progvl, + sword ftype, sword scale, sb2 *indp, oratext *fmt, sword fmtl, + sword fmtt ); + /* + ** ocibin - bind by value by name + ** ocibrv - bind by reference by name + ** ocibra - bind by reference by name (array) + ** ocibndps - bind by reference by name (array) piecewise or with skips + ** ocibnn - bind by value numeric + ** ocibrn - bind by reference numeric + ** + ** the contents of storage specified in bind-by-value calls are + ** evaluated immediately. + ** the addresses of storage specified in bind-by-reference calls are + ** remembered, and the contents are examined at every execute. + ** + ** cursor - pointer to csrdef + ** sqlvn - the number represented by the name of the bind variables + ** for variables of the form :n or &n for n in [1..256) + ** (i.e. &1, :234). unnecessarily using larger numbers + ** in the range wastes space. + ** sqlvar - the name of the bind variable (:name or &name) + ** sqlval - the length of the name; + ** in bindif -1, strlen(bvname) is used + ** progv - pointer to the object to bind. + ** progvl - length of object to bind. + ** in bind-by-value if specified as -1 then strlen(bfa) is + ** used (really only makes sends with character types) + ** in bind-by-value, if specified as -1 then UB2MAXVAL + ** is used. Again this really makes sense only with + ** SQLT_STR. + ** ftype - datatype of object + ** indp - pointer to indicator variable. + ** -1 means to ignore bfa/bfl and bind NULL; + ** not -1 means to bind the contents of bfa/bfl + ** bind the contents pointed to by bfa + ** aln - Alternate length pointer + ** rcp - Return code pointer + ** mal - Maximum array length + ** cal - Current array length pointer + ** fmt - format string + ** fmtl - length of format string; if -1, strlen(fmt) is used + ** fmtt - desired output type after applying forat mask. Not + ** really yet implemented + ** scale - number of decimal digits in a cobol packed decimal (type 7) + ** + ** Note that the length of bfa when bound as SQLT_STR is reduced + ** to strlen(bfa). + ** Note that trailing blanks are stripped of storage of SQLT_STR. + */ + +/***************************/ +/* DESCRIBING */ +/***************************/ +sword ocidsc ( struct csrdef *cursor, sword pos, sb2 *dbsize, sb2 *fsize, + sb2 *rcode, sb2 *dtype, sb1 *buf, sb2 *bufl, sb2 *dsize ); +sword ocidsr( struct csrdef *cursor, sword pos, sb2 *dbsize, sb2 *dtype, + sb2 *fsize ); +sword ocinam( struct csrdef *cursor, sword pos, sb1 *tbuf, sb2 *tbufl, + sb1 *buf, sb2 *bufl ); + /* + ** ocidsc, ocidsr: Obtain information about a column + ** ocinam : get the name of a column + ** cursor - pointer to csrdef + ** pos - position in select list from [1..N] + ** dbsize - place to store the database size + ** fsize - place to store the fetched size + ** rcode - place to store the fetched column returned code + ** dtype - place to store the data type + ** buf - array to store the column name + ** bufl - place to store the column name length + ** dsize - maximum display size + ** tbuf - place to store the table name + ** tbufl - place to store the table name length + */ + +sword ocidsp ( struct csrdef *cursor, sword pos, sb4 *dbsize, sb2 *dbtype, + sb1 *cbuf, sb4 *cbufl, sb4 *dsize, sb2 *pre, sb2 *scl, + sb2 *nul ); + +sword ocidpr( ldadef *lda, oratext *object_name, size_t object_length, + void * reserved1, size_t reserved1_length, void * reserved2, + size_t reserved2_length, ub2 *overload, ub2 *position, + ub2 *level, oratext **argument_name, ub2 *argument_length, + ub2 *datatype, ub1 *default_supplied, ub1 *in_out, + ub4 *length, sb2 *precision, sb2 *scale, ub1 *radix, + ub4 *spare, ub4 *total_elements ); + /* + ** OCIDPR - User Program Interface: Describe Stored Procedure + ** + ** This routine is used to obtain information about the calling + ** arguments of a stored procedure. The client provides the + ** name of the procedure using "object_name" and "database_name" + ** (database name is optional). The client also supplies the + ** arrays for OCIDPR to return the values and indicates the + ** length of array via the "total_elements" parameter. Upon return + ** the number of elements used in the arrays is returned in the + ** "total_elements" parameter. If the array is too small then + ** an error will be returned and the contents of the return arrays + ** are invalid. + ** + ** + ** EXAMPLE : + ** + ** Client provides - + ** + ** object_name - SCOTT.ACCOUNT_UPDATE@BOSTON + ** total_elements - 100 + ** + ** + ** ACCOUNT_UPDATE is an overloaded function with specification : + ** + ** type number_table is table of number index by binary_integer; + ** table account (account_no number, person_id number, + ** balance number(7,2)) + ** table person (person_id number(4), person_nm varchar2(10)) + ** + ** function ACCOUNT_UPDATE (account number, + ** person person%rowtype, amounts number_table, + ** trans_date date) return accounts.balance%type; + ** + ** function ACCOUNT_UPDATE (account number, + ** person person%rowtype, amounts number_table, + ** trans_no number) return accounts.balance%type; + ** + ** + ** Values returned - + ** + ** overload position argument level datatype length prec scale rad + ** ------------------------------------------------------------------- + ** 0 0 0 NUMBER 22 7 2 10 + ** 0 1 ACCOUNT 0 NUMBER 22 0 0 0 + ** 0 2 PERSON 0 RECORD 0 0 0 0 + ** 0 2 PERSON_ID 1 NUMBER 22 4 0 10 + ** 0 2 PERSON_NM 1 VARCHAR2 10 0 0 0 + ** 0 3 AMOUNTS 0 TABLE 0 0 0 0 + ** 0 3 1 NUMBER 22 0 0 0 + ** 0 4 TRANS_NO 0 NUMBER 22 0 0 0 + ** + ** 1 0 0 NUMBER 22 7 2 10 + ** 1 1 ACCOUNT 0 NUMBER 22 0 0 0 + ** 1 2 PERSON 0 RECORD 0 0 0 0 + ** 1 2 PERSON_ID 1 NUMBER 22 4 0 10 + ** 1 2 PERSON_NM 1 VARCHAR2 10 0 0 0 + ** 1 3 AMOUNTS 0 TABLE 0 0 0 0 + ** 1 3 1 NUMBER 22 0 0 0 + ** 1 4 TRANS_DATE 0 NUMBER 22 0 0 0 + ** + ** + ** OCIDPR Argument Descriptions - + ** + ** ldadef - pointer to ldadef + ** object_name - object name, synonyms are also accepted and will + ** be translate, currently only procedure and function + ** names are accepted, also NLS names are accepted. + ** Currently, the accepted format of a name is + ** [[part1.]part2.]part3[@dblink] (required) + ** object_length - object name length (required) + ** reserved1 - reserved for future use + ** reserved1_length - reserved for future use + ** reserved2 - reserved for future use + ** reserved2_length - reserved for future use + ** overload - array indicating overloaded procedure # (returned) + ** position - array of argument positions, position 0 is a + ** function return argument (returned) + ** level - array of argument type levels, used to describe + ** sub-datatypes of data structures like records + ** and arrays (returned) + ** argument_name - array of argument names, only returns first + ** 30 characters of argument names, note storage + ** for 30 characters is allocated by client (returned) + ** argument_length - array of argument name lengths (returned) + ** datatype - array of oracle datatypes (returned) + ** default_supplied - array indicating parameter has default (returned) + ** 0 = no default, 1 = default supplied + ** in_out - array indicating if argument is IN or OUT (returned + ** 0 = IN param, 1 = OUT param, 2 = IN/OUT param + ** length - array of argument lengths (returned) + ** precision - array of precisions (if number type)(returned) + ** scale - array of scales (if number type)(returned) + ** radix - array of radix (if number type)(returned) + ** spare - array of spares. + ** total_elements - size of arrays supplied by client (required), + ** total number of elements filled (returned) + */ + +/*************************************/ +/* DEFINING */ +/*************************************/ +sword ocidfi( struct csrdef *cursor, sword pos, ub1 *buf, sword bufl, + sword ftype, sb2 *rc, sword scale ); +sword ocidfn( struct csrdef *cursor, sword pos, ub1 *buf, sword bufl, + sword ftype, sword scale, sb2 *indp, oratext *fmt, sword fmtl, + sword fmtt, ub2 *rl, ub2 *rc ); +sword ocidfnps( struct csrdef *cursor, ub1 opcode, sword pos, ub1 *buf, + sb4 bufl, sword ftype, sword scale, + sb2 *indp, oratext *fmt, sb4 fmtl, + sword fmtt, ub2 *rl, ub2 *rc, + sb4 pv_skip, sb4 ind_skip, sb4 len_skip, + sb4 rc_skip ); + + + /* Define a user data buffer using upidfn + ** cursor - pointer to csrdef + ** pos - position of a field or exp in the select list of a query + ** bfa/bfl - address and length of client-supplied storage + to receive data + ** ftype - user datatype + ** scale - number of fractional digits for cobol packed decimals + ** indp - place to store the length of the returned value. If returned + ** value is: + ** negative, the field fetched was NULL + ** zero , the field fetched was same length or shorter than + ** the buffer provided + ** positive, the field fetched was truncated + ** fmt - format string + ** fmtl - length of format string, if -1 strlent(fmt) used + ** rl - place to store column length after each fetch + ** rc - place to store column error code after each fetch + ** fmtt - fomat type + */ + +/********************************/ +/* PIECE INFORMATION GET/SET */ +/********************************/ +sword ocigetpi( struct csrdef *cursor, ub1 *piecep, + void **ctxpp, ub4 *iterp, ub4 *indexp ); +sword ocisetpi( struct csrdef *cursor, ub1 piece, + void *bufp, ub4 *lenp ); + + +/********************************/ +/* EXECUTE */ +/********************************/ +sword ociexe( struct csrdef *cursor ); +sword ociexn( struct csrdef *cursor, sword iters, sword roff ); +sword ociefn( struct csrdef *cursor, ub4 nrows, sword can, sword exact ); + /* + ** ociexe - execute a cursor + ** ociexn - execute a cursosr N times + ** cursor - pointer to a csrdef + ** iters - number of times to execute cursor + ** roff - offset within the bind variable array at which to begin + ** operations. + */ + + +/*********************************/ +/* FETCHING */ +/*********************************/ +sword ocifet( struct csrdef *cursor ); +sword ocifen( struct csrdef *cursor, sword nrows ); + /* ocifet - fetch the next row + ** ocifen - fetch n rows + ** cursor - pointer to csrdef + ** nrows - number of rows to be fetched + */ + +sword ocilng( struct csrdef *cursor, sword posit, ub1 *bfa, sb4 bfl, + sword dty, ub4 *rln, sb4 off ); + +/*********************************/ +/* CONVERSION */ +/*********************************/ +sword ocic32( struct csrdef *cursor ); + /* + ** Convert selected version 3 return codes to the equivalent + ** version 2 code. + ** csrdef->csrrc is set to the converted code + ** csrdef->csrft is set to v2 oracle statment type + ** csrdef->csrrpc is set to the rows processed count + ** csrdef->csrpeo is set to error postion + ** + ** cursor - pointer to csrdef + */ + + +sword ocir32( struct csrdef *cursor, sword retcode ); + /* + ** Convert selected version 3 return codes to the equivalent version 2 + ** code. + ** + ** cursor - pointer to csrdef + ** retcode - place to store the return code + */ + + +void ociscn( sword **arglst, char *mask_addr, sword **newlst ); + /* + ** Convert call-by-ref to call-by-value: + ** takes an arg list and a mask address, determines which args need + ** conversion to a value, and creates a new list begging at the address + ** of newlst. + ** + ** arglst - list of arguments + ** mast_addr _ mask address determines args needing conversion + ** newlst - new list of args + */ + +sword ocistf ( sword typ, sword bufl, sword rdig, oratext *fmt, + struct csrdef *cursor, sword *err ); +/* Convert a packed decimal buffer length (bytes) and scale to a format +** string of the form mm.+/-nn, where mm is the number of packed +** decimal digits, and nn is the scaling factor. A positive scale name +** nn digits to the rights of the decimal; a negative scale means nn zeros +** should be supplied to the left of the decimal. +** bufl - length of the packed decimal buffer +** rdig - number of fractional digits +** fmt - pointer to a string holding the conversion format +** cursor - pointer to csrdef +** err - pointer to word storing error code +*/ + + +/******************************************/ +/* Non-blocking operations */ +/******************************************/ +sword ocinbs( ldadef *lda ); /* set a connection to non-blocking */ +sword ocinbt( ldadef *lda ); /* test if connection is non-blocking */ +sword ocinbc( ldadef *lda ); /* clear a connection to blocking */ +sword ocinlo( ldadef *lda, struct hstdef *hst, oratext *conn, + sword connl, oratext *uid, sword uidl, + oratext *psw, sword pswl, sword audit ); + /* logon in non-blocking fashion */ +/* ocinlo allows an application to logon in non-blocking fashion. +** lda - pointer to ldadef +** hst - pointer to a 256 byte area, must be cleared to zero before call +** conn - the database link (if specified @LINK in uid will be ignored) +** connl - length of conn; if -1 strlen(conn) is used +** uid - user id [USER[/PASSWORD][@LINK]] +** uidl - length of uid, if -1 strlen(uid) is used +** psw - password string; ignored if specified in uid +** pswl - length of psw, if -1 strlen(psw) is used +** audit - is not supported; the only permissible value is 0 +*/ + +/***************************************************/ +/* Procedure Declaration for Pro*C */ +/***************************************************/ +/* Note: The following routines are used in Pro*C and have the + same interface as their couterpart in OCI. + Althought the interface follows for more details please refer + to the above routines */ + +/******************************************/ +/* initialization/logon/logof */ +/******************************************/ +sword ocipin( ub4 mode ); + +sword ologin( ldadef *lda, sb2 areacount ); +sword ologon( ldadef *lda, sb2 areacount ); + +/*****************************************/ +/* Open/Close/Parse Cursor */ +/*****************************************/ + +/* +** ocisqd - oci delayed parse (Should be used only with deferred upi/oci) +** FUNCTION: Call upidpr to delay the parse of the sql statement till the +** time that a call needs to be made to the kernel (execution or +** describe time ) +** RETURNS: Oracle return code. +*/ +sword ocisq7( struct csrdef *cursor, oratext * /* sqlstm */, sb4 sqllen, + sword defflg, ub4 sqlt ); + +/*****************************************/ +/* Bind */ +/*****************************************/ +sword obind( struct csrdef *cursor, oratext *sqlvar, sword sqlvl, + ub1 *progv, sword progvl, sword ftype, sword scale, + oratext *fmt, sword fmtl, sword fmtt ); +sword obindn( struct csrdef *cursor, ub2 sqlvn, ub1 *progv, sword progvl, + sword ftype, sword scale, oratext *fmt, sword fmtl, + sword fmtt ); + +/**********************************************/ +/* Define */ +/**********************************************/ +sword odfinn( struct csrdef *cursor, sword pos, ub1 *buf, sword bufl, + sword ftype, sb2 *rc, sword scale ); + +/**********************************************/ +/* Describe */ +/**********************************************/ +sword odsrbn( struct csrdef *cursor, sword pos, sb2 *dbsize, sb2 *dtype, + sb2 *fsize ); + + +/******************************************/ +/* Non-blocking operations */ +/******************************************/ +sword onblon( ldadef *lda, struct hstdef *hst, oratext *conn, + sword connl, oratext *uid, sword uidl, + oratext *psw, sword pswl, sword audit ); + /* logon in non-blocking fashion */ +sword ocignfd( ldadef *lda, void *nfdp ); /* get native fd */ + +ub2 ocigft_getFcnType( ub2 oertyp ); /* get sql function code */ + +#endif diff --git a/sdk/include/ocidem.h b/sdk/include/ocidem.h new file mode 100755 index 0000000..f7bb786 --- /dev/null +++ b/sdk/include/ocidem.h @@ -0,0 +1,113 @@ +/* + * + */ + +/* Copyright (c) 1991, 2005, Oracle. All rights reserved. */ +/* Copyright (c) 1991, 2005, Oracle. All rights reserved. */ +/* + NAME + ocidem.h - OCI demo header + MODIFIED (MM/DD/YY) + dmukhin 06/29/05 - ANSI prototypes; miscellaneous cleanup + whe 04/07/99 - bug#810071 + whe 03/19/99 - lrg 32079 etc.: putting static back for oci_func_tab + nmacnaug 02/02/99 - static declarations should not be in header files + mygopala 09/22/97 - Fix for bug 550351 + surman 03/14/97 - Merge 413362 to 8.0.3 + surman 11/08/96 - 413362: Add SS_64BIT_SERVER macro + emendez 04/07/94 - merge changes from branch 1.6.710.1 + emendez 02/02/94 - Fix for bug 157576 + jnlee 01/05/93 - include oratypes.h once, make oci_func_tab static + rkooi2 10/26/92 - More portability mods + rkooi2 10/22/92 - Change text back to char to avoid casts + rkooi2 10/20/92 - Changes to make it portable + sjain 03/16/92 - Creation +*/ + +/* + * ocidem.h + * + * Declares additional functions and data structures + * used in the OCI C sample programs. + */ + + +#ifndef ORATYPES +#include +#endif /* ORATYPES */ + +#ifndef OCIDFN +#include +#endif /* OCIDFN */ + +#ifndef OCIDEM +#define OCIDEM + + +/* internal/external datatype codes */ +#define VARCHAR2_TYPE 1 +#define NUMBER_TYPE 2 +#define INT_TYPE 3 +#define FLOAT_TYPE 4 +#define STRING_TYPE 5 +#define ROWID_TYPE 11 +#define DATE_TYPE 12 + +/* ORACLE error codes used in demonstration programs */ +#define VAR_NOT_IN_LIST 1007 +#ifndef NO_DATA_FOUND +# define NO_DATA_FOUND 1403 +#endif +#define NULL_VALUE_RETURNED 1405 + +/* some SQL and OCI function codes */ +#define FT_INSERT 3 +#define FT_SELECT 4 +#define FT_UPDATE 5 +#define FT_DELETE 9 + +#define FC_OOPEN 14 + +/* + * OCI function code labels, + * corresponding to the fc numbers + * in the cursor data area. + */ +static const text *oci_func_tab[] = {(text *) "not used", +/* 1-2 */ (text *) "not used", (text *) "OSQL", +/* 3-4 */ (text *) "not used", (text *) "OEXEC, OEXN", +/* 5-6 */ (text *) "not used", (text *) "OBIND", +/* 7-8 */ (text *) "not used", (text *) "ODEFIN", +/* 9-10 */ (text *) "not used", (text *) "ODSRBN", +/* 11-12 */ (text *) "not used", (text *) "OFETCH, OFEN", +/* 13-14 */ (text *) "not used", (text *) "OOPEN", +/* 15-16 */ (text *) "not used", (text *) "OCLOSE", +/* 17-18 */ (text *) "not used", (text *) "not used", +/* 19-20 */ (text *) "not used", (text *) "not used", +/* 21-22 */ (text *) "not used", (text *) "ODSC", +/* 23-24 */ (text *) "not used", (text *) "ONAME", +/* 25-26 */ (text *) "not used", (text *) "OSQL3", +/* 27-28 */ (text *) "not used", (text *) "OBNDRV", +/* 29-30 */ (text *) "not used", (text *) "OBNDRN", +/* 31-32 */ (text *) "not used", (text *) "not used", +/* 33-34 */ (text *) "not used", (text *) "OOPT", +/* 35-36 */ (text *) "not used", (text *) "not used", +/* 37-38 */ (text *) "not used", (text *) "not used", +/* 39-40 */ (text *) "not used", (text *) "not used", +/* 41-42 */ (text *) "not used", (text *) "not used", +/* 43-44 */ (text *) "not used", (text *) "not used", +/* 45-46 */ (text *) "not used", (text *) "not used", +/* 47-48 */ (text *) "not used", (text *) "not used", +/* 49-50 */ (text *) "not used", (text *) "not used", +/* 51-52 */ (text *) "not used", (text *) "OCAN", +/* 53-54 */ (text *) "not used", (text *) "OPARSE", +/* 55-56 */ (text *) "not used", (text *) "OEXFET", +/* 57-58 */ (text *) "not used", (text *) "OFLNG", +/* 59-60 */ (text *) "not used", (text *) "ODESCR", +/* 61-62 */ (text *) "not used", (text *) "OBNDRA", +/* 63-64 */ (text *) "OBINDPS", (text *) "ODEFINPS", +/* 65-66 */ (text *) "OGETPI", (text *) "OSETPI" +}; + +#endif /* OCIDEM */ + diff --git a/sdk/include/ocidfn.h b/sdk/include/ocidfn.h new file mode 100755 index 0000000..873c5a7 --- /dev/null +++ b/sdk/include/ocidfn.h @@ -0,0 +1,249 @@ +/* Copyright (c) 1991, 2005, Oracle. All rights reserved. */ +/* Copyright (c) 1991, 2005, Oracle. All rights reserved. */ +/* + NAME + ocidfn.h - OCI Definations + NOTES + Shipped to users. + MODIFIED (MM/DD/YY) + mbastawa 09/16/05 - dbhygiene + dmukhin 06/29/05 - ANSI prototypes; miscellaneous cleanup + srseshad 11/25/02 - change binary float/double codes + srseshad 11/14/02 - Add SQLT_IBFLOAT, SQLT_IBDOUBLE + mxyang 09/17/02 - grabtrans 'mmorsi_obj_float' + srseshad 09/06/02 - Add binary float/double + aahluwal 06/04/02 - bug 2360115 + kmuthukk 05/02/00 - add SQLT_PNTY + amangal 07/30/99 - Merge into 8.1.6 : Bug 879031 + tnbui 07/28/99 - Remove SQLT_TIMESTAMP_ITZ + tnbui 07/21/99 - SQLT_TIMESTAMP_LTZ + tnbui 06/16/99 - TIMESTAMP WITH IMPLICIT TIME ZONE + whe 04/07/99 - bug#810075 + whe 03/19/99 - lrg 32079 etc.: move HDA def from ocidem.h to ocidfn. + skmishra 05/10/98 - + vyanaman 04/16/98 - update sql92 datatypes + khnguyen 01/16/98 - + khnguyen 12/23/97 - SQLT* for datetimes and intervals + tanguyen 08/19/97 - + dchatter 03/18/97 - porting exception 390897 + dchatter 05/02/97 - merge porting exception + dalpern 12/04/96 - SQLCS_LIT_NULL added + cxcheng 11/14/96 - add SQLT_BFILE/SQLT_CFILE to fix compile prob + cxcheng 11/12/96 - add SQLT_NCO for named collection + lchidamb 10/17/96 - add SQLT_VST and SQLT_ODT + sgollapu 10/14/96 - Mutual exclusion of ocidfn and sqldef + sgollapu 10/07/96 - OCI Simplification + aroy 09/09/96 - add SQLCS* definitions + slari 08/07/96 - add SQLT_RDD, rowid descriptor + slari 06/12/96 - remove SQLT_TTBL + dchatter 04/21/96 - prepare for merge into main + slari 08/24/95 - b299432, define CDA_SIZE + zwalcott 02/28/96 - add SQLT_BFILEE and SQLT_CFILEE. + lchidamb 02/22/96 - make dtys consistent with dtydef.h + lchidamb 02/16/96 - add SQLT_BFILEE and SQLT_CFILEE + lchidamb 01/30/96 - rename new datatypes for v8 + lchidamb 09/06/95 - add new datatypes + slari 05/11/95 - add OCI_EV_DEF and OCI_EV_TSF + dchatter 04/06/95 - add ifdef flags around OCI_flags + dchatter 03/08/95 - piece values + dchatter 03/06/95 - merge changes from branch 1.2.720.3 + jfbrown 02/17/95 - merge changes from branch 1.2.720.2 + dchatter 02/08/95 - olog call modes + jfbrown 02/03/95 - remove non-printable characters + lchidamb 12/06/94 - merge changes from branch 1.2.720.1 + lchidamb 10/04/94 - added field chk to cda_head, cda_def + dchatter 07/05/94 - SQLT_CUR added + rkooi2 11/27/92 - Changing e* datatypes to s* + rkooi2 10/26/92 - More portability mods + rkooi2 10/22/92 - Added #ifndef ORATYPES ... + rkooi2 10/18/92 - Changes to make it portable. + sjain 03/16/92 - Creation +*/ + +/* + * ocidfn.h + * + * Common header file for OCI C sample programs. + * This header declares the cursor and logon data area structure. + * The types used are defined in . + * + */ + +#ifndef OCIDFN +#define OCIDFN + +#include + +/* The cda_head struct is strictly PRIVATE. It is used + internally only. Do not use this struct in OCI programs. */ + +struct cda_head { + sb2 v2_rc; + ub2 ft; + ub4 rpc; + ub2 peo; + ub1 fc; + ub1 rcs1; + ub2 rc; + ub1 wrn; + ub1 rcs2; + sword rcs3; + struct { + struct { + ub4 rcs4; + ub2 rcs5; + ub1 rcs6; + } rd; + ub4 rcs7; + ub2 rcs8; + } rid; + sword ose; + ub1 chk; + void *rcsp; +}; + +/* +** Size of HDA area: +** 512 for 64 bit arquitectures +** 256 for 32 bit arquitectures +*/ + +#if defined(SS_64BIT_SERVER) || defined(__64BIT__) +# define HDA_SIZE 512 +#else +# define HDA_SIZE 256 +#endif + +#if defined(SS_64BIT_SERVER) || defined(__64BIT__) +#define CDA_SIZE 88 +#else +# define CDA_SIZE 64 +#endif + +/* the real CDA, padded to CDA_SIZE bytes in size */ +struct cda_def { + sb2 v2_rc; /* V2 return code */ + ub2 ft; /* SQL function type */ + ub4 rpc; /* rows processed count */ + ub2 peo; /* parse error offset */ + ub1 fc; /* OCI function code */ + ub1 rcs1; /* filler area */ + ub2 rc; /* V7 return code */ + ub1 wrn; /* warning flags */ + ub1 rcs2; /* reserved */ + sword rcs3; /* reserved */ + struct { /* rowid structure */ + struct { + ub4 rcs4; + ub2 rcs5; + ub1 rcs6; + } rd; + ub4 rcs7; + ub2 rcs8; + } rid; + sword ose; /* OSD dependent error */ + ub1 chk; + void *rcsp; /* pointer to reserved area */ + ub1 rcs9[CDA_SIZE - sizeof (struct cda_head)]; /* filler */ +}; + +typedef struct cda_def Cda_Def; + +/* the logon data area (LDA) + is the same shape as the CDA */ +typedef struct cda_def Lda_Def; + +/* OCI Environment Modes for opinit call */ +#define OCI_EV_DEF 0 /* default single-threaded environment */ +#define OCI_EV_TSF 1 /* thread-safe environment */ + +/* OCI Logon Modes for olog call */ +#define OCI_LM_DEF 0 /* default login */ +#define OCI_LM_NBL 1 /* non-blocking logon */ + +/* + * since sqllib uses both ocidef and ocidfn the following defines + * need to be guarded + */ +#ifndef OCI_FLAGS +#define OCI_FLAGS + +/* OCI_*_PIECE defines the piece types that are returned or set +*/ +#define OCI_ONE_PIECE 0 /* there or this is the only piece */ +#define OCI_FIRST_PIECE 1 /* the first of many pieces */ +#define OCI_NEXT_PIECE 2 /* the next of many pieces */ +#define OCI_LAST_PIECE 3 /* the last piece of this column */ +#endif + +#ifndef SQLDEF + +/* input data types */ +#define SQLT_CHR 1 /* (ORANET TYPE) character string */ +#define SQLT_NUM 2 /* (ORANET TYPE) oracle numeric */ +#define SQLT_INT 3 /* (ORANET TYPE) integer */ +#define SQLT_FLT 4 /* (ORANET TYPE) Floating point number */ +#define SQLT_STR 5 /* zero terminated string */ +#define SQLT_VNU 6 /* NUM with preceding length byte */ +#define SQLT_PDN 7 /* (ORANET TYPE) Packed Decimal Numeric */ +#define SQLT_LNG 8 /* long */ +#define SQLT_VCS 9 /* Variable character string */ +#define SQLT_NON 10 /* Null/empty PCC Descriptor entry */ +#define SQLT_RID 11 /* rowid */ +#define SQLT_DAT 12 /* date in oracle format */ +#define SQLT_VBI 15 /* binary in VCS format */ +#define SQLT_BFLOAT 21 /* Native Binary float*/ +#define SQLT_BDOUBLE 22 /* NAtive binary double */ +#define SQLT_BIN 23 /* binary data(DTYBIN) */ +#define SQLT_LBI 24 /* long binary */ +#define SQLT_UIN 68 /* unsigned integer */ +#define SQLT_SLS 91 /* Display sign leading separate */ +#define SQLT_LVC 94 /* Longer longs (char) */ +#define SQLT_LVB 95 /* Longer long binary */ +#define SQLT_AFC 96 /* Ansi fixed char */ +#define SQLT_AVC 97 /* Ansi Var char */ +#define SQLT_IBFLOAT 100 /* binary float canonical */ +#define SQLT_IBDOUBLE 101 /* binary double canonical */ +#define SQLT_CUR 102 /* cursor type */ +#define SQLT_RDD 104 /* rowid descriptor */ +#define SQLT_LAB 105 /* label type */ +#define SQLT_OSL 106 /* oslabel type */ + +#define SQLT_NTY 108 /* named object type */ +#define SQLT_REF 110 /* ref type */ +#define SQLT_CLOB 112 /* character lob */ +#define SQLT_BLOB 113 /* binary lob */ +#define SQLT_BFILEE 114 /* binary file lob */ +#define SQLT_CFILEE 115 /* character file lob */ +#define SQLT_RSET 116 /* result set type */ +#define SQLT_NCO 122 /* named collection type (varray or nested table) */ +#define SQLT_VST 155 /* OCIString type */ +#define SQLT_ODT 156 /* OCIDate type */ + +/* datetimes and intervals */ +#define SQLT_DATE 184 /* ANSI Date */ +#define SQLT_TIME 185 /* TIME */ +#define SQLT_TIME_TZ 186 /* TIME WITH TIME ZONE */ +#define SQLT_TIMESTAMP 187 /* TIMESTAMP */ +#define SQLT_TIMESTAMP_TZ 188 /* TIMESTAMP WITH TIME ZONE */ +#define SQLT_INTERVAL_YM 189 /* INTERVAL YEAR TO MONTH */ +#define SQLT_INTERVAL_DS 190 /* INTERVAL DAY TO SECOND */ +#define SQLT_TIMESTAMP_LTZ 232 /* TIMESTAMP WITH LOCAL TZ */ + +#define SQLT_PNTY 241 /* pl/sql representation of named types */ + +/* cxcheng: this has been added for backward compatibility - + it needs to be here because ocidfn.h can get included ahead of sqldef.h */ +#define SQLT_FILE SQLT_BFILEE /* binary file lob */ +#define SQLT_CFILE SQLT_CFILEE +#define SQLT_BFILE SQLT_BFILEE + +/* CHAR/NCHAR/VARCHAR2/NVARCHAR2/CLOB/NCLOB char set "form" information */ +#define SQLCS_IMPLICIT 1 /* for CHAR, VARCHAR2, CLOB w/o a specified set */ +#define SQLCS_NCHAR 2 /* for NCHAR, NCHAR VARYING, NCLOB */ +#define SQLCS_EXPLICIT 3 /* for CHAR, etc, with "CHARACTER SET ..." syntax */ +#define SQLCS_FLEXIBLE 4 /* for PL/SQL "flexible" parameters */ +#define SQLCS_LIT_NULL 5 /* for typecheck of NULL and empty_clob() lits */ + +#endif /* SQLDEF */ +#endif /* OCIDFN */ diff --git a/sdk/include/ociextp.h b/sdk/include/ociextp.h new file mode 100755 index 0000000..7026a68 --- /dev/null +++ b/sdk/include/ociextp.h @@ -0,0 +1,282 @@ +/* + * + */ + +/* Copyright (c) 1996, 2005, Oracle. All rights reserved. */ + +/* + NAME + ociextp.h - Interface Definitions for PL/SQL External Procedures + + DESCRIPTION + This header file contains C language callable interface from + PL/SQL External Procedures. + + PUBLIC FUNCTION(S) + OCIExtProcAllocCallMemory - Allocate Call memory + OCIExtProcRaiseExcp - Raise Exception + OCIExtProcRaiseExcpWithMsg - Raise Exception with message + OCIExtProcGetEnv - Get OCI Environment + + PRIVATE FUNCTION(S) + + + EXAMPLES + + NOTES + + + MODIFIED (MM/DD/YY) + dmukhin 06/29/05 - ANSI prototypes; miscellaneous cleanup + srseshad 03/12/03 - convert oci public api to ansi + rdecker 01/10/02 - change 32k to MAX_OEN for error numbers + sagrawal 07/20/01 - Statement Handle to safe cal outs + abrumm 04/19/01 - move include of oci.h after defines/typedef + rdecker 02/22/01 - lint fix + bpalaval 02/08/01 - Change text to oratext. + sagrawal 06/16/00 - ref cursor in callouts + whe 09/01/99 - 976457:check __cplusplus for C++ code + asethi 04/15/99 - Created (by moving ociextp.h from /vobs/plsql/public) + rhari 03/25/97 - Use ifndef + rhari 12/18/96 - Include oratypes.h + rhari 12/11/96 - #416977, Flip values of return codes + rhari 12/02/96 - Define Return Code Macros + rhari 11/18/96 - Error number is int + rhari 10/30/96 - Fix OCIExtProcRaiseExcpWithMsg + rhari 10/30/96 - Get rid of warnings + rhari 10/04/96 - Fix OCIExtProcRaiseExcpWithMsg + rhari 09/23/96 - Creation + +*/ + + +#ifndef OCIEXTP_ORACLE +# define OCIEXTP_ORACLE + +# ifndef ORATYPES +# include +# endif + + +/*--------------------------------------------------------------------------- + PUBLIC TYPES AND CONSTANTS + ---------------------------------------------------------------------------*/ + + +/* ----------------------------- Return Codes ----------------------------- */ +/* Success and Error return codes for certain external procedure interface + * functions. If a particular interface function returns OCIEXTPROC_SUCCESS + * or OCIEXTPROC_ERROR, then applications must use these macros to check + * for return values. + * + * OCIEXTPROC_SUCCESS -- External Procedure Success Return Code + * OCIEXTPROC_ERROR -- External Procedure Failure Return Code + */ +#define OCIEXTPROC_SUCCESS 0 +#define OCIEXTPROC_ERROR 1 + + +/* --------------------------- With-Context Type --------------------------- */ +/* + * The C callable interface to PL/SQL External Procedures require the + * With-Context parameter to be passed. The type of this structure is + * OCIExtProcContext is is opaque to the user. + * + * The user can declare the With-Context parameter in the application as + * + * OCIExtProcContext *with_context; + */ +typedef struct OCIExtProcContext OCIExtProcContext; + +/* NOTE: OCIExtProcContext must be visible prior to including */ + +# ifndef OCI_ORACLE +# include +# endif + + +/* ----------------------- OCIExtProcAllocCallMemory ----------------------- */ +/* OCIExtProcAllocCallMemory + * Allocate N bytes of memory for the duration of the External Procedure. + * + * Memory thus allocated will be freed by PL/SQL upon return from the + * External Procedure. You must not use any kind of 'free' function on + * memory allocated by OCIExtProcAllocCallMemory. + * Use this function to allocate memory for function returns. + * + * PARAMETERS + * Input : + * with_context - The with_context pointer that is passed to the C + * External Procedure. + * Type of with_context : OCIExtProcContext * + * amount - The number of bytes to allocate. + * Type of amount : size_t + * + * Output : + * Nothing + * + * Return : + * An untyped (opaque) Pointer to the allocated memory. + * + * Errors : + * A 0 return value should be treated as an error + * + * EXAMPLE + * text *ptr = (text *)OCIExtProcAllocCallMemory(wctx, 1024) + * + */ +#define OCIExtProcAllocCallMemory(with_context, amount) \ +ociepacm(with_context, (size_t)amount) + + + + +/* -------------------------- OCIExtProcRaiseExcp -------------------------- */ +/* OCIExtProcRaiseExcp + * Raise an Exception to PL/SQL. + * + * Calling this function signalls an exception back to PL/SQL. After a + * successful return from this function, the External Procedure must start + * its exit handling and return back to PL/SQL. Once an exception is + * signalled to PL/SQL, INOUT and OUT arguments, if any, are not processed + * at all. + * + * PARAMETERS + * Input : + * with_context - The with_context pointer that is passed to the C + * External Procedure. + * Type of with_context : OCIExtProcContext * + * errnum - Oracle Error number to signal to PL/SQL. errnum + * must be a positive number and in the range 1 to MAX_OEN + * Type of errnum : int + * Output : + * Nothing + * + * Return : + * OCIEXTPROC_SUCCESS - If the call was successful. + * OCIEXTPROC_ERROR - If the call failed. + * + */ +#define OCIExtProcRaiseExcp(with_context, errnum) \ +ocieperr(with_context, (int)errnum) + + + + + +/* ---------------------- OCIExtProcRaiseExcpWithMsg ---------------------- */ +/* OCIExtProcRaiseExcpWithMsg + * Raise an exception to PL/SQL. In addition, substitute the + * following error message string within the standard Oracle error + * message string. See note for OCIExtProcRaiseExcp + * + * PARAMETERS + * Input : + * with_context - The with_context pointer that is passed to the C + * External Procedure. + * Type of with_context : OCIExtProcContext * + * errnum - Oracle Error number to signal to PL/SQL. errnum + * must be a positive number and in the range 1 to MAX_OEN + * Type of errnum : int + * errmsg - The error message associated with the errnum. + * Type of errmsg : char * + * len - The length of the error message. 0 if errmsg is + * null terminated string. + * Type of len : size_t + * Output : + * Nothing + * + * Return : + * OCIEXTPROC_SUCCESS - If the call was successful. + * OCIEXTPROC_ERROR - If the call failed. + * + */ +#define OCIExtProcRaiseExcpWithMsg(with_context, errnum, errmsg, msglen) \ +ociepmsg(with_context, (int)errnum, errmsg, (size_t)msglen) + + + +/* --------------------------- OCIExtProcGetEnv --------------------------- */ +/* OCIExtProcGetEnv + * Get OCI Environment + * + * PARAMETERS + * Input : + * with_context - The with_context pointer that is passed to the C + * External Procedure. + * + * Output : + * envh - The OCI Environment handle. + * svch - The OCI Service handle. + * errh - The OCI Error handle. + * + * Return : + * OCI_SUCCESS - Successful completion of the function. + * OCI_ERROR - Error. + * + */ +#define OCIExtProcGetEnv(with_context, envh, svch, errh) \ +ociepgoe(with_context, envh, svch, errh) + + + +/* ------------------------ OCIInitializeStatementHandle ------------------- */ +/* OCIreateStatementHandle + * Initialize Statement Handle + * + * PARAMETERS + * Input : + * wctx - The + * cursorno - The cursor number for which we need to initialize + * the statement handle + * svch - The OCI Service handle. + * + * Output : + * stmthp - The OCI Statement handle. + * errh - The OCI Error handle. + * + * Return : + * OCI_SUCCESS - Successful completion of the function. + * OCI_ERROR - Error. + * + */ +#define OCIInitializeStatementHandle(wctx, cursorno, svch, stmthp, errh) \ +ociepish(wctx, cursor, svch, stmthp, errh) + + + + +/*--------------------------------------------------------------------------- + PRIVATE TYPES AND CONSTANTS + ---------------------------------------------------------------------------*/ + + +/*--------------------------------------------------------------------------- + PUBLIC FUNCTIONS + ---------------------------------------------------------------------------*/ + + +/*--------------------------------------------------------------------------- + PRIVATE FUNCTIONS + ---------------------------------------------------------------------------*/ + + + +void *ociepacm(OCIExtProcContext *with_context, size_t amount); + + + +size_t ocieperr(OCIExtProcContext *with_context, int error_number); + + + +size_t ociepmsg(OCIExtProcContext *with_context, int error_number, + oratext *error_message, size_t len ); + + + +sword ociepgoe(OCIExtProcContext *with_context, OCIEnv **envh, + OCISvcCtx **svch, OCIError **errh); + + +#endif /* OCIEXTP_ORACLE */ diff --git a/sdk/include/ocikpr.h b/sdk/include/ocikpr.h new file mode 100755 index 0000000..425d696 --- /dev/null +++ b/sdk/include/ocikpr.h @@ -0,0 +1,165 @@ +/* Copyright (c) 1991, 2005, Oracle. All rights reserved. */ +/* + NAME + ocikpr.h - header of K & R compilers + MODIFIED (MM/DD/YY) + mbastawa 09/16/05 - dbhygiene + porangas 12/04/00 - Forward merge bug#974710 to 9i + sgollapu 05/19/98 - Change text to OraText + dchatter 04/21/96 - + dchatter 11/10/95 - add ognfd() - get native fd + lchidamb 04/06/95 - drop maxdsz from obindps/odefinps + slari 04/07/95 - add opinit + dchatter 03/08/95 - osetpi and ogetpi + lchidamb 12/09/94 - add obindps() and odefinps() + dchatter 03/06/95 - merge changes from branch 1.1.720.2 + dchatter 11/14/94 - merge changes from branch 1.1.720.1 + dchatter 02/08/95 - olog call; drop onblon + dchatter 10/31/94 - new functions for non-blocking oci + rkooi2 11/27/92 - Changing datatypes (in comments) and return types + rkooi2 10/26/92 - More portability mods + rkooi2 10/18/92 - Changed to agree with oci.c + sjain 03/16/92 - Creation +*/ + +/* + * Declare the OCI functions. + * Prototype information is commented out. + * Use this header for non-ANSI C compilers. + * Note that you will need to include ocidfn.h in the .c files + * to get the definition for cda_def. + */ + +#ifndef OCIKPR +#define OCIKPR + +#include + +/* + * Oci BIND (Piecewise or with Skips) + */ +sword obindps( struct cda_def *cursor, ub1 opcode, OraText *sqlvar, + sb4 sqlvl, ub1 *pvctx, sb4 progvl, + sword ftype, sword scale, + sb2 *indp, ub2 *alen, ub2 *arcode, + sb4 pv_skip, sb4 ind_skip, sb4 alen_skip, sb4 rc_skip, + ub4 maxsiz, ub4 *cursiz, + OraText *fmt, sb4 fmtl, sword fmtt ); +sword obreak( struct cda_def *lda ); +sword ocan ( struct cda_def *cursor ); +sword oclose( struct cda_def *cursor ); +sword ocof ( struct cda_def *lda ); +sword ocom ( struct cda_def *lda ); +sword ocon ( struct cda_def *lda ); + + +/* + * Oci DEFINe (Piecewise or with Skips) + */ +sword odefinps( struct cda_def *cursor, ub1 opcode, sword pos,ub1 *bufctx, + sb4 bufl, sword ftype, sword scale, + sb2 *indp, OraText *fmt, sb4 fmtl, sword fmtt, + ub2 *rlen, ub2 *rcode, + sb4 pv_skip, sb4 ind_skip, sb4 alen_skip, sb4 rc_skip ); +sword odescr( struct cda_def *cursor, sword pos, sb4 *dbsize, + sb2 *dbtype, sb1 *cbuf, sb4 *cbufl, sb4 *dsize, + sb2 *prec, sb2 *scale, sb2 *nullok ); +sword odessp( struct cda_def *cursor, OraText *objnam, size_t onlen, + ub1 *rsv1, size_t rsv1ln, ub1 *rsv2, size_t rsv2ln, + ub2 *ovrld, ub2 *pos, ub2 *level, OraText **argnam, + ub2 *arnlen, ub2 *dtype, ub1 *defsup, ub1* mode, + ub4 *dtsiz, sb2 *prec, sb2 *scale, ub1 *radix, + ub4 *spare, ub4 *arrsiz ); +sword oerhms( struct cda_def *lda, sb2 rcode, OraText *buf, + sword bufsiz ); +sword oermsg( sb2 rcode, OraText *buf ); +sword oexec ( struct cda_def *cursor ); +sword oexfet( struct cda_def *cursor, ub4 nrows, + sword cancel, sword exact ); +sword oexn ( struct cda_def *cursor, sword iters, sword rowoff ); +sword ofen ( struct cda_def *cursor, sword nrows ); +sword ofetch( struct cda_def *cursor ); +sword oflng ( struct cda_def *cursor, sword pos, ub1 *buf, + sb4 bufl, sword dtype, ub4 *retl, sb4 offset ); +sword ogetpi( struct cda_def *cursor, ub1 *piecep, void **ctxpp, + ub4 *iterp, ub4 *indexp ); +sword opinit( ub4 mode ); +sword olog ( struct cda_def *lda, ub1 *hst, + OraText *uid, sword uidl, + OraText *psw, sword pswl, + OraText *conn, sword connl, + ub4 mode ); +sword ologof( struct cda_def *lda ); +sword oopen ( struct cda_def *cursor, struct cda_def *lda, + OraText *dbn, sword dbnl, sword arsize, + OraText *uid, sword uidl ); +sword oopt ( struct cda_def *cursor, sword rbopt, sword waitopt ); +sword oparse( struct cda_def *cursor, OraText *sqlstm, sb4 sqllen, + sword defflg, ub4 lngflg ); +sword orol ( struct cda_def *lda ); +sword osetpi( struct cda_def *cursor, ub1 piece, void *bufp, + ub4 *lenp ); +void sqlld2 ( struct cda_def *lda, OraText *cname, sb4 *cnlen ); +void sqllda ( struct cda_def *lda ); + +/* non-blocking functions */ +sword onbset( struct cda_def *lda ); +sword onbtst( struct cda_def *lda ); +sword onbclr( struct cda_def *lda ); +sword ognfd ( struct cda_def *lda, void *fdp ); + + + +/* + * OBSOLETE FUNCTIONS + */ + +/* + * OBSOLETE BIND CALLS-- use obindps() + */ +sword obndra( struct cda_def *cursor, OraText *sqlvar, sword sqlvl, + ub1 *progv, sword progvl, sword ftype, sword scale, + sb2 *indp, ub2 *alen, ub2 *arcode, ub4 maxsiz, + ub4 *cursiz, OraText *fmt, sword fmtl, sword fmtt ); +sword obndrn( struct cda_def *cursor, sword sqlvn, ub1 *progv, + sword progvl, sword ftype, sword scale, sb2 *indp, + OraText *fmt, sword fmtl, sword fmtt ); +sword obndrv( struct cda_def *cursor, OraText *sqlvar, sword sqlvl, + ub1 *progv, sword progvl, sword ftype, sword scale, + sb2 *indp, OraText *fmt, sword fmtl, sword fmtt ); + +/* + * OBSOLETE DEFINE CALLS-- use odefinps() + */ +sword odefin( struct cda_def *cursor, sword pos, ub1 *buf, + sword bufl, sword ftype, sword scale, sb2 *indp, + OraText *fmt, sword fmtl, sword fmtt, ub2 *rlen, + ub2 *rcode ); + + +/* older calls ; preferred equivalent calls above */ +sword odsc ( struct cda_def *cursor, sword pos, sb2 *dbsize, + sb2 *fsize, sb2 *rcode, sb2 *dtype, sb1 *buf, + sb2 *bufl, sb2 *dsize ); +sword oname ( struct cda_def *cursor, sword pos, sb1 *tbuf, + sb2 *tbufl, sb1 *buf, sb2 *bufl ); +sword olon ( struct cda_def *lda, OraText *uid, sword uidl, + OraText *pswd, sword pswdl, sword audit ); +sword orlon ( struct cda_def *lda, ub1 *hda, OraText *uid, + sword uidl, OraText *pswd, sword pswdl, sword audit ); +sword osql3 ( struct cda_def *cda, OraText *sqlstm, sword sqllen ); + + + + + + + +#endif /* OCIKPR */ + + + + + + + diff --git a/sdk/include/ocixmldb.h b/sdk/include/ocixmldb.h new file mode 100755 index 0000000..721516f --- /dev/null +++ b/sdk/include/ocixmldb.h @@ -0,0 +1,211 @@ +/* Copyright (c) 2003, 2011, Oracle and/or its affiliates. +All rights reserved. */ + +/* + NAME + ocixmldb.h - XDB public functions + + DESCRIPTION + This file contains XDB specific public functions required for DOM C-API. + + RELATED DOCUMENTS + + + EXPORT FUNCTION(S) + struct xmlctx *OCIXmlDbInitXmlCtx(OCIEnv *, OCISvcCtx *, OCIError *, + ocixmldbparam *params, int num_params); + + void OCIXmlDbFreeXmlCtx(struct xmlctx *xctx); + + + ------------------------------------------------------------------------ + EXAMPLES + + NOTES + + MODIFIED (MM/DD/YY) + srirkris 06/15/11 - Add OCIXmlDr_DEF + srirkris 06/07/11 - Backport srirkris_bug-12613945 from main + srirkris 04/26/11 - Backport srirkris_xmlop_bnd from main + srirkris 04/14/11 - Backport srirkris_xqupd_repl from main + yifeng 02/15/11 - Backport yifeng_bug-10236275 from main + srirkris 03/01/11 - OCIXmlDbRewriteXMLDiff definition change + vmedi 01/14/11 - OCIXmlDbGetFullyQualifiedSchemaUrl + sipatel 03/08/10 - add lob arg to OCIXmlDbRewriteXMLDiff + samane 01/20/10 - Bug 9302227 + yifeng 11/05/09 - add OCIXmlDbRewriteXMLDiff + samane 08/05/09 - Bug 8661204 + ataracha 12/11/03 - remove redundant definitions + ataracha 05/28/03 - change names + ataracha 02/18/03 - add oratypes, remove XMLERR_* + imacky 02/01/03 - remove xml.h; xdbs fix + ataracha 01/24/03 - use "struct xmlctx" instead of xmlctx + imacky 01/28/03 - fix XMLERR defs + ataracha 01/21/03 - ataracha_uni_capi_cleanup + ataracha 01/09/03 - Creation + +*/ + +#ifndef ORATYPES +#include +#endif + +#ifndef OCI_ORACLE +# include +#endif + +#ifndef OCIXMLDB_ORACLE +# define OCIXMLDB_ORACLE + +/*--------------------------------------------------------------------------- + PUBLIC TYPES AND CONSTANTS + ---------------------------------------------------------------------------*/ + +#ifndef XMLCTX_DEFINED +# define XMLCTX_DEFINED +/* DATATYPE xmlctx - XML top-level context +*/ +struct xmlctx; typedef struct xmlctx xmlctx; +#endif + + +typedef struct OCIXmlDiffBnd { + oratext *bndnmp; + ub1 bndnml; + ub2 bndpos; + ub2 bndnum; + ub2 bnddty; + void *bndvalp; + ub4 bndvallen; +} OCIXmlDiffBnd; + +struct xmldrctx; typedef struct xmldrctx xmldrctx; + +typedef enum +{ + XCTXINIT_OCIDUR = 1, + XCTXINIT_ERRHDL = 2 +} ocixmldbpname; + +typedef struct ocixmldbparam +{ + ocixmldbpname name_ocixmldbparam; + void *value_ocixmldbparam; +} ocixmldbparam; + +#define NUM_OCIXMLDBPARAMS 2 + +#define OCIXMLDB_BINDBYNAME 1 +#define OCIXMLDB_BINDBYNUM 2 + +#define OCIMAXXQUBNDLMT 1000 + +#define OCIXmlDr_DEF 1 + + +/*--------------------------------------------------------------------------- + PRIVATE TYPES AND CONSTANTS + ---------------------------------------------------------------------------*/ + + +/*--------------------------------------------------------------------------- + EXPORT FUNCTIONS + ---------------------------------------------------------------------------*/ +/***************************************************************************** + DESCRIPTION + +-----------------------------OCIXmlDbInitXmlCtx--------------------------------- +Name +OCIXmlDbInitXmlCtx +Purpose +To get a xmlctx structure initialized with error-handler and XDB callbacks. +Syntax +struct xmlctx *OCIXmlDbInitXmlCtx (OCIEnv *envhp, + OCISvcCtx *svchp, + OCIError *err, + params_ocixmldb *params, + int num_params); +Parameters +envhp (IN) - The OCI environment handle +svchp (IN) - The OCI service handle +errhp (IN) - The OCI error handle +params (IN)- This contains the following optional parameters : + (a) OCIDuration dur (IN - The OCI Duration (Default: OCI_DURATION_SESSION) + (b) void (*err_handler) (sword, (const oratext *) (IN) - + Pointer to the error handling function (Default: null) +num_params (IN) - Number of parameters to be read from parameter params. + If the value of num_params exceeds the size of array + "params", unexpected behavior will result. + +Returns +A pointer to xmlctx structure, with xdb context, error handler and callbacks +populated with appropriate values. This is later used for all API calls. NULL +if no database connection available. + +-----------------------------OCIXmlDbFreeXmlCtx---------------------------- +Name +OCIXmlDbFreeXmlCtx +Pupose +To free any allocations done during OCIXmlDbInitXmlCtx. +Syntax +void OCIXmlDbFreeXmlCtx (struct xmlctx *xctx) +Parameters +xctx (IN) - The xmlctx to terminate +Returns +- +------------------------OCIXmlDbOrastreamFromLob--------------------------- +Name +OCIXmlDbOrastreamFromLob +Pupose +To create an orastream from a lob. This orastream can be used by functions like XMLLoadDom(). +Syntax +sword OCIXmlDbOrastreamFromLob(OCIError *errhp, xmlctx *xctx, + void **stream, OCILobLocator *lobloc) +Parameters +envhp (IN) - The OCI environment handle +xctx (IN) - XML context +stream (IN/OUT) - A pointer to orastream +lobloc (IN) - The OCI lob locator +Returns +The orastream created on top of the lob is returned in the parameter 'stream'. +******************************************************************************/ + +struct xmlctx *OCIXmlDbInitXmlCtx(OCIEnv *, OCISvcCtx *, OCIError *, + ocixmldbparam *, int); + +void OCIXmlDbFreeXmlCtx(struct xmlctx *xctx); +sword OCIXmlDbStreamFromXMLType(OCIError *errhp, void **stream, + OCIXMLType *doc, ub4 mode); +sword OCIXmlDbOrastreamFromLob(OCIError *errhp, xmlctx *xctx, + void **stream, OCILobLocator *lobloc); +sword OCIXmlDbStreamRead(OCIError *errhp, void *stream, + void *bufp, sb8 *len, ub4 mode); +sword OCIXmlDbStreamClose(OCIError *errhp, void *stream); + +/*--------------------------------------------------------------------------- + INTERNAL FUNCTIONS + ---------------------------------------------------------------------------*/ +/* This function is for internal usage only */ +sword OCIXmlDbRewriteXMLDiff(OCIEnv *envhp, OCIError *errhp, OCISvcCtx *svchp, + xmldrctx *xctx , oratext* colname, ub4 colnamelen, + const void* xmldiff, ub4 xmldifflen, + OCILobLocator *xdiff_locator, oratext** updstmt, + ub2 binditerator, ub2 *colvalbndcount, + OCIXmlDiffBnd **bindlist); + +struct xmldrctx *OCIXmlInitDRCtx(OCIEnv *env, OCISvcCtx *svc, OCIError *err, + ub1 bindtyp); + +void OCIXmlFreeDRCtx(xmldrctx *xctx); + +sword OCIXmlDbGetFullyQualifiedSchemaUrl(OCIError *errhp, + oratext *schema_url, + ub2 schema_url_len, + oratext *schema_owner, + ub2 schema_owner_len, + oratext **fq_schema_url, + ub4 *fs_schema_url_len); + +void *OCIXmlDbMemCallback(void *ctx, size_t size); + +#endif /* OCIXMLDB_ORACLE */ diff --git a/sdk/include/ocixstream.h b/sdk/include/ocixstream.h new file mode 100755 index 0000000..9a25ed7 --- /dev/null +++ b/sdk/include/ocixstream.h @@ -0,0 +1,2116 @@ +/* Copyright (c) 2006, 2013, Oracle and/or its affiliates. +All rights reserved. */ + +/* + NAME + ocixstream.h - OCI XStream APIs + + DESCRIPTION + OCI APIs for XStream + + RELATED DOCUMENTS + + EXPORT FUNCTION(S) + + INTERNAL FUNCTION(S) + + EXAMPLES + + NOTES + + MODIFIED (MM/DD/YY) + fergutie 01/30/13 - Backport fergutie_bug-14496414 from main + thoang 02/15/12 - Backport thoang_bug-13444033 from main + huntran 09/02/12 - Backport huntran_bug-13471035 from + huntran 05/09/12 - Backport huntran_bug-13042334 from main + apfwkr 02/13/12 - Backport vchandar_bug-13058458 from main + elu 06/06/11 - Backport elu_bug-12592488 from main + bpwang 04/14/11 - Backport bpwang_bug-11815316 from main + elu 04/12/11 - xmlschema + elu 03/28/11 - xmlschema + tianli 03/21/11 - Backport tianli_bug-11875662 from main + thoang 12/04/11 - Add OCI_ROWLCR_IS_INFLIGHT_TXN + elu 05/25/11 - remove xml schema + thoang 03/10/10 - Add OCIXSTREAM_IN_ATTACH_RESTART_INBOUND mode + thoang 12/28/09 - Update comments + elu 01/07/10 - stmt lcr + thoang 12/15/09 - Remove non-oracle src mode + thoang 12/09/09 - Add note to OCIXStreamInErrorGet + thoang 12/04/09 - Remove ProcessedLWMGet2/Set2 + rmao 11/20/09 - add OCI_ROWLCR_SEQ_LCR + thoang 10/20/09 - Add rollback and start_tx cmd. + bpwang 10/09/09 - Add OCI_ROWLCR_HAS_ID_KEY_ONLY + elu 10/05/09 - add stmt LCR + rihuang 10/06/09 - Add OCIXSTREAM_IN_FLUSH_WAIT_FOR_COMPLETE + thoang 05/08/09 - Add OCILCR_NEW_ONLY_MODE + praghuna 05/11/09 - removed 'TODO' comments + thoang 02/15/09 - Change lob_column_* to chunk_column_* + thoang 01/27/09 - 8216105 - add OLD/NEW column parms to OCILCRHeaderGet + rihuang 01/05/09 - Add OCI_LCR_ATTR_TRACKING_LABEL + tianli 11/28/08 - add DDL flags + tianli 11/20/08 - add OCILCRAttribute methods + thoang 11/20/08 - Define OCI_LCR_MAX_TXID_LEN + tianli 11/07/08 - add edition + thoang 11/10/08 - change return type to sword for consistency + thoang 10/16/08 - remove commit position arg + tianli 08/26/08 - rename client_name in XStreamIn attach call + thoang 06/30/08 - Support XStream APIs using two callbacks. + praghuna 05/14/08 - charset id is ub2, OCILcrGetRowStmtWithBindVar + thoang 06/02/08 - Define reserved attach mode for internal clients + elu 05/08/08 - add pos functions + thoang 04/29/08 - API changes + jinwu 04/28/08 - add OCILcrGetExtraAttributes + elu 04/14/08 - add OCI_LCR_MAX_POSITION_LEN + juyuan 03/27/08 - add flag for Set/GetHeader and Set/GetColumnInfo + thoang 02/25/08 - Add GetNextChunk and SetNextChunk + rihuang 03/24/08 - Signature change for OCILcrNew + elu 03/05/08 - add lcr id + praghuna 02/26/08 - Added OCILcrGetRowStmt + thoang 01/25/08 - Add wm_time parameter to XApply APIs + thoang 12/28/07 - Add mode parameter to XApplyDetach + thoang 11/07/07 - Change extapp apis to return ub1[] watermark + juyuan 05/23/07 - XStream In + thoang 11/13/06 - Add XStream Out methods + thoang 11/13/06 - Add LCR getter methods + nshodhan 05/12/06 - xstream OCI APIs + nshodhan 05/12/06 - Creation + +*/ + +#ifndef OCIXSTREAM_ORACLE +# define OCIXSTREAM_ORACLE + +#ifndef ORATYPES +# include +#endif + +#ifndef OCI_ORACLE +# include +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/*--------------------------------------------------------------------------- + PUBLIC TYPES AND CONSTANTS + ---------------------------------------------------------------------------*/ +/* LCR Types -- must match with values defined in kngo.h */ +#define OCI_LCR_XROW (3) /* External Row LCR */ +#define OCI_LCR_XDDL (4) /* External DDL LCR */ + +/* DML Command Types -- must match with values defined in kngl.h */ +#define OCI_LCR_ROW_CMD_INSERT "INSERT" +#define OCI_LCR_ROW_CMD_DELETE "DELETE" +#define OCI_LCR_ROW_CMD_UPDATE "UPDATE" +#define OCI_LCR_ROW_CMD_COMMIT "COMMIT" +#define OCI_LCR_ROW_CMD_LOB_WRITE "LOB WRITE" +#define OCI_LCR_ROW_CMD_LOB_TRIM "LOB TRIM" +#define OCI_LCR_ROW_CMD_LOB_ERASE "LOB ERASE" +#define OCI_LCR_ROW_CMD_ROLLBACK "ROLLBACK" +#define OCI_LCR_ROW_CMD_START_TX "START_TX" /* start transaction */ +#define OCI_LCR_ROW_CMD_CTRL_INFO "CONTROL INFO" /* contorl lcr */ + +/* LCR Extra Attribute Name -- must match with values defined in knll.h */ +#define OCI_LCR_ATTR_THREAD_NO "THREAD#" +#define OCI_LCR_ATTR_ROW_ID "ROW_ID" +#define OCI_LCR_ATTR_SESSION_NO "SESSION#" +#define OCI_LCR_ATTR_SERIAL_NO "SERIAL#" +#define OCI_LCR_ATTR_USERNAME "USERNAME" +#define OCI_LCR_ATTR_TX_NAME "TX_NAME" + +/* below are non first class LCR field specific */ +#define OCI_LCR_ATTR_EDITION_NAME "EDITION_NAME" +#define OCI_LCR_ATTR_MESSAGE_TRACKING_LABEL "MESSAGE_TRACKING_LABEL" +#define OCI_LCR_ATTR_CURRENT_USER "CURRENT_USER" +#define OCI_LCR_ATTR_OLD_OWNER "OLD_OWNER" +#define OCI_LCR_ATTR_OLD_ONAME "OLD_ONAME" + +/* Row LCR column value types used in OCILCRRowColumnInfoGet/Set functions. */ +#define OCI_LCR_ROW_COLVAL_OLD 0 /* OLD columns */ +#define OCI_LCR_ROW_COLVAL_NEW 1 /* NEW columns */ + +/* maximum length for position + * NOTE: This MUST be consistent with DefaultRowLCRCache.MaxLowWaterMarkLength + * in DefaultRowLCRCache.java + */ +#define OCI_LCR_MAX_POSITION_LEN 64 + +/* maximum length for txid */ +#define OCI_LCR_MAX_TXID_LEN 128 + +/* Valid column flags used in OCILCRRowColumnInfoSet, OCILCRRowColumnInfoGet, + * OCILCRLobInfoSet, OCILCRLobInfoGet, OCIXStreamOutChunkReceive, + * OCIXStreamInChunkSend calls. + * NOTE: last byte reserved for private OCIP_LCR flags. + */ +#define OCI_LCR_COLUMN_LOB_DATA (0x00000001) /* col contains lob data */ +#define OCI_LCR_COLUMN_LONG_DATA (0x00000002) /* col contains long data*/ +#define OCI_LCR_COLUMN_EMPTY_LOB (0x00000004) /* col has an empty lob */ +#define OCI_LCR_COLUMN_LAST_CHUNK (0x00000008) /* last chunk of current col*/ +#define OCI_LCR_COLUMN_AL16UTF16 (0x00000010) /* col is in AL16UTF16 fmt */ +#define OCI_LCR_COLUMN_NCLOB (0x00000020) /* col has NCLOB data */ +#define OCI_LCR_COLUMN_XML_DATA (0x00000040) /* col contains xml data */ +#define OCI_LCR_COLUMN_XML_DIFF (0x00000080)/* col contains xmldiff data */ +#define OCI_LCR_COLUMN_ENCRYPTED (0x00000100) /* col is encrypted */ + +/* OCI_LCR_COLUMN_UPDATED is set only for the modified columns in the NEW + * column list of an update LCR. + */ +#define OCI_LCR_COLUMN_UPDATED (0x00000200) /* col is updated */ + +/* Valid bit values for the flag parameter in the following APIS: + * - OCILCRHeaderGet + * - OCILCRHeaderSet + */ +#define OCI_ROWLCR_HAS_ID_KEY_ONLY (0x00000001) /* only has ID key cols */ + /* (0x00000002) is RESERVED */ + /* (0x00000004) is RESERVED */ + /* (0x00000008) is RESERVED */ +#define OCI_ROWLCR_SEQ_LCR (0x00000010) /* sequence lcr */ + +/* LCR belongs to an inflight transaction, i.e., transaction was started + * before the outbound server's starting position. + */ +#define OCI_ROWLCR_IS_INFLIGHT_TXN (0x00000020) + +/* Valid bit values for flag parameter in the following APIs: + * - OCIXStreamOutChunkReceive & OCIXStreamOutLCRReceive + * - OCIXStreamInChunkSend & OCIXStreamInLCRSend + */ +#define OCI_XSTREAM_MORE_ROW_DATA (0x00000001) /* LCR contains more data */ + +/* Valid mode flag for OCILCRHeaderGet and OCILCRRowColumnInfoGet functions */ +#define OCILCR_NEW_ONLY_MODE (0x0001) /* NEW columns only -- dont */ + /* include OLD columns */ + +/* Valid mode flag for OCIXStreamInFlush */ + /* Synchronous mode for OCIXStreamInFlush */ +#define OCIXSTREAM_IN_FLUSH_WAIT_FOR_COMPLETE (0x00000001) + +/* SessionSet attributes */ +#define OCIXSTREAM_SESSION_SET_MAX_PARAM_LEN 128 +#define OCIXSTREAM_ATTR_ATTACH_TIMEOUT "ATTACH_TIMEOUT_SECS" +#define OCIXSTREAM_ATTR_MAX_ATTACH_RETRIES "MAX_ATTACH_RETRIES" + +/*--------------------------------------------------------------------------- + PRIVATE TYPES AND CONSTANTS + ---------------------------------------------------------------------------*/ + + +/*--------------------------------------------------------------------------- + EXPORT FUNCTIONS + ---------------------------------------------------------------------------*/ +/* +------------------------------------------------------------------------------= +NAME + OCILCRNew - OCI LCR NEW +DESCRIPTION + Create a new XStream LCR for the user specified duration and type +PARAMETERS + svchp (IN) - OCI service context + errhp (IN) - OCI Error Handle + duration (IN) - allocation duration for LCR memory + lcrtype (IN) - LCR type (OCI_LCR_XROW / OCI_LCR_XDDL) + lcrp (IN/OUT) - XStream LCR. (*lcrp must be initialized to null.) + mode (IN) - mode +NOTES + - memory will be based on the duration specified by the user + - For now, specify OCI_DEFAULT for mode +------------------------------------------------------------------------------= +*/ +sword OCILCRNew(OCISvcCtx *svchp, + OCIError *errhp, + OCIDuration duration, + ub1 lcrtype, + void **lcrp, + ub4 mode); + +/* +------------------------------------------------------------------------------= +NAME + OCILCRFree - OCI LCR FREE +DESCRIPTION + Free XStream LCR specified by the user +PARAMETERS + svchp (IN) - OCI service context + errhp (IN) - OCI Error Handle + lcrp (IN/OUT) - XStream LCR + mode (IN) - mode +NOTES + - For now, specify OCI_DEFAULT for mode +------------------------------------------------------------------------------= +*/ +sword OCILCRFree(OCISvcCtx *svchp, + OCIError *errhp, + void *lcrp, + ub4 mode); + + +/* +------------------------------------------------------------------------------= +NAME + OCILCRHeaderSet - OCI LCR Set Header +DESCRIPTION + Initialize elements of XStream LCR's header +PARAMETERS + svchp (IN) - OCI service context + errhp (IN) - OCI Error Handle + src_db_name (IN) - Pointer to Canonicalized source database name. + Must be non-NULL. + src_db_name_len (IN) - Length of source database name in bytes + excluding NULL terminator. Should follow Oracle + naming conventions and size limitations. + cmd_type (IN) - For ROW LCRs: OCI_LCR_ROW_CMD_XXXXXXX + For DDL LCRs: One of the command types + corresponding to OCI Reference manual + cmd_type_len (IN) - Length of cmd_type. + owner (IN) - Canonicalized table owner name. Not required + for COMMIT LCR. + owner_len (IN) - Length of owner name in bytes excluding the + NULL terminator. Should follow Oracle naming + conventions and size limitations. + oname (IN) - Canonicalized table name. Not required for + COMIT LCR. + oname_len (IN) - Length of table name in bytes excluding the + NULL terminator. Should follow Oracle naming + conventions and size limitations. + tag (IN) - A binary tag that enables tracking of the LCR. + For example, this tag can be used to determine + the original source database of the DML + statement if apply forwarding is used. + tag_len (IN) - Number of bytes in the tag. Cannot exceed 2000 + bytes + txid (IN) - Transaction ID. + txid_len (IN) - Length of transaction id in bytes excluding the + NULL terminator. Should not exceeed + OCI_LCR_MAX_TXID_LEN bytes. + src_time (IN) - The time when the change was generated at the + source database. + position (IN) - position for LCR. Must be byte-comparable. + position_len (IN) - Length of position. Must be non-zero. + flag (IN) - LCR flag. + lcrp (IN/OUT) - XStream LCR + mode (IN) - mode +NOTES + - For now, specify OCI_DEFAULT for mode + - This function clears the current contents of the input LCR before + setting the header to the new values. +------------------------------------------------------------------------------= +*/ +sword OCILCRHeaderSet(OCISvcCtx *svchp, + OCIError *errhp, + oratext *src_db_name, + ub2 src_db_name_len, + oratext *cmd_type, + ub2 cmd_type_len, + oratext *owner, + ub2 owner_len, + oratext *oname, + ub2 oname_len, + ub1 *tag, + ub2 tag_len, + oratext *txid, + ub2 txid_len, + OCIDate *src_time, + ub1 *position, + ub2 position_len, + oraub8 flag, + void *lcrp, + ub4 mode); + +/* +------------------------------------------------------------------------------= +NAME + OCILCRHeaderGet - OCI LCR Get Header +DESCRIPTION + Get header information from XStream LCR +PARAMETERS + svchp (IN) - OCI service context + errhp (IN) - OCI Error Handle + src_db_name (OUT) - Pointer to Canonicalized source database name. + Optional, if src_db_name is specified then + must specify src_db_name_len as well. + src_db_name_len (OUT) - Length of source database name in bytes + excluding NULL terminator. + Optional, if specified src_db_name_len then + must specify src_db_name as well. + cmd_type (OUT) - Command type. Must be non-null if + cmd_type_len is non-null. Must be null if + cmd_type_len is NULL. + cmd_type_len (OUT) - Length of cmd_type. Optional. + owner (OUT) - Canonicalized table owner name. + Optional, if owner is specified then + must specify owner_len as well. + owner_len (OUT) - Length of owner name in bytes excluding the + NULL terminator. + Optional, if owner_len is specified then + must specify owner as well. + oname (OUT) - Canonicalized table name. + Optional, if oname is specified then + must specify oname_len as well. + oname_len (OUT) - Length of table name in bytes excluding the + NULL terminator. + Optional, if oname_len is specified then + must specify oname as well. + tag (OUT) - A binary tag that enables tracking of the LCR. + For example, this tag can be used to determine + the original source database of the + DML statement if apply forwarding is used. + Optional, if tag is specified then + must specify tag_len as well. + tag_len (OUT) - Number of bytes in the tag. + Optional, if tag_len is specified then + must specify tag as well. + txid (OUT) - Transaction ID. + Optional, if txid is specified then + must specify txid_len as well. + txid_len (OUT) - Length of transaction id in bytes excluding + the NULL terminator. + Optional, if txid_len is specified then + must specify txid as well. + src_time (OUT) - The time when the change was generated at the + source database. Optional. + old_columns (OUT) - Number of columns in the OLD column list. + Return 0 if input lcr is DDL LCR. Optional. + new_columns (OUT) - Number of columns present in either + the OLD or NEW column list. + Return 0 if input lcr is DDL LCR. Optional. + See NOTES below for the special mode supported + by this function. + position (OUT) - LCR position. Optional. + position_len (OUT) - Length of position. Must be non-null if + position is non-null. Must be null if + position is null. + flag (OUT) - LCR flag. Optional. + lcrp (IN) - XStream LCR + mode (IN) - mode (see NOTES) +NOTES + - Parameter src_time is optional. If specified the appropriate return + structure must be pre-allocated before calling OCILCRHeaderGet. + - The return values for src_db_name, cmd_type, owner, oname, tag, txid and + position are shallow-copied (i.e., they point directly into the LCR + structure). + - Valid mode flags: + - OCILCR_NEW_ONLY_MODE: if this mode is specified then the new_columns + returned is the count of the columns in the NEW column list only. + Otherwise, the new_columns returned is the number of distinct + columns present in either the NEW or the OLD column list of the given + ROW LCR. +------------------------------------------------------------------------------= +*/ + +sword OCILCRHeaderGet(OCISvcCtx *svchp, + OCIError *errhp, + oratext **src_db_name, + ub2 *src_db_name_len, + oratext **cmd_type, + ub2 *cmd_type_len, + oratext **owner, + ub2 *owner_len, + oratext **oname, + ub2 *oname_len, + ub1 **tag, + ub2 *tag_len, + oratext **txid, + ub2 *txid_len, + OCIDate *src_time, + ub2 *old_columns, + ub2 *new_columns, + ub1 **position, + ub2 *position_len, + oraub8 *flag, + void *lcrp, + ub4 mode); + +/* +------------------------------------------------------------------------------= +NAME + OCILCRRowColumnInfoSet - OCI LCR ROW SET COLUMN INFO +DESCRIPTION + Populates column information as specified by the user. +PARAMETERS + svchp (IN) - OCI service context + errhp (IN) - OCI Error Handle + column_value_type (IN) - ROW LCR column value type: + - OCI_LCR_ROW_COLVAL_OLD + - OCI_LCR_ROW_COLVAL_NEW + num_columns (IN) - Number of columns to be populated + column_names (IN) - Pointer to an array of column names. Column + names must be canonicalized. Column names should + follow Oracle naming conventions + column_name_lens (IN) - Pointer to an array of column name lengths + in bytes, excluding the NULL terminator. + column_dtyp (IN) - Pointer to an array of column datatypes. + column_valuesp (IN) - Pointer to an array of column data values. + column_indp (IN) - Pointer to an indicator array. For all datatypes, + this is a pointer to an array of OCIInd values + (OCI_IND_NULL/OCI_IND_NOTNULL). + column_alensp (IN) - Pointer to an array of actual column lengths in + bytes. + column_csetfp (IN) - Pointer to an array of character set forms for + the columns. The default form is SQLCS_IMPLICIT. + Setting this attribute will cause the database or + national character set to be used on the client + side. Set this attribute to SQLCS_NCHAR for the + national character set or SQLCS_IMPLICIT for the + database character set. + Pass 0 for non-character columns. + column_flags (IN) - Pointer to an array of column flags. + Possible bit values are OCI_LCR_COLUMN_* flags + listed above. + column_csid (IN) - Pointer to an array of column character set id. + The character set id is only required for + XMLType column; otherwise, the csid is ignored. + row_lcrp (IN/OUT)- XStream Row LCR pointer + mode (IN) - mode +NOTES + - For now, specify OCI_DEFAULT for mode +------------------------------------------------------------------------------= +*/ +sword OCILCRRowColumnInfoSet(OCISvcCtx *svchp, + OCIError *errhp, + ub2 column_value_type, + ub2 num_columns, + oratext **column_names, + ub2 *column_name_lens, + ub2 *column_dtyp, + void **column_valuesp, + OCIInd *column_indp, + ub2 *column_alensp, + ub1 *column_csetfp, + oraub8 *column_flags, + ub2 *column_csid, + void *row_lcrp, + ub4 mode); + +/* +------------------------------------------------------------------------------= +NAME + OCILCRRowColumnInfoGet - OCI LCR ROW GET COLUMN INFO +DESCRIPTION + Returns column information as requested by the user. +PARAMETERS + svchp (IN) - OCI service context + errhp (IN) - OCI Error Handle + column_value_type (IN) - ROW LCR column value type: + - OCI_LCR_ROW_COLVAL_OLD + - OCI_LCR_ROW_COLVAL_NEW + (See NOTES for special mode supported by this + function.) + num_columns (OUT) - Number of columns in requested column list + column_names (IN/OUT)- Pointer to an array of column names. + Optional. If specified then column_namesl must + be specified as well, and both arrays must be the + size specified by array_size parameter. + column_name_lens (IN/OUT)- Pointer to an array of column name lengths + in bytes, excluding the NULL terminator. + Optional. If specified then column_names must + be specified as well, and both arrays must be the + size specified by array_size parameter. + column_dtyp (IN/OUT)- Pointer to an array of column datatypes. + Optional. If specified then this array must be + the size specified by array_size parameter. + column_valuesp (IN/OUT)- Pointer to an array of column data values. + Optional. If specified then this array must be + the size specified by array_size parameter. + column_indp (IN/OUT)- Pointer to an indicator array. For all datatypes, + this is a pointer to an array of OCIInd values + (OCI_IND_NULL/OCI_IND_NOTNULL). + Optional. If specified then this array must be + the size specified by array_size parameter. + column_alensp (IN/OUT)- Pointer to an array of actual column lengths in + bytes. + Optional. If specified then this array must be + the size specified by array_size parameter. + column_csetfp (IN/OUT)- Pointer to an array of character set forms for + the columns. + Optional. If specified then this array must be + the size specified by array_size parameter. + column_flags (IN/OUT)- Pointer to an array of column flags for + the columns. + Optional. If specified then this array must be + the size specified by array_size parameter. + Possible bit values are OCI_LCR_COLUMN_* flags + listed above. + column_csid (IN/OUT)- Pointer to an array of column character set id for + the columns. + Optional. If specified then this array must be + the size specified by array_size parameter. + The column csid is returned only for XMLType + column. + row_lcrp (IN) - XStream Row LCR pointer + array_size (IN) - Size of each of above arrays + mode (IN) - mode (see NOTES) +NOTES + - For now, specify OCI_DEFAULT for mode + - If array_size is not large enough to accommodate the number of columns + in the requested column list then OCI_ERROR is returned. Parameter + num_columns will have the number of columns in the requested column list. + - The return values for column_names and column_valuesp will be shallow + copied (i.e., they reference directly into the LCR structure). + Client should not modify those pointers directly. + - Valid mode flags: + - OCILCR_NEW_ONLY_MODE: this mode is valid only for OCI_LCR_ROW_COLVAL_NEW + column_value_type; otherwise, an error is raised. + If this mode is specified then the columns returned include only the + columns in the NEW column list. + If this mode is not specified then the columns returned is the union + of the NEW columns plus the OLD columns that are not present in the + NEW column list. +------------------------------------------------------------------------------= +*/ +sword OCILCRRowColumnInfoGet(OCISvcCtx *svchp, + OCIError *errhp, + ub2 column_value_type, + ub2 *num_columns, + oratext **column_names, + ub2 *column_name_lens, + ub2 *column_dtyp, + void **column_valuesp, + OCIInd *column_indp, + ub2 *column_alensp, + ub1 *column_csetfp, + oraub8 *column_flags, + ub2 *column_csid, + void *row_lcrp, + ub2 array_size, + ub4 mode); + + +/* +------------------------------------------------------------------------------= +NAME + OCILCRDDLInfoSet - OCI LCR SET DDL INFO +DESCRIPTION + populates DDL information as sepcified by the user. +PARAMETERS + svchp (IN) - OCI service context + errhp (IN) - OCI Error Handle + object_type (IN) - The type of object on which the DDL statement was + executed. The following are valid object types: + CLUSTER, FUNCTION, INDEX, LINK, OUTLINE, + PACKAGE, PACKAGE BODY, PROCEDURE, SEQUENCE, + SYNONYM, TABLE, TRIGGER, TYPE, USER, VIEW + LINK represents a database link. + NULL is also a valid object type. Specify NULL + for all object types not listed. + object_type_len (IN) - Length of object_type without the NULL terminator. + ddl_text (IN) - The text of the DDL statement. This parameter + should be set to a non-NULL value. + DDL text must be in Oracle DDL format. + ddl_text_len (IN) - DDL text length in bytes without NULL terminator. + logon_user (IN) - Canonicalized name of the user whose session + executed the DDL statement. Should follow Oracle + naming conventions and size limitations. + logon_user_len (IN) - logon user name length in bytes without NULL + terminator. + current_schema (IN) - The canonicalized schema name that is used if no + schema is specified explicitly for the modified + database objects in ddl_text. If a schema is + specified in ddl_text that differs from the one + specified for current_schema, then the schema + specified in ddl_text will be used. + This parameter should be set to a non-NULL value. + Should follow Oracle naming conventions and size + limitations. + current_schema_len (IN) - schema name length in bytes without NULL terminator + base_table_owner (IN) - If the DDL statement is a table related DDL + (such as CREATE TABLE and ALTER TABLE), or if the + DDL statement involves a table (such as creating + a trigger on a table), then base_table_owner + specifies the canonicalized owner of the table + involved. Otherwise, base_table_owner is NULL. + Should follow Oracle naming conventions and size + limitations. + base_table_owner_len (IN)- base table owner name length in bytes without NULL + terminator. + base_table_name (IN) - If the DDL statement is a table related DDL (such + as CREATE TABLE and ALTER TABLE), or if the DDL + statement involves a table (such as creating a + trigger on a table), then base_table_name + specifies the canonicalized name of the table + involved. Otherwise, base_table_name is NULL. + Length of the above string without the NULL + terminator. Should follow Oracle naming + conventions and size limitations. + Should follow Oracle naming conventions and size + limitations. + base_table_name_len (IN)- base table name length in bytes without NULL + terminator. + flag (IN) - DDL LCR flag. + ddl_lcrp (IN/OUT) - XStream Ddl LCR pointer + mode (IN) - mode +NOTES + - For now, specify OCI_DEFAULT for mode +------------------------------------------------------------------------------= +*/ +sword OCILCRDDLInfoSet(OCISvcCtx *svchp, + OCIError *errhp, + oratext *object_type, + ub2 object_type_len, + oratext *ddl_text, + ub4 ddl_text_len, + oratext *logon_user, + ub2 logon_user_len, + oratext *current_schema, + ub2 current_schema_len, + oratext *base_table_owner, + ub2 base_table_owner_len, + oratext *base_table_name, + ub2 base_table_name_len, + oraub8 flag, + void *ddl_lcrp, + ub4 mode); + +/* +------------------------------------------------------------------------------= +NAME + OCILCRDDLInfoGet - OCI LCR GET DDL INFO +DESCRIPTION + Returns DDL information from specified lcr. +PARAMETERS + svchp (IN) - OCI service context + errhp (IN) - OCI Error Handle + object_type (OUT) - The type of object on which the DDL statement + was executed. + Optional, if object_type is specified then + must specify object_type_len as well. + object_type_len (OUT) - Length of object_type without the NULL + terminator. + ddl_text (OUT) - The text of the DDL statement. + Optional, if ddl_text is specified then + must specify ddl_text_len as well. + ddl_text_len (OUT) - DDL text length in bytes without NULL + terminator. + logon_user (OUT) - Canonicalized name of the user whose session + executed the DDL statement. + Optional, if logon_user is specified then + must specify logon_user_len as well. + logon_user_len (OUT) - logon user name length in bytes without NULL + terminator. + current_schema (OUT) - The canonicalized schema name that is used if + no schema is specified explicitly for the + modified database objects in ddl_text. + Optional, if current_schema is specified then + must specify current_schema_len as well. + current_schema_len (OUT)- schema name length in bytes without NULL + terminator + base_table_owner (OUT) - If the DDL statement is a table related DDL + (such as CREATE TABLE and ALTER TABLE), or if + the DDL statement involves a table (such as + creating a trigger on a table), then + base_table_owner specifies the canonicalized + owner of the table involved. Otherwise, + base_table_owner is NULL. Optional, if + base_table_owner is specified then must specify + base_table_owner_len as well. + base_table_owner_len (OUT) - base table owner name length in bytes without + NULL terminator. + base_table_name (OUT) - If the DDL statement is a table related DDL + (such as CREATE TABLE and ALTER TABLE), or if + the DDL statement involves a table (such as + creating a trigger on a table), then + base_table_name specifies the canonicalized name + of the table involved. Otherwise, + base_table_name is NULL. Optional, if + base_table_name is specified then must specify + base_table_name_len as well. + base_table_name_len (OUT) - base table name length in bytes without NULL + terminator. + flag (OUT) - DDL LCR flag. Optional, data not returned if + NULL. + ddl_lcrp (IN) - XStream DDL LCR pointer + mode (IN) - mode (for future extention - not used currently) +RETURNS + OCI_SUCCESS or OCI_ERROR. +NOTES + - For now, specify OCI_DEFAULT for mode +------------------------------------------------------------------------------= +*/ +sword OCILCRDDLInfoGet(OCISvcCtx *svchp, + OCIError *errhp, + oratext **object_type, + ub2 *object_type_len, + oratext **ddl_text, + ub4 *ddl_text_len, + oratext **logon_user, + ub2 *logon_user_len, + oratext **current_schema, + ub2 *current_schema_len, + oratext **base_table_owner, + ub2 *base_table_owner_len, + oratext **base_table_name, + ub2 *base_table_name_len, + oraub8 *flag, + void *ddl_lcrp, + ub4 mode); + +/* +------------------------------------------------------------------------------= +NAME + OCILCRAttributesSet - OCI LCR SET ATTRIBUTES +DESCRIPTION + populates extra attribute information in ROW/DDL LCR, as well as any + non first class attributes that can not be set through + OCILCRHeaderSet, OCILCRDDLInfoSet, or OCILCRRowColumnInfoSet. + e.g. edition name +PARAMETERS + svchp (IN) - OCI service context + errhp (IN) - OCI Error Handle + num_attrs (IN) - Number of extra attributes to be populated + attr_names (IN) - Pointer to an array of attribute names. Attribute + names must be canonicalized and should follow + Oracle naming conventions + attr_names_lens (IN) - Pointer to an array of attribute name lengths + in bytes, excluding the NULL terminator. + attr_dtyp (IN) - Pointer to an array of attribute datatypes. + attr_valuesp (IN) - Pointer to an array of attribute data values. + attr_indp (IN) - Pointer to an indicator array. For all datatypes, + this is a pointer to an array of OCIInd values + (OCI_IND_NULL/OCI_IND_NOTNULL). + attr_alensp (IN) - Pointer to an array of actual attribute lengths in + bytes. + lcrp (IN/OUT)- XStream (Row/DDL) LCR pointer + mode (IN) - mode +NOTES + - For now, specify OCI_DEFAULT for mode +------------------------------------------------------------------------------= +*/ +sword OCILCRAttributesSet(OCISvcCtx *svchp, + OCIError *errhp, + ub2 num_attrs, + oratext **attr_names, + ub2 *attr_name_lens, + ub2 *attr_dtyp, + void **attr_valuesp, + OCIInd *attr_indp, + ub2 *attr_alensp, + void *lcrp, + ub4 mode); + +/* +------------------------------------------------------------------------------= +NAME + OCILCRAttributesGet - OCI LCR GET EXTRA ATTRIBUTES +DESCRIPTION + Gets extra attribute information in (ROW/DDL) LCR, as well as any + non first class attributes that are not populated through + OCILCRHeaderGet, OCILCRDDLInfoGet, or OCILCRRowColumnInfoGet + e.g. edition name +PARAMETERS + svchp (IN) - OCI service context + errhp (IN) - OCI Error Handle + num_attrs (OUT) - Number of extra attributes to be populated + attr_names (IN/OUT)- Pointer to an array of attribute names. Attribute + names must be canonicalized and should follow + Oracle naming conventions + attr_namesl (IN/OUT)- Pointer to an array of attribute name lengths + in bytes, excluding the NULL terminator. + attr_dtyp (IN/OUT)- Pointer to an array of attribute datatypes. + attr_valuesp (IN/OUT)- Pointer to an array of attribute data values. + attr_indp (IN/OUT)- Pointer to an indicator array. For all datatypes, + this is a pointer to an array of OCIInd values + (OCI_IND_NULL/OCI_IND_NOTNULL). + attr_alensp (IN/OUT)- Pointer to an array of actual attribute lengths in + bytes. + lcrp (IN) - XStream (Row/DDL) LCR pointer + array_size (IN) - Size of each of above arrays, use at least the size + defined by OCI_LCR_MAX_ATTRIBUTES + mode (IN) - mode +NOTES + - For now, specify OCI_DEFAULT for mode + - If array_size is not large enough to accommodate the number of attributes + in the requested attribute list then OCI_ERROR is returned. Parameter + num_attrs will return the suggested size. +------------------------------------------------------------------------------= +*/ +sword OCILCRAttributesGet(OCISvcCtx *svchp, + OCIError *errhp, + ub2 *num_attrs, + oratext **attr_names, + ub2 *attr_namesl, + ub2 *attr_dtyp, + void **attr_valuesp, + OCIInd *attr_indp, + ub2 *attr_alensp, + void *lcrp, + ub2 array_size, + ub4 mode); + +/*--------------------- OCILCRWhereClauseGet ----------------------------*/ +/* + NAME + OCILCRWhereClauseGet - OCI Get Where Clause + DESCRIPTION + Gets the Where clause statement for the given ROW LCR. + PARAMETERS + svchp (IN/OUT) - OCI service handle + errhp (IN/OUT) - Error Handle to which errors + should be reported + wc_stmt (OUT) - Sql Statement equivalent to the + LCR has applied + wc_stmt_len (IN/OUT) - length of wc_stmt buffer + row_lcrp (IN) - row LCR to be converted to SQL + mode (IN) - Mode flags (For future extension. + Not used currently) + RETURNS + OCI_SUCCESS or OCI_ERROR. + NOTES + - For now, specify OCI_DEFAULT for mode + - WHERE clause generated for INSERT lcr will have all the columns that + are being inserted. This WHERE clause could be used to identify the + inserted row after inserting. (like "returning ROWID"). + INSERT INTO TAB(COL1) VALUES (10) -> WHERE COL1=10 + - WHERE clause generated for UPDATE will have all the columns in the + old column list. However the values of the columns will be that of + new value if it exist in the new column list + of the UPDATE. If the column doesnt have new value then the old column + value will be used. + UPDATE TAB SET COL1 = 10 WHERE COL1 = 20 -> WHERE COL1 = 10 + UPDATE TAB SET COL2 = 20 WHERE COL1 = 20 -> WHERE COL1 = 20 + - WHERE clause for DELETE will use the columns and values from + old column lst + - LOB piecewise operations would use the new columns and values for + generating the WHERE clause. +*/ + +sword OCILCRWhereClauseGet( + OCISvcCtx *svchp, + OCIError *errhp, + oratext *wc_stmt, + ub4 *wc_stmt_len, + void *row_lcrp, + ub4 mode); + +/*--------------------- OCILCRRowStmtGet ----------------------------*/ +/* + NAME + OCILCRRowStmtGet - OCI Get Row Statement + DESCRIPTION + Gets the SQL statement for the given ROW LCR. + PARAMETERS + svchp (IN/OUT) - OCI service handle + errhp (IN/OUT) - Error Handle to which errors + should be reported + row_stmt (OUT) - Sql Statement equivalent to the + LCR has applied + row_stmt_len (IN/OUT) - length of row_stmt buffer + row_lcrp (IN) - row LCR to be converted to SQL + mode (IN) - Mode flags (For future extension. + Not used currently) + RETURNS + OCI_SUCCESS or OCI_ERROR. + NOTES + None +*/ +sword OCILCRRowStmtGet( + OCISvcCtx *svchp, + OCIError *errhp, + oratext *row_stmt, + ub4 *row_stmt_len, + void *row_lcrp, + ub4 mode); + +/*--------------------- OCILCRWhereClauseWithBindVarGet ----------------------*/ +/* + NAME + OCILCRWhereClauseWithBindVarGet - OCI Get Where clause with binds + DESCRIPTION + Gets the where clause statement with bind variables for the given ROW LCR. + PARAMETERS + svchp (IN/OUT) - OCI service handle + errhp (IN/OUT) - Error Handle to which errors + should be reported + wc_stmt (OUT) - Sql Stmt equivalent to the LCR + wc_stmt_len (IN/OUT) - length of wc_stmt buffer + num_bind_var (OUT) - Number of bind variables + bind_var_dtyp (OUT) - Array of Data types of bind + variables + bind_var_valuesp (OUT) - Array of Values of bind variables + bind_var_indp (OUT) - Array of null indicators of + bind variables + bind_var_alensp (OUT) - Array of lengths of bind values + bind_var_csetidp (OUT) - Array of char set id of binds + bind_var_csetfp (OUT) - Array of char set form of binds + row_lcrp (IN) - row LCR to be converted to SQL + array_size (IN) - Size of the array of bind values + bind_var_syntax (IN) - Native syntax to be used for binds + mode (IN) - Mode flags (For future extension. + Not used currently) + RETURNS + OCI_SUCCESS or OCI_ERROR. + NOTES + - For now, specify OCI_DEFAULT for mode + - If array_size is not large enough to accommodate the number of columns + in the requested column list then OCI_ERROR is returned. Expected + array_size is returned through num_bind_var parameter. + - bind_var_syntax for oracle should contain ":". This will generate + positional binds such as :1, :2, :3 etc. For other non-oracle databases + they can give the string that needs to be used for binds. + - WHERE clause generated for INSERT lcr will have all the columns that + are being inserted. This WHERE clause could be used to identify the + inserted row after inserting. (like "returning ROWID"). + INSERT INTO TAB(COL1) VALUES (10) -> WHERE COL1=10 + - WHERE clause generated for UPDATE will have all the columns in the + old column list. However the values of the columns will be that of + new column value of the column if it exist in the new values + of the UPDATE. If the column appears only in the old column then + old column value will be used. + UPDATE TAB SET COL1 = 10 WHERE COL1 = 20 -> WHERE COL1 = 10 + UPDATE TAB SET COL2 = 20 WHERE COL1 = 20 -> WHERE COL1 = 20 + - WHERE clause for DELETE will use the columns and values from + old column lst + - LOB piecewise operations would use the new columns and values for + generating the WHERE clause. +*/ +sword OCILCRWhereClauseWithBindVarGet( + OCISvcCtx *svchp, + OCIError *errhp, + oratext *wc_stmt, + ub4 *wc_stmt_len, + ub2 *num_bind_var, + ub2 *bind_var_dtyp, + void **bind_var_valuesp, + OCIInd *bind_var_indp, + ub2 *bind_var_alensp, + ub2 *bind_var_csetidp, + ub1 *bind_var_csetfp, + void *row_lcrp, + ub2 array_size, + oratext *bind_var_syntax, + ub4 mode); + +/*--------------------- OCILCRRowStmtWithBindVarGet ----------------------*/ +/* + NAME + OCILCRRowStmtWithBindVarGet - OCI Get Row Statement + DESCRIPTION + Gets the SQL statement with bind variables for the given ROW LCR. + PARAMETERS + svchp (IN/OUT) - OCI service handle + errhp (IN/OUT) - Error Handle to which errors + should be reported + row_stmt (OUT) - Sql Stmt equivalent to the LCR + row_stmt_len (IN/OUT) - length of row_stmt buffer + num_bind_var (OUT) - Number of bind variables + bind_var_dtyp (OUT) - Array of Data types of bind + variables + bind_var_valuesp (OUT) - Array of Values of bind variables + bind_var_indp (OUT) - Array of null indicators of + bind variables + bind_var_alensp (OUT) - Array of lengths od bind values + bind_var_csetidp (OUT) - Array of char set id of binds + bind_var_csetfp (OUT) - Array of char set form of binds + row_lcrp (IN) - row LCR to be converted to SQL + chunk_column_names (OUT) - Array of chunked column names in + lcr + chunk_column_namesl (OUT) - Length of chunk_column_names + chunk_column_flags (OUT) - flags of chunked columns in lcr + Possible bit values are + OCI_LCR_COLUMN_* flags listed + above. + array_size (IN) - Size of the array of bind values + bind_var_syntax (IN) - Native syntax to be used for binds + mode (IN) - Mode flags (For future extension. + Not used currently) + RETURNS + OCI_SUCCESS or OCI_ERROR. + NOTES + - For now, specify OCI_DEFAULT for mode + - If array_size is not large enough to accommodate the number of columns + in the requested column list then OCI_ERROR is returned. Expected + array_size is returned through num_bind_var parameter. + - bind_var_syntax for oracle should contain ":". This will generate + positional binds such as :1, :2, :3 etc. For other non-oracle databases + they can give the string that needs to be used for binds. +*/ +sword OCILCRRowStmtWithBindVarGet( + OCISvcCtx *svchp, + OCIError *errhp, + oratext *row_stmt, + ub4 *row_stmt_len, + ub2 *num_bind_var, + ub2 *bind_var_dtyp, + void **bind_var_valuesp, + OCIInd *bind_var_indp, + ub2 *bind_var_alensp, + ub2 *bind_var_csetidp, + ub1 *bind_var_csetfp, + void *row_lcrp, + oratext **chunk_column_names, + ub2 *chunk_column_namesl, + oraub8 *chunk_column_flags, + ub2 array_size, + oratext *bind_var_syntax, + ub4 mode); + +/* +------------------------------------------------------------------------------- + NAME + OCILCRSCNsFromPosition - Get SCNs From Position + + DESCRIPTION + Returns the SCN and commit SCN from the given position. + PARAMETERS + svchp (IN) - OCI service context + errhp (IN) - OCI Error Handle + position (IN) - LCR position + position_len (IN) - length of position + scn (OUT) - the SCN stored in position + commit_scn (OUT) - the commit SCN stored in position + mode (IN) - Mode flags (For future extension. Not used + currently) + RETURN + OCI_SUCCESS if the conversion succeeds, OCI_ERROR otherwise. + NOTE + The user must allocate memory for the return numbers. + The input position must conform to the format generated by an XStream + server. +------------------------------------------------------------------------------- +*/ +sword OCILCRSCNsFromPosition(OCISvcCtx *svchp, + OCIError *errhp, + ub1 *position, + ub2 position_len, + OCINumber *scn, + OCINumber *commit_scn, + ub4 mode); + +/* +------------------------------------------------------------------------------- + NAME + OCILCRSCNToPosition - Converts SCN To Position + + DESCRIPTION + Converts an SCN to a position. The generated position can be passed as the + last_position to OCIXStreamOutAttach function to filter the LCRs + with commit SCN less than the given SCN and the LCR's SCN less than the + given SCN. This means the first LCR sent by the Outbound server is either + - a commit LCR at the given SCN, or + - the first LCR of the subsequent transaction with commit SCN greater + than or equal to the given SCN. + PARAMETERS + svchp (IN) - OCI service context + errhp (IN) - OCI Error Handle + position (OUT) - Result position. Must pre-allocate + OCI_LCR_MAX_POSITION_LEN bytes. + position_len (OUT) - Length of position + scn (IN) - The SCN to be stored in position + mode (IN) - Mode flags (for future extension) + RETURN + OCI_SUCCESS if the conversion succeeds, OCI_ERROR otherwise. +------------------------------------------------------------------------------- +*/ +sword OCILCRSCNToPosition(OCISvcCtx *svchp, + OCIError *errhp, + ub1 *position, + ub2 *position_len, + OCINumber *scn, + ub4 mode); + +/* +------------------------------------------------------------------------------= +NAME + OCILCRLobInfoGet - OCI LCR GET LOB INFO +DESCRIPTION + Returns the LOB information for a given piece-wise LOB LCR. +PARAMETERS + svchp (IN) - OCI service context + errhp (IN) - OCI Error Handle + column_name (OUT) - Pointer to the LOB column name. + Optional. If specified then column_name_len must + be specified as well. + column_name_len(OUT) - Length of LOB column name without the NULL + terminator. + column_dty (OUT) - LOB column dty - either SQLT_CHR (for CLOB) or + SQLT_BIN (for BLOB). + column_flag (OUT) - LOB column flag. + Possible bit values are OCI_LCR_COLUMN_* flags + listed above. + offset (OUT) - LOB operation offset in code points. Returned only + for LOB_TRIM and LOB_WRITE operations; otherwise, + a zero is returned. + This is the same as the 'soffset' parameter for + OCILobErase or the 'offset' parameter in + OCILobWrite functions. + size (OUT) - LOB operation size in code points. Returned only + for LOB_TRIM and LOB_ERASE operations; otherwise, + a zero is returned. + This is the same as the 'new_length' parameter in + OCILobTrim or the 'amtp' parameter in OCILobErase + functions. + row_lcrp (IN) - XStream Row LCR pointer + mode (IN) - mode +NOTES + - For now, specify OCI_DEFAULT for mode +------------------------------------------------------------------------------= +*/ +sword OCILCRLobInfoGet(OCISvcCtx *svchp, + OCIError *errhp, + oratext **column_name, + ub2 *column_name_len, + ub2 *column_dty, + oraub8 *column_flag, + ub4 *offset, + ub4 *size, + void *row_lcrp, + ub4 mode); + + +/* +------------------------------------------------------------------------------= +NAME + OCILCRLobInfoSet - OCI LCR SET LOB INFO +DESCRIPTION + Sets the LOB information for a given piece-wise LOB LCR. +PARAMETERS + svchp (IN) - OCI service context + errhp (IN) - OCI Error Handle + column_name (IN) - Pointer to the LOB column name. + column_name_len(IN) - Length of LOB column name without the NULL + terminator. + column_dty (IN) - LOB column dty - either SQLT_CHR (for CLOB) or + SQLT_BIN (for BLOB). + column_flag (IN) - LOB column flag. + Possible bit values are OCI_LCR_COLUMN_* flags + listed above. + offset (IN) - LOB operation offset in code points. Returned only + for LOB_TRIM and LOB_WRITE operations; otherwise, + a zero is returned. + This is the same as the 'soffset' parameter for + OCILobErase or the 'offset' parameter in + OCILobWrite functions. + size (IN) - LOB operation size in code points. Returned only + for LOB_TRIM and LOB_ERASE operations; otherwise, + a zero is returned. + This is the same as the 'new_length' parameter in + OCILobTrim or the 'amtp' parameter in OCILobErase + functions. + row_lcrp (IN/OUT)- XStream Row LCR pointer + mode (IN) - mode +NOTES + - For now, specify OCI_DEFAULT for mode +------------------------------------------------------------------------------= +*/ +sword OCILCRLobInfoSet(OCISvcCtx *svchp, + OCIError *errhp, + oratext *column_name, + ub2 column_name_len, + ub2 column_dty, + oraub8 column_flag, + ub4 offset, + ub4 size, + void *row_lcrp, + ub4 mode); + +/*--------------------------------------------------------------------------- + XSTREAM OUT FUNCTIONS + ---------------------------------------------------------------------------*/ + +/*------------------------- OCIXStreamOutAttach -----------------------------*/ +/* + NAME + OCIXStreamOutAttach - OCI Attach to XStream Out + DESCRIPTION + Given the name of the server process, attach to the outbound server. + PARAMETERS + svchp (IN/OUT) - OCI service handle + errhp (IN/OUT) - Error Handle for error reporting + server_name (IN) - Server name. + server_name_len (IN) - Length of server name. + last_position (IN) - last rcv position. (Optional) + last_position_len (IN) - Length of last_position. + mode (IN) - Mode flags (see below) + RETURNS + OCI_SUCCESS or OCI_ERROR. + NOTES + Specify OCI_DEFAULT for the mode parameter. + + The name of the outbound server must be provided because multiple + outbound servers can be configured in one Oracle instance. This call + returns OCI_ERROR if it encounters any error while attaching to the + outbound server. + + The last_position parameter is used to establish the starting point + of the stream. This call returns OCI_ERROR if the specified position + is non-null and less than the server's processed low-watermark; + otherwise, LCRs with position greater than last_position will be + sent to the user. + + If last_position is null then the stream will start from the processed + low-watermark maintained in the server. +*/ + +sword OCIXStreamOutAttach (OCISvcCtx *svchp, OCIError *errhp, + oratext *server_name, ub2 server_name_len, + ub1 *last_position, + ub2 last_position_len, + ub4 mode); + +/* Valid modes for OCIXStreamOutAttach call */ +#define OCIXSTREAM_OUT_ATTACH_RESERVED_1 (0x00000001) +/* Application is in charge of freeing the LCRs from the outbound server */ +#define OCIXSTREAM_OUT_ATTACH_APP_FREE_LCR (0x00000002) + +/*---------------------- OCIXStreamOutProcessedLWMSet ----------------------*/ +/* + NAME + OCIXStreamOutProcessedLWMSet - Set Processed Low-Watermark + DESCRIPTION + Sets the processed low-watermark maintained at the client. + PARAMETERS + svchp (IN/OUT) - OCI service handle + errhp (IN/OUT) - Error Handle for error reporting + processed_low_position (IN) - processed low position. + processed_low_position_len (IN) - processed low position length. + mode (IN) - mode for future extension. (Not used + currently). + RETURNS + OCI_SUCCESS or OCI_ERROR. + + NOTES + The processed low-watermark denotes all LCRs at or below this position + have been processed. After successfully attaching to an XStream + outbound server, a local copy of the processed low-watermark is + maintained at the client. Periodically, this watermark is sent to the + server so that archived logs containing already processed transactions + can be purged. + + The following API is used to update the local copy of the processed + low-watermark. It can be called anytime between OCIXStreamOutAttach + and OCIXStreamOutDetach calls. Clients, using the callback mechanism + to stream LCRs from the server, can invoke this API while + in the callback functions. +*/ + +sword OCIXStreamOutProcessedLWMSet (OCISvcCtx *svchp, OCIError *errhp, + ub1 *processed_low_position, + ub2 processed_low_position_len, + ub4 mode); + + +/*-------------------- OCICallbackXStreamOutLCRProcess ----------------------*/ +/* + NAME + OCICallbackXStreamOutLCRProcess - Callback to process each LCR received + DESCRIPTION + This callback is invoked during OCIXStreamOutLCRCallbackReceive + to process each LCR received from the outbound server. + PARAMETERS + usrctxp (IN/OUT) - Ptr to the user context. + lcrp (IN) - Pointer to the LCR just received. + lcrtyp (IN) - LCR type (OCI_LCR_XROW / OCI_LCR_XDDL) + flag (IN) - If OCI_XSTREAM_MORE_ROW_DATA is set, + this means the current LCR has more + chunk data. + RETURNS + This callback function must return OCI_CONTINUE to continue processing + OCIXStreamOutLCRCallbackReceive call. Any return code other than + OCI_CONTINUE signals that the client wants to terminate + OCIXStreamOutLCRCallbackReceive immediately. +*/ +typedef sb4 (*OCICallbackXStreamOutLCRProcess) (void *usrctxp, void *lcrp, + ub1 lcrtyp, oraub8 flag); + + +/*-------------------- OCICallbackXStreamOutChunkProcess --------------------*/ +/* + NAME + OCICallbackXStreamOutChunkProcess - Callback to process each chunk + DESCRIPTION + This callback is invoked during OCIXStreamOutLCRCallbackReceive + to process each chunk in an LCR. + PARAMETERS + usrctxp (IN/OUT) - Ptr to the user context. + column_name (IN) - Column name for the current chunk. + column_name_len (IN) - Length of column name. + column_dty (IN) - Chunk data type (SQLT_CHR or SQLT_BIN). + column_flag (IN) - LCR column flags. Possible bit values are + OCI_LCR_COLUMN_* flags listed above. + column_csid (IN) - Column character set id. Relevant only if + the column is an XMLType column (i.e., + column_flag has OCI_LCR_COLUMN_XML_DATA bit set). + chunk_bytes (IN) - Chunk data length in bytes. + chunk_data (IN) - Chunk data buffer. + flag (IN) - If OCI_XSTREAM_MORE_ROW_DATA is set, this means + the current LCR has more chunks. + RETURNS + This callback function must return OCI_CONTINUE to continue processing + OCIXStreamOutLCRCallbackReceive call. Any return code other than + OCI_CONTINUE signals that the client wants to terminate + OCIXStreamOutLCRCallbackReceive immediately. +*/ +typedef sb4 (*OCICallbackXStreamOutChunkProcess) + (void *usrctxp, oratext *column_name, ub2 column_name_len, + ub2 column_dty, oraub8 column_flag, ub2 column_csid, + ub4 chunk_bytes, ub1 *chunk_data, oraub8 flag); + +/*-------------------- OCIXStreamOutLCRCallbackReceive ----------------------*/ +/* + NAME + OCIXStreamOutLCRCallbackReceive - OCI Receive LCR stream using Callbacks + DESCRIPTION + This API is used to get the LCR stream from the outbound server using + callbacks to gain better performance. The user must supply a callback + function to be invoked for each LCR received. If some row changes + in the stream may contain LOB/LONG/XMLType columns then the data for + those columns are returned to the user in chunks. To receive those row + changes, the user must provide a second callback to be invoked to + process each chunk data. + + If there is an LCR available in the stream, the processlcr_cb function + is invoked immediately. After the processlcr_cb function exits, if the + current LCR contains additional chunks then the processchunk_cb function + is invoked for each chunk belonging to that LCR. + + If there is no LCR in the stream when the idle timeout expires (see + OCI_ATTR_XSTREAM_IDLE_TIMEOUT), this call returns a null LCR with + OCI_SUCCESS code. + PARAMETERS + svchp (IN/OUT) - OCI service handle + errhp (IN/OUT) - Error Handle for error reporting + processlcr_cb (IN) - Client callback function for each LCR. + processchunk_cb (IN) - Client callback function for each + chunk. + usrctxp (IN) - Client context. (Optional) + fetch_low_position (OUT)- Fetch low watermark. (Optional) + fetch_low_position_len (OUT)- Fetch low watermark length. + mode (IN) - mode for future extension. (Not used + currently). + RETURNS + OCI_SUCCESS or OCI_ERROR. + NOTES + - The fetch low watermark is used to indicate all transactions + with commit position below this have been received by the XStream + outbound server. + + - If the LCR contains non-chunked column(s), the duration of that LCR is + limited to the processlcr_cb function. If the LCR contains some + chunk data then the duration of the LCR is extended until all the + chunks have been processed (that is, when the flag passing to + processchunk_cb function does not have OCI_XSTREAM_MORE_ROW_DATA flag + set). If the user wants to access the LCR data at a later time, a + copy of the LCR must be made. The client callback should not modify + or free the LCR passing to the callback. + + If the OCIXSTREAM_OUT_ATTACH_APP_FREE_LCR mode is passed to + OCIXStreamOutAttach call then the application is in charge of calling + OCILCRFree to free each LCR. Note, this mode does not apply to the + chunk data associated with each LCR. Each chunk data is freed + immediately after each OCIXStreamOutChunkReceive call. + + - The given usrctxp is passed to both callbacks. + + - An ACK interval is the interval in seconds which the outbound + server receives the processed LWM or the inbound server sends + the processed LWM. The default ACK interval is 30 seconds. This + value can be changed by setting the OCI_ATTR_XSTREAM_ACK_INTERVAL + attribute using OCIAttrSet API. This attribute is checked only + during the Attach call; thus, it must be set before invoking this API. + + - The idle timeout is the interval in seconds after which the current + call will terminate if there is no LCR in the stream. The default + idle timeout is one second. This value can be changed by setting the + OCI_ATTR_XSTREAM_IDLE_TIMEOUT attribute using OCIAttrSet API. This + attribute is checked only during the Attach call; thus, it must be + set before invoking this API. + + - The outbound server ends each call at the transaction boundary + after an ACK interval has elapsed since the start of the call + or when the idle timeout expires. This API returns the fetch + low watermark at the end of each call. +*/ +sword OCIXStreamOutLCRCallbackReceive( + OCISvcCtx *svchp, OCIError *errhp, + OCICallbackXStreamOutLCRProcess processlcr_cb, + OCICallbackXStreamOutChunkProcess processchunk_cb, void *usrctxp, + ub1 *fetch_low_position, ub2 *fetch_low_position_len, ub4 mode); + +/*---------------------- OCIXStreamOutLCRReceive -------------------------*/ +/* + NAME + OCIXStreamOutLCRReceive - Receive LCR without using callback + DESCRIPTION + This API is used to receive an LCR from an outbound stream. If there + is an LCR available, this API immediately returns that LCR. + When there is no LCR available in the stream, this call returns a + null LCR after the idle timeout (see OCI_ATTR_XSTREAM_IDLE_TIMEOUT) + has expired. + + The client must not modify the LCR received from the outbound server. + The duration of each LCR is until the next OCIXStreamOutLCRReceive call. + If the OCIXSTREAM_OUT_ATTACH_APP_FREE_LCR mode is passed to + OCIXStreamOutAttach call then the application is in charge of calling + OCILCRFree to free each LCR. Note, this mode does not apply to the + chunk data associated with each LCR. Each chunk data is freed + immediately after each OCIXStreamOutChunkReceive call. + + To avoid network round trip for every OCIXStreamOutLCRReceive call, + the connection is tied to this call to let the server fill up + the network buffer with LCRs so subsequent calls can quickly receive + the LCRs from the network. The server ends each call at the + transaction boundary after an ACK interval has elapsed since the start + of the call or when the idle timeout expires. See + OCI_ATTR_XSTREAM_ACK_INTERVAL & OCI_ATTR_XSTREAM_IDLE_TIMEOUT + attributes. + PARAMETERS + svchp (IN/OUT) - OCI service handle + errhp (IN/OUT) - Error Handle for error reporting + lcrp (OUT) - Pointer to the LCR received from the + stream. + lcrtype (OUT) - LCR type (OCI_LCR_XROW / OCI_LCR_XDDL) + flag (OUT) - If OCI_XSTREAM_MORE_ROW_DATA is set, + it means the current LCR has more + chunk data. + fetch_low_position (OUT)- Fetch low watermark. (Optional) + fetch_low_position_len (OUT)- Fetch low watermark length. + mode (IN) - mode for future extension. (Not used + currently). + RETURNS + - OCI_STILL_EXECUTING means the current call is still in progress. The + connection associated with the specified service context handle is + still tied to this call for streaming the LCRs from the server. An + error is returned if the user attempts to use the same connection to + execute any OCI calls that require database round trip, for example, + OCIStmtExecute, OCIStmtFetch, OCILobRead, etc. OCILcr* calls are + local calls; thus, they are valid while the stream is in progress. + - OCI_SUCCESS means the current call is completed. User is free to + execute OCIStmt*, OCILob*, etc. from the same service context. + - OCI_ERROR means the current call encounters some errors. Use + OCIErrorGet to obtain information about the error. + + NOTES + This call always returns a null LCR when the return code is OCI_SUCCESS. + In addition, it returns the fetch low position to denote the outbound + server has received all transactions with commit position lower than or + equal to this value. + + The fetch low watermark is used to indicate all transactions + with commit position below this have been received by the XStream + outbound server. +*/ + +sword OCIXStreamOutLCRReceive( + OCISvcCtx *svchp, OCIError *errhp, + void **lcrp, + ub1 *lcrtype, + oraub8 *flag, + ub1 *fetch_low_position, + ub2 *fetch_low_position_len, + ub4 mode); + +/*-------------------------- OCIXStreamOutChunkReceive ---------------------*/ +/* + NAME + OCIXStreamOutChunkReceive - Receive Chunk data + DESCRIPTION + Receives next chunk of LCR data from XStream Outbound server. + This API can only be called while OCIXStreamOutLCRReceive call is + in progress. + PARAMETERS + svchp (IN/OUT) - OCI service handle + errhp (IN/OUT) - Error Handle to which errors should be reported + column_name (OUT) - Name of column for which data is retrieved. + column_name_len (OUT) - Length of column name. + column_dty (OUT) - LCR column data type. + column_flag (OUT) - LCR column flag. Possible bit values are + OCI_LCR_COLUMN_LOB_DATA + OCI_LCR_COLUMN_LONG_DATA + OCI_LCR_COLUMN_EMPTY_LOB + OCI_LCR_COLUMN_LAST_CHUNK + OCI_LCR_COLUMN_AL16UTF16 + OCI_LCR_COLUMN_ENCRYPTED + OCI_LCR_COLUMN_NCLOB + OCI_LCR_COLUMN_XML_DATA + OCI_LCR_COLUMN_XML_DIFF + column_csid (OUT) - Column character set id. This is returned only + if the column is an XMLType column (i.e., + column_flag has OCI_LCR_COLUMN_XML_DATA bit + set). + chunk_bytes (OUT) - Number of bytes in output buffer. + chunk_data (OUT) - Pointer to the chunk data in the LCR. + Client must not de-allocate this pointer. + flag (OUT) - If OCI_XSTREAM_MORE_ROW_DATA is set, it means + the current LCR has more data coming. + mode (IN) - mode for future extension. (Not used currently). + RETURNS + OCI_SUCCESS - Check colname_len and chunk_bytes to determine the + data just read. + OCI_ERROR - Error encountered. Execute OCIErrorGet to get information + about the error. + NOTES + - If the return code is OCI_SUCCESS, client should check chunk_bytes to + determine the # of bytes read and check column_name to determine + which LCR column the data associated with. + + - All the chunks from one LOB/LONG/XMLType column are returned entirely + before the chunk value for the next LOB/LONG/XMLType column is + returned. + + - The is no fixed ordering on how the LOB/LONG/XMLType columns is + returned. Users must check the column name to determine which column. + The column_flag will have OCI_LCR_COLUMN_LAST_CHUNK bit set when this + function returns the last chunk of each column. + + - This call returns a null column name and null chunk data if it's + invoked when the current LCR contains only non-chunked columns. + + - If OCIXStreamOutLCRReceive call returns OCI_XSTREAM_MORE_ROW_DATA flag + then the user must iteratively call OCIXStreamOutChunkReceive to + retrieve all the chunks belonging to the current row change before + calling the next OCIXStreamOutLCRReceive. + +*/ +sword OCIXStreamOutChunkReceive(OCISvcCtx *svchp, OCIError *errhp, + oratext **column_name, ub2 *column_name_len, + ub2 *column_dty, oraub8 *column_flag, + ub2 *column_csid, ub4 *chunk_bytes, + ub1 **chunk_data, oraub8 *flag, ub4 mode); + +/*------------------------- OCIXStreamOutDetach -----------------------------*/ +/* + NAME + OCIXStreamOutDetach - OCI Detach from XStream Out + DESCRIPTION + Detaches from the attached XStream outbound server. This call sends the + current local processed low-watermark to the server before detaching + from the outbound server. The outbound server automatically restarts + after this call. This API returns OCI_ERROR if it is invoked while a + ReceiveLCR call is in progress. + PARAMETERS + svchp (IN/OUT) - OCI service handle + errhp (IN/OUT) - Error Handle to which errors should be reported + mode (IN) - mode for future extension. (Not used currently). + RETURNS + OCI_SUCCESS or OCI_ERROR. + NOTES + - The processed_low_position is passed to the server so it can update its + copy. This value if provided must be greater than or equal to the + value maintained in the server; otherwise, an error is returned. +*/ +sword OCIXStreamOutDetach (OCISvcCtx *svchp, OCIError *errhp, ub4 mode); + +/*--------------------------------------------------------------------------- + XSTREAM IN FUNCTIONS + ---------------------------------------------------------------------------*/ + +/*------------------------ OCIXStreamInAttach -------------------------------*/ +/* + NAME + OCIXStreamInAttach - OCI XStream In Attach + DESCRIPTION + Attaches to the specified XStream inbound server. + PARAMETERS + svchp (IN/OUT) - OCI service handle + errhp (IN/OUT) - Error Handle to which errors + should be reported + server_name (IN) - XStream inbound server name. + server_name_len (IN) - Length of server name. + source_name (IN) - source name to identify the data src. + source_name_len (IN) - Length of source name. + last_position (OUT) - Last position received by inbound + server. Optional. If specified must + pre-allocate OCI_LCR_MAX_POSITION_LEN + bytes for return value. + last_position_len (OUT) - Length of last_position. Must be + non-NULL if last_position is non-NULL. + mode (IN) - Mode flags (For future extension. + (Not used currently) + RETURNS + OCI_SUCCESS or OCI_ERROR. + NOTES + The last_position parameter is returned to establish the starting point + to resume the inbound stream. The client should start sending LCRs with + positions greater than the last_position since the inbound server will + ignore all LCRs with positions less than or equal to this value. +*/ + +sword OCIXStreamInAttach( + OCISvcCtx *svchp, + OCIError *errhp, + oratext *server_name, + ub2 server_name_len, + oratext *source_name, + ub2 source_name_len, + ub1 *last_position, + ub2 *last_position_len, + ub4 mode); + +/*--------- Valid modes for OCIXStreamInAttach -------------*/ +/* Restart inbound server regardless if it's in DISABLED or ABORTED state. */ +#define OCIXSTREAM_IN_ATTACH_RESTART_INBOUND (0x00000001) + +/*-------------------- OCICallbackXStreamInLCRCreate ------------------------*/ +/* + NAME + OCICallbackXStreamInLCRCreate - Callback to create an LCR + DESCRIPTION + This callback is invoked during OCIXStreamInLCRCallbackSend + to create each LCR to be sent to the inbound server. + PARAMETERS + usrctxp (IN/OUT) - Ptr to the user context + lcrp (OUT) - Pointer to the LCR to be sent + lcrtyp (OUT) - LCR type (OCI_LCR_XROW / OCI_LCR_XDDL) + flag (OUT) - If OCI_XSTREAM_MORE_ROW_DATA is set, + this means the current LCR has more + chunk data. + RETURNS + This callback function must return OCI_CONTINUE to continue processing + OCIXStreamInLCRCallbackSend call. Any return code other than + OCI_CONTINUE signals that the client wants to terminate + OCIXStreamInLCRCallbackSend immediately. +*/ +typedef sb4 (*OCICallbackXStreamInLCRCreate)( + void *usrctxp, + void **lcrp, + ub1 *lcrtyp, + oraub8 *flag); + +/*-------------------- OCICallbackXStreamInChunkCreate --------------------*/ +/* + NAME + OCICallbackXStreamInChunkCreate - Callback to create each chunk + DESCRIPTION + This callback is invoked during OCIXStreamInLCRCallbackSend + to create each chunk to be sent to the inbound server. + PARAMETERS + usrctxp (IN/OUT) - Ptr to the user context. + column_name (OUT) - Column name for the current chunk. + column_name_len (OUT) - Length of column name. + column_dty (OUT) - Chunk data type (SQLT_CHR or SQLT_BIN). + column_flag (OUT) - LCR column flags. Possible bit values are + OCI_LCR_COLUMN_* flags listed above. + column_csid (OUT) - Column character set id. Relevant only if + the column is an XMLType column (i.e., + column_flag has OCI_LCR_COLUMN_XML_DATA bit + set). + chunk_bytes (OUT) - Chunk data length in bytes. + chunk_data (OUT) - Chunk data buffer. + flag (OUT) - If OCI_XSTREAM_MORE_ROW_DATA is set, this means + the current LCR has more chunks. + RETURNS + This callback function must return OCI_CONTINUE to continue processing + OCIXStreamInLCRCallbackSend call. Any return code other than + OCI_CONTINUE signals that the client wants to terminate + OCIXStreamInLCRCallbackSend immediately. +*/ +typedef sb4 (*OCICallbackXStreamInChunkCreate)( + void *usrctxp, + oratext **column_name, + ub2 *column_name_len, + ub2 *column_dty, + oraub8 *column_flag, + ub2 *column_csid, + ub4 *chunk_bytes, + ub1 **chunk_data, + oraub8 *flag); + +/*--------------------- OCIXStreamInLCRCallbackSend ------------------------*/ +/* + NAME + OCIXStreamInLCRCallbackSend - OCI XStream In Send LCR to Inbound Server + DESCRIPTION + Sends LCR stream to XStream inbound server using callbacks. + The API invokes createlcr_cb function to obtain each LCR to send to the + server. If the return flag from the createlcr_cb function has + OCI_XSTREAM_MORE_ROW_DATA bit set, then it invokes createchunk_cb + procedure to obtain each chunk. It repeatedly calls createchunk_cb + function while the flag returned from this callback has + OCI_XSTREAM_MORE_ROW_DATA bit set. When this bit is not set, this API + cycles back to invoke createlcr_cb function to get the next LCR. + This cycle is repeated until the createlcr_cb function returns a null + LCR or when an ACK interval has elapsed since the start of the call. + See OCI_ATTR_XSTREAM_ACK_INTERVAL attribute. + PARAMETERS + svchp (IN/OUT) - OCI service handle + errhp (IN/OUT) - Error Handle to which errors + should be reported + createlcr_cb (IN) - Callback function to be invoked + to generate an LCR for streaming. + Cannot be null. + createchunk_cb (IN) - Callback function to be invoked to + create each chunk. Can be null if the + user does not need to send any LCR with + LOB/LONG/XMLType columns. OCI_ERROR + will be returned if this argument is + null and the user attempts to send an + LCR with additional chunk data. + usrctxp (IN) - Client context to pass to both + callback functions. + mode (IN) - Mode flags (For future extension. + Not used currently) + RETURNS + OCI_SUCCESS or OCI_ERROR. + NOTES + None +*/ + +sword OCIXStreamInLCRCallbackSend( + OCISvcCtx *svchp, + OCIError *errhp, + OCICallbackXStreamInLCRCreate createlcr_cb, + OCICallbackXStreamInChunkCreate createchunk_cb, + void *userctxp, + ub4 mode); + +/*---------------------------- OCIXStreamInLCRSend --------------------------*/ +/* + NAME + OCIXStreamInLCRSend - OCI XStream In Send LCR to Inbound Server + DESCRIPTION + Sends LCR stream to XStream inbound server without using callbacks. + To avoid a network round trip for every OCIXStreamInLCRSend call, + the connection is tied to this call for at least the duration + specified by the OCI_ATTR_XSTREAM_ACK_INTERVAL attribute. + PARAMETERS + svchp (IN/OUT) - OCI service handle + errhp (IN/OUT) - Error Handle to which errors + should be reported + lcrp (IN) - Pointer to the LCR to send. Cannot + be null. + lcrtype (IN) - LCR type (OCI_LCR_XROW / OCI_LCR_XDDL) + flag (IN) - If OCI_XSTREAM_MORE_ROW_DATA is set, + it means the current LCR has more + chunk data. + mode (IN) - Mode flags (For future extension. + Not used currently) + RETURNS + - OCI_STILL_EXECUTING means the current call is still in progress. The + connection associated with the specified service context handle is + still tied to this call for streaming the LCRs to the server. An error + is returned if the user attempts to use the same connection to + execute any OCI calls that require database round trip, for example, + OCIStmtExecute, OCIStmtFetch, OCILobRead, etc. OCILcr* calls are + local calls; thus, they are valid while this call is in progress. + - OCI_SUCCESS means the current call is completed. User is free to + execute OCIStmt*, OCILob*, etc. from the same service context. + - OCI_ERROR means this call encounters some errors. Use OCIErrorGet to + obtain information about the error. +*/ +sword OCIXStreamInLCRSend( + OCISvcCtx *svchp, + OCIError *errhp, + void *lcrp, + ub1 lcrtype, + oraub8 flag, + ub4 mode); + +/*----------------------------- OCIXStreamInChunkSend -----------------------*/ +/* + NAME + OCIXStreamInChunkSend - Send Chunk + DESCRIPTION + Sends the given chunk of column data to XStream Inbound server. + This chunk is associated with the LCR that is sent by the + most recent OCIXStreamInLCRSend call prior to this call. + PARAMETERS + svchp (IN/OUT) - OCI service handle + errhp (IN/OUT) - Error Handle to which errors should be reported + column_name (IN) - Name of column for which data is sent. + Column names must be canonicalized and must + follow Oracle naming conventions. + column_name_len (IN) - Length of column name. + column_dty (IN) - LCR column data type (must be SQLT_CHR or + SQLT_BIN). + column_flag (IN) - LCR column flags. Possible bit values are + OCI_LCR_COLUMN_LOB_DATA + OCI_LCR_COLUMN_LONG_DATA + OCI_LCR_COLUMN_EMPTY_LOB + OCI_LCR_COLUMN_LAST_CHUNK + OCI_LCR_COLUMN_AL16UTF16 + OCI_LCR_COLUMN_ENCRYPTED + OCI_LCR_COLUMN_NCLOB + OCI_LCR_COLUMN_XML_DATA + OCI_LCR_COLUMN_XML_DIFF + column_csid (IN) - Column character set id. This is required only + if the column is an XMLType column (i.e., + column_flag has OCI_LCR_COLUMN_XML_DATA bit set). + chunk_bytes (IN) - Chunk data length in bytes. + chunk_data (IN) - Chunk data buffer. + flag (IN) - If OCI_XSTREAM_MORE_ROW_DATA is set, it means + the current LCR has more data coming. + mode (IN) - mode for future extension. (Not used currently). +RETURNS + OCI_SUCCESS - Successful call. + OCI_ERROR - Error encountered. Execute OCIErrorGet to get information + about the error. +NOTES + - This function must be called while OCIXStreamInLCRSend is in progress. + + - This function is valid only if the associated LCR's cmd type is + INSERT, UPDATE or LOB_WRITE. It can be invoked multiple times for the + same LCR. + + - This API is not valid for LOB_ERASE and LOB_TRIM LCRs. + + - The chunk values for different columns can not be interleaved. If a + column contains multiple chunks, this procedure must be called + consecutively using the same column name before proceeding to a new column. + The ordering in which the LOB/LONG/XMLType column values are set is + irrelevant. + + - The OCI_LCR_COLUMN_LAST_CHUNK must be specified for the last chunk of + each column. + + - Only one column can be specified for LOB_WRITE operation. + + - For NCLOB or varying width CLOB, the input buffer must be in + AL16UTF16 format. + + - For INSERT operation, each LOB/LONG/XMLType column, with value set using + OCIXStreamInChunkSend, must be included in the current LCR's NEW + column list. The value of that LOB/LONG/XMLType column must be set to + null and must have OCI_LCR_COLUMN_EMPTY_LOB flag defined. + +*/ +sword OCIXStreamInChunkSend (OCISvcCtx *svchp, OCIError *errhp, + oratext *column_name, ub2 column_name_len, + ub2 column_dty, oraub8 column_flag, + ub2 column_csid, ub4 chunk_bytes, + ub1 *chunk_data, oraub8 flag, ub4 mode); + +/*--------------------- OCIXStreamInDetach ----------------------------*/ +/* + NAME + OCIXStreamInDetach - OCI XStream In Detach from Inbound Server + DESCRIPTION + Detaches from XStream inbound server and returns the inbound server's + processed low-watermark. + PARAMETERS + svchp (IN/OUT) - OCI service handle + errhp (IN/OUT) - Error Handle to which errors + should be reported + processed_low_position (OUT) - Inbound server's processed low + position. Must pre-allocate + OCI_LCR_MAX_POSITION_LEN bytes for + output buffer. + processed_low_position_len(OUT)- Processed_low_position length. + mode (IN) - Mode flags (For future extension. + Not used currently) + RETURNS + OCI_SUCCESS or OCI_ERROR. + NOTES + None +*/ +sword OCIXStreamInDetach( + OCISvcCtx *svchp, + OCIError *errhp, + ub1 *processed_low_position, + ub2 *processed_low_position_len, + ub4 mode); + +/*--------- Valid modes for OCIXStreamInDetach -------------*/ +/* Restart inbound server when calling detach. */ +#define OCIXSTREAM_IN_DETACH_RESTART_INBOUND (0x00000001) + +/*--------------------- OCIXStreamInProcessedLWMGet -------------------------*/ +/* + NAME + OCIXStreamInProcessedLWMGet - OCI XStream In Get LowWatermark + DESCRIPTION + Returns XStream inbound server's processed low watermark + cached at the client. + PARAMETERS + svchp (IN/OUT) - OCI service handle + errhp (IN/OUT) - Error Handle to which errors + should be reported + processed_low_position (OUT) - Inbound server's cached processed + low position. Must pre- + allocate OCI_LCR_MAX_POSITION_LEN + bytes for output buffer. + processed_low_position_len (OUT) - Processed_low_position length. + mode (IN) - Mode flags (For future extension. + Not used currently) + RETURNS + OCI_SUCCESS or OCI_ERROR. + NOTES + None +*/ +sword OCIXStreamInProcessedLWMGet( + OCISvcCtx *svchp, + OCIError *errhp, + ub1 *processed_low_position, + ub2 *processed_low_position_len, + ub4 mode); + +/*-------------------------- OCIXStreamInFlush ------------------------------*/ +/* + NAME + OCIXStreamInFlush - OCI XStream In Flush network + DESCRIPTION + Flushes network and terminates any in-progress OCIXStreamInLCRSend or + OCIXStreamInLCRCallbackSend call associated with the given service handle. + PARAMETERS + svchp (IN/OUT) - OCI service handle + errhp (IN/OUT) - Error Handle to which errors + should be reported + mode (IN) - Mode flags (see below) + RETURNS + OCI_SUCCESS or OCI_ERROR. + NOTES + Each call will incur a database round trip to get the server's processed + low-watermark, which the user can retrieve afterward using + OCIXStreamInProcessedLWMGet API. This API should be called only when + there is no LCR to send to the server and the client wants to know the + progress of the attached inbound server. + + This call returns OCI_ERROR if it is invoked from the callback functions + of OCIXStreamInLCRCallbackSend API. + + Client must have attached to an XStream inbound server prior to calling + this API. + + Valid Mode flags: + - OCIXSTREAM_IN_FLUSH_WAIT_FOR_COMPLETE : flush network and wait for all + complete and rollback transactions sent to the inbound server to complete + before returning control to the client. + +*/ +sword OCIXStreamInFlush( + OCISvcCtx *svchp, + OCIError *errhp, + ub4 mode); + + +/*-------------------------- OCIXStreamInCommit -----------------------------*/ +/* + NAME + OCIXStreamInCommit - OCI XStream In Commit + DESCRIPTION + Commits current transaction + PARAMETERS + svchp (IN/OUT) - OCI service handle + errhp (IN/OUT) - Error Handle to which errors + should be reported + lcrp (IN) - Pointer to the LCR to send. Must + be a commit LCR. + mode (IN) - Mode flags (For future extension. + Not used currently) + RETURNS + OCI_SUCCESS or OCI_ERROR. + NOTES + The position of the input LCR must be higher than + DBA_XSTREAM_INBOUND_PROGRESS.APPLIED_HIGH_POSITION and the LCR's source + database must match DBA_APPLY_PROGRESS.SOURCE_DATABASE of the attached + inbound server. + + Upon receiving this LCR, the inbound server will check if there is any + unapplied complete or rollback transaction remaining. If none is found + it inserts a row to the apply progress table based on the input LCR and + commit the current transaction; otherwise, it returns an error. + + If there is any pre-commit handler defined, it will be executed when + this commit LCR is executed. +*/ +sword OCIXStreamInCommit( + OCISvcCtx *svchp, + OCIError *errhp, + void *lcrp, + ub4 mode); + +/*-------------------------- OCIXStreamInErrorGet ---------------------------*/ +/* + NAME + OCIXStreamInErrorGet - OCI XStream In Get Error Info + DESCRIPTION + Returns the first error encountered by the inbound server since the + Attach call. + PARAMETERS + svchp (IN/OUT) - OCI service handle + errhp (IN/OUT) - Error Handle + errcodep (OUT) - Error code + msgbuf (IN/OUT) - Pre-allocated message buffer + msg_bufsize (IN) - Message buffer size + msg_len (OUT) - Length of returned error message + txn_id (IN/OUT) - Pre-allocated txn id buffer + txn_id_bufsize (IN) - Txn_id buffer size + txn_id_len (OUT) - Length of returned txn id + RETURNS + OCI_SUCCESS or OCI_ERROR. + NOTES + The maximum size for the returned txn id is OCI_LCR_MAX_TXID_LEN. If the + allocated buffer for txn_id is too small, this routine returns ORA-29258. + The maximum size for the returned error msg is OCI_ERROR_MAXMSG_SIZE. If + the allocated size for msgbuf is too small, the returned message will be + truncated. +*/ +sword OCIXStreamInErrorGet( + OCISvcCtx *svchp, + OCIError *errhp, + sb4 *errcodep, + oratext *msgbuf, + ub2 msg_bufsize, + ub2 *msg_len, + oratext *txn_id, + ub2 txn_id_bufsize, + ub2 *txn_id_len); + +/* +------------------------------------------------------------------------------= +NAME + OCIXStreamOutSessionSet - OCI XStream Out Session Set attribute +DESCRIPTION + Sets session attributes for XStream Out +PARAMETERS + svchp (IN) - OCI service context + errhp (IN) - OCI Error Handle + attribute_name (IN) - Attribute name + attribute_name_len (IN) - Attribute name length + attribute_value (IN) - Attribute value + attribute_value_len (IN) - Attribute value length + attribute_dty (IN) - Attribute dty + mode (IN) - mode +RETURNS + OCI_SUCCESS if successful, OCI_ERROR otherwise +NOTES +------------------------------------------------------------------------------= +*/ +sword OCIXStreamOutSessionSet(OCISvcCtx *svchp, + OCIError *errhp, + oratext *attribute_name, + ub2 attribute_name_len, + void *attribute_value, + ub2 attribute_value_len, + ub2 attribute_dty, + ub4 mode); + +/* +------------------------------------------------------------------------------= +NAME + OCIXStreamInSessionSet - OCI XStream In Session Set attribute +DESCRIPTION + Sets session attributes for XStream In +PARAMETERS + svchp (IN) - OCI service context + errhp (IN) - OCI Error Handle + attribute_name (IN) - Attribute name + attribute_name_len (IN) - Attribute name length + attribute_value (IN) - Attribute value + attribute_value_len (IN) - Attribute value length + attribute_dty (IN) - Attribute dty + mode (IN) - mode +RETURNS + OCI_SUCCESS if successful, OCI_ERROR otherwise +NOTES +------------------------------------------------------------------------------= +*/ +sword OCIXStreamInSessionSet(OCISvcCtx *svchp, + OCIError *errhp, + oratext *attribute_name, + ub2 attribute_name_len, + void *attribute_value, + ub2 attribute_value_len, + ub2 attribute_dty, + ub4 mode); + +/*--------------------------------------------------------------------------- + INTERNAL FUNCTIONS + ---------------------------------------------------------------------------*/ + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* OCIXSTREAM_ORACLE */ diff --git a/sdk/include/odci.h b/sdk/include/odci.h new file mode 100755 index 0000000..c65cfad --- /dev/null +++ b/sdk/include/odci.h @@ -0,0 +1,801 @@ +/* + * + */ + +/* Copyright (c) 1998, 2010, Oracle and/or its affiliates. +All rights reserved. */ + +/* + NAME + odci.h - Oracle Data Cartridge Interface definitions + + DESCRIPTION + This file contains Oracle Data Cartridge Interface definitions. These + include the ODCI Types and Constants. + + RELATED DOCUMENTS + + INSPECTION STATUS + Inspection date: + Inspection status: + Estimated increasing cost defects per page: + Rule sets: + + ACCEPTANCE REVIEW STATUS + Review date: + Review status: + Reviewers: + + PUBLIC FUNCTION(S) + None. + + PRIVATE FUNCTION(S) + None. + + EXAMPLES + + NOTES + - The constants defined here are replica of the constants defined + in ODCIConst Package defined as part of catodci.sql. If you change + these do make the similar change in catodci.sql. + + MODIFIED (MM/DD/YY) + yhu 02/03/10 - add a new flag ODCI_INDEX_UGI + spsundar 09/13/07 - + yhu 06/02/06 - add callproperty for statistics + yhu 05/22/06 - add ODCI_NODATA to speed rebuild empty index or ind. + part. + srirkris 05/09/06 - change ODCIOrderByInfo_ind + srirkris 02/06/06 - add definitions for CDI query. + spsundar 02/17/06 - add fields/types for system managed domain idx + yhu 02/08/06 - add RenameCol Na d RenameTopADT + yhu 03/11/05 - add flags for rename column and rename table + spsundar 11/28/05 - add fields/types for composite domain idx + yhu 12/06/05 - mapping table for local text indexes + dmukhin 06/29/05 - ANSI prototypes; miscellaneous cleanup + ayoaz 04/21/03 - add CursorNum to ODCIEnv + abrumm 12/30/02 - Bug #2223225: add define for + ODCI_ARG_DESC_LIST_MAXSIZE + ayoaz 10/14/02 - Add Cardinality to ODCIArgDesc + ayoaz 09/11/02 - add ODCIQueryInfo to ODCIIndexCtx + yhu 09/19/02 - add ODCI_DEBUGGING_ON for ODCIEnv.EnvFlags + hsbedi 10/10/02 - add object number into ODCIExtTableInfo + ayoaz 08/30/02 - add ODCITable2 types + tchorma 07/29/02 - Add ODCIFuncCallInfo type for WITH COLUMN CONTEXT + hsbedi 06/29/02 - External table populate + yhu 07/20/01 - add parallel degree in ODCIIndexInfo. + abrumm 02/20/01 - ODCIExtTableInfo: add AccessParmBlob attribute + abrumm 01/18/01 - ODCIExtTableInfo: add default directory + spsundar 08/24/00 - Update attrbiute positions + abrumm 08/04/00 - external tables changes: ODCIExtTableInfo, constants + tchorma 09/11/00 - Add return code ODCI_FATAL + tchorma 08/08/00 - Add Update Block References Option for Alter Index + ayoaz 08/01/00 - Add ODCI_AGGREGATE_REUSE_CTX + spsundar 06/19/00 - add ODCIEnv type + abrumm 06/27/00 - add defines for ODCIExtTable flags + abrumm 06/04/00 - external tables: ODCIExtTableInfo change; add ODCIEnv + ddas 04/28/00 - extensible optimizer enhancements for 8.2 + yhu 06/05/00 - add a bit in IndexInfoFlags for trans. tblspc + yhu 04/10/00 - add ODCIPartInfo & remove ODCIIndexPartList + abrumm 03/29/00 - external table support + spsundar 02/14/00 - update odci definitions for 8.2 + nagarwal 03/07/99 - bug# 838308 - set estimate_stats=1 + rmurthy 11/09/98 - add blocking flag + ddas 10/31/98 - add ODCI_QUERY_SORT_ASC and ODCI_QUERY_SORT_DESC + ddas 05/26/98 - fix ODCIPredInfo flag bits + rmurthy 06/03/98 - add macro for RegularCall + spsundar 05/08/98 - add constants related to ODCIIndexAlter options + rmurthy 04/30/98 - remove include s.h + rmurthy 04/20/98 - name fixes + rmurthy 04/13/98 - add C mappings for odci types + alsrivas 04/10/98 - adding defines for ODCI_INDEX1 + jsriniva 04/04/98 - Creation + +*/ + +#ifndef OCI_ORACLE +# include +#endif +#ifndef ODCI_ORACLE +# define ODCI_ORACLE + +/*---------------------------------------------------------------------------*/ +/* SHORT NAMES SUPPORT SECTION */ +/*---------------------------------------------------------------------------*/ + +#ifdef SLSHORTNAME + +/* The following are short names that are only supported on IBM mainframes + * with the SLSHORTNAME defined. + * With this all subsequent long names will actually be substituted with + * the short names here + */ + +#define ODCIColInfo_ref odcicir +#define ODCIColInfoList odcicil +#define ODCIColInfoList2 odcicil2 +#define ODCIIndexInfo_ref odciiir +#define ODCIPredInfo_ref odcipir +#define ODCIRidList odcirl +#define ODCIIndexCtx_ref odciicr +#define ODCIObject_ref odcior +#define ODCIObjectList odciol +#define ODCIQueryInfo_ref odciqir +#define ODCIFuncInfo_ref odcifir +#define ODCICost_ref odcicr +#define ODCIArgDesc_ref odciadr +#define ODCIArgDescList odciadl +#define ODCIStatsOptions_ref odcisor +#define ODCIColInfo odcici +#define ODCIColInfo_ind odcicii +#define ODCIIndexInfo odciii +#define ODCIIndexInfo_ind odciiii +#define ODCIPredInfo odcipi +#define ODCIPredInfo_ind odcipii +#define ODCIIndexCtx odciic +#define ODCIIndexCtx_ind odciici +#define ODCIObject odcio +#define ODCIObject_ind odcioi +#define ODCIQueryInfo odciqi +#define ODCIQueryInfo_ind odciqii +#define ODCIFuncInfo odcifi +#define ODCIFuncInfo_infd odcifii +#define ODCICost odcic +#define ODCICost_ind odcici +#define ODCIArgDesc odciad +#define ODCIArgDesc_ind odciadi +#define ODCIStatsOptions odciso +#define ODCIStatsOptions_ind odcisoi +#define ODCIPartInfo odcipti +#define ODCIPartInfo_ind odciptii +#define ODCIPartInfo_ref odciptir +#define ODCIExtTableInfo odcixt +#define ODCIExtTableInfo_ind odcixti +#define ODCIExtTableInfo_ref odcixtr +#define ODCIExtTableQCInfo odcixq +#define ODCIExtTableQCInfo_ind odcixqi +#define ODCIExtTableQCInfo_ref odcixqr +#define ODCIFuncCallInfo odcifc +#define ODCIFuncCall_ind odcifci +#define ODCIFuncCall_ref odcifcr +#define ODCIColValList odcicvl +#define ODCIColArrayList odcical +#define ODCIFilterInfoList odciflil +#define ODCIOrderByInfoList odciobil +#define ODCIFilterInfo_ref odciflir +#define ODCIOrderByInfo_ref odciobir +#define ODCICompQueryInfo_ref odcicqir +#define ODCIFilterInfo odcifli +#define ODCIOrderByInfo odciobi +#define ODCICompQueryInfo odcicqi +#define ODCIFilterInfo_ind odciflii +#define ODCIOrderByInfo_ind odciobii +#define ODCICompQueryInfo_ind odcicqii + +#endif /* SLSHORTNAME */ + +/*--------------------------------------------------------------------------- + PUBLIC TYPES AND CONSTANTS + ---------------------------------------------------------------------------*/ + +/* Constants for Return Status */ +#define ODCI_SUCCESS 0 +#define ODCI_ERROR 1 +#define ODCI_WARNING 2 +#define ODCI_ERROR_CONTINUE 3 +#define ODCI_FATAL 4 + +/* Constants for ODCIPredInfo.Flags */ +#define ODCI_PRED_EXACT_MATCH 0x0001 +#define ODCI_PRED_PREFIX_MATCH 0x0002 +#define ODCI_PRED_INCLUDE_START 0x0004 +#define ODCI_PRED_INCLUDE_STOP 0x0008 +#define ODCI_PRED_OBJECT_FUNC 0x0010 +#define ODCI_PRED_OBJECT_PKG 0x0020 +#define ODCI_PRED_OBJECT_TYPE 0x0040 +#define ODCI_PRED_MULTI_TABLE 0x0080 +#define ODCI_PRED_NOT_EQUAL 0x0100 + +/* Constants for QueryInfo.Flags */ +#define ODCI_QUERY_FIRST_ROWS 0x01 +#define ODCI_QUERY_ALL_ROWS 0x02 +#define ODCI_QUERY_SORT_ASC 0x04 +#define ODCI_QUERY_SORT_DESC 0x08 +#define ODCI_QUERY_BLOCKING 0x10 + +/* Constants for ScnFlg(Func /w Index Context) */ +#define ODCI_CLEANUP_CALL 1 +#define ODCI_REGULAR_CALL 2 + +/* Constants for ODCIFuncInfo.Flags */ +#define ODCI_OBJECT_FUNC 0x01 +#define ODCI_OBJECT_PKG 0x02 +#define ODCI_OBJECT_TYPE 0x04 + +/* Constants for ODCIArgDesc.ArgType */ +#define ODCI_ARG_OTHER 1 +#define ODCI_ARG_COL 2 /* column */ +#define ODCI_ARG_LIT 3 /* literal */ +#define ODCI_ARG_ATTR 4 /* object attribute */ +#define ODCI_ARG_NULL 5 +#define ODCI_ARG_CURSOR 6 + +/* Maximum size of ODCIArgDescList array */ +#define ODCI_ARG_DESC_LIST_MAXSIZE 32767 + +/* Constants for ODCIStatsOptions.Options */ +#define ODCI_PERCENT_OPTION 1 +#define ODCI_ROW_OPTION 2 + +/* Constants for ODCIStatsOptions.Flags */ +#define ODCI_ESTIMATE_STATS 0x01 +#define ODCI_COMPUTE_STATS 0x02 +#define ODCI_VALIDATE 0x04 + +/* Constants for ODCIIndexAlter parameter alter_option */ +#define ODCI_ALTIDX_NONE 0 +#define ODCI_ALTIDX_RENAME 1 +#define ODCI_ALTIDX_REBUILD 2 +#define ODCI_ALTIDX_REBUILD_ONL 3 +#define ODCI_ALTIDX_MODIFY_COL 4 +#define ODCI_ALTIDX_UPDATE_BLOCK_REFS 5 +#define ODCI_ALTIDX_RENAME_COL 6 +#define ODCI_ALTIDX_RENAME_TAB 7 +#define ODCI_ALTIDX_MIGRATE 8 + +/* Constants for ODCIIndexInfo.IndexInfoFlags */ +#define ODCI_INDEX_LOCAL 0x0001 +#define ODCI_INDEX_RANGE_PARTN 0x0002 +#define ODCI_INDEX_HASH_PARTN 0x0004 +#define ODCI_INDEX_ONLINE 0x0008 +#define ODCI_INDEX_PARALLEL 0x0010 +#define ODCI_INDEX_UNUSABLE 0x0020 +#define ODCI_INDEX_ONIOT 0x0040 +#define ODCI_INDEX_TRANS_TBLSPC 0x0080 +#define ODCI_INDEX_FUNCTION_IDX 0x0100 +#define ODCI_INDEX_LIST_PARTN 0x0200 +#define ODCI_INDEX_UGI 0x0400 + +/* Constants for ODCIIndexInfo.IndexParaDegree */ +#define ODCI_INDEX_DEFAULT_DEGREE 32767 + +/* Constants for ODCIEnv.EnvFlags */ +#define ODCI_DEBUGGING_ON 0x01 +#define ODCI_NODATA 0x02 + +/* Constants for ODCIEnv.CallProperty */ +#define ODCI_CALL_NONE 0 +#define ODCI_CALL_FIRST 1 +#define ODCI_CALL_INTERMEDIATE 2 +#define ODCI_CALL_FINAL 3 +#define ODCI_CALL_REBUILD_INDEX 4 +#define ODCI_CALL_REBUILD_PMO 5 +#define ODCI_CALL_STATSGLOBAL 6 +#define ODCI_CALL_STATSGLOBALANDPARTITION 7 +#define ODCI_CALL_STATSPARTITION 8 + +/* Constants for ODCIExtTableInfo.OpCode */ +#define ODCI_EXTTABLE_INFO_OPCODE_FETCH 1 +#define ODCI_EXTTABLE_INFO_OPCODE_POPULATE 2 + +/* Constants (bit definitions) for ODCIExtTableInfo.Flag */ + /* sampling type: row or block */ +#define ODCI_EXTTABLE_INFO_FLAG_SAMPLE 0x00000001 +#define ODCI_EXTTABLE_INFO_FLAG_SAMPLE_BLOCK 0x00000002 + /* AccessParmClob, AccessParmBlob discriminator */ +#define ODCI_EXTTABLE_INFO_FLAG_ACCESS_PARM_CLOB 0x00000004 +#define ODCI_EXTTABLE_INFO_FLAG_ACCESS_PARM_BLOB 0x00000008 + +/* Constants for ODCIExtTableInfo.IntraSourceConcurrency */ +#define ODCI_TRUE 1 +#define ODCI_FALSE 0 + +/* Constants (bit definitions) for ODCIExtTable{Open,Fetch,Populate,Close} + * Flag argument. + */ +#define ODCI_EXTTABLE_OPEN_FLAGS_QC 0x00000001 /* caller is Query Coord */ +#define ODCI_EXTTABLE_OPEN_FLAGS_SHADOW 0x00000002 /* caller is shadow proc */ +#define ODCI_EXTTABLE_OPEN_FLAGS_SLAVE 0x00000004 /* caller is slave proc */ + +#define ODCI_EXTTABLE_FETCH_FLAGS_EOS 0x00000001 /* end-of-stream on fetch */ + +/* Constants for Flags argument to ODCIAggregateTerminate */ +#define ODCI_AGGREGATE_REUSE_CTX 1 + +/* Constants for ODCIColInfo.Flags */ +#define ODCI_COMP_FILTERBY_COL 0x0001 +#define ODCI_COMP_ORDERBY_COL 0x0002 +#define ODCI_COMP_ORDERDSC_COL 0x0004 +#define ODCI_COMP_UPDATED_COL 0x0008 +#define ODCI_COMP_RENAMED_COL 0x0010 +#define ODCI_COMP_RENAMED_TOPADT 0x0020 + +/* Constants for ODCIOrderByInfo.ExprType */ +#define ODCI_COLUMN_EXPR 1 +#define ODCI_ANCOP_EXPR 2 + +/* Constants for ODCIOrderByInfo.SortOrder */ +#define ODCI_SORT_ASC 1 +#define ODCI_SORT_DESC 2 +#define ODCI_NULLS_FIRST 4 + +/* Constants for ODCIPartInfo.PartOp */ +#define ODCI_ADD_PARTITION 1 +#define ODCI_DROP_PARTITION 2 + +/*--------------------------------------------------------------------------- + ODCI TYPES + ---------------------------------------------------------------------------*/ +/* + * These are C mappings for the OTS types defined in catodci.sql + */ + +typedef OCIRef ODCIColInfo_ref; +typedef OCIArray ODCIColInfoList; +typedef OCIArray ODCIColInfoList2; +typedef OCIRef ODCIIndexInfo_ref; +typedef OCIRef ODCIPredInfo_ref; +typedef OCIArray ODCIRidList; +typedef OCIRef ODCIIndexCtx_ref; +typedef OCIRef ODCIObject_ref; +typedef OCIArray ODCIObjectList; +typedef OCIRef ODCIQueryInfo_ref; +typedef OCIRef ODCIFuncInfo_ref; +typedef OCIRef ODCICost_ref; +typedef OCIRef ODCIArgDesc_ref; +typedef OCIArray ODCIArgDescList; +typedef OCIRef ODCIStatsOptions_ref; +typedef OCIRef ODCIPartInfo_ref; +typedef OCIRef ODCIEnv_ref; +typedef OCIRef ODCIExtTableInfo_ref; /* external table support */ +typedef OCIArray ODCIGranuleList; /* external table support */ +typedef OCIRef ODCIExtTableQCInfo_ref; /* external table support */ +typedef OCIRef ODCIFuncCallInfo_ref; +typedef OCIArray ODCINumberList; +typedef OCIArray ODCIPartInfoList; +typedef OCIArray ODCIColValList; +typedef OCIArray ODCIColArrayList; +typedef OCIArray ODCIFilterInfoList; +typedef OCIArray ODCIOrderByInfoList; +typedef OCIRef ODCIFilterInfo_ref; +typedef OCIRef ODCIOrderByInfo_ref; +typedef OCIRef ODCICompQueryInfo_ref; + +struct ODCIColInfo +{ + OCIString* TableSchema; + OCIString* TableName; + OCIString* ColName; + OCIString* ColTypName; + OCIString* ColTypSchema; + OCIString* TablePartition; + OCINumber ColFlags; + OCINumber ColOrderPos; + OCINumber TablePartitionIden; + OCINumber TablePartitionTotal; +}; +typedef struct ODCIColInfo ODCIColInfo; + +struct ODCIColInfo_ind +{ + OCIInd atomic; + OCIInd TableSchema; + OCIInd TableName; + OCIInd ColName; + OCIInd ColTypName; + OCIInd ColTypSchema; + OCIInd TablePartition; + OCIInd ColFlags; + OCIInd ColOrderPos; + OCIInd TablePartitionIden; + OCIInd TablePartitionTotal; +}; +typedef struct ODCIColInfo_ind ODCIColInfo_ind; + +struct ODCIFuncCallInfo +{ + struct ODCIColInfo ColInfo; +}; + +struct ODCIFuncCallInfo_ind +{ + struct ODCIColInfo_ind ColInfo; +}; + +struct ODCIIndexInfo +{ + OCIString* IndexSchema; + OCIString* IndexName; + ODCIColInfoList* IndexCols; + OCIString* IndexPartition; + OCINumber IndexInfoFlags; + OCINumber IndexParaDegree; + OCINumber IndexPartitionIden; + OCINumber IndexPartitionTotal; +}; +typedef struct ODCIIndexInfo ODCIIndexInfo; + +struct ODCIIndexInfo_ind +{ + OCIInd atomic; + OCIInd IndexSchema; + OCIInd IndexName; + OCIInd IndexCols; + OCIInd IndexPartition; + OCIInd IndexInfoFlags; + OCIInd IndexParaDegree; + OCIInd IndexPartitionIden; + OCIInd IndexPartitionTotal; +}; +typedef struct ODCIIndexInfo_ind ODCIIndexInfo_ind; + +struct ODCIPredInfo +{ + OCIString* ObjectSchema; + OCIString* ObjectName; + OCIString* MethodName; + OCINumber Flags; +}; +typedef struct ODCIPredInfo ODCIPredInfo; + +struct ODCIPredInfo_ind +{ + OCIInd atomic; + OCIInd ObjectSchema; + OCIInd ObjectName; + OCIInd MethodName; + OCIInd Flags; +}; +typedef struct ODCIPredInfo_ind ODCIPredInfo_ind; + +struct ODCIFilterInfo +{ + ODCIColInfo ColInfo; + OCINumber Flags; + OCIAnyData *strt; + OCIAnyData *stop; +}; +typedef struct ODCIFilterInfo ODCIFilterInfo; + +struct ODCIFilterInfo_ind +{ + OCIInd atomic; + ODCIColInfo_ind ColInfo; + OCIInd Flags; + OCIInd strt; + OCIInd stop; +}; +typedef struct ODCIFilterInfo_ind ODCIFilterInfo_ind; + + +struct ODCIOrderByInfo +{ + OCINumber ExprType; + OCIString *ObjectSchema; + OCIString *TableName; + OCIString *ExprName; + OCINumber SortOrder; +}; +typedef struct ODCIOrderByInfo ODCIOrderByInfo; + +struct ODCIOrderByInfo_ind +{ + OCIInd atomic; + OCIInd ExprType; + OCIInd ObjectSchema; + OCIInd TableName; + OCIInd ExprName; + OCIInd SortOrder; +}; +typedef struct ODCIOrderByInfo_ind ODCIOrderByInfo_ind; + + +struct ODCICompQueryInfo +{ + ODCIFilterInfoList *PredInfo; + ODCIOrderByInfoList *ObyInfo; +}; +typedef struct ODCICompQueryInfo ODCICompQueryInfo; + +struct ODCICompQueryInfo_ind +{ + OCIInd atomic; + OCIInd PredInfo; + OCIInd ObyInfo; +}; +typedef struct ODCICompQueryInfo_ind ODCICompQueryInfo_ind; + + +struct ODCIObject +{ + OCIString* ObjectSchema; + OCIString* ObjectName; +}; +typedef struct ODCIObject ODCIObject; + +struct ODCIObject_ind +{ + OCIInd atomic; + OCIInd ObjectSchema; + OCIInd ObjectName; +}; +typedef struct ODCIObject_ind ODCIObject_ind; + +struct ODCIQueryInfo +{ + OCINumber Flags; + ODCIObjectList* AncOps; + ODCICompQueryInfo CompInfo; +}; +typedef struct ODCIQueryInfo ODCIQueryInfo; + + +struct ODCIQueryInfo_ind +{ + OCIInd atomic; + OCIInd Flags; + OCIInd AncOps; + ODCICompQueryInfo_ind CompInfo; +}; +typedef struct ODCIQueryInfo_ind ODCIQueryInfo_ind; + +struct ODCIIndexCtx +{ + struct ODCIIndexInfo IndexInfo; + OCIString* Rid; + struct ODCIQueryInfo QueryInfo; +}; +typedef struct ODCIIndexCtx ODCIIndexCtx; + +struct ODCIIndexCtx_ind +{ + OCIInd atomic; + struct ODCIIndexInfo_ind IndexInfo; + OCIInd Rid; + struct ODCIQueryInfo_ind QueryInfo; +}; +typedef struct ODCIIndexCtx_ind ODCIIndexCtx_ind; + +struct ODCIFuncInfo +{ + OCIString* ObjectSchema; + OCIString* ObjectName; + OCIString* MethodName; + OCINumber Flags; +}; +typedef struct ODCIFuncInfo ODCIFuncInfo; + +struct ODCIFuncInfo_ind +{ + OCIInd atomic; + OCIInd ObjectSchema; + OCIInd ObjectName; + OCIInd MethodName; + OCIInd Flags; +}; +typedef struct ODCIFuncInfo_ind ODCIFuncInfo_ind; + +struct ODCICost +{ + OCINumber CPUcost; + OCINumber IOcost; + OCINumber NetworkCost; + OCIString* IndexCostInfo; +}; +typedef struct ODCICost ODCICost; + +struct ODCICost_ind +{ + OCIInd atomic; + OCIInd CPUcost; + OCIInd IOcost; + OCIInd NetworkCost; + OCIInd IndexCostInfo; +}; +typedef struct ODCICost_ind ODCICost_ind; + +struct ODCIArgDesc +{ + OCINumber ArgType; + OCIString* TableName; + OCIString* TableSchema; + OCIString* ColName; + OCIString* TablePartitionLower; + OCIString* TablePartitionUpper; + OCINumber Cardinality; +}; +typedef struct ODCIArgDesc ODCIArgDesc; + +struct ODCIArgDesc_ind +{ + OCIInd atomic; + OCIInd ArgType; + OCIInd TableName; + OCIInd TableSchema; + OCIInd ColName; + OCIInd TablePartitionLower; + OCIInd TablePartitionUpper; + OCIInd Cardinality; +}; +typedef struct ODCIArgDesc_ind ODCIArgDesc_ind; + +struct ODCIStatsOptions +{ + OCINumber Sample; + OCINumber Options; + OCINumber Flags; +}; +typedef struct ODCIStatsOptions ODCIStatsOptions; + +struct ODCIStatsOptions_ind +{ + OCIInd atomic; + OCIInd Sample; + OCIInd Options; + OCIInd Flags; +}; +typedef struct ODCIStatsOptions_ind ODCIStatsOptions_ind; + +struct ODCIEnv +{ + OCINumber EnvFlags; + OCINumber CallProperty; + OCINumber DebugLevel; + OCINumber CursorNum; +}; +typedef struct ODCIEnv ODCIEnv; + +struct ODCIEnv_ind +{ + OCIInd _atomic; + OCIInd EnvFlags; + OCIInd CallProperty; + OCIInd DebugLevel; + OCIInd CursorNum; +}; +typedef struct ODCIEnv_ind ODCIEnv_ind; + +struct ODCIPartInfo +{ + OCIString* TablePartition; + OCIString* IndexPartition; + OCINumber IndexPartitionIden; + OCINumber PartOp; +}; +typedef struct ODCIPartInfo ODCIPartInfo; + +struct ODCIPartInfo_ind +{ + OCIInd atomic; + OCIInd TablePartition; + OCIInd IndexPartition; + OCIInd IndexPartitionIden; + OCIInd PartOp; +}; +typedef struct ODCIPartInfo_ind ODCIPartInfo_ind; + +/*---------- External Tables ----------*/ +struct ODCIExtTableInfo +{ + OCIString* TableSchema; + OCIString* TableName; + ODCIColInfoList* RefCols; + OCIClobLocator* AccessParmClob; + OCIBlobLocator* AccessParmBlob; + ODCIArgDescList* Locations; + ODCIArgDescList* Directories; + OCIString* DefaultDirectory; + OCIString* DriverType; + OCINumber OpCode; + OCINumber AgentNum; + OCINumber GranuleSize; + OCINumber Flag; + OCINumber SamplePercent; + OCINumber MaxDoP; + OCIRaw* SharedBuf; + OCIString* MTableName; + OCIString* MTableSchema; + OCINumber TableObjNo; +}; +typedef struct ODCIExtTableInfo ODCIExtTableInfo; + +struct ODCIExtTableInfo_ind +{ + OCIInd _atomic; + OCIInd TableSchema; + OCIInd TableName; + OCIInd RefCols; + OCIInd AccessParmClob; + OCIInd AccessParmBlob; + OCIInd Locations; + OCIInd Directories; + OCIInd DefaultDirectory; + OCIInd DriverType; + OCIInd OpCode; + OCIInd AgentNum; + OCIInd GranuleSize; + OCIInd Flag; + OCIInd SamplePercent; + OCIInd MaxDoP; + OCIInd SharedBuf; + OCIInd MTableName; + OCIInd MTableSchema; + OCIInd TableObjNo; +}; +typedef struct ODCIExtTableInfo_ind ODCIExtTableInfo_ind; + +struct ODCIExtTableQCInfo +{ + OCINumber NumGranules; + OCINumber NumLocations; + ODCIGranuleList* GranuleInfo; + OCINumber IntraSourceConcurrency; + OCINumber MaxDoP; + OCIRaw* SharedBuf; +}; +typedef struct ODCIExtTableQCInfo ODCIExtTableQCInfo; + +struct ODCIExtTableQCInfo_ind +{ + OCIInd _atomic; + OCIInd NumGranules; + OCIInd NumLocations; + OCIInd GranuleInfo; + OCIInd IntraSourceConcurrency; + OCIInd MaxDoP; + OCIInd SharedBuf; +}; +typedef struct ODCIExtTableQCInfo_ind ODCIExtTableQCInfo_ind; + +/*********************************************************/ +/* Table Function Info types (used by ODCITablePrepare) */ +/*********************************************************/ + +struct ODCITabFuncInfo +{ + ODCINumberList* Attrs; + OCIType* RetType; +}; +typedef struct ODCITabFuncInfo ODCITabFuncInfo; + +struct ODCITabFuncInfo_ind +{ + OCIInd _atomic; + OCIInd Attrs; + OCIInd RetType; +}; +typedef struct ODCITabFuncInfo_ind ODCITabFuncInfo_ind; + +/*********************************************************************/ +/* Table Function Statistics types (used by ODCIStatsTableFunction) */ +/*********************************************************************/ + +struct ODCITabFuncStats +{ + OCINumber num_rows; +}; +typedef struct ODCITabFuncStats ODCITabFuncStats; + +struct ODCITabFuncStats_ind +{ + OCIInd _atomic; + OCIInd num_rows; +}; +typedef struct ODCITabFuncStats_ind ODCITabFuncStats_ind; + +/*--------------------------------------------------------------------------- + PRIVATE TYPES AND CONSTANTS + ---------------------------------------------------------------------------*/ + + +/*--------------------------------------------------------------------------- + PUBLIC FUNCTIONS + ---------------------------------------------------------------------------*/ + + +/*--------------------------------------------------------------------------- + PRIVATE FUNCTIONS + ---------------------------------------------------------------------------*/ + + +#endif /* ODCI_ORACLE */ diff --git a/sdk/include/oraca.h b/sdk/include/oraca.h new file mode 100755 index 0000000..5f49c94 --- /dev/null +++ b/sdk/include/oraca.h @@ -0,0 +1,156 @@ +/* + * $Header: oraca.h 24-apr-2003.12:50:59 mkandarp Exp $ oraca.h + */ + +/* Copyright (c) 1985, 2003, Oracle Corporation. All rights reserved. */ + +/* +NAME + ORACA : Oracle Communications Area. +FUNCTION + Contains no code. Provides supplementary communications to/from + Oracle (in addition to standard SQLCA). +NOTES + ************************************************************** + *** *** + *** This file is SOSD. Porters must change the data types *** + *** appropriately on their platform. See notes/pcport.doc *** + *** for more information. *** + *** *** + ************************************************************** + + oracchf : Check cursor cache consistency flag. If set AND oradbgf + is set, then directs SQLLIB to perform cursor cache + consistency checks before every cursor operation + (OPEN, FETCH, SELECT, INSERT, etc.). + oradbgf : Master DEBUG flag. Used to turn all DEBUG options + on or off. + orahchf : Check Heap consistency flag. If set AND oradbgf is set, + then directs SQLLIB to perform heap consistency checks + everytime memory is dynamically allocated/free'd via + sqlalc/sqlfre/sqlrlc. MUST BE SET BEFORE 1ST CONNECT + and once set cannot be cleared (subsequent requests + to change it are ignored). + orastxtf: Save SQL stmt text flag. If set, then directs SQLLIB + to save the text of the current SQL stmt in orastxt + (in VARCHAR format). + orastxt : Saved len and text of current SQL stmt (in VARCHAR + format). + orasfnm : Saved len and text of filename containing current SQL + stmt (in VARCHAR format). + oraslnr : Saved line nr within orasfnm of current SQL stmt. + + Cursor cache statistics. Set after COMMIT or ROLLBACK. Each + CONNECT'd DATABASE has its own set of statistics. + + orahoc : Highest Max Open OraCursors requested. Highest value + for MAXOPENCURSORS by any CONNECT to this DATABASE. + oramoc : Max Open OraCursors required. Specifies the max nr + of OraCursors required to run this pgm. Can be higher + than orahoc if working set (MAXOPENCURSORS) was set + too low, thus forcing the PCC to expand the cache. + oracoc : Current nr of OraCursors used. + oranor : Nr of OraCursor cache reassignments. Can show the + degree of "thrashing" in the cache. Optimally, this + nr should be kept as low as possible (time vs space + optimization). + oranpr : Nr of SQL stmt "parses". + oranex : Nr of SQL stmt "executes". Optimally, the relation- + ship of oranex to oranpr should be kept as high as + possible. + + + If the symbol ORACA_NONE is defined, then there will be no ORACA + *variable*, although there will still be a struct defined. This + macro should not normally be defined in application code. + + If the symbol ORACA_INIT is defined, then the ORACA will be + statically initialized. Although this is not necessary in order + to use the ORACA, it is a good pgming practice not to have + unitialized variables. However, some C compilers/OS's don't + allow automatic variables to be init'd in this manner. Therefore, + if you are INCLUDE'ing the ORACA in a place where it would be + an automatic AND your C compiler/OS doesn't allow this style + of initialization, then ORACA_INIT should be left undefined -- + all others can define ORACA_INIT if they wish. + +OWNER + Clare +DATE + 10/19/85 +MODIFIED + apopat 05/08/02 - [2362423] MVS PE to make lines shorter than 79 + apopat 07/31/99 - [707588] TAB to blanks for OCCS + lvbcheng 10/27/98 - change long to int for oraca + pccint 10/03/96 - Add IS_OSD for linting + jbasu 12/12/94 - Bug 217878: note this is an SOSD file + losborne 09/04/92 - Make oraca variable optional + Osborne 05/24/90 - Add ORACA_STORAGE_CLASS construct + Clare 02/20/86 - PCC [10101l] Feature: Heap consistency check. + Clare 03/04/86 - PCC [10101r] Port: ORACA init ifdef. + Clare 03/12/86 - PCC [10101ab] Feature: ORACA cuc statistics. +*/ +/* IS_OSD */ +#ifndef ORACA +#define ORACA 1 + +struct oraca + { + /* text */ char oracaid[8]; /* Reserved */ + /* ub4 */ int oracabc; /* Reserved */ + + /* Flags which are setable by User. */ + + /* ub4 */ int oracchf; /* <> 0 if "check cur cache consistncy"*/ + /* ub4 */ int oradbgf; /* <> 0 if "do DEBUG mode checking" */ + /* ub4 */ int orahchf; /* <> 0 if "do Heap consistency check" */ + /* ub4 */ int orastxtf; /* SQL stmt text flag */ +#define ORASTFNON 0 /* = don't save text of SQL stmt */ +#define ORASTFERR 1 /* = only save on SQLERROR */ +#define ORASTFWRN 2 /* = only save on SQLWARNING/SQLERROR */ +#define ORASTFANY 3 /* = always save */ + struct + { + /* ub2 */ unsigned short orastxtl; + /* text */ char orastxtc[70]; + } orastxt; /* text of last SQL stmt */ + struct + { + /* ub2 */ unsigned short orasfnml; + /* text */ char orasfnmc[70]; + } orasfnm; /* name of file containing SQL stmt */ + /* ub4 */ int oraslnr; /* line nr-within-file of SQL stmt */ + + /* ub4 */ int orahoc; /* highest max open OraCurs requested */ + /* ub4 */ int oramoc; /* max open OraCursors required */ + /* ub4 */ int oracoc; /* current OraCursors open */ + /* ub4 */ int oranor; /* nr of OraCursor re-assignments */ + /* ub4 */ int oranpr; /* nr of parses */ + /* ub4 */ int oranex; /* nr of executes */ + }; + +#ifndef ORACA_NONE + +#ifdef ORACA_STORAGE_CLASS +ORACA_STORAGE_CLASS struct oraca oraca +#else +struct oraca oraca +#endif +#ifdef ORACA_INIT + = + { + {'O','R','A','C','A',' ',' ',' '}, + sizeof(struct oraca), + 0,0,0,0, + {0,{0}}, + {0,{0}}, + 0, + 0,0,0,0,0,0 + } +#endif + ; + +#endif + +#endif +/* end oraca.h */ diff --git a/sdk/include/oratypes.h b/sdk/include/oratypes.h new file mode 100755 index 0000000..37803bc --- /dev/null +++ b/sdk/include/oratypes.h @@ -0,0 +1,296 @@ +/* $RCSfile: oratypes.h $ $Date: 20-jul-00.13:44:19 + ---------------------------------------------------------------------- + Copyright (c) 1982, 2008, Oracle and/or its affiliates. All rights reserved. + ---------------------------------------------------------------------- */ + +#ifndef ORATYPES +# define ORATYPES +# define SX_ORACLE +# define SX3_ORACLE + +#ifndef ORASTDDEF +# include +# define ORASTDDEF +#endif + +#ifndef ORALIMITS +# include +# define ORALIMITS +#endif + +#ifndef TRUE +# define TRUE 1 +# define FALSE 0 +#endif + +/* --- Signed/Unsigned one-byte scalar (sb1/ub1) --- */ + +#ifndef lint + typedef unsigned char ub1; + typedef signed char sb1; + typedef char eb1; +#else +# define ub1 unsigned char +# define sb1 signed char +# define eb1 char +#endif + +#define UB1MAXVAL ((ub1)UCHAR_MAX) +#define UB1MINVAL ((ub1) 0) +#define SB1MAXVAL ((sb1)SCHAR_MAX) +#define SB1MINVAL ((sb1)SCHAR_MIN) + +#define MINUB1MAXVAL ((ub1) 255) +#define MAXUB1MINVAL ((ub1) 0) +#define MINSB1MAXVAL ((sb1) 127) +#define MAXSB1MINVAL ((sb1) -127) + +#define EB1MAXVAL ((eb1)SCHAR_MAX) +#define EB1MINVAL ((eb1) 0) + +#define MINEB1MAXVAL ((eb1) 127) +#define MAXEB1MINVAL ((eb1) 0) + +#define UB1BITS CHAR_BIT +#define UB1MASK ((1 << ((uword)CHAR_BIT)) - 1) + +/* backwards compatibility */ + +#ifndef lint + typedef sb1 b1; +#else +# define b1 sb1 +#endif + +#define B1MAXVAL SB1MAXVAL +#define B1MINVAL SB1MINVAL + +/* --- Signed/Unsigned two-byte scalar (sb2/ub2) --- */ + +#ifndef lint + typedef unsigned short ub2; + typedef signed short sb2; + typedef short eb2; +#else +# define ub2 unsigned short +# define sb2 signed short +# define eb2 short +#endif + +#define UB2MAXVAL ((ub2)USHRT_MAX) +#define UB2MINVAL ((ub2) 0) +#define SB2MAXVAL ((sb2) SHRT_MAX) +#define SB2MINVAL ((sb2) SHRT_MIN) + +#define MINUB2MAXVAL ((ub2) 65535) +#define MAXUB2MINVAL ((ub2) 0) +#define MINSB2MAXVAL ((sb2) 32767) +#define MAXSB2MINVAL ((sb2)-32767) + +#define EB2MAXVAL ((eb2) SHRT_MAX) +#define EB2MINVAL ((eb2) 0) + +#define MINEB2MAXVAL ((eb2) 32767) +#define MAXEB2MINVAL ((eb2) 0) + +/* backwards compatibility */ + +#ifndef lint + typedef sb2 b2; +#else +# define b2 sb2 +#endif + +#define B2MAXVAL SB2MAXVAL +#define B2MINVAL SB2MINVAL + +/* --- Signed/Unsigned four-byte scalar (sb4/ub4) --- */ + +#ifndef lint + typedef unsigned int ub4; + typedef signed int sb4; + typedef int eb4; +#else +# define ub4 unsigned int +# define sb4 signed int +# define eb4 int +#endif + +#define UB4MAXVAL ((ub4)UINT_MAX) +#define UB4MINVAL ((ub4) 0) +#define SB4MAXVAL ((sb4) INT_MAX) +#define SB4MINVAL ((sb4) INT_MIN) + +#define MINUB4MAXVAL ((ub4) 4294967295) +#define MAXUB4MINVAL ((ub4) 0) +#define MINSB4MAXVAL ((sb4) 2147483647) +#define MAXSB4MINVAL ((sb4)-2147483647) + +#define EB4MAXVAL ((eb4) INT_MAX) +#define EB4MINVAL ((eb4) 0) + +#define MINEB4MAXVAL ((eb4) 2147483647) +#define MAXEB4MINVAL ((eb4) 0) + +/* --- Signed/Unsigned eight-byte scalar (orasb8/oraub8) --- */ + +# define ORAXB8_DEFINED +# ifndef lint +# ifdef __LP64__ + typedef unsigned long oraub8; + typedef signed long orasb8; +# else + typedef unsigned long long oraub8; + typedef signed long long orasb8; +# endif /* __LP64__ */ + typedef oraub8 ub8; + typedef orasb8 sb8; +# else +# define ub8 oraub8 +# define sb8 orasb8 +# ifdef __LP64__ +# define oraub8 unsigned long +# define orasb8 signed long +# else +# define oraub8 unsigned long long +# define orasb8 signed long long +# endif /* __LP64__ */ +# endif /* !lint */ + +# define ORAUB8MINVAL ((oraub8)0) +# define ORAUB8MAXVAL ((oraub8)18446744073709551615) +# define ORASB8MINVAL ((orasb8)-9223372036854775808) +# define ORASB8MAXVAL ((orasb8) 9223372036854775807) + +# define MAXORAUB8MINVAL ((oraub8)0) +# define MINORAUB8MAXVAL ((oraub8)18446744073709551615) +# define MAXORASB8MINVAL ((orasb8)-9223372036854775807) +# define MINORASB8MAXVAL ((orasb8) 9223372036854775807) + +/* backwards compatibility */ + +#ifndef lint + typedef sb4 b4; +#else +# define b4 sb4 +#endif + +#define B4MAXVAL SB4MAXVAL +#define B4MINVAL SB4MINVAL + +/* --- Character pointer --- */ + +#ifdef lint +# define oratext unsigned char +#else + typedef unsigned char oratext; +#endif + +#if !defined(LUSEMFC) +# ifdef lint +# define text unsigned char +# define OraText oratext +# else + typedef oratext text; + typedef oratext OraText; +# endif +#endif + +#if !defined(MOTIF) && !defined(LISPL) && !defined(__cplusplus) && \ + !defined(LUSEMFC) + typedef OraText *string; +#endif + +#ifndef lint + typedef unsigned short utext; +#else +# define utext unsigned short +#endif + +/* --- Boolean --- */ + +#ifndef boolean +# ifndef lint + typedef int boolean; +# else +# define boolean int +# endif +#endif + +/* --- Other data types --- */ + +#ifndef lint + typedef int eword; + typedef unsigned int uword; + typedef signed int sword; +#else +# define eword int +# define uword unsigned int +# define sword signed int +#endif + +#define EWORDMAXVAL ((eword) INT_MAX) +#define EWORDMINVAL ((eword) 0) + +#define UWORDMAXVAL ((uword)UINT_MAX) +#define UWORDMINVAL ((uword) 0) + +#define SWORDMAXVAL ((sword) INT_MAX) +#define SWORDMINVAL ((sword) INT_MIN) + +#define MINEWORDMAXVAL ((eword) 2147483647) +#define MAXEWORDMINVAL ((eword) 0) + +#define MINUWORDMAXVAL ((uword) 4294967295) +#define MAXUWORDMINVAL ((uword) 0) + +#define MINSWORDMAXVAL ((sword) 2147483647) +#define MAXSWORDMINVAL ((sword) -2147483647) + +#ifndef lint + typedef unsigned long ubig_ora; + typedef signed long sbig_ora; +#else +# define ubig_ora unsigned long +# define sbig_ora signed long +#endif + +#define UBIG_ORAMAXVAL ((ubig_ora)ULONG_MAX) +#define UBIG_ORAMINVAL ((ubig_ora) 0) + +#define SBIG_ORAMAXVAL ((sbig_ora) LONG_MAX) +#define SBIG_ORAMINVAL ((sbig_ora) LONG_MIN) + +#define MINUBIG_ORAMAXVAL ((ubig_ora) 4294967295) +#define MAXUBIG_ORAMINVAL ((ubig_ora) 0) + +#define MINSBIG_ORAMAXVAL ((sbig_ora) 2147483647) +#define MAXSBIG_ORAMINVAL ((sbig_ora)-2147483647) + +#define UBIGORABITS (UB1BITS * sizeof(ubig_ora)) + +/* --- Const --- */ + +#undef CONST +#define CONST const + +/* --- Misc --- */ + +#define dvoid void + +typedef void (*lgenfp_t)( void ); + +#ifndef ORASYS_TYPES +# include +# define ORASYS_TYPES +#endif + +#ifndef SIZE_TMAXVAL +# define SIZE_TMAXVAL UBIG_ORAMAXVAL +#endif + +#ifndef MINSIZE_TMAXVAL +# define MINSIZE_TMAXVAL (size_t)4294967295 +#endif + +#endif /* ORATYPES */ diff --git a/sdk/include/ori.h b/sdk/include/ori.h new file mode 100755 index 0000000..60ea1b9 --- /dev/null +++ b/sdk/include/ori.h @@ -0,0 +1,2095 @@ +/* Copyright (c) 1994, 2006, Oracle. All rights reserved. */ + +/* + NAME + ORI - OCI navigational interface + + DESCRIPTION + + This section is intended to give a brief introduction to the navigational + interfaces. Readers can refer to the documents listed in the section + 'RELATED DOCUMENTS' for more information. + + PURPOSE + The Oracle Call Interface (OCI) supports navigational access of objects. + In the navigational paradigm, data is represented as a graph of objects + connected by references. Objects in the graph are reached by following + the references. + + OBJECT ENVIRONMENT + + The object environment is initialized when the OCI environment handle is + initialized with the object option. An object environment contains a + heap which buffers type instances in memory. The object environment also + contains an object cache which keeps track of the objects in the object + environment. Readers can refer to the "Functional Specification for + Programmatic Interface" for more information about the object + environment. + + INSTANCE, OBJECT AND VALUE + + An OTS instance is an occurence of a type specified by the Oracle Type + System (OTS). This section describes how an OTS instance can be + represented in OCI. In OCI, an OTS instance can be classified based on + the type, the lifetime and referencability (see the figure below): + + 1) A persistent object is an instance of an object type. A persistent + object resides in a row of a table in the server and can exist longer + than the duration of a session (connection). Persistent objects can be + identified by object references which contain the object identifiers. + A persistent object is obtained by pinning its object reference. + + 2) A transient object is an instance of an object type. A transient + object cannot exist longer than the duration of a session, and it is + used to contain temporary computing results. Transient objects can + also be identified by references which contain transient object + identifiers. + + 3) A value is an instance of an user-defined type (object type or + collection type) or any built-in OTS type. Unlike objects, values of + object types are identified by memory pointers, rather than by + references. + + A value can be standalone or embbeded. A standalone value is usually + obtained by issuing a select statement. OCI also allows the client + program to select a row of object table into a value by issuing a SQL + statement. Thus, a referenceable object (in the database) can be + represented as a value (which cannot be identified by a reference). + A standalone value can also be an out-of-line attribute in an object + (e.g varchar, raw) or an out-of-line element in a collection (e.g. + varchar, raw, object). + + An embedded value is phyiscally included in a containing instance. + An embedded value can be an in-line attribute in an object (e.g. + number, nested object) or an in-line element in a collection. + + All values are considered to be transient by OCI, e.g. OCI does not + support automatic flushing a value to the database, and the client has + to explicitly execute a SQL statement to store a value into the + database. For embedded values, they are flushed when their containing + instance are flushed. + + + OTS instance + | | + v v + object value (type) + | | + v v + persistent transient (lifetime) + + + persistent obj transient obj value + --------------------------------------------------------------- + | | | | object type, | + | type | object type | object type | built-in, | + | | | | collection | + --------------------------------------------------------------- + | maximum | until object | session | session | + | lifetime | is deleted | | | + --------------------------------------------------------------- + | referencable | yes | yes | no | + --------------------------------------------------------------- + | embeddable | no | no | yes | + --------------------------------------------------------------- + + REFERENCEABLE OBJECT, STANDALONE OBJECT, EMBEDDED OBJECT + + In the reminding of this include file, the following term will be used: + 1) The term 'object' can be generally referred to a persistent object, + a transient object, a standalone value of object type, or an embedded + value of object type. + 2) The term 'referenceable object' refers to a persistent object or a + transient object. + 3) The term 'standalone object' refers to a persistent object, a + transient object or a standalone value of object type. + 4) The term 'embedded object' referes to a embbeded value of object + type. + + META ATTRIBUTES + + There is a set of meta-attributes that are defined for standalone + objects. A meta-attribute can be transient or persistent. A + transient meta-attribute is applicable to an instance only when it is + in memory. A persistent meta-attribute can be applicable to an instance + that is in the disk. + + The set of user visible meta-attributes for persistent objects are: + 1) existent (persistent) : Does the object exist? + 2) nullness (persistent) : Null information of the instance + 3) locked (persistent) : Is the object locked? + 4) pinned (transient) : Is the object being accessed by the client? + 5) dirty (transient) : Has the object been modified? + 6) allocation duration (transient) : see below + 7) pin duration (transient) : see below + + The set of user visible meta-attributes for transient objects are: + 1) existent (transient) : Does the object exist? + 2) nullness (transient) : Null information of the instance + 3) pinned (transient) : Is the object being accessed by the client? + 4) dirty (transient) : Has the object been modified? + 4) allocation duration (transient) : see below + 5) pin duration (transient) : see below + + The set of user visible meta-attributes for standalone values of object + type or collections are: + 1) allocation duration (transient) : see below + 2) nullness (transient) : Null information of the instance + (of an object type) + + NULLNESS OF AN INSTANCE + + Each standalone object is associated with a null structure which keeps + the null information about the object. A null indicates the absence of + data. The null structure itself contains null indicators that represent: + 1) atomic nullness : a null value that pertains to the whole object + 2) null status of the individual attribute in the object + + The layout of a null structure in memory resembles that of the object, + except that the null structure has additional indicators to represent + the atomic nullness for each object. + + An non-existent object is different than an object that is atomically + null. A atomically null object is an existing object that has no data. + + MEMORY LAYOUT OF AN OBJECT + + A standalone object in memory is composed of a top level memory chunk, + a null structure and optionally, a number of secondary memory chunks. + For a DEPARTMENT object type, + + OBJECT TYPE department + { + dep_name varchar2(20), + budget number, + manager person, /o person is an object type o/ + employees collection of person + } + + Each instance of DEPARTMENT will has a top level memory chunk which + contains the top level attributes such as dep_name, budget, manager and + employees. The attributes dep_name and employees are themselves pointers + to the additional memory (the secondary memory chunks). The secondary + memory is for the out-of-line attribute (e.g. varray). + + CONSISTENCY MODEL + + Each pin operation behaves like a distinct SQL select. Thus, the object + cache does not guarantee consistency for a graph of objects. In order to + retrieve a consistent graph of objects, the user has to explicitly start + a serializable transaction or a read-only transaction. + + DURATION + In OCI, a duration is used to specify + + 1) the length of memory allocation of an instance + When each instance is allocated, it is associate with an allocation + duration. The memory occupied by the object is freed automatically + at the end of its allocation duration. The allocation duration of an + instance cannot be changed. + + 2) the length of pinning of an object + When each object is pinned, the client has to give a pin duration + which specify the length of time that the object is intended to be + used. It is an user error to specify a pin duration longer than an + allocation duration of the object. An object is completely unpinned + at the end of its pin duration (see OCIObjectUnpin()). + + An OCI program can use the allocation duration and the pin duration to + automatically free the memory of the instances: + 1) Transient objects and values are freed at the end of the allocation + duration. + 2) Persistent objects ARE freed at the end of the allocation duration. + Persistent objects CAN be freed at the end of the pin duration when + the objects are completely unpinned. The persistent objects are said + to be aged out. See OCIObjectUnpin() for more details. + + There are 3 predefined duration: session, transaction, call. The time + spans of these durations are defined based on the programming model + presented by OCI. The call duration is mapped to the transaction + duration in the client-side environment. See oro.h for the macros defined + for these 3 durations. + + A pin duration can be promoted. For example, if an object is pinned with + duration 1, and the object is later pinned with duration 2, the pin + routine will try to find a duration that is longer or equal to the + length of both duration 1 and duration 2. The pin duration of the object + is set to the that duration. The object is automatically unpinned only + after both duration 1 and duration 2 are terminated. + + RELATED DOCUMENTS + "Functional Specification for Oracle Object RDBMS" + "Functional Specification for Programmatic Interfaces" + "Functional Specification for the Oracle Type System (OTS)" + + INSPECTION STATUS + Inspection date: + Inspection status: + Estimated increasing cost defects per page: + Rule sets: + + ACCEPTANCE REVIEW STATUS + Review date: + Review status: + Reviewers: + + PUBLIC FUNCTIONS + OCIObjectNew - OCI new a standalone instance + OCIObjectPin - OCI pin an object by reference + OCIObjectUnpin - OCI unpin a referenceable object + OCIObjectPinCountReset - OCI reset the pin count of a referenceable object + OCIObjectLock - OCI lock a persistent object + OCIObjectLockNoWait - OCI lock a persistent object + OCIObjectMarkUpdate - OCI mark a referenceable object as updated + OCIObjectUnmark - OCI unmark a dirtied referenceable object + OCIObjectUnmarkByRef - OCI unmark a dirtied object by reference + OCIObjectFree - OCI free a standalone instance + OCIObjectMarkDelete - OCI mark a referenceable object as deleted + OCIObjectMarkDeleteByRef - OCI mark a referenceable object as deleted by + giving a reference + OCIObjectFlush - OCI flush a persistent object + OCIObjectRefresh - OCI refresh a persistent object + OCIObjectCopy - OCI CoPy one object to another + OCIObjectGetTypeRef - OCI get the Type Reference of a standalone object + OCIObjectGetObjectRef - OCI get the Object's Reference + OCIObjectGetInd - OCI get Null Structure of an standalone object + OCIObjectExists - OCI get the existence of a referenceable object + OCIObjectGetProperty - get object property + OCIObjectIsLocked - OCI get the lock status of a referenceable object + OCIObjectIsDirty - OCI get the dirty status of a referenceable object + OCIObjectPinTable - OCI get Table object + OCIObjectArrayPin - OCI pin array of objects + OCIObjectGetPrimayKeyTypeRef - OCI get the Ref for the primary key OID's + type + OCIObjectMakeObjectRef - OCI Create a pk or sys generated REF + + OCIObjectGetNewOID - OCI Create a new Object ID + + OCICacheFlush - OCI flsuh the modified persistent objects in the cache + OCICacheRefresh - OCI refresh persistent objects in the cache + OCICacheUnpin - OCI unpin referenceable objects in the cache + OCICacheFree - OCI free all instances in the environment + OCICacheUnmark - OCI unmark all dirty referenceable objects in the cache + + PRIVATE FUNCTIONS + None + + EXAMPLES + + The following types will be used in the examples in this section: + + OBJECT TYPE professor + ( + varchar2 name; + number department; + number num_of_students; + ); + + OBJECT TYPE course + ( + varchar2 name; + number grade; + ); + + OBJECT TYPE student + ( + vstring name; + number department; + ref advisor; /o advisor is a professor o/ + collection courses; + ); + + EXAMPLE 1 + + Here is a set of examples to illustrate the usages of some of the + orio and oric functions. + + OCIenv *env; /o OCI environment handle o/ + OCIError *err; /o OCI error handle o/ + OCISvcCtx *svc; /o OCI service handle o/ + + void *stu_tbl; /o pointer to the student table o/ + OCIType *stu_tdo; /o student type tdo o/ + + OCIRef *stu2_ref; /o object reference to student object o/ + student *stu1; /o pointer to the student object o/ + student *stu2; /o pointer to the student object o/ + professor *pro; /o pointer to the professor object o/ + + /o Initialize the OCI environment handle, error handle and service + handle and login to the database o/ + ... + + /o CREATE A PERSISTENT OBJECT o/ + + /o get the table object of student o/ + if (OCIObjectPinTable(env, err, svc, "ORACLEU", sizeof("ORACLEU"), + "STUDENT_TABLE", sizeof("STUDENT_TABLE"), (OCIRef *)0, + OCI_DURATION_NULL, &stu_tbl) != OCI_SUCCESS) + /o error handling code o/ + + /o get type object of student o/ + if (OCITypeByName(env, err, svc, "ORACLEU", sizeof("ORACLEU"), + "STUDENT", sizeof("STUDENT"), OCI_DURATION_NULL, OCI_TYPEGET_HEADER, + &stu_tdo) != OCI_SUCCESS) + /o error handling code o/ + + /o create a persistent object 'mark' (of type student) o/ + if (OCIObjectNew(env, err, svc, OCI_TYPECODE_ADT, stu_tdo, stu_tbl, + OCI_DURATION_TRANS, (ub1)FALSE, (void **)&stu1) != OCI_SUCCESS) + /o error handling code o/ + + /o RETRIEVE OBJECTS IN PERSISTENT STORES o/ + + /o Use OCI to retrieve a reference to student object 'joe'. + o The retrieved reference is bound to the variable stu2_ref. + o/ + + /o pin/retrieve the student "joe" by reference o/ + if (OCIObjectPin(env, err, &stu2_ref, (OCIComplexObject *)0, OCI_PIN_ANY, + OCI_DURATION_TRANS, OCI_LOCK_X, &stu2) != OCI_SUCCESS) + /o error handling code o/ + + /o pin/retrieve the advisor of student "joe" by reference o/ + if (OCIObjectPin(env, err, &stu2->advisor, (OCIComplexObject *)0, + OCI_PIN_ANY, OCI_DURATION_TRANS, OCI_LOCK_X, &pro) != OCI_SUCCESS) + /o error handling code o/ + + /o MODIFY OBJECTS o/ + + /o initialize the newly created object "mark" o/ + DISCARD OCIStringAssignText(env, err, "mark", sizeof("mark"), + &stu1->name); + department = 522; + DISCARD OCINumberFromInt(err, &department, sizeof(department), + OCI_NUMBER_UNSIGNED, &stu1->department); + + /o assign advisor to student "mark" o/ + DISCARD OCIRefAssign(env, err, &stu2->advisor, &stu1->advisor); + + /o update student "joe". o/ + department = 533; + DISCARD OCINumberFromInt(err, &department, sizeof(department), + OCI_NUMBER_UNSIGNED, &stu2->department); + DISCARD OCIObjectMarkUpdate(env, err, stu2); + + /o UNPIN OBJECTS AFTER FINSIHED PROCESSING THEM o/ + + /o unpin the student object "mark" o/ + if (OCIObjectUnpin(env, err, stu1) != OCI_SUCCESS) + /o error handling code o/ + + /o unpin the student object "joe" o/ + if (OCIObjectUnpin(env, err, stu2) != OCI_SUCCESS) + /o error handling code o/ + + /o unpin the professor object o/ + if (OCIObjectUnpin(env, err, pro) != OCI_SUCCESS) + /o error handling code o/ + + /o unpin the type object o/ + if (OCIObjectUnpin(env, err, stu_tdo) != OCI_SUCCESS) + /o error handling code o/ + + /o unpin the table object o/ + if (OCIObjectUnpin(env, err, stu_tbl) != OCI_SUCCESS) + /o error handling code o/ + + /o FLUSH MODIFIED OBJECTS BACK TO PERSISTENT STORE o/ + + if (OCICacheFlush(env, err, svc, (void *)0, ((OCIRef*)(*)())0, + (OCIRef *)0) != OCI_SUCCESS) + /o error handling code o/ + + /o commit transaction o/ + + END OF EXAMPLE 1 + + NOTES + This file has been subsetted to contain only the routines that will + be in the first release. + + MODIFIED + dmukhin 06/29/05 - ANSI prototypes; miscellaneous cleanup + srseshad 03/12/03 - convert oci public api to ansi + aahluwal 06/03/02 - bug 2360115 + bpalaval 02/09/01 - Change text to oratext. + rkasamse 06/21/00 - add ociobjectgetnewoid + rkasamse 05/24/00 - add OCIObjectSetData + whe 09/01/99 - 976457:check __cplusplus for C++ code + smuralid 10/29/98 - add comments for OCIObjectMakeObjectRef + mkrishna 08/19/98 - change OCIGetPkTypeRef to OCIObjectGetPrimaryKeyTypeR + mkrishna 08/10/98 - add OCIObjectMakeObjectRef & OCIObjectGetPkTypeRef + rkasamse 06/22/98 - add comments for OCIDurationBegin(End) + pmitra 04/01/98 - OCIObjectLockNoWait added + pmitra 11/05/97 - [573769] OCIObjectArrayPin pos parameter cannot be NU + cxcheng 07/29/97 - fix compile for short names + skrishna 07/14/97 - add OCIObjectGetProperty + skrishna 04/30/97 - OCIObjectFlushRefresh: remove duplicate declaration + skrishna 04/24/97 - flag unsupported functions + sthakur 03/20/97 - modify flag argument to OCIObjectFree + skrishna 03/18/97 - fix ifdef for supporting ansi and k&r proto-types + cxcheng 02/19/97 - remove short names support + cxcheng 02/06/97 - take out short name support except with SLSHORTNAME + sthakur 12/20/96 - fix a typepo in OCIOBjectArrayPin + jboonleu 11/07/96 - modify comments + cxcheng 10/28/96 - more beautification changes + jboonleu 10/24/96 - add flag to OCIObjectFree + jboonleu 10/22/96 - change interface of OCICacheFlush + cxcheng 10/18/96 - rename OCIObjectPinArray to OCIObjectArrayPin + cxcheng 10/14/96 - more renaming of types + jboonleu 10/09/96 - add new interfaces + cxcheng 10/09/96 - more lint fixes + cxcheng 10/08/96 - more lint fixes + jboonleu 09/27/96 - fix lint errors + jboonleu 10/07/96 - beautify ori.h after conversion to long names + cxcheng 10/04/96 - replace short names with long names + sthakur 08/20/96 - add COR context to OCIObjectPin + mluong 07/17/96 - add back orioglk, oriogdr, oriogiv, and oriocur. + jboonleu 07/17/96 - rename refresh option to conherency option + jboonleu 07/16/96 - change comment for cache consistency + jwijaya 07/03/96 - add ANSI prototypes + jboonleu 06/12/96 - update comment + jboonleu 05/08/96 - change description of OCIDurationGetParent + jboonleu 05/01/96 - add OROOCOSFN + skrishna 04/08/96 - change ori*() to take OCIEnv* and OCIError* instead + of oroenv* + jboonleu 01/04/96 - interface change + jboonleu 10/24/95 - support of variable ref + jboonleu 02/15/95 - new interface + sthakur 01/05/95 - pass username to origrgc + skotsovo 12/07/94 - update example + jwijaya 11/15/94 - rename ORONSPTAB to ORONSPEXT + jwijaya 10/06/94 - add namespace to oriopnm() + jwijaya 10/02/94 - connection handle -> connection number + jboonleu 08/16/94 - fix lint errors + jboonleu 07/20/94 - change interface of OCICacheFlush + tanguyen 07/18/94 - add oriocpe, change OCIObjectCopy to oriocps + tcheng 07/15/94 - add init param maximum_sga_heap_size + tcheng 07/13/94 - change origini to get param string + jboonleu 07/05/94 - change sccs string from sccid to a comment + jboonleu 07/01/94 - Add examples to ORIO* and ORIC* functions + tanguyen 06/30/94 - Fix the ORI_ORACLE ifdef + skotsovo 06/27/94 - include all public functions in public functions + list at top of header file + tcheng 06/27/94 - modify comments according to new template + tanguyen 06/24/94 - fix comments for OCIObjectCopy + tcheng 06/24/94 - fix comments in origrgc() + tanguyen 06/21/94 - fix comments and format + tcheng 06/20/94 - commenting origini/trm/err/rgc/urg() functions + tanguyen 06/16/94 - fix descriptions of ref operations + tanguyen 06/16/94 - clarifies refs comparison + tanguyen 05/12/94 - adds more interfaces (OCIObjectMarkUpdate) + jwijaya 05/10/94 - fix examples, add origurg, change origcon to origrgc + tanguyen 05/03/94 - remove unnecessary 'type' argument from + 'OCIObjectCopy' + tanguyen 03/08/94 - clarifies comments + jwijaya 02/16/94 - more questions + jwijaya 02/11/94 - more comments + jwijaya 02/10/94 - identify optional arguments + jwijaya 02/07/94 - Creation +*/ + + +#ifndef ORATYPES +#include +#endif +#ifndef ORO_ORACLE +#include +#endif +#ifndef OCI_ORACLE +#include +#endif +#ifndef ORT_ORACLE +#include +#endif + +#ifndef ORI_ORACLE +#define ORI_ORACLE + +/*---------------------------------------------------------------------------*/ +/* SHORT NAMES SUPPORT SECTION */ +/*---------------------------------------------------------------------------*/ + +#ifdef SLSHORTNAME + +/* the following are short names that are only supported on IBM mainframes + with the SLSHORTNAME defined. + With this all subsequent long names will actually be substituted with + the short names here */ + +#define OCIDurationBegin origbgu +#define OCIDurationEnd origedu +#define OCIDurationGetParent origpdr +#define OCICacheFlushRefresh oricfrh +#define OCICacheUnpin oricunp +#define OCICacheFree oricfre +#define OCICacheUnmark oricumk +#define OCICacheGetObjects oricgpr +#define OCICacheRegister oricscb +#define OCIObjectUnpin oriounp +#define OCIObjectPinCountReset orioupz +#define OCIObjectLock oriolck +#define OCIObjectLockNoWait oriolnw +#define OCIObjectMarkUpdate orioupd +#define OCIObjectUnmark orioumk +#define OCIObjectUnmarkByRef orioumr +#define OCIObjectAlwaysLatest oriomkl +#define OCIObjectNotAlwaysLatest oriouml +#define OCIObjectMarkDeleteByRef oriordl +#define OCIObjectMarkDelete oriopdl +#define OCIObjectFlush oriofls +#define OCIObjectFlushRefresh oriofrh +#define OCIObjectCopy oriocpy +#define OCIObjectGetTypeRef oriogtr +#define OCIObjectGetObjectRef oriogor +#define OCIObjectGetInd oriogns +#define OCIObjectExists oriogex +#define OCIObjectGetProperty oriogpr +#define OCIObjectRefresh oriorfs +#define OCIObjectPinTable oriogtb +#define OCIObjectGetPrimaryKeyTypeRef oriogpf +#define OCIObjectMakeObjectRef oriomrf + +#define OCIObjectNew orionew +#define OCIObjectPin oriopin +#define OCIObjectFree oriofre +#define OCIObjectArrayPin orioapn +#define OCIObjectIsDirty oriodrt +#define OCIObjectIsDirtied oriodrd +#define OCIObjectIsLoaded orioldd +#define OCICacheFlush oricfls +#define OCICacheRefresh oricrfs + +#endif /* SLSHORTNAME */ + +/*---------------------------------------------------------------------------*/ +/* PUBLIC TYPES AND CONSTANTS */ +/*---------------------------------------------------------------------------*/ + +/* Also see oro.h. */ + +/*---------------------------------------------------------------------------*/ +/* PUBLIC FUNCTIONS */ +/*---------------------------------------------------------------------------*/ +/*---------------------------------------------------------------------------*/ +/* OBJECT/INSTANCE OPERATIONS */ +/*---------------------------------------------------------------------------*/ + +/*--------------------------- OCIObjectNew ----------------------------------*/ +sword OCIObjectNew( OCIEnv *env, OCIError *err, const OCISvcCtx *svc, + OCITypeCode typecode, OCIType *tdo, void *table, + OCIDuration duration, boolean value, + void **instance ); +/* + NAME: OCIObjectNew - OCI new (create) a standalone instance + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + svc (IN) - OCI service handle. + typecode (IN) - the typecode of the type of the instance. + tdo (IN, optional) - pointer to the type descriptor object. The + TDO describes the type of the instance that is to be + created. Refer to OCITypeByName() for obtaining a TDO. + The TDO is required for creating a named type (e.g. an + object or a collection). + table (IN, optional) - pointer to a table object which specifies a + table in the server. This parameter can be set to NULL + if no table is given. See the description below to find + out how the table object and the TDO are used together + to determine the kind of instances (persistent, + transient, value) to be created. Also see + OCIObjectPinTable() for retrieving a table object. + duration (IN) - this is an overloaded parameter. The use of this + parameter is based on the kind of the instance that is + to be created. + a) persistent object. This parameter specifies the + pin duration. + b) transient object. This parameter specififes the + allocation duration and pin duration. + c) value. This parameter specifies the allocation + duration. + value (IN) - specifies whether the created object is a value. + If TRUE, then a value is created. Otherwise, a + referenceable object is created. If the instance is + not an object, then this parameter is ignored. + instance (OUT) - address of the newly created instance + + REQUIRES: + - a valid OCI environment handle must be given. + DESCRIPTION: + This function creates a new instance of the type specified by the + typecode or the TDO. Based on the parameters 'typecode' (or 'tdo'), + 'value' and 'table', different kinds of instances can be created: + + The parameter 'table' is not NULL? + + yes no + ---------------------------------------------------------------- + | object type (value=TRUE) | value | value | + ---------------------------------------------------------------- + | object type (value=FALSE) | persistent obj | transient obj | + type ---------------------------------------------------------------- + | built-in type | value | value | + ---------------------------------------------------------------- + | collection type | value | value | + ---------------------------------------------------------------- + + This function allocates the top level memory chunk of an OTS instance. + The attributes in the top level memory are initialized (e.g. an + attribute of varchar2 is initialized to a vstring of 0 length). + + If the instance is an object, the object is marked existed but is + atomically null. + + FOR PERSISTENT OBJECTS: + The object is marked dirty and existed. The allocation duration for + the object is session. The object is pinned and the pin duration is + specified by the given parameter 'duration'. + + FOR TRANSIENT OBJECTS: + The object is pinned. The allocation duration and the pin duration are + specified by the given parameter 'duration'. + + FOR VALUES: + The allocation duration is specified by the given parameter 'duration'. + + RETURNS: + if environment handle or error handle is null, return + OCI_INVALID_HANDLE. + if operation suceeds, return OCI_SUCCESS. + if operation fails, return OCI_ERROR. + */ + +/*--------------------------- OCIObjectPin ----------------------------------*/ +sword OCIObjectPin( OCIEnv *env, OCIError *err, OCIRef *object_ref, + OCIComplexObject *corhdl, OCIPinOpt pin_option, + OCIDuration pin_duration, + OCILockOpt lock_option, void **object ); +/* + NAME: OCIObjectPin - OCI pin a referenceable object + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns + OCI_ERROR. The error recorded in 'err' can be + retrieved by calling OCIErrorGet(). + object_ref (IN) - the reference to the object. + corhdl (IN) - handle for complex object retrieval. + pin_option (IN) - See description below. + pin_duration (IN) - The duration of which the object is being accesed + by a client. The object is implicitly unpinned at + the end of the pin duration. + If OCI_DURATION_NULL is passed, there is no pin + promotion if the object is already loaded into + the cache. If the object is not yet loaded, then + the pin duration is set to OCI_DURATION_DEFAULT. + lock_option (IN) - lock option (e.g., exclusive). If a lock option + is specified, the object is locked in the server. + See 'oro.h' for description about lock option. + object (OUT) - the pointer to the pinned object. + + REQUIRES: + - a valid OCI environment handle must be given. + DESCRIPTION: + + This function pins a referenceable object instance given the object + reference. The process of pinning serves three purposes: + + 1) locate an object given its reference. This is done by the object + cache which keeps track of the objects in the object heap. + + 2) notify the object cache that an object is being in use. An object + can be pinned many times. A pinned object will remain in memory + until it is completely unpinned (see OCIObjectUnpin()). + + 3) notify the object cache that a persistent object is being in use + such that the persistent object cannot be aged out. Since a + persistent object can be loaded from the server whenever is needed, + the memory utilization can be increased if a completely unpinned + persistent object can be freed (aged out), even before the + allocation duration is expired. + + Also see OCIObjectUnpin() for more information about unpinning. + + FOR PERSISTENT OBJECTS: + + When pinning a persistent object, if it is not in the cache, the object + will be fetched from the persistent store. The allocation duration of + the object is session. If the object is already in the cache, it is + returned to the client. The object will be locked in the server if a + lock option is specified. + + This function will return an error for a non-existent object. + + A pin option is used to specify the copy of the object that is to be + retrieved: + + 1) If option is OCI_PIN_ANY (pin any), if the object is already + in the environment heap, return this object. Otherwise, the object + is retrieved from the database. This option is useful when the + client knows that he has the exclusive access to the data in a + session. + + 2) If option is OCI_PIN_LATEST (pin latest), if the object is + not cached, it is retrieved from the database. If the object is + cached, it is refreshed with the latest version. See + OCIObjectRefresh() for more information about refreshing. + + 3) If option is OCI_PIN_RECENT (pin recent), if the object is loaded + into the cache in the current transaction, the object is returned. + If the object is not loaded in the current transaction, the object + is refreshed from the server. + + FOR TRANSIENT OBJECTS: + + This function will return an error if the transient object has already + been freed. This function does not return an error if an exclusive + lock is specified in the lock option. + + RETURNS: + if environment handle or error handle is null, return + OCI_INVALID_HANDLE. + if operation suceeds, return OCI_SUCCESS. + if operation fails, return OCI_ERROR. + */ + +/*------------------------------ OCIObjectUnpin -----------------------------*/ +sword OCIObjectUnpin( OCIEnv *env, OCIError *err, void *object ); +/* + NAME: OCIObjectUnpin - OCI unpin a referenceable object + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by + calling OCIErrorGet(). + object (IN) - pointer to an object + REQUIRES: + - a valid OCI environment handle must be given. + - The specified object must be pinned. + DESCRIPTION: + This function unpins an object. An object is completely unpinned when + 1) the object was unpinned N times after it has been pinned N times + (by calling OCIObjectPin()). + 2) it is the end of the pin duration + 3) the function OCIObjectPinCountReset() is called + + There is a pin count associated with each object which is incremented + whenever an object is pinned. When the pin count of the object is zero, + the object is said to be completely unpinned. An unpinned object can + be freed without error. + + FOR PERSISTENT OBJECTS: + When a persistent object is completely unpinned, it becomes a candidate + for aging. The memory of an object is freed when it is aged out. Aging + is used to maximize the utilization of memory. An dirty object cannot + be aged out unless it is flushed. + + FOR TRANSIENT OBJECTS: + The pin count of the object is decremented. A transient can be freed + only at the end of its allocation duration or when it is explicitly + deleted by calling OCIObjectFree(). + + FOR VALUE: + This function will return an error for value. + + RETURNS: + if environment handle or error handle is null, return + OCI_INVALID_HANDLE. + if operation suceeds, return OCI_SUCCESS. + if operation fails, return OCI_ERROR. + */ + +/*---------------------------- OCIObjectPinCountReset -----------------------*/ +sword OCIObjectPinCountReset( OCIEnv *env, OCIError *err, void *object ); +/* + NAME: OCIObjectPinCountReset - OCI resets the pin count of a referenceable + object + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by + calling OCIErrorGet(). + object (IN) - pointer to an object + REQUIRES: + - a valid OCI environment handle must be given. + - The specified object must be pinned. + DESCRIPTION: + This function completely unpins an object. When an object is + completely unpinned, it can be freed without error. + + FOR PERSISTENT OBJECTS: + When a persistent object is completely unpinned, it becomes a candidate + for aging. The memory of an object is freed when it is aged out. Aging + is used to maximize the utilization of memory. An dirty object cannot + be aged out unless it is flushed. + + FOR TRANSIENT OBJECTS: + The pin count of the object is decremented. A transient can be freed + only at the end of its allocation duration or when it is explicitly + freed by calling OCIObjectFree(). + + FOR VALUE: + This function will return an error for value. + + RETURNS: + if environment handle or error handle is null, return + OCI_INVALID_HANDLE. + if operation suceeds, return OCI_SUCCESS. + if operation fails, return OCI_ERROR. + */ + +/*--------------------------- OCIObjectLock ---------------------------------*/ +sword OCIObjectLock( OCIEnv *env, OCIError *err, void *object ); +/* + NAME: OCIObjectLock - OCI lock a persistent object + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by + calling OCIErrorGet(). + object (IN) - pointer to the persistent object + REQUIRES: + - a valid OCI environment handle must be given. + - The specified object must be pinned. + DESCRIPTION: + This function locks a persistent object at the server. Unlike + OCIObjectLockNoWait() this function waits if another user currently + holds a lock on the desired object. This function + returns an error if: + 1) the object is non-existent. + + This function will return an error for transient objects and values. + The lock of an object is released at the end of a transaction. + + RETURNS: + if environment handle or error handle is null, return + OCI_INVALID_HANDLE. + if operation suceeds, return OCI_SUCCESS. + if operation fails, return OCI_ERROR. +*/ + +/*------------------------ OCIObjectLockNoWait ------------------------------*/ +sword OCIObjectLockNoWait( OCIEnv *env, OCIError *err, void *object ); +/* + NAME: OCIObjectLockNoWait - OCI lock a persistent object, do not wait for + the lock, return error if lock not available + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by + calling OCIErrorGet(). + object (IN) - pointer to the persistent object + REQUIRES: + - a valid OCI environment handle must be given. + - The specified object must be pinned. + DESCRIPTION: + This function locks a persistent object at the server. Unlike + OCIObjectLock() this function will not wait if another user holds + the lock on the desired object. This function returns an error if: + 1) the object is non-existent. + 2) the object is currently locked by another user in which + case this function returns with an error. + + This function will return an error for transient objects and values. + The lock of an object is released at the end of a transaction. + + RETURNS: + if environment handle or error handle is null, return + OCI_INVALID_HANDLE. + if operation suceeds, return OCI_SUCCESS. + if operation fails, return OCI_ERROR. +*/ + +/*--------------------------- OCIObjectMarkUpdate ---------------------------*/ +sword OCIObjectMarkUpdate( OCIEnv *env, OCIError *err, void *object ); +/* + NAME: OCIObjectMarkUpdate - OCI marks an object as updated + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by + calling OCIErrorGet(). + object (IN) - pointer to the persistent object + REQUIRES: + - a valid OCI environment handle must be given. + - The specified object must be pinned. + DESCRIPTION: + FOR PERSISTENT OBJECTS: + This function marks the specified persistent object as updated. The + persistent objects will be written to the server when the object cache + is flushed. The object is not locked or flushed by this function. It + is an error to update a deleted object. + + After an object is marked updated and flushed, this function must be + called again to mark the object as updated if it has been dirtied + after it is being flushed. + + FOR TRANSIENT OBJECTS: + This function marks the specified transient object as updated. The + transient objects will NOT be written to the server. It is an error + to update a deleted object. + + FOR VALUES: + It is an no-op for values. + + RETURNS: + if environment handle or error handle is null, return + OCI_INVALID_HANDLE. + if operation suceeds, return OCI_SUCCESS. + if operation fails, return OCI_ERROR. + */ + +/*----------------------------- OCIObjectUnmark -----------------------------*/ +sword OCIObjectUnmark( OCIEnv *env, OCIError *err, void *object ); +/* + NAME: OCIObjectUnmark - OCI unmarks an object + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by + calling OCIErrorGet(). + object (IN) - pointer to the persistent object + REQUIRES: + - a valid OCI environment handle must be given. + - The specified object must be pinned. + DESCRIPTION: + FOR PERSISTENT OBJECTS AND TRANSIENT OBJECTS: + This function unmarks the specified persistent object as dirty. Changes + that are made to the object will not be written to the server. If the + object is marked locked, it remains marked locked. The changes that + have already made to the object will not be undone implicitly. + + FOR VALUES: + It is an no-op for values. + + RETURNS: + if environment handle or error handle is null, return + OCI_INVALID_HANDLE. + if operation suceeds, return OCI_SUCCESS. + if operation fails, return OCI_ERROR. + */ + +/*----------------------------- OCIObjectUnmarkByRef ------------------------*/ +sword OCIObjectUnmarkByRef( OCIEnv *env, OCIError *err, OCIRef *ref ); +/* + NAME: OCIObjectUnmarkByRef - OCI unmarks an object by Ref + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by + calling OCIErrorGet(). + ref (IN) - reference of the object + REQUIRES: + - a valid OCI environment handle must be given. + - The specified object must be pinned. + DESCRIPTION: + FOR PERSISTENT OBJECTS AND TRANSIENT OBJECTS: + This function unmarks the specified persistent object as dirty. Changes + that are made to the object will not be written to the server. If the + object is marked locked, it remains marked locked. The changes that + have already made to the object will not be undone implicitly. + + FOR VALUES: + It is an no-op for values. + + RETURNS: + if environment handle or error handle is null, return + OCI_INVALID_HANDLE. + if operation suceeds, return OCI_SUCCESS. + if operation fails, return OCI_ERROR. + */ + +/*--------------------------- OCIObjectFree ---------------------------------*/ +sword OCIObjectFree( OCIEnv *env, OCIError *err, void *instance, + ub2 flags ); +/* + NAME: OCIObjectFree - OCI free (and unpin) an standalone instance + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns + OCI_ERROR. The error recorded in 'err' can be + retrieved by calling OCIErrorGet(). + instance (IN) - pointer to a standalone instance. + flags (IN) - If OCI_OBJECT_FREE_FORCE is set, free the object + even if it is pinned or dirty. + If OCI_OBJECT_FREE_NONULL is set, the null + structure will not be freed. + REQUIRES: + - a valid OCI environment handle must be given. + - The instance to be freed must be standalone. + - If the instance is a referenceable object, the object must be pinned. + DESCRIPTION: + This function deallocates all the memory allocated for an OTS instance, + including the null structure. + + FOR PERSISTENT OBJECTS: + This function will return an error if the client is attempting to free + a dirty persistent object that has not been flushed. The client should + either flush the persistent object or set the parameter 'flag' to + OCI_OBJECT_FREE_FORCE. + + This function will call OCIObjectUnpin() once to check if the object + can be completely unpin. If it succeeds, the rest of the function will + proceed to free the object. If it fails, then an error is returned + unless the parameter 'flag' is set to OCI_OBJECT_FREE_FORCE. + + Freeing a persistent object in memory will not change the persistent + state of that object at the server. For example, the object will + remain locked after the object is freed. + + FOR TRANSIENT OBJECTS: + + This function will call OCIObjectUnpin() once to check if the object + can be completely unpin. If it succeeds, the rest of the function will + proceed to free the object. If it fails, then an error is returned + unless the parameter 'flag' is set to OCI_OBJECT_FREE_FORCE. + + FOR VALUES: + The memory of the object is freed immediately. + + RETURNS: + if environment handle or error handle is null, return + OCI_INVALID_HANDLE. + if operation suceeds, return OCI_SUCCESS. + if operation fails, return OCI_ERROR. +*/ + +/*----------------------- OCIObjectMarkDeleteByRef --------------------------*/ +sword OCIObjectMarkDeleteByRef( OCIEnv *env, OCIError *err, + OCIRef *object_ref); +/* + NAME: OCIObjectMarkDeleteByRef - OCI "delete" (and unpin) an object given + a reference + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns + OCI_ERROR. The error recorded in 'err' can be + retrieved by calling OCIErrorGet(). + object_ref (IN) - ref of the object to be deleted + + REQUIRES: + - a valid OCI environment handle must be given. + DESCRIPTION: + This function marks the object designated by 'object_ref' as deleted. + + FOR PERSISTENT OBJECTS: + If the object is not loaded, then a temporary object is created and is + marked deleted. Otherwise, the object is marked deleted. + + The object is deleted in the server when the object is flushed. + + FOR TRANSIENT OBJECTS: + The object is marked deleted. The object is not freed until it is + unpinned. + + RETURNS: + if environment handle or error handle is null, return + OCI_INVALID_HANDLE. + if operation suceeds, return OCI_SUCCESS. + if operation fails, return OCI_ERROR. + */ + +/*--------------------------- OCIObjectMarkDelete ---------------------------*/ +sword OCIObjectMarkDelete( OCIEnv *env, OCIError *err, void *instance ); +/* + NAME: OCIObjectMarkDelete - OCI "delete" an instance given a Pointer + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns + OCI_ERROR. The error recorded in 'err' can be + retrieved by calling OCIErrorGet(). + instance (IN) - pointer to the instance + REQUIRES: + - a valid OCI environment handle must be given. + - The instance must be standalone. + - If the instance is a referenceable object, then it must be pinned. + DESCRIPTION: + + FOR PERSISTENT OBJECTS: + The object is marked deleted. The memory of the object is not freed. + The object is deleted in the server when the object is flushed. + + FOR TRANSIENT OBJECTS: + The object is marked deleted. The memory of the object is not freed. + + FOR VALUES: + This function frees a value immediately. + + RETURNS: + if environment handle or error handle is null, return + OCI_INVALID_HANDLE. + if operation suceeds, return OCI_SUCCESS. + if operation fails, return OCI_ERROR. + */ + +/*---------------------------- OCIObjectFlush -------------------------------*/ +sword OCIObjectFlush( OCIEnv *env, OCIError *err, void *object ); +/* + NAME: OCIObjectFlush - OCI flush a persistent object + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns + OCI_ERROR. The error recorded in 'err' can be + retrieved by calling OCIErrorGet(). + object (IN) - pointer to the persistent object + REQUIRES: + - a valid OCI environment handle must be given. + - The specified object must be pinned. + DESCRIPTION: + This function flushes a modified persistent object to the server. + An exclusive lock is obtained implicitly for the object when flushed. + + When the object is written to the server, triggers may be fired. + Objects can be modified by the triggers at the server. To keep the + objects in the object cache being coherent with the database, the + clients can free or refresh the objects in the cache. + + This function will return an error for transient objects and values. + + RETURNS: + if environment handle or error handle is null, return + OCI_INVALID_HANDLE. + if operation suceeds, return OCI_SUCCESS. + if operation fails, return OCI_ERROR. + */ + +/*------------------------ OCIObjectRefresh ---------------------------------*/ +sword OCIObjectRefresh( OCIEnv *env, OCIError *err, void *object ); +/* + NAME: OCIObjectRefresh - OCI refresh a persistent object + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns + OCI_ERROR. The error recorded in 'err' can be + retrieved by calling OCIErrorGet(). + object (IN) - pointer to the persistent object + REQUIRES: + - a valid OCI environment handle must be given. + - The specified object must be pinned. + DESCRIPTION: + This function refreshes an unmarked object with data retrieved from the + latest snapshot in the server. An object should be refreshed when the + objects in the cache are inconsistent with the objects at + the server: + 1) When an object is flushed to the server, triggers can be fired to + modify more objects in the server. The same objects (modified by + the triggers) in the object cache become obsolete. + 2) When the user issues a SQL or executes a PL/SQL procedure to modify + any object in the server, the same object in the cache becomes + obsolete. + + The object that is refreshed will be 'replaced-in-place'. When an + object is 'replaced-in-place', the top level memory of the object will + be reused so that new data can be loaded into the same memory address. + The top level memory of the null structre is also reused. Unlike the + top level memory chunk, the secondary memory chunks may be resized and + reallocated. The client should be careful when holding onto a pointer + to the secondary memory chunk (e.g. assigning the address of a + secondary memory to a local variable), since this pointer can become + invalid after the object is refreshed. + + The object state will be modified as followed after being refreshed: + - existent : set to appropriate value + - pinned : unchanged + - allocation duration : unchanged + - pin duration : unchanged + + This function is an no-op for transient objects or values. + + RETURNS: + if environment handle or error handle is null, return + OCI_INVALID_HANDLE. + if operation suceeds, return OCI_SUCCESS. + if operation fails, return OCI_ERROR. + */ + +/*---------------------------- OCIObjectCopy --------------------------------*/ +sword OCIObjectCopy( OCIEnv *env, OCIError *err, const OCISvcCtx *svc, + void *source, void *null_source, + void *target, void *null_target, OCIType *tdo, + OCIDuration duration, ub1 option ); +/* + NAME: OCIObjectCopy - OCI copy one instance to another + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns + OCI_ERROR. The error recorded in 'err' can be + retrieved by calling OCIErrorGet(). + svc (IN) - OCI service context handle + source (IN) - pointer to the source instance + null_source (IN) - pointer to the null structure of the source + target (IN) - pointer to the target instance + null_target (IN) - pointer to the null structure of the target + tdo (IN) - the TDO for both source and target + duration (IN) - allocation duration of the target memory + option (IN) - specify the copy option: + OROOCOSFN - Set Reference to Null. All references + in the source will not be copied to the target. The + references in the target are set to null. + REQUIRES: + - a valid OCI environment handle must be given. + - If source or target is referenceable, it must be pinned. + - The target or the containing instance of the target must be already + be instantiated (e.g. created by OCIObjectNew()). + - The source and target instances must be of the same type. If the + source and target are located in a different databases, then the + same type must exist in both databases. + DESCRIPTION: + This function copies the contents of the 'source' instance to the + 'target' instance. This function performs a deep-copy such that the + data that is copied/duplicated include: + a) all the top level attributes (see the exceptions below) + b) all the secondary memory (of the source) that is reachable from the + top level attributes. + c) the null structure of the instance + + Memory is allocated with the specified allocation duration. + + Certain data items are not copied: + a) If the option OCI_OBJECTCOPY_NOREF is specified, then all references + in the source are not copied. Instead, the references in the target + are set to null. + b) If the attribute is a LOB, then it is set to null. + + RETURNS: + if environment handle or error handle is null, return + OCI_INVALID_HANDLE. + if operation suceeds, return OCI_SUCCESS. + if operation fails, return OCI_ERROR. + */ + +/*---------------------------- OCIObjectGetTypeRef --------------------------*/ +sword OCIObjectGetTypeRef( OCIEnv *env, OCIError *err, void *instance, + OCIRef *type_ref ); +/* + NAME: OCIObjectGetTypeRef - get the type reference of a standalone object + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns + OCI_ERROR. The error recorded in 'err' can be + retrieved by calling OCIErrorGet(). + instance (IN) - pointer to an standalone instance + type_ref (OUT) - reference to the type of the object. The reference + must already be allocated. + REQUIRES: + - a valid OCI environment handle must be given. + - The instance must be standalone. + - If the object is referenceable, the specified object must be pinned. + - The reference must already be allocated. + DESCRIPTION: + This function returns a reference to the TDO of a standalone instance. + RETURNS: + if environment handle or error handle is null, return + OCI_INVALID_HANDLE. + if operation suceeds, return OCI_SUCCESS. + if operation fails, return OCI_ERROR. + */ + +/*--------------------------- OCIObjectGetObjectRef -------------------------*/ +sword OCIObjectGetObjectRef( OCIEnv *env, OCIError *err, void *object, + OCIRef *object_ref ); +/* + NAME: OCIObjectGetObjectRef - OCI get the object reference of an + referenceable object + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns + OCI_ERROR. The error recorded in 'err' can be + retrieved by calling OCIErrorGet(). + object (IN) - pointer to a persistent object + object_ref (OUT) - reference of the given object. The reference must + already be allocated. + REQUIRES: + - a valid OCI environment handle must be given. + - The specified object must be pinned. + - The reference must already be allocated. + DESCRIPTION: + This function returns a reference to the given object. It returns an + error for values. + RETURNS: + if environment handle or error handle is null, return + OCI_INVALID_HANDLE. + if operation suceeds, return OCI_SUCCESS. + if operation fails, return OCI_ERROR. + */ + +/*--------------------------- OCIObjectMakeObjectRef -----------------------*/ +sword OCIObjectMakeObjectRef( OCIEnv *env, OCIError *err, + const OCISvcCtx *svc, void * table, + void **values, ub4 array_len, + OCIRef *object_ref ); +/* + NAME: OCIObjectMakeObjectRef - OCI Create an object reference to a + referenceable object. + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns + OCI_ERROR. The error recorded in 'err' can be + retrieved by calling OCIErrorGet(). + svc (IN) - the service context + table (IN) - A pointer to the table object (must be pinned) + attrlist (IN) - A list of values (OCI type values) from which + the ref is to be created. + attrcnt (IN) - The length of the attrlist array. + object_ref (OUT) - reference of the given object. The reference must + already be allocated. + REQUIRES: + - a valid OCI environment handle must be given. + - The specified table object must be pinned. + - The reference must already be allocated. + DESCRIPTION: + This function creates a reference given the values that make up the + reference and also a pointer to the table object. + Based on the table's OID property, whether it is a pk based OID or + a system generated OID, the function creates a sys-generated REF or + a pk based REF. + In case of system generated REFs pass in a OCIRaw which is 16 bytes + long contatining the sys generated OID. + In case of PK refs pass in the OCI equivalent for numbers, chars etc.. + RETURNS: + if environment handle or error handle is null, return + OCI_INVALID_HANDLE. + if operation suceeds, return OCI_SUCCESS. + if operation fails, return OCI_ERROR. + */ + +/*--------------------------- OCIObjectGetPrimaryKeyTypeRef --------------- */ +sword OCIObjectGetPrimaryKeyTypeRef( OCIEnv *env, OCIError *err, + const OCISvcCtx *svc, void *table, + OCIRef *type_ref ); +/* + NAME: OCIObjectGetPrimaryKeyTypeRef - OCI get the REF to the pk OID type + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns + OCI_ERROR. The error recorded in 'err' can be + retrieved by calling OCIErrorGet(). + svc (IN) - the service context + table (IN) - pointer to the table object + type_ref (OUT) - reference of the pk type. The reference must + already be allocated. + REQUIRES: + - a valid OCI environment handle must be given. + - The specified table object must be pinned. + - The reference must already be allocated. + DESCRIPTION: + This function returns a reference to the pk type. It returns an + error for values. If the table is not a Pk oid table/view, then + it returns error. + RETURNS: + if environment handle or error handle is null, return + OCI_INVALID_HANDLE. + if operation suceeds, return OCI_SUCCESS. + if operation fails, return OCI_ERROR. + */ + +/*-------------------------- OCIObjectGetInd --------------------------------*/ +sword OCIObjectGetInd( OCIEnv *env, OCIError *err, void *instance, + void **null_struct ); +/* + NAME: OCIObjectGetInd - OCI get the null structure of a standalone object + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns + OCI_ERROR. The error recorded in 'err' can be + retrieved by calling OCIErrorGet(). + instance (IN) - pointer to the instance + null_struct (OUT) - null structure + REQUIRES: + - a valid OCI environment handle must be given. + - The object must be standalone. + - If the object is referenceable, the specified object must be pinned. + DESCRIPTION: + This function returns the null structure of an instance. This function + will allocate the top level memory of the null structure if it is not + already allocated. If an null structure cannot be allocated for the + instance, then an error is returned. This function only works for + ADT or row type instance. + RETURNS: + if environment handle or error handle is null, return + OCI_INVALID_HANDLE. + if operation suceeds, return OCI_SUCCESS. + if operation fails, return OCI_ERROR. + */ + +/*------------------------- OCIObjectExists --------------------------------*/ +sword OCIObjectExists(OCIEnv *env, OCIError *err, void *ins, boolean *exist); +/* + NAME: OCIObjectExist - OCI checks if the object exists + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns + OCI_ERROR. The error recorded in 'err' can be + retrieved by calling OCIErrorGet(). + ins (IN) - pointer to an instance + exist (OUT) - return TRUE if the object exists + REQUIRES: + - a valid OCI environment handle must be given. + - The object must be standalone. + - if object is a referenceable, it must be pinned. + DESCRIPTION: + This function returns the existence of an instance. If the instance + is a value, this function always returns TRUE. + RETURNS: + if environment handle or error handle is null, return + OCI_INVALID_HANDLE. + if operation suceeds, return OCI_SUCCESS. + if operation fails, return OCI_ERROR. + */ + +/*------------------------- OCIObjectGetProperty ---------------------------*/ +sword OCIObjectGetProperty(OCIEnv *envh, OCIError *errh, const void *obj, + OCIObjectPropId propertyId, + void *property, ub4 *size ); +/* + NAME: OCIObjectGetProperty - OCIObject Get Property of given object + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns + OCI_ERROR. The error recorded in 'err' can be + retrieved by calling OCIErrorGet(). + obj (IN) - object whose property is returned + propertyId (IN) - id which identifies the desired property + property (OUT) - buffer into which the desired property is + copied + size (IN/OUT) - on input specifies the size of the property buffer + passed by caller, on output will contain the + size in bytes of the property returned. + This parameter is required for string type + properties only (e.g OCI_OBJECTPROP_SCHEMA, + OCI_OBJECTPROP_TABLE). For non-string + properties this parameter is ignored since + the size is fixed. + DESCRIPTION: + This function returns the specified property of the object. + The desired property is identified by 'propertyId'. The property + value is copied into 'property' and for string typed properties + the string size is returned via 'size'. + + Objects are classified as persistent, transient and value + depending upon the lifetime and referenceability of the object. + Some of the properties are applicable only to persistent + objects and some others only apply to persistent and + transient objects. An error is returned if the user tries to + get a property which in not applicable to the given object. + To avoid such an error, the user should first check whether + the object is persistent or transient or value + (OCI_OBJECTPROP_LIFETIME property) and then appropriately + query for other properties. + + The different property ids and the corresponding type of + 'property' argument is given below. + + OCI_OBJECTPROP_LIFETIME + This identifies whether the given object is a persistent + object (OCI_OBJECT_PERSISTENT) or a + transient object (OCI_OBJECT_TRANSIENT) or a + value instance (OCI_OBJECT_VALUE). + 'property' argument must be a pointer to a variable of + type OCIObjectLifetime. + + OCI_OBJECTPROP_SCHEMA + This returns the schema name of the table in which the + object exists. An error is returned if the given object + points to a transient instance or a value. If the input + buffer is not big enough to hold the schema name an error + is returned, the error message will communicate the + required size. Upon success, the size of the returned + schema name in bytes is returned via 'size'. + 'property' argument must be an array of type text and 'size' + should be set to size of array in bytes by the caller. + + OCI_OBJECTPROP_TABLE + This returns the table name in which the object exists. An + error is returned if the given object points to a + transient instance or a value. If the input buffer is not + big enough to hold the table name an error is returned, + the error message will communicate the required size. Upon + success, the size of the returned table name in bytes is + returned via 'size'. 'property' argument must be an array + of type text and 'size' should be set to size of array in + bytes by the caller. + + OCI_OBJECTPROP_PIN_DURATION + This returns the pin duration of the object. + An error is returned if the given object points to a value + instance. Valid pin durations are: OCI_DURATION_SESSION and + OCI_DURATION_TRANS. + 'property' argument must be a pointer to a variable of type + OCIDuration. + + OCI_OBJECTPROP_ALLOC_DURATION + This returns the allocation duration of the object. + Valid allocation durations are: OCI_DURATION_SESSION and + OCI_DURATION_TRANS. + 'property' argument must be a pointer to a variable of type + OCIDuration. + + OCI_OBJECTPROP_LOCK + This returns the lock status of the + object. The possible lock status is enumerated by OCILockOpt. + An error is returned if the given object points to a transient + or value instance. + 'property' argument must be a pointer to a variable of + type OCILockOpt. + Note, the lock status of an object can also be retrieved by + calling OCIObjectIsLocked(). + + OCI_OBJECTPROP_MARKSTATUS + This returns the status flag which indicates whether the + object is a new object, updated object and/or deleted object. + The following macros can be used to test the mark status + flag: + + OCI_OBJECT_IS_UPDATED(flag) + OCI_OBJECT_IS_DELETED(flag) + OCI_OBJECT_IS_NEW(flag) + OCI_OBJECT_IS_DIRTY(flag) + + An object is dirty if it is a new object or marked deleted or + marked updated. + An error is returned if the given object points to a transient + or value instance. 'property' argument must be of type + OCIObjectMarkStatus. + + OCI_OBJECTPROP_VIEW + This identifies whether the specified object is a view object + or not. If property value returned is TRUE, it indicates the + object is a view otherwise it is not. + 'property' argument must be of type boolean. + + RETURNS: + if environment handle or error handle is null, return + OCI_INVALID_HANDLE. + if operation suceeds, return OCI_SUCCESS. + if operation fails, return OCI_ERROR. Possible errors are TBD + */ + +/*---------------------------- OCIObjectIsLocked --------------------------*/ +sword OCIObjectIsLocked( OCIEnv *env, OCIError *err, void *ins, + boolean *lock); +/* + NAME: OCIObjectIsLocked - OCI get the lock status of a standalone object + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns + OCI_ERROR. The error recorded in 'err' can be + retrieved by calling OCIErrorGet(). + ins (IN) - pointer to an instance + lock (OUT) - return value for the lock status. + REQUIRES: + - a valid OCI environment handle must be given. + - The instance must be standalone. + - If the object is referenceable, the specified object must be pinned. + DESCRIPTION: + This function returns the lock status of an instance. If the instance + is a value, this function always returns FALSE. + RETURNS: + if environment handle or error handle is null, return + OCI_INVALID_HANDLE. + if operation suceeds, return OCI_SUCCESS. + if operation fails, return OCI_ERROR. + */ + +/*------------------------- OCIObjectIsDirty ------------------------------*/ +sword OCIObjectIsDirty( OCIEnv *env, OCIError *err, void *ins, + boolean *dirty); +/* + NAME: OCIObjectIsDirty - OCI get the dirty status of a standalone object + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns + OCI_ERROR. The error recorded in 'err' can be + retrieved by calling OCIErrorGet(). + ins (IN) - pointer to an instance + dirty (OUT) - return value for the dirty status. + REQUIRES: + - a valid OCI environment handle must be given. + - The instance must be standalone. + - if instance is an object, the instance must be pinned. + DESCRIPTION: + This function returns the dirty status of an instance. If the instance + is a value, this function always returns FALSE. + RETURNS: + if environment handle or error handle is null, return + OCI_INVALID_HANDLE. + if operation suceeds, return OCI_SUCCESS. + if operation fails, return OCI_ERROR. + */ + +/*--------------------------- OCIObjectPinTable -----------------------------*/ +sword OCIObjectPinTable( OCIEnv *env, OCIError *err, const OCISvcCtx *svc, + const oratext *schema_name, + ub4 s_n_length, const oratext *object_name, ub4 o_n_length, + const OCIRef *scope_obj_ref, OCIDuration pin_duration, + void ** object ); +/* + NAME: OCIObjectPinTable - OCI get table object + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns + OCI_ERROR. The error recorded in 'err' can be + retrieved by calling OCIErrorGet(). + svc (IN) - OCI service context handle + schema_name (IN, optional) - schema name of the table + s_n_length (IN, optional) - length of the schema name + object_name (IN) - name of the table + o_n_length (IN) - length of the table name + scope_obj_ref (IN, optional) - reference of the scoping object + pin_duration (IN) - pin duration. See description in OCIObjectPin(). + object (OUT) - the pinned table object + REQUIRES: + - a valid OCI environment handle must be given. + DESCRIPTION: + This function pin a table object with the specified pin duration. + The client can unpin the object by calling OCIObjectUnpin(). See + OCIObjectPin() and OCIObjectUnpin() for more information about pinning + and unpinning. + RETURNS: + if environment handle or error handle is null, return + OCI_INVALID_HANDLE. + if operation suceeds, return OCI_SUCCESS. + if operation fails, return OCI_ERROR. + */ + +/*------------------------- OCIObjectArrayPin -------------------------------*/ +sword OCIObjectArrayPin(OCIEnv *env, OCIError *err, OCIRef **ref_array, + ub4 array_size, OCIComplexObject **cor_array, + ub4 cor_array_size, OCIPinOpt pin_option, + OCIDuration pin_duration, OCILockOpt lock, + void **obj_array, ub4 *pos ); +/* + NAME: OCIObjectArrayPin - ORIO array pin + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns + OCI_ERROR. The error recorded in 'err' can be + retrieved by calling OCIErrorGet(). + ref_array (IN) - array of references to be pinned + array_size (IN) - number of elements in the array of references + pin_option (IN) - pin option. See OCIObjectPin(). + pin_duration (IN) - pin duration. See OCIObjectPin(). + lock_option (IN) - lock option. See OCIObjectPin(). + obj_array (OUT) - If this argument is not NULL, the pinned objects + will be returned in the array. The user must + allocate this array with element type being + 'void *'. The size of this array is identical to + 'array'. + pos (OUT) - If there is an error, this argument will contain + the element that is causing the error. Note that + this argument is set to 1 for the first element in + the ref_array. + REQUIRE: + - a valid OCI environment handle must be given. + - If 'obj_array' is not NULL, then it must already be allocated and + the size of 'obj_array' is 'array_size'. + DESCRIPTION: + This function pin an array of references. All the pinned objects are + retrieved from the database in one network roundtrip. If the user + specifies an output array ('obj_array'), then the address of the + pinned objects will be assigned to the elements in the array. See + OCIObjectPin() for more information about pinning. + RETURNS: + if environment handle or error handle is null, return + OCI_INVALID_HANDLE. + if operation suceeds, return OCI_SUCCESS. + if operation fails, return OCI_ERROR. + */ + +/*---------------------------------------------------------------------------*/ +/* HEAP/CACHE OPERATIONS */ +/*---------------------------------------------------------------------------*/ + +/*--------------------------- OCICacheFlush ---------------------------------*/ +sword OCICacheFlush( OCIEnv *env, OCIError *err, const OCISvcCtx *svc, + void *context, OCIRef *(*get)(void *context, ub1 *last), + OCIRef **ref ); +/* + NAME: OCICacheFlush - OCI flush persistent objects + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns + OCI_ERROR. The error recorded in 'err' can be + retrieved by calling OCIErrorGet(). + svc (IN) [optional] - OCI service context. If null pointer is + specified, then the dirty objects in all connections + will be flushed. + context (IN) [optional] - specifies an user context that is an + argument to the client callback function 'get'. This + parameter is set to NULL if there is no user context. + get (IN) [optional] - an client-defined function which acts an + iterator to retrieve a batch of dirty objects that need + to be flushed. If the function is not NULL, this function + will be called to get a reference of a dirty object. + This is repeated until a null reference is returned by + the client function or the parameter 'last' is set to + TRUE. The parameter 'context' is passed to get() + for each invocation of the client function. This + parameter should be NULL if user callback is not given. + If the object that is returned by the client function is + not a dirtied persistent object, the object is ignored. + All the objects that are returned from the client + function must be from newed or pinned the same service + context, otherwise, an error is signalled. Note that the + returned objects are flushed in the order in which they + are marked dirty. + ref (OUT) [optional] - if there is an error in flushing the + objects, (*ref) will point to the object that + is causing the error. If 'ref' is NULL, then the object + will not be returned. If '*ref' is NULL, then a + reference will be allocated and set to point to the + object. If '*ref' is not NULL, then the reference of + the object is copied into the given space. If the + error is not caused by any of the dirtied object, + the given ref is initalized to be a NULL reference + (OCIRefIsNull(*ref) is TRUE). + REQUIRES: + - a valid OCI environment handle must be given. + DESCRIPTION: + This function flushes the modified persistent objects from the + environment heap to the server. The objects are flushed in the order + that they are marked updated or deleted. + + See OCIObjectFlush() for more information about flushing. + + RETURNS: + if environment handle or error handle is null, return + OCI_INVALID_HANDLE. + if operation suceeds, return OCI_SUCCESS. + if operation fails, return OCI_ERROR. + */ + +/*--------------------------- OCICacheRefresh -------------------------------*/ +sword OCICacheRefresh(OCIEnv *env, OCIError *err, const OCISvcCtx *svc, + OCIRefreshOpt option, void *context, + OCIRef *(*get)(void *context), OCIRef **ref); +/* + NAME: OCICacheRefresh - OCI ReFreSh persistent objects + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns + OCI_ERROR. The error recorded in 'err' can be + retrieved by calling OCIErrorGet(). + svc (IN) [optional] - OCI service context. If null pointer is + specified, then the persistent objects in all connections + will be refreshed. + option (IN) [optional] - if OCI_REFRESH_LOAD is specified, all + objects that is loaded within the transaction are + refreshed. If the option is OCI_REFERSH_LOAD and the + parameter 'get' is not NULL, this function will ignore + the parameter. + context (IN) [optional] - specifies an user context that is an + argument to the client callback function 'get'. This + parameter is set to NULL if there is no user context. + get (IN) [optional] - an client-defined function which acts an + iterator to retrieve a batch of objects that need to be + refreshed. If the function is not NULL, this function + will be called to get a reference of an object. If + the reference is not NULL, then the object will be + refreshed. These steps are repeated until a null + reference is returned by this function. The parameter + 'context' is passed to get() for each invocation of the + client function. This parameter should be NULL if user + callback is not given. + ref (OUT) [optional] - if there is an error in refreshing the + objects, (*ref) will point to the object that + is causing the error. If 'ref' is NULL, then the object + will not be returned. If '*ref' is NULL, then a + reference will be allocated and set to point to the + object. If '*ref' is not NULL, then the reference of + the object is copied into the given space. If the + error is not caused by any of the object, + the given ref is initalized to be a NULL reference + (OCIRefIsNull(*ref) is TRUE). + REQUIRES: + - a valid OCI environment handle must be given. + DESCRIPTION: + This function refreshes all pinned persistent objects. All unpinned + persistent objects are freed. See OCIObjectRefresh() for more + information about refreshing. + RETURNS: + if environment handle or error handle is null, return + OCI_INVALID_HANDLE. + if operation suceeds, return OCI_SUCCESS. + if operation fails, return OCI_ERROR. + */ + +/*---------------------------- OCICacheUnpin --------------------------------*/ +sword OCICacheUnpin( OCIEnv *env, OCIError *err, const OCISvcCtx *svc ); +/* + NAME: OCICacheUnpin - OCI UNPin objects + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns + OCI_ERROR. The error recorded in 'err' can be + retrieved by calling OCIErrorGet(). + svc (IN) [optional] - OCI service context. If null pointer is + specified, then the objects in all connections + will be unpinned. + REQUIRES: + - a valid OCI environment handle must be given. + DESCRIPTION: + If a connection is specified, this function completely unpins the + persistent objects in that connection. Otherwise, all persistent + objects in the heap are completely unpinned. All transient objects in + the heap are also completely unpinned. See OCIObjectUnpin() for more + information about unpinning. + RETURNS: + if environment handle or error handle is null, return + OCI_INVALID_HANDLE. + if operation suceeds, return OCI_SUCCESS. + if operation fails, return OCI_ERROR. + */ + +/*----------------------------- OCICacheFree --------------------------------*/ +sword OCICacheFree( OCIEnv *env, OCIError *err, const OCISvcCtx *svc ); +/* + NAME: OCICacheFree - OCI FREe instances + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns + OCI_ERROR. The error recorded in 'err' can be + retrieved by calling OCIErrorGet(). + svc (IN) [optional] - OCI service context. If null pointer is + specified, then the objects in all connections + will be freed. + REQUIRES: + - a valid OCI environment handle must be given. + DESCRIPTION: + If a connection is specified, this function frees the persistent + objects, transient objects and values allocated for that connection. + Otherwise, all persistent objects, transient objects and values in the + heap are freed. Objects are freed regardless of their pin count. See + OCIObjectFree() for more information about freeing an instance. + RETURNS: + if environment handle or error handle is null, return + OCI_INVALID_HANDLE. + if operation suceeds, return OCI_SUCCESS. + if operation fails, return OCI_ERROR. +*/ + +/*---------------------------- OCICacheUnmark -------------------------------*/ +sword OCICacheUnmark( OCIEnv *env, OCIError *err, const OCISvcCtx *svc ); +/* + NAME: OCICacheUnmark - OCI Unmark all dirty objects + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns + OCI_ERROR. The error recorded in 'err' can be + retrieved by calling OCIErrorGet(). + svc (IN) [optional] - OCI service context. If null pointer is + specified, then the objects in all connections + will be unmarked. + REQUIRES: + - a valid OCI environment handle must be given. + DESCRIPTION: + If a connection is specified, this function unmarks all dirty objects + in that connection. Otherwise, all dirty objects in the cache are + unmarked. See OCIObjectUnmark() for more information about unmarking + an object. + RETURNS: + if environment handle or error handle is null, return + OCI_INVALID_HANDLE. + if operation suceeds, return OCI_SUCCESS. + if operation fails, return OCI_ERROR. + */ + + +sword OCIDurationBegin( OCIEnv *env, OCIError *err, const OCISvcCtx *svc, + OCIDuration parent, OCIDuration *dur ); +/* + NAME: OCIDurationBegin - OCI DURATION BEGIN + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + This should be passed NULL, when cartridge services + are to be used. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + svc (IN/OUT) - OCI service handle. + parent (IN) - parent for the duration to be started. + dur (OUT) - newly created user duration + REQUIRES: + - a valid OCI environment handle must be given for non-cartridge + services. + - For cartridge services, NULL should be given for environment handle + - A valid service handle must be given in all cases. + DESCRIPTION: + This function starts a new user duration. A user can have multiple + active user durations simultaneously. The user durations do not have + to be nested. + + The object subsystem predefines 3 durations : + 1) session - memory allocated with session duration comes from + the UGA heap (OCI_DURATION_SESSION). A session + duration terminates at the end of the user session. + 2) transaction - memory allocated with transaction duration comes + from the UGA heap (OCI_DURATION_TRANS). A trans- + action duration terminates at the end of the user + transaction. + 3) call - memory allocated with call duration comes from PGA + heap (OCI_DURATION_CALL). A call duration terminates + at the end of the user call. + + Each user duration has a parent duration. A parent duration can be a + predefined duration or another user duration. The relationship between + a user duration and its parent duration (child duration) are: + + 1) An user duration is nested within the parent duration. When its + parent duration terminates, the user duration will also terminate. + 2) The memory allocated with an user duration comes from the heap of + its parent duration. For example, if the parent duration of an + user duration is call, then the memory allocated with the user + duration will also come from the PGA heap. + + This function can be used as both part of cartridge services as well + as without cartridge services. + The difference in the function in the case of cartridge and + non-cartridge services is: + In case of cartridge services, as descibed above a new user + duration is created as a child of the "parent" duration. + But when used for non-cartridge purposes, when a pre-defined + duration is passed in as parent, it is mapped to the cache duration + for that connection (which is created if not already present) and + the new user duration will be child of the cache duration. + + RETURNS: + if environment handle and service handle is null or if error + handle is null return OCI_INVALID_HANDLE. + if operation suceeds, return OCI_SUCCESS. + if operation fails, return OCI_ERROR. + */ + + +sword OCIDurationEnd( OCIEnv *env, OCIError *err, const OCISvcCtx *svc, + OCIDuration duration ); +/* + NAME: OCIDurationEnd - OCI DURATION END + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + This should be passed NULL, when cartridge services + are to be used. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + svc (IN/OUT) - OCI service handle. + dur (OUT) - a previously created user duration using + OCIDurationBegin() + REQUIRES: + - a valid OCI environment handle must be given for non-cartridge + services. + - For cartridge services, NULL should be given for environment handle + - A valid service handle must be given in all cases. + DESCRIPTION: + This function terminates a user duration. All memory allocated for + this duration is freed. + + This function can be used as both part of cartridge services as well + as without cartridge services. In both cased, the heap duration + is freed and all the allocated memory for that duration is freed. + The difference in the function in the case of cartridge and + non-cartridge services is: + In case of non-cartridge services, if the duration is pre- + defined, the associated cache duration (see OCIDurationBegin()) + is also terminated and the following is done. + 1) The child durations are terminated. + 2) All objects pinned for this duration are unpinned. + 3) All instances allocated for this duration are freed. + + In case of cartridge services, only the heap duration is + freed. All the context entries allocated for that duration are + freed from the context hash table.. + + RETURNS: + if environment handle and service handle is null or if error + handle is null return OCI_INVALID_HANDLE. + if operation suceeds, return OCI_SUCCESS. + if operation fails, return OCI_ERROR. + */ + +/****************************************************************************** +** DO NOT USE THE FUNCTIONS BELOW! ** +** UNSUPPORTED INTERFACE ** +** WILL BE REMOVED/CHANGED IN A FUTURE RELEASE ** +******************************************************************************/ + +sword OCIDurationGetParent( OCIEnv *env, OCIError *err, + OCIDuration duration, OCIDuration *parent ); + +sword OCIObjectAlwaysLatest( OCIEnv *env, OCIError *err, void *object ); + +sword OCIObjectNotAlwaysLatest( OCIEnv *env, OCIError *err, + void *object ); + +sword OCIObjectFlushRefresh( OCIEnv *env, OCIError *err, void *object); + +sword OCIObjectIsLoaded( OCIEnv *env, OCIError *err, void *ins, + boolean *load); + +sword OCIObjectIsDirtied( OCIEnv *env, OCIError *err, void *ins, + boolean *dirty); + +sword OCICacheGetObjects( OCIEnv *env, OCIError *err, + const OCISvcCtx *svc, + OCIObjectProperty property, + void *client_context, + void (*client_callback)( + void *client_context, + void *object )); + +sword OCICacheRegister( OCIEnv *env, OCIError *err, + OCIObjectEvent event, + void *client_context, + void (*client_callback)( + void *client_context, + OCIObjectEvent event, + void *object)); + +sword OCICacheFlushRefresh( OCIEnv *env, OCIError *err, + const OCISvcCtx *svc, void *context, + OCIRef *(*get)(void *context, ub1 *last), + OCIRef **ref ); + +sword OCIObjectSetData(OCIEnv *env, OCIError *err, void *obj_hdr, + void *data); + +sword OCIObjectGetNewOID(OCIEnv *env, OCIError *err, OCISvcCtx *svc, + ub1 *oid); + + +#endif /* ORI_ORACLE */ diff --git a/sdk/include/orid.h b/sdk/include/orid.h new file mode 100755 index 0000000..a105f64 --- /dev/null +++ b/sdk/include/orid.h @@ -0,0 +1,373 @@ +/* Copyright (c) 1994, 2006, Oracle. All rights reserved. */ + +/* + Author: Tin Nguyen + Date: 02/07/94 + Source documents: "Functional Specification for C Object Interface, Object + Management Subsystem", "Oracle C Coding Standards + version 2.2", and the header file template + Rule sets: the generic and .h file rule sets + Quality status: not exited + Identification tag: [ one or more letters to identify the .h file ] + Revision code: [ date of the last revision of the .h file ] + + Note to the user of this header file: + + Anything in this header file that is marked private is not supported and + must not be used. Private sections are included in the header file to + improve internal maintenance. + + NAME + + ORID - Oracle Object Interface for Dynamic Data Access + + DESCRIPTION + + This file contains declarations for C object interface functions including + the dynamic object data access operations that allow callers to dynamically + access and manipulate objects; these operations include getting and setting + attributes of an object. These dynamic object operations are for accessing + and manipulation objects whose types are not known at compile-time. + + RELATED DOCUMENTS + + Functional Specification for C Object Interface / Object Management System + + PUBLIC FUNCTIONS + + OCIObjectSetAttr - ORID SET attribute value + OCIObjectGetAttr - ORID GET attribute value + + PRIVATE FUNCTIONS + + None + + EXAMPLES + + EXAMPLE 1 + + /o + o This example illustrates how an interative program can use the dynamic + o attribute access to display and modify attributes of an ADT instance. + o The interactive program does not know the type of the object at + o compile time. + o/ + + void display(adt_ref, object, null_struct, names, names_count, + names_length, indexes, indexes_count) + { + /o Pin the ADT o/ + if (OCIObjectPin(env, &adt_ref, OROOPOCUR, OROOPDTRA, OROOLMNON, &adt) + != OROSTASUC) + /o error handling code o/ + + /o + o Call the type manager to obtain all the attributes in the object. + o Display the content of each attribute in the ADT instance. If the + o attribute is an array, display each element of the array. If the + o attribute is an ADT instance, recursively call this routine to + o display the embedded ADT instance. + o/ + numAttrs = OCITypeAttrs(env, adt); + for (i= 1; i <= numAttrs; i++) + { + /o get attribute descriptor o/ + if (ortgabp(env, adt, i, &ado_ref, &ado) != OROSTASUC) + /o error handling code o/ + + /o get attribute name o/ + names[names_count] = OCITypeElemName(env, ado, + &names_length[names_count]); + + /o dynamically get the attr o/ + if (OCIObjectGetAttr(env, object, null_struct, 0, adt_ref, names, + names_length, names_count+1, indexes, indexes_count, 0, + &null, &null_info, &attr) != OROSTASUC) + /o error handling code o/ + + /o check if attribute is null o/ + if (null) continue; + + /o get typecode of attribute o/ + typecode = OCITypeElemTypeCode(env, ado); + + /o if attribute is a varray, display each element in varray o/ + if (typecode == OCI_TYPECODE_VARRAY) + { + /o get the reference to the type of the element of the array o/ + if (OCITypeElemParameterizedTyper(env, ado, &attr_type_ref) + != OROSTASUC) + /o error handling code o/ + + /o get the size of array o/ + if (orlasiz(env, &attr_type_ref, (orlva *)attr, + &numElm) != OROSTASUC) + /o error handling code o/ + + /o get the typecode of the element of the array o/ + if (ortty2r(env, attr_type_ref, &typecode) != OROSTASUC) + /o error handling code o/ + + /o iterate the array o/ + for (j=0; j < numElm; j++) + { + /o get an element in the array o/ + if (OCIObjectGetAttr(env, attr, null_info, j+1, attr_type_ref, + names, names_length, 0, indexes, 0, 0, &null, &null_info, + &element) != OROSTASUC) + /o error handling code o/ + + /o check if element is null o/ + if (null) continue; + + /o if attr is an ADT instance, recursively call this routine o/ + if (typecode == OCI_TYPECODE_ADT || typecode == + OCI_TYPECODE_UNNAMEDADT) + { + /o display the element as an adt o/ + display(attr_type_ref, element, null_info, names, lengths, + 0, indexes, 0); + } + + /o if attribute is scalar, print the value to the screen o/ + else output_to_screen(element, typecode); + } + } + + /o if attribute is an ADT instance, recursively call this routine o/ + else if (typecode == OCI_TYPECODE_ADT || typecode == + OCI_TYPECODE_UNNAMEDADT) + { + /o get the type ref of the attribute o/ + if (ortgarf(env, ado, &attr_type_ref) != OROSTASUC) + /o error handling code o/ + + display(attr_type_ref, attr, null_info, 0, names, 0, names_length, + indexes, 0); + } + + /o if attribute is scalar, print the value to the screen o/ + else output_to_screen(attr, typecode); + } + } + + /o ******** main routine *********** o/ + .... + + /o + o Allocate the arrays for storing the path expression + o/ + + /o get the tdo of type 'long' o/ + if (orttypget(&env, con, "SYS", sizeof("SYS"), "SINT32", sizeof("SINT32"), + OROOPDSES, &long_ref, &long_tdo) != OROSTASUC) + /o error handling code o/ + + /o get the tdo of type 'varchar' o/ + if (orttypget(&env, con, "SYS", sizeof("SYS"), "SQL_VARCHAR2", + sizeof("SQL_VARCHAR2"), OROOPDSES, &vchar_ref, &vchar_tdo) + != OROSTASUC) + /o error handling code o/ + + /o allocate the varrays for the path expression o/ + if (orlalloc(env, &vchar_ref, MAX_ARR_SIZE, &attr_names) != OROSTASUC) + /o error handling code o/ + + if (orlalloc(env, &long_ref, MAX_ARR_SIZE, &attr_name_lengths) + != OROSTASUC) + /o error handling code o/ + + if (orlalloc(env, &long_ref, MAX_ARR_SIZE, &attr_name_indexes) + != OROSTASUC) + /o error handling code o/ + + /o + o Get an ADT instance. The ref to the ADT instance can be obtained + o by through ORI or OSCI. + o/ + if (OCIObjectPin(env, &obj_ref, OROOPOCUR, OROOPDTRA, OROOLMUPD, &object) + != OROSTASUC) + /o error handling code o/ + + /o get the null structure of the ADT instance o/ + if (OCIObjectGetInd(gp, object, &null_struct) != OROSTASUC) + /o error handling code o/ + + /o + o Get the type of the ADT instance + o/ + + /o find out the type of the ADT instance o/ + if (oriogto(env, object, &adt_ref) != OROSTASUC) + /o error handling code o/ + + /o display the object o/ + display(adt_ref, object, null_struct, attr_names, 0, attr_names_lengths, + attr_names_indexes, 0); + + /o After the object is displayed, the program waits for the user to + o respond. The user modifies the values of an attribute and the + o program generates a path expression for the attribute and calls + o OCIObjectSetAttr() to set the value. + o/ + + if (OCIObjectSetAttr(env, object, null_struct, adt_ref, + (text **)attr_names, (ub4 *)attr_name_lengths, + attr_names_count, (ub4 *)attr_array_indexes, + attr_array_indexes_count, + (void *)0, FALSE, (void *)value) != OROSTASUC) + /o error handling code o/ + + END OF EXAMPLE 1 + + NOTES + + This file has been subsetted to contain only the routines that will + be in the first release. + + MODIFIED + dmukhin 06/29/05 - ANSI prototypes; miscellaneous cleanup + srseshad 03/12/03 - convert oci public api to ansi + aahluwal 06/03/02 - bug 2360115 + bpalaval 02/09/01 - Change text to oratext. + whe 09/01/99 - 976457:check __cplusplus for C++ code + sthakur 09/18/97 - collection indexing not supported + cxcheng 08/05/97 - fix compile with short names + skrishna 03/18/97 - fix ifdef for supporting ansi and k&r proto-types + cxcheng 02/06/97 - take out short name support except with SLSHORTNAME + cxcheng 10/17/96 - final renaming of functions + jboonleu 10/07/96 - beautify with OCI long names + cxcheng 10/07/96 - change short names to long names for readability + jboonleu 09/27/96 - fix lint + jwijaya 07/03/96 - add ANSI prototypes + jboonleu 04/13/95 - new interface + jwijaya 10/11/94 - fix the sccs header and add namespace + tanguyen 08/22/94 - fix example + tanguyen 08/09/94 - remove Sccsid declaration + tanguyen 07/20/94 - fix OCIObjectSetAttr and OCIObjectGetAttr to + use position descriptor + tanguyen 07/18/94 - change 'object' type to become ptr to object + tanguyen 06/30/94 - Fix the ORID_ORACLE ifdef + tanguyen 06/27/94 - update to template format + skotsovo 05/12/94 - replace ado with attribute position + jweisz 05/11/94 - test new checkin facility + jwijaya 05/05/94 - orienv/ref/typ -> oroenv/ref/typ + jwijaya 02/07/94 - Creation + +*/ + +#ifndef ORATYPES +#include +#endif +#ifndef ORO_ORACLE +#include +#endif +#ifndef OCI_ORACLE +#include +#endif + +#ifndef ORID_ORACLE +#define ORID_ORACLE + +#ifdef SLSHORTNAME + +#define OCIObjectSetAttr oridset +#define OCIObjectGetAttr oridget + +#endif /* SLSHORTNAME */ + +/*---------------------------------------------------------------------------*/ +/* PUBLIC FUNCTIONS */ +/*---------------------------------------------------------------------------*/ + +/*-------------------------- OCIObjectSetAttr ----------------------------*/ +sword OCIObjectSetAttr( OCIEnv *env, OCIError *err, void *instance, + void *null_struct, struct OCIType *tdo, + const oratext **names, const ub4 *lengths, + const ub4 name_count, const ub4 *indexes, + const ub4 index_count, const OCIInd null_status, + const void *attr_null_struct, const void *attr_value ); +/* + NAME: OCIObjectSetAttr - ORID SET value + PARAMETERS: + env (IN) - OCI environment handle initialized in object mode + err (IN) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + instance (IN) - pointer to an ADT instance + null_struct (IN) - the null structure of the ADT instance or array + tdo (IN) - pointer to the TDO + names (IN) - array of attribute names. This is used to specify + the names of the attributes in the path expression. + lengths (IN) - array of lengths of attribute names. + name_count (IN) - number of element in the array 'names'. + indexes (IN) [OPTIONAL] - currently NOT SUPPORTED, pass (ub4 *)0. + index_count (IN) [OPTIONAL] - currently NOT SUPPORTED, pass (ub4)0. + attr_null_status (IN) - the null status of the attribute if the type of + attribute is primitive. + attr_null_struct (IN) - the null structure of an ADT or collection + attribute. + attr_value (IN) - pointer to the attribute value. + REQUIRES: + DESCRIPTION: + This function set the attribute of the given object with the given + value. The position of the attribute is specified as a path + expression which is an array of names and an array of indexes. + RETURNS: + one of OROSTA* + EXAMPLES: + For path expression stanford.cs.stu[5].addr, the arrays will look like + names = {"stanford", "cs", "stu", "addr"} + lengths = {8, 2, 3, 4} + indexes = {5} + + Also see the above example. + */ + +/*-------------------------- OCIObjectGetAttr ----------------------------*/ +sword OCIObjectGetAttr( OCIEnv *env, OCIError *err, void *instance, + void *null_struct, struct OCIType *tdo, + const oratext **names, const ub4 *lengths, + const ub4 name_count, const ub4 *indexes, + const ub4 index_count, OCIInd *attr_null_status, + void **attr_null_struct, void **attr_value, + struct OCIType **attr_tdo ); +/* + NAME: OCIObjectGetAttr - ORID GET value + PARAMETERS: + env (IN) - OCI environment handle initialized in object mode + err (IN) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + instance (IN) - pointer to an ADT instance + null_struct (IN) - the null structure of the ADT instance or array + tdo (IN) - pointer to the TDO + names (IN) - array of attribute names. This is used to specify + the names of the attributes in the path expression. + lengths (IN) - array of lengths of attribute names. + name_count (IN) - number of element in the array 'names'. + indexes (IN) [OPTIONAL] - currently NOT SUPPORTED, pass (ub4 *)0. + index_count (IN) [OPTIONAL] - currently NOT SUPPORTED, pass (ub4)0. + attr_null_status (OUT) - the null status of the attribute if the type + of attribute is primitive. + attr_null_struct (OUT) - the null structure of an ADT or collection + attribute. + attr_value (OUT) - pointer to the attribute value. + attr_tdo (OUT) - pointer to the TDO of the attribute. + REQUIRES: + - a valid OCI environment handle must be given. + DESCRIPTION: + This function gets a value from an ADT instance or from an array. + If the parameter 'instance' points to an ADT instance, then the path + expression specifies the location of the attribute in the ADT. + It is assumed that the object is pinned and that the value returned + is valid until the object is unpinned. + RETURNS: + one of OROSTA* + EXAMPLES: + See example in OCIObjectSetAttr(). Also see the above example. + */ + +#endif /* ORID_ORACLE */ diff --git a/sdk/include/orl.h b/sdk/include/orl.h new file mode 100755 index 0000000..5aa3d88 --- /dev/null +++ b/sdk/include/orl.h @@ -0,0 +1,3633 @@ +/* Copyright (c) 1993, 2006, Oracle. All rights reserved. */ + +/* + Author: Srinath Krishnaswamy + Date: 11/24/93 + Source documents: "Functional Specification for C Language Mapping of + OTS Types, Object Management Subsystem", "Oracle C + Coding Standards version 2.2", and the header file + template + Rule sets: the generic and .h file rule sets + Quality status: not exited + Identification tag: [ one or more letters to identify the .h file ] + Revision code: 11/24/93 + + NAME + + ORL - ORacle's external C Language interface to primitive OTS types + + DESCRIPTION + + This header file contains C langauge interface to the OTS primitive + types. The interface includes C mapping of OTS primitive types and + the prototype of the pre-defined operations on the primitive types. + + *********************************************************************** + *** NOTE: The OCI functions for objects requires the *** + *** application to be running in OBJECT mode. That is, during *** + *** process initialization OCIInitialize(), the mode *** + *** specified should be OBJECT mode. *** + ** OCIInitialize(OCI_OBJECT, ..); *** + *********************************************************************** + + RELATED DOCUMENTS + + [1] Krishnaswamy, Srinath and Nguyen, Tin A., "Functional Specification + for C Language Mapping of OTS Types, Object Management Subsystem", + March 1994. + [2] Nguyen, Tin A., "The Open Type System", Oracle Corporation, + February 1994. + [3] Klein, Jonathan D., "Large Field Management", Oracle Corporation, + October 1993. + + PUBLIC FUNCTIONS + + OCI - OCI functions to manipulate Oracle Number, float and decimal + ARITHMETIC + OCINumberInc - OCINumber INCrement (optimized) + OCINumberDec - OCINumber DECrement (optimized) + OCINumberAdd - OCINumber ADD numbers + OCINumberSub - OCINumber SUBtract numbers + OCINumberMul - OCINumber MULtiply numbers + OCINumberDiv - OCINumber DIVide numbers + OCINumberMod - OCINumber MODulo division + OCINumberIntPower - OCINumber integer PoWeR + OCINumberShift - OCINumber decimal ShiFT number + OCINumberNeg - OCINumber NEGate number + OCINumberAbs - OCINumber ABSolute value + OCINumberCeil - OCINumber CEiling of number + OCINumberFloor - OCINumber FLooR of number + OCINumberSqrt - OCINumber SQuare Root of number + OCINumberSign - OCINumber get SIGN of number + NATIVE TYPE CONVERSION + OCINumberToInt - OCINumber convert number TO machine-format Integer + OCINumberFromInt - OCINumber convert machine-format Integer TO Number + OCINumberToReal - OCINumber convert number TO machine-format Real + OCINumberToRealArray - OCINumber convert array of numbers TO + machine-format Real + OCINumberFromReal - OCINumber convert machine-format Real TO Number + TEXT STRING CONVERSION + OCINumberToText - OCINumber convert number TO String + OCINumberFromText - OCINumber convert String TO Number + COMPARISON + OCINumberCmp - OCINumber CoMPare numbers + OCINumberIsZero - OCINumber comparison with ZERo + OCINumberIsInt - OCINumber Is an Integer + ASSIGNMENT + OCINumberAssign - OCINumber ASsiGn number + OCINumberSetZero - OCINumber Set number to Zero value + OCINumberSetPi - OCINumber Set number to Pi + ROUNDING + OCINumberTrunc - OCINumber TRUncate an Oracle number + OCINumberRound - OCINumber ROUnd number + OCINumberPrec - OCINumber round to Precision digits + TRANSCENDENTAL + OCINumberSin - OCINumber SINe + OCINumberArcSin - OCINumber Arc SINe + OCINumberHypSin - OCINumber SiNe Hyperbolic + OCINumberCos - OCINumber COSine + OCINumberArcCos - OCINumber Arc COSine + OCINumberHypCos - OCINumber CoSine Hyperbolic + OCINumberTan - OCINumber TANgent + OCINumberArcTan - OCINumber Arc TANgent + OCINumberArcTan2 - OCINumber Arc TaNgent 2 + OCINumberHypTan - OCINumber TaNgent Hyperbolic + OCINumberPower - OCINumber arbitrary Base EXponentiation + OCINumberExp - OCINumber EXPonentiation to base e + OCINumberLn - OCINumber Logarithm Natural + OCINumberLog - OCINumber LOGarithm to arbitrary base + + OCIDate - OCI functions to manipulate OCI Date + OCIDateToExternal - OCIDate convert date to external form + OCIDateFromExternal - OCIDate convert external form of date into OCIDate + OCIDateAssign - OCIDate Assignment + OCIDateToText - OCIDate convert date TO String + OCIDateFromText - OCIDate convert String TO Date + OCIDateZoneToZone - OCIDate convert date from one time + Zone TO another Zone + OCIDateCompare - OCIDate CoMPare dates + OCIDateAddMonths - OCIDate ADd or subtract Months + OCIDateAddDays - OCIDate ADd or subtract Days + OCIDateLastDay - OCIDate get date of LaST day of month + OCIDateDaysBetween - OCIDate get number of days BeTWeen two dates + OCIDateNextDay - OCIDate get date of Next DaY + OCIDateCheck - OCIDate CHecK if the given date is valid + OCIDateSysDate - OCIDate get current SYStem date and time + + OCIString - OCI String functions to manipulate Variable-length string + OCIStringAssign - OCIString Assign string to string + OCIStringAssignText - OCIString Assign Text string to string + OCIStringResize - OCIString ReSiZe string + OCIStringSize - OCIString get String Size + OCIStringPtr - OCIString get String PoinTeR + OCIStringAllocSize - OCIString get Allocated SiZe + + OCIRaw - OCI Raw functions to manipulate variable-length raW + OCIRawAssignRaw - OCIRaw Assign Raw (of type OCIRaw*) to raw + (of type OCIRaw*) + OCIRawResize - OCIRaw Resize raw + OCIRawSize - OCIRaw get Raw Size + OCIRawPtr - OCIRaw get Raw data Pointer + OCIRawAllocSize - OCIRaw get Allocated Size + + OCIColl - OCI Collection generic functions. These functions can be + used to manipulate both variable-length array (varray) and + nested table. + OCICollSize - OCIColl return current SIZe of the given collection + (in number of elements) + OCICollMax - OCIColl return the MAXimum number of elements in the + collection (i.e. upper-bound) + OCICollGetElem - OCIColl GET pointer to the element at the given + position + OCICollAssignElem - OCIColl assign to element at given index + OCICollAssign - OCIColl ASsiGn collection; perform deep-copy of source + collection to target collection + OCICollAppend - OCIColl aPPend the given element to the end of the + collection + OCICollTrim - OCIColl trim (delete) the given number of elements + from the end of the collection + OCICollIsLocator - OCIColl indicates whether a collection is locator + based or not. + OCIIterCreate - OCIColl Create an ITerator to scan the collection + elements + OCIIterDelete - OCIColl Delete ITerator + OCIIterInit - OCIColl Initialize ITerator to scan the given collection + OCIIterGetCurrent - OCIColl Iterator based, get CURrent + collection element + OCIIterNext - OCIColl Iterator based, get NeXT collection element + OCIIterPrev - OCIColl Iterator based, get PReVious collection element + + OCITable - OCI functions to manipulate nested Table. The OCIColl*() and + OCITable*() functions can be used to manipulate nested table + OCITableDelete(i) - OCITable if element(i) exists then the element is + marked as deleted else the function returns false. So + delete's create "holes". + OCITableExists(i) - OCITable return true iff an element at + position i EXIsts + OCITableFirst - OCITable return the smallest value of i for which + exists(i) is true. + OCITableLast - OCITable return the largest value of i for which + exists(i) is true. + OCITableNext(i) - OCITable return pointer to the smallest position j, + greater than i, such that OCITableExists(j) is true + OCITablePrev(i) - OCITable return pointer to the largest position j, + less than i, such that OCITableExists(j) is true + OCITableSize - OCITable return current SIZe of the given nested table not + including deleted elements + + OCIRef - OCI functions to manipulate object Reference + OCIRefClear - OCIRef CLeaR or nullify a ref + OCIRefAssign - OCIRef ASsiGn a ref to another + OCIRefIsEqual - OCIRef compare two refs for EQUality + OCIRefIsNull - OCIRef test if a ref is NULl + OCIRefFromHex - OCIRef convert a Hexadecimal string TO a Ref + OCIRefToHex - OCIRef convert a ref to a Hexadecimal string + OCIRefHexSize - OCIRef get size of buffer in bytes to store hexadecimal + string + + OBSOLETE: to be replaced by functions from oci.h: + + ORLL - ORL functions to manipulate lob Locators + orllasg - ORLL AsiGn one locator to another + orllequ - ORLL compare two locators for EQUality + orlliini - ORLL Is the locator INItialized? + orllgsz - ORLL Get locator SiZe + orllgcid - ORLL Get Character set ID + + NOTE: The following are specific to FILE lobs: + + orllsnm - ORLL Set directory alias and file NaMe in the locator + orllgnm - ORLL Get directory alias and file NaMe from the locator + + EXAMPLES + + Examples are given in the description of each function where + relevant. + + NOTES + + This file has been subsetted to contain ONLY the routines that will + be in the first release. + + QUESTIONS + + MODIFIED + bkhaladk 08/01/05 - add defn for OCIBinXmlReposCtx + dmukhin 06/29/05 - ANSI prototypes; miscellaneous cleanup + srseshad 03/12/03 - convert oci public api to ansi + rpingte 11/21/02 - Add OCICollGetElemArray and OCINumberToRealArray + aahluwal 06/03/02 - bug 2360115 + gayyappa 02/01/02 - fix 2210776 : change Dom to DOM + whe 09/25/01 - add OCIXMLType & OCIDomDocument opaque types + bpalaval 02/09/01 - Change text to oratext. + rkasamse 09/20/99 - lint changes + whe 09/01/99 - 976457:check __cplusplus for C++ code + hsbedi 08/11/99 - Add macro + rxgovind 10/14/98 - make non exposed calls (OCIRowType etc) private + rxgovind 06/09/98 - update OCIRowTypeCreate + nmantrav 05/11/98 - add OCIRowTypeGetCount + rxgovind 03/29/98 - add OCIRowType and OCIRowData interfaces + jwijaya 05/06/98 - add OCICollIsLocator + rxgovind 03/18/98 - opaque types: move to kolo.h + etucker 02/02/98 - add comments for Dec and Inc + etucker 01/29/98 - Finish core5 integration + rxgovind 11/11/97 - opaque types + etucker 10/28/97 - add ORLN functions for SDK + cxcheng 07/28/97 - remove OCILobLocator #define + skmishra 05/13/97 - stdcc compatibility changes + skrishna 04/25/97 - rename OCINumber*(): Exp Power TanHyp Zero Init + TanToArc Sqr Truncate and Compare + skotsovo 03/31/97 - remove OCILobLocatorSize + skrishna 03/25/97 - remove orld2i and orldi2d + skrishna 03/18/97 - fix ifdef for supporting ansi and k&r proto-types + cxcheng 02/06/97 - take out short name support except with SLSHORTNAME + skrishna 01/06/97 - update OCITableSize() comments + skrishna 12/27/96 - fix OCIDateGet/OCIDateSet + skrishna 12/12/96 - update OCICollGelElem comments + skrishna 11/07/96 - OCICollGetElem: interface change + skrishna 11/05/96 - add OCIDate Get/Set and OCIDateAssign + cxcheng 10/31/96 - change OCINumberTanHyp to OCINumberHypTan + cxcheng 10/30/96 - #define orll short names to long names + dchatter 10/26/96 - fix some OCI file long names + cxcheng 10/24/96 - remove unnecessary comment in front + cxcheng 10/14/96 - disable long name mapping for LOB functions + skrishna 10/13/96 - continue beautification + skotsovo 10/16/96 - update ocilob names + cxcheng 10/09/96 - add structure members in #define for date/time + cxcheng 10/09/96 - more lint fixes + skrishna 10/09/96 - continue beautification + cxcheng 10/09/96 - more fixes + skrishna 10/09/96 - change fixed-char rep. to orlvstr* + jwijaya 10/08/96 - continue beautification + jwijaya 10/07/96 - beautify + cxcheng 10/07/96 - more changes + cxcheng 10/04/96 - replace short names with long names + skrishna 10/01/96 - orlcsiz, orltsiz: change prototype to take errhdl + skrishna 09/23/96 - fix lint errors + skotsovo 09/23/96 - remove orllmkcur(). + jwijaya 09/17/96 - comments on null ref + skrishna 09/19/96 - change orlraw format + skotsovo 09/19/96 - add orlliini and remove orllnul + skrishna 08/14/96 - orlvstr: change format to ub4 followed by text + jboonleu 08/06/96 - update comment + skotsovo 08/08/96 - revert to locators instead of descriptors as input t + jboonleu 07/23/96 - remove orlrcur + skrishna 07/06/96 - add orltsiz + skrishna 07/05/96 - add orld2i and orldi2d + jwijaya 07/03/96 - add ANSI prototypes + skrishna 06/27/96 - document default string format in orlds2d & orld2s + skrishna 06/25/96 - change max date value + skrishna 06/18/96 - modify orld2s() comments + skotsovo 06/13/96 - orll functions take lob descriptors instead of locat + rxgovind 06/05/96 - change prototype of orlrcur to take ocienvh + skrishna 05/30/96 - support collection trimming + skrishna 05/30/96 - remove orlralo/fre and orllalo/fre instead use + orionew/fre + skrishna 05/28/96 - add orlt*() and modify orla*() + skotsovo 05/23/96 - add orlbl typedefs for pro*c + jboonleu 05/14/96 - add orlrcur + rxgovind 05/08/96 - changes for 3gl callbacks + skotsovo 05/01/96 - in orllasg, no need to alloc orlbl* + skrishna 04/21/96 - merge changes from 960418 object branch into big + skrishna 04/17/96 - rename orlrcpy to orlrasg + skrishna 04/12/96 - add orlr2h and orlrh2r functions + skotsovo 04/15/96 - add fnt to make the lob locator current + skrishna 04/08/96 - change orl*() to take ocienvh* and ocierrh* instead + of oroenv* + skotsovo 03/22/96 - add locator functions + skotsovo 03/22/96 - add locator functions + skrishna 02/27/96 - remove mlslabel interface + skotsovo 02/20/96 - remove orlbty and use dty type instead. + skotsovo 02/14/96 - add text file lobs. + skrishna 01/31/96 - update comments of orln2r, orldchk, orlds2d & orld2s + skrishna 01/31/96 - change orld2s() and orln2s() to return string length + skrishna 01/21/96 - remove old raw interface + skrishna 12/14/95 - add raw interface + skotsovo 01/03/96 - change LOB offsets and lengths from ub4 to ubig_ora + to support 64 bit machines. + skotsovo 10/30/95 - add orlblsiz() to get lob locator size + skrishna 10/24/95 - move ref functions from ori and update the ref + functions to support variable-length ref + cxcheng 10/20/95 - add more comments on number versions + cxcheng 10/13/95 - add more number functions + cxcheng 08/29/95 - Support for segmented varrays + cxcheng 08/18/95 - modifiy orlmls structure + skrishna 06/06/95 - rename orln, orld, orlvs and orlva to orlnum, + orldat, orlvstr and orlvary respectively + skrishna 11/15/94 - remove orlnget() function + skrishna 09/20/94 - modify orldbtw() to return number of days only + skrishna 08/24/94 - change format string length type from ub4 to ub1 + skrishna 07/19/94 - Rename orln2c & orlnc2n to orln2s & orlns2n + skrishna 06/29/94 - Add blob interface; add examples + skrishna 06/23/94 - Update comments and format + skrishna 05/19/94 - update varray append comments + skrishna 05/05/94 - Subsetting + skrishna 11/24/93 - Creation +*/ + +#ifndef ORATYPES +#include +#endif + +#ifndef ORO_ORACLE +#include +#endif + +#ifndef ORT_ORACLE +#include +#endif + +#ifndef OCI_ORACLE +#include +#endif + +#ifndef ORL_ORACLE +#define ORL_ORACLE + +/*---------------------------------------------------------------------------*/ +/* SHORT NAMES SUPPORT SECTION */ +/*---------------------------------------------------------------------------*/ + +#ifdef SLSHORTNAME + +/* the following are short names that are only supported on IBM mainframes + with the SLSHORTNAME defined. + With this all subsequent long names will actually be substituted with + the short names here */ + +#define OCIArray orlvary +#define OCIColl orlcol +#define OCICollAppend orlcapp +#define OCICollAssign orlcasg +#define OCICollAssignElem orlcase +#define OCICollGetElem orlcget +#define OCICollGetElemArray orlcgeta +#define OCICollMax orlcmax +#define OCICollSize orlcsiz +#define OCICollTrim orlctrm +#define OCICollIsLocator orlcilc +#define OCIDate orldat +#define OCIDateAddDays orldadd +#define OCIDateAddMonths orldadm +#define OCIDateCheck orldchk +#define OCIDateCompare orldcmp +#define OCIDateDD day_orldat +#define OCIDateDaysBetween orldbtw +#define OCIDateFromText orlds2d +#define OCIDateLastDay orldlst +#define OCIDateMM mon_orldat +#define OCIDateNextDay orldndy +#define OCIDateSysDate orldsys +#define OCIDateTime time_orldat +#define OCIDateYYYY gye_orldat +#define OCIDateZoneToZone orldz2z +#define OCIIter orlcitr +#define OCIIterCreate orlccit +#define OCIIterDelete orlcdit +#define OCIIterGetCurrent orlcicur +#define OCIIterInit orlciit +#define OCIIterNext orlcinxt +#define OCIIterPrev orlciprv +#define OCINumber orlnum +#define OCINumberAbs orlnabs +#define OCINumberAdd orlnadd +#define OCINumberArcCos orlnacos +#define OCINumberArcSin orlnasin +#define OCINumberArcTan orlnatan +#define OCINumberAssign orlnasg +#define OCINumberCeil orlncel +#define OCINumberCos orlncos +#define OCINumberDiv orlndiv +#define OCINumberPower orlnbex +#define OCINumberFloor orlnflr +#define OCINumberFromInt orlni2n +#define OCINumberFromReal orlnr2n +#define OCINumberFromText orlns2n +#define OCINumberHypCos orlncsh +#define OCINumberHypSin orlnsnh +#define OCINumberSetZero orlnini +#define OCINumberSetPi orlnspi +#define OCINumberInc orlninc +#define OCINumberDec orlndec +#define OCINumberIntPower orlnpwr +#define OCINumberLn orlnln +#define OCINumberLog orlnlog +#define OCINumberMod orlnmod +#define OCINumberMul orlnmul +#define OCINumberNeg orlnneg +#define OCINumberPart orlnpart +#define OCINumberExp orlnexp +#define OCINumberRound orlnrou +#define OCINumberPrec orlnpre +#define OCINumberShift orlnsft +#define OCINumberSign orlnsgn +#define OCINumberSin orlnsin +#define OCINumberSqrt orlnsqr +#define OCINumberSub orlnsub +#define OCINumberTan orlntan +#define OCINumberHypTan orlntnh +#define OCINumberArcTan2 orlnatn2 +#define OCINumberToInt orln2i +#define OCINumberToReal orln2r +#define OCINumberToRealArray orln2ra +#define OCINumberToText orln2s +#define OCINumberTrunc orlntru +#define OCINumberCmp orlncmp +#define OCINumberIsZero orlnzer +#define OCINumberIsInt orlnint +#define OCIRaw orlraw +#define OCIRawAllocSize orlwasz +#define OCIRawAssignBytes orlwabr +#define OCIRawAssignRaw orlwarr +#define OCIRawPtr orlwgrp +#define OCIRawResize orlwrsz +#define OCIRawSize orlwgsz +#define OCIRefAssign orlrasg +#define OCIRefClear orlrclr +#define OCIRefFromHex orlrh2r +#define OCIRefHexSize orlrhsz +#define OCIRefIsEqual orlrequ +#define OCIRefIsNull orlrnul +#define OCIRefToHex orlr2h +#define OCIString orlvstr +#define OCIStringAllocSize orlvasz +#define OCIStringAssign orlvass +#define OCIStringAssignText orlvats +#define OCIStringPtr orlvgsp +#define OCIStringResize orlvrsz +#define OCIStringSize orlvgsz +#define OCITable orltbl +#define OCITableDelete orltdel +#define OCITableExists orltexi +#define OCITableFirst orltfst +#define OCITableLast orltlst +#define OCITableNext orltnxt +#define OCITablePrev orltprv +#define OCITableSize orltsiz +#define OCITime orldtm +#define OCITimeHH orldtmhh +#define OCITimeMI orldtmmm +#define OCITimeSS orldtmss +#define OCI_LOBMODE_READONLY ORLBMORO +#define OCI_LOBMODE_READWRITE ORLBMORW + +#endif /* SLSHORTNAME */ + +/*****************************************************************************/ +/* NUMBER/FLOAT/DECIMAL TYPE */ +/*****************************************************************************/ + +#define OCI_NUMBER_SIZE 22 +struct OCINumber +{ + ub1 OCINumberPart[OCI_NUMBER_SIZE]; +}; +typedef struct OCINumber OCINumber; + +/* + * OCINumber - OCI Number mapping in c + * + * The OTS types: NUMBER, NUMERIC, INT, SHORTINT, REAL, DOUBLE PRECISION, + * FLOAT and DECIMAL are represented by OCINumber. + * The contents of OCINumber is opaque to clients. + * + * For binding variables of type OCINumber in OCI calls (OCIBindByName(), + * OCIBindByPos(), and OCIDefineByPos()) use the type code SQLT_VNU. + */ + +/* + EXAMPLE + + The following example shows how to manipulate an attribute of type + oracle number. + + struct person + { + OCINumber sal; + }; + typedef struct person person; + + OCIError *err; + person* joe; + person* tom; + person* debbie; + OCINumber *joesal; + OCINumber *tomsal; + OCINumber *debsal; + sword status; + int inum; + double dnum; + OCINumber ornum; + char buffer[21]; + ub4 buflen; + sword result; + + /o See oci.h for an example of how to initialize OCIError. + o For this example, assume the OCIEnv and OCIError has been + o initialized. + o/ + + /o Pin joe, tom and debbie person objects in the object cache. See ori.h + o for an example on pinning objects. For this example, assume that + o joe, tom and debbie are pointing to pinned objects. + o/ + joesal = &joe->sal; + tomsal = &tom->sal; + debsal = &debbie->sal; + + /o initialize joe's salary to be $12,000 o/ + inum = 12000; + status = OCINumberFromInt(err, &inum, sizeof(inum), OCI_NUMBER_SIGNED, + joesal); + if (status != OCI_SUCCESS) + /o goto to handle error from OCINumberFromInt o/; + + /o initialize tom's salary to be same as joe o/ + OCINumberAssign(err, joesal, tomsal); + + /o initialize debbie's salary to be 20% more than joe's o/ + dnum = 1.2; + status = OCINumberFromReal(err, &dnum, sizeof(double), &ornum); + if (status != OCI_SUCCESS) + /o goto to handle error from OCINumberFromReal o/; + status = OCINumberMul(err, joesal, &ornum, debsal); + if (status != OCI_SUCCESS) /o goto to handle error from OCINumberMul o/; + + /o give tom a 50% raise o/ + dnum = 1.5; + status = OCINumberFromReal(err, &dnum, sizeof(double), &ornum); + if (status != OCI_SUCCESS) + /o goto to handle error from OCINumberFromReal o/; + status = OCINumberMul(err, tomsal, &ornum, tomsal); + if (status != OCI_SUCCESS) /o goto to handle error from OCINumberMul o/; + + /o double joe's salary o/ + status = OCINumberAdd(err, joesal, joesal, joesal); + if (status != OCI_SUCCESS) /o goto to handle error from OCINumberAdd o/; + + /o get joe's salary in integer o/ + status = OCINumberToInt(err, joesal, sizeof(inum), OCI_NUMBER_SIGNED, + &inum); + if (status != OCI_SUCCESS)/o goto to handle error from OCINumberToInt o/; + /o inum is set to 24000 o/ + + /o get debbie's salary in double o/ + status = OCINumberToReal(err, debsal, sizeof(dnum), &dnum); + if (status != OCI_SUCCESS)/o goto to handle error from OCINumberToReal o/; + /o dnum is set to 14400 o/ + + /o print tom's salary as DEM0001`8000.00 o/ + buflen = sizeof(buffer); + status = OCINumberToText(err, tomsal, "C0999G9999D99", 13, + "NLS_NUMERIC_CHARACTERS='.`' NLS_ISO_CURRENCY='Germany'", 54, + &buflen, buffer); + if (status != OCI_SUCCESS)/o goto to handle error from OCINumberToText o/; + printf("tom's salary = %s\n", buffer); + + /o compare joe and tom's salary o/ + status = OCINumberCmp(err, joesal, tomsal, &result); + if (status != OCI_SUCCESS) /o goto to handle error from OCINumberCmp o/; + /o result is positive o/ + + /o read debbie's new salary from string o/ + status = OCINumberFromText(err, "48`000.00", 9, "99G999D99", 9, + "NLS_NUMERIC_CHARACTERS='.`'", 27, debsal); + if (status != OCI_SUCCESS) + /o goto to handle error from OCINumberFromText o/; + /o debbie's salary is now 48000.00 o/ + +*/ + +/*----------------------------- OCINumberInc --------------------------------*/ + +sword OCINumberInc( OCIError *err, OCINumber *number ); +/* + NAME: OCINumberInc - OCINumber INCrement numbers + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + number (IN/OUT) a positive Oracle number to be incremented + DESCRIPTION: + Increment Oracle number in place. It is assumed that the input is + an integer between 0 and 100^21-2. If the is input too large, it will + be treated as 0 - the result will be an Oracle number 1. If the input + is not a positive integer, the result will be unpredictable. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + any of the number arguments is null + */ + +/*----------------------------- OCINumberDec --------------------------------*/ + +sword OCINumberDec( OCIError *err, OCINumber *number ); +/* + NAME: OCINumberDec - OCINumber DECrement numbers + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + number (IN/OUT) - a positive Oracle number to be decremented + DESCRIPTION: + Decrement Oracle number in place. It is assumed that the input is an + integer between 1 and 100^21-2. If the input is too large, it will be + treated as 1 - the result will be an Oracle number 0. If the input is + not a positive integer, the result will be unpredictable. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + any of the number arguments is null + */ + +/*-------------------------- OCINumberSetZero -------------------------------*/ + +void OCINumberSetZero( OCIError *err, OCINumber *num ); +/* + NAME: OCINumberSetZero - OCINumber Set number to Zero value + PARAMETERS: + err (IN/OUT) - pointer to OCI error handle + num (OUT) - set to zero value + DESCRIPTION: + Initialize the given number to value 0. + */ + +/*--------------------------- OCINumberSetPi --------------------------------*/ + +void OCINumberSetPi( OCIError *err, OCINumber *num ); +/* + NAME: OCINumberSetPi - OCINumber Set number to Pi + err (IN/OUT) - pointer to OCI error handle + num (OUT) - set to zero value + DESCRIPTION: + Initialize the given number to value Pi. + */ + +/*----------------------------- OCINumberAdd --------------------------------*/ + +sword OCINumberAdd( OCIError *err, const OCINumber *number1, + const OCINumber *number2, OCINumber *result ); +/* + NAME: OCINumberAdd - OCINumber ADD numbers + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + number1, number2 (IN) - numbers to be added + result (OUT) - result of adding 'number1' with 'number2' + DESCRIPTION: + Add 'number1' with 'number2' and return result in 'result'. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + any of the number arguments is null + */ + +/*----------------------------- OCINumberSub --------------------------------*/ + +sword OCINumberSub( OCIError *err, const OCINumber *number1, + const OCINumber *number2, OCINumber *result ); +/* + NAME: OCINumberSub - OCINumber SUBtract numbers + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + number1, number2 (IN) - 'number2' subtracted from 'number1' + result (OUT) - subtraction result + DESCRIPTION: + Subtract 'number2' from 'number1' and return result in 'result'. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + any of the number arguments is null + */ + +/*----------------------------- OCINumberMul --------------------------------*/ + +sword OCINumberMul( OCIError *err, const OCINumber *number1, + const OCINumber *number2, OCINumber *result ); +/* + NAME: OCINumberMul - OCINumber MULtiply numbers + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + number1, number2 (IN) - numbers to be multiplied + result (OUT) - multiplication result + DESCRIPTION: + Multiply 'number1' with 'number2' and return result in 'result'. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + any of the number arguments is null + */ + +/*----------------------------- OCINumberDiv --------------------------------*/ + +sword OCINumberDiv( OCIError *err, const OCINumber *number1, + const OCINumber *number2, OCINumber *result ); +/* + NAME: OCINumberDiv - OCINumber DIVide numbers + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + number1 (IN) - pointer to the numerator + number2 (IN) - pointer to the denominator + result (OUT) - division result + DESCRIPTION: + Divide 'number1' by 'number2' and return result in 'result'. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + any of the number arguments is null + underflow errorr + overflow errorr + divide by zero errorr + */ + +/*----------------------------- OCINumberMod --------------------------------*/ + +sword OCINumberMod( OCIError *err, const OCINumber *number1, + const OCINumber *number2, OCINumber *result ); +/* + NAME: OCINumberMod - OCINumber MODulous + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + number1 (IN) - pointer to the numerator + number2 (IN) - pointer to the denominator + result (OUT) - remainder of the result + DESCRIPTION: + Finds the remainder of the division of two Oracle numbers. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + any of the number arguments is null + divide by zero errorr + */ + +/*------------------------ OCINumberIntPower --------------------------------*/ + +sword OCINumberIntPower( OCIError *err, const OCINumber *base, + const sword exp, OCINumber *result ); +/* + NAME: OCINumberIntPower - OCINumber takes an arbitary base to an arbitary + integer PoWeR + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + base (IN) - base of the exponentiation + exp (IN) - exponent to which the base is to be raised + result (OUT) - output of exponentiation + DESCRIPTION: + Takes an arbitary base to an arbitary integer power. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + any of the number arguments is null + */ + +/*-------------------------- OCINumberShift ---------------------------------*/ + +sword OCINumberShift( OCIError *err, const OCINumber *number, + const sword nDig, OCINumber *result ); +/* + NAME: OCINumberShift - OCINumber multiplies by a power of 10. + + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + number (IN) - Oracle Number to be shifted. + nDig (IN) - number of decimal places to shift. + result (OUT) - shift result. + DESCRIPTION: + Multiplies number by 10^NDig and sets product to the result. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + any of the number arguments is null + */ + +/*----------------------------- OCINumberNeg --------------------------------*/ + +sword OCINumberNeg( OCIError *err, const OCINumber *number, + OCINumber *result ); +/* + NAME: OCINumberNeg - OCINumber NEGate number + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + number (IN) - number to be negated + result (OUT) - will contain negated value of 'number' + DESCRIPTION: + Negates an Oracle number. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + any of the number arguments is null + */ + +/*------------------------- OCINumberToText ---------------------------------*/ + +sword OCINumberToText( OCIError *err, const OCINumber *number, + const oratext *fmt, ub4 fmt_length, + const oratext *nls_params, ub4 nls_p_length, + ub4 *buf_size, oratext *buf ); +/* + NAME: OCINumberToText - OCINumber convert number TO String + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + number (IN) - Oracle number to be converted + fmt (IN) - conversion format + fmt_length (IN) - length of the 'fmt' parameter + nls_params (IN) - nls format specification, if null string + i.e. (oratext *)0, then the default parameters for the + session is used + nls_p_length (IN) - length of the 'nls_params' parameter + buf_size (IN/OUT) - size of the buffer must be passed as input by + the caller, this function will return the length of the + resulting string in bytes via this parameter. The length + does not include the terminating null ('\0'). + buf (OUT) - buffer into which the converted string is placed. The + resulting string is null terminated. + DESCRIPTION: + Converts the given number to a character string + according to the specified format. Refer to "TO_NUMBER" conversion + function described in "Oracle SQL Language Reference Manual" for a + description of format and NLS parameters. + The converted number string is stored in the buffer 'buf', up to + a max of '*buf_size' bytes. Length of the resulting string is + returned via 'buf_size'. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + 'number' or 'buf' is null + buffer too small + invalid format + invalid nls format + number to text translation for the given format causes overflow + */ + +/*-------------------------- OCINumberFromText ------------------------------*/ + +sword OCINumberFromText( OCIError *err, const oratext *str, + ub4 str_length, const oratext *fmt, ub4 fmt_length, + const oratext *nls_params, ub4 nls_p_length, + OCINumber *number ); +/* + NAME: OCINumberFromText - OCINumber convert String TO Number + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + str (IN) - input string to be converted to Oracle number + str_length (IN) - size of the input string + fmt (IN) - conversion format + fmt_length (IN) - length of the 'fmt' parameter + nls_params (IN) - nls format specification, if null string + i.e. (oratext *)0, then the default parameters for the + session is used + nls_p_length (IN) - length of the 'nls_params' parameter + number (OUT) - given string converted to number + DESCRIPTION: + Converts the given string to a number + according to the specified format. Refer to "TO_NUMBER" conversion + function described in "Oracle SQL Language Reference Manual" for a + description of format and NLS parameters. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + 'number' or 'str' is null + 'str_length' is 0 + invalid format + invalid nls format + invalid input string + */ + +/*-------------------------- OCINumberToInt ---------------------------------*/ + +#define OCI_NUMBER_UNSIGNED 0 /* Unsigned type -- ubX */ +#define OCI_NUMBER_SIGNED 2 /* Signed type -- sbX */ + +sword OCINumberToInt( OCIError *err, const OCINumber *number, + uword rsl_length, uword rsl_flag, void *rsl ); +/* + NAME: OCINumberToInt - OCINumber convert number TO Integer + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + number (IN) - number to be converted + rsl_length (IN) - size of the desired result + rsl_s_flag (IN) - flag denoting the desired sign of the output; valid + values are OCI_NUMBER_UNSIGNED, OCI_NUMBER_SIGNED + rsl (OUT) - pointer to space for the result + DESCRIPTION: + Native type conversion function. + Converts the given Oracle number into an xbx (e.g. ub2, ub4, sb2 etc.) + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + 'number' or 'rsl' is null + integer value of 'number' is too big -- overflow + integer value of 'number' is too small -- underflow + invalid sign flag value ('rsl_s_flag') + */ + +/*--------------------------- OCINumberFromInt ------------------------------*/ + +sword OCINumberFromInt( OCIError *err, const void *inum, uword inum_length, + uword inum_s_flag, OCINumber *number ); +/* + NAME: OCINumberFromInt - OCINumber convert Integer TO Number + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + inum (IN) - pointer to the integer to be converted + inum_length (IN) - size of the integer + inum_s_flag (IN) - flag that designates the sign of the integer; valid + values are OCI_NUMBER_UNSIGNED, OCI_NUMBER_SIGNED + number (OUT) - given integer converted to Oracle number + DESCRIPTION: + Native type conversion function. Converts any Oracle standard + machine-native integer type (xbx) to an Oracle number. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + 'number' or 'inum' is null + integer too BIG -- the number is too large to fit into an Oracle + number + invalid sign flag value ('inum_s_flag') + */ + +/*------------------------- OCINumberToReal ---------------------------------*/ + +sword OCINumberToReal( OCIError *err, const OCINumber *number, + uword rsl_length, void *rsl ); +/* + NAME: OCINumberToReal - OCINumber convert number TO Real + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + number (IN) - number to be converted + rsl_length (IN) - is the size of the desired result, + sizeof( float | double | long double) + rsl (OUT) - pointer to space for storing the result + DESCRIPTION: + Native type conversion function. Converts an Oracle number into a + machine-native real type. This function only converts numbers up to + LDBL_DIG, DBL_DIG, or FLT_DIG digits of precision and removes + trailing zeroes. The above constants are defined in float.h + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + 'number' or 'rsl' is null + 'rsl_length' is 0 + */ + +/*------------------------- OCINumberToRealArray ----------------------------*/ + +sword OCINumberToRealArray( OCIError *err, const OCINumber **number, + uword elems, uword rsl_length, void *rsl ); +/* + NAME: OCINumberToRealArray - OCINumber convert array of numbers TO Real + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + number (IN) - Pointer to array of number to be converted + elems (IN) - Upper bound of number array + rsl_length (IN) - is the size of the desired result, + sizeof( float | double | long double) + rsl (OUT) - pointer to array of space for storing the result + DESCRIPTION: + Native type conversion function. Converts an Oracle number into a + machine-native real type. This function only converts numbers up to + LDBL_DIG, DBL_DIG, or FLT_DIG digits of precision and removes + trailing zeroes. The above constants are defined in float.h + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + 'number' or 'rsl' is null + 'rsl_length' is 0 + */ + +/*-------------------------- OCINumberFromReal ------------------------------*/ + +sword OCINumberFromReal( OCIError *err, const void *rnum, + uword rnum_length, OCINumber *number ); +/* + NAME: OCINumberFromReal - OCINumber convert Real TO Number + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + rnum (IN) - pointer to the floating point number to be converted + rnum_length (IN) - size of the desired result, i.e. + sizeof({float | double | long double}) + number (OUT) - given float converted to Oracle number + DESCRIPTION: + Native type conversion function. Converts a machine-native floating + point type to an Oracle number. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + 'number' or 'rnum' is null + 'rnum_length' is 0 + */ + +/*----------------------------- OCINumberCmp --------------------------------*/ + +sword OCINumberCmp( OCIError *err, const OCINumber *number1, + const OCINumber *number2, sword *result ); +/* + NAME: OCINumberCmp - OCINumber CoMPare numbers + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + number1, number2 (IN) - numbers to be compared + result (OUT) - 0 if equal, negative if number1 < number2, + positive if number1 > number2 + DESCRIPTION: + The function OCINumberCmp compares two numbers. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + 'number1' or 'number2' or 'result' is null + */ + +/*---------------------------- OCINumberSign --------------------------------*/ + +sword OCINumberSign( OCIError *err, const OCINumber *number, + sword *result ); +/* + NAME: OCINumberSign - OCINumber obtains SiGN of an Oracle number + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + number (IN) - number whose sign is returned + result (OUT) - 0 if number == 0, -1 if number < 0, + 1 if number > 0 + DESCRIPTION: + Obtains sign of an Oracle number + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + 'number' or 'result' is null + */ + +/*---------------------------- OCINumberIsZero ------------------------------*/ + +sword OCINumberIsZero( OCIError *err, const OCINumber *number, + boolean *result ); +/* + NAME: OCINumberIsZero - OCINumber comparison with ZERo + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + number (IN) - numbers to be compared + result (OUT) - set to TRUE if equal to zero else FALSE + DESCRIPTION: + Test if the given number is equal to zero. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + 'number' or 'result' is null + */ + +/*---------------------------- OCINumberIsInt -------------------------------*/ + +sword OCINumberIsInt( OCIError *err, const OCINumber *number, + boolean *result ); +/* + NAME: OCINumberIsInt - OCINumber Is Integer value. + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + number (IN) - number to be tested + result (OUT) - set to TRUE if integer value else FALSE + DESCRIPTION: + Test if the given number is an integer value. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + 'number' or 'result' is null + */ + +/*-------------------------- OCINumberAssign --------------------------------*/ + +sword OCINumberAssign( OCIError *err, const OCINumber *from, + OCINumber *to ); +/* + NAME: OCINumberAssign - OCINumber ASsiGn number + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + from (IN) - number to be assigned + to (OUT) - number copied into + DESCRIPTION: + Assign number 'from' to 'to'. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + 'from' or 'to' is null + */ + +/*----------------------------- OCINumberAbs --------------------------------*/ + +sword OCINumberAbs( OCIError *err, const OCINumber *number, + OCINumber *result ); +/* + NAME: OCINumberAbs - OCINumber compute ABSolute value + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + number (IN) - input number + result (OUT) - output which will contain the absolue value of the + input number + DESCRIPTION: + Computes the absolute value of an Oracle number. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + any of the number arguments is null + */ + +/*---------------------------- OCINumberCeil --------------------------------*/ + +sword OCINumberCeil( OCIError *err, const OCINumber *number, + OCINumber *result ); +/* + NAME: OCINumberCeil - OCINumber compute the CEiL value of an Oracle number + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + number (IN) - input number + result (OUT) - output which will contain the ceil value of the + input number + DESCRIPTION: + Computes the ceil value of an Oracle number. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + any of the number arguments is null + */ + +/*--------------------------- OCINumberFloor --------------------------------*/ + +sword OCINumberFloor( OCIError *err, const OCINumber *number, + OCINumber *result ); +/* + NAME: OCINumberFloor - OCINumber compute the FLooR value of an Oracle number + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + number (IN) - input number + result (OUT) - output which will contain the floor value of the + input number + DESCRIPTION: + Computes the floor value of an Oracle number. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + any of the number arguments is null + */ + +/*----------------------------- OCINumberSqrt -------------------------------*/ + +sword OCINumberSqrt( OCIError *err, const OCINumber *number, + OCINumber *result ); +/* + NAME: OCINumberSqrt - OCINumber compute the SQuare Root of an Oracle number + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + number (IN) - input number + result (OUT) - output which will contain the square root of the + input number + DESCRIPTION: + Computes the square root of an Oracle number. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + any of the number arguments is null + 'number' is negative + */ + +/*--------------------------- OCINumberTrunc --------------------------------*/ + +sword OCINumberTrunc( OCIError *err, const OCINumber *number, + sword decplace, OCINumber *result ); +/* + NAME: OCINumberTrunc - OCINumber TRUncate an Oracle number at a + specified decimal place + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + number (IN) - input number + decplace (IN) - number of decimal digits to the right of the + decimal point to truncate at. Negative values are allowed. + result (OUT) - output of truncation + DESCRIPTION: + Truncate an Oracle number at a specified decimal place + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + any of the number arguments is null + */ + +/*----------------------------- OCINumberPower ------------------------------*/ + +sword OCINumberPower( OCIError *err, const OCINumber *base, + const OCINumber *number, OCINumber *result ); +/* + NAME: OCINumberPower - OCINumber takes an arbitary Base to an + arbitary Power + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + base (IN) - base of the exponentiation + number (IN) - exponent to which the base is to be raised + result (OUT) - output of exponentiation + DESCRIPTION: + Takes an arbitary base to an arbitary power. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + any of the number arguments is null + */ + +/*--------------------------- OCINumberRound --------------------------------*/ + +sword OCINumberRound( OCIError *err, const OCINumber *number, + sword decplace, OCINumber *result ); +/* + NAME: OCINumberRound - OCINumber ROUnds an Oracle number to a specified + decimal place + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + number (IN) - round this number and return result in 'result' + decplace (IN) - number of decimal digits to the right of the + decimal point to round to. Negative values are allowed. + result (OUT) - output of rounding + DESCRIPTION: + Rounds an Oracle number to a specified decimal place + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + any of the number arguments is null + */ + +/*--------------------------- OCINumberPrec ---------------------------------*/ + +sword OCINumberPrec( OCIError *err, const OCINumber *number, + sword nDigs, OCINumber *result ); +/* + NAME: OCINumberPrec - Rounds an Oracle number to a specified number of + decimal digits. + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + number (IN) - number for which to set precision. + nDig (IN) - number of decimal digits desired in the result. + result (OUT) - result. + DESCRIPTION: + Performs a floating point round with respect to the number + of digits. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + any of the number arguments is null + */ + +/*----------------------------- OCINumberSin --------------------------------*/ + +sword OCINumberSin( OCIError *err, const OCINumber *number, + OCINumber *result ); +/* + NAME: OCINumberSin - OCINumber takes the SINe of an Oracle number + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + number (IN) - argument of the sine in radians + result (OUT) - result of the sine + DESCRIPTION: + Takes the sine in radians of an Oracle number. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + any of the number arguments is null + */ + +/*-------------------------- OCINumberArcSin --------------------------------*/ + +sword OCINumberArcSin( OCIError *err, const OCINumber *number, + OCINumber *result ); +/* + NAME: OCINumberArcSin - OCINumber takes the Arc SINe of an Oracle number + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + number (IN) - argument of the arc sine + result (OUT) - result of the arc sine in radians + DESCRIPTION: + Takes the arc sine in radians of an Oracle number. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + any of the number arguments is null + 'number' is < -1 or 'number' is > 1. + */ + +/*-------------------------- OCINumberHypSin --------------------------------*/ + +sword OCINumberHypSin( OCIError *err, const OCINumber *number, + OCINumber *result ); +/* + NAME: OCINumberHypSin - OCINumber takes the SiNe Hyperbolic of an + Oracle number + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + number (IN) - argument of the sine hyperbolic + result (OUT) - result of the sine hyperbolic + DESCRIPTION: + Takes the hyperbolic sine of an Oracle number. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + any of the number arguments is null + NOTES: + An Oracle number overflow causes an unpredictable result value. + */ + +/*----------------------------- OCINumberCos --------------------------------*/ + +sword OCINumberCos( OCIError *err, const OCINumber *number, + OCINumber *result ); +/* + NAME: OCINumberCos - OCINumber takes the COSine of an Oracle number + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + number (IN) - argument of the cosine in radians + result (OUT) - result of the cosine + DESCRIPTION: + Takes the cosine in radians of an Oracle number. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + any of the number arguments is null + */ + +/*-------------------------- OCINumberArcCos --------------------------------*/ + +sword OCINumberArcCos( OCIError *err, const OCINumber *number, + OCINumber *result ); +/* + NAME: OCINumberArcCos - OCINumber takes the Arc COSine of an Oracle number + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + number (IN) - argument of the arc cosine + result (OUT) - result of the arc cosine in radians + DESCRIPTION: + Takes the arc cosine in radians of an Oracle number. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + any of the number arguments is null + 'number' is < -1 or 'number' is > 1. + */ + +/*-------------------------- OCINumberHypCos --------------------------------*/ + +sword OCINumberHypCos( OCIError *err, const OCINumber *number, + OCINumber *result ); +/* + NAME: OCINumberHypCos - OCINumber takes the CoSine Hyperbolic of an + Oracle number + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + number (IN) - argument of the cosine hyperbolic + result (OUT) - result of the cosine hyperbolic + DESCRIPTION: + Takes the hyperbolic cosine of an Oracle number. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + any of the number arguments is null + NOTES: + An Oracle number overflow causes an unpredictable result value. + */ + +/*----------------------------- OCINumberTan --------------------------------*/ + +sword OCINumberTan( OCIError *err, const OCINumber *number, + OCINumber *result ); +/* + NAME: OCINumberTan - OCINumber takes the TANgent of an Oracle number + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + number (IN) - argument of the tangent in radians + result (OUT) - result of the tangent + DESCRIPTION: + Takes the tangent in radians of an Oracle number. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + any of the number arguments is null + */ + +/*-------------------------- OCINumberArcTan --------------------------------*/ + +sword OCINumberArcTan( OCIError *err, const OCINumber *number, + OCINumber *result ); +/* + NAME: OCINumberArcTan - OCINumber takes the Arc TANgent of an Oracle number + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + number (IN) - argument of the arc tangent + result (OUT) - result of the arc tangent in radians + DESCRIPTION: + Takes the arc tangent in radians of an Oracle number. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + any of the number arguments is null + */ + +/*------------------------ OCINumberArcTan2 ---------------------------------*/ + +sword OCINumberArcTan2( OCIError *err, const OCINumber *number1, + const OCINumber *number2, OCINumber *result ); +/* + NAME: OCINumberArcTan2 - OCINumber takes the ATan2 of 2 Oracle numbers + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + number1 (IN) - first argument of atan2(y,x) function which + corresponds to 'y' parameter in the function + number2 (IN) - second argument of atan2(y,x) function which + corresponds to 'x' parameter in the function + result (OUT) - result of the atan2() in radians + DESCRIPTION: + Takes the atan2(number1, number2). + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + any of the number arguments is null + 'number2' is 0 + */ + +/*----------------------------- OCINumberHypTan -----------------------------*/ + +sword OCINumberHypTan( OCIError *err, const OCINumber *number, + OCINumber *result ); +/* + NAME: OCINumberHypTan - OCINumber takes the TaNgent Hyperbolic of an Oracle + number + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + number (IN) - argument of the tangent hyperbolic + result (OUT) - result of the tangent hyperbolic + DESCRIPTION: + Takes the hyperbolic tangent of an Oracle number. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + any of the number arguments is null + NOTES: + An Oracle number overflow causes an unpredictable result value. + */ + +/*--------------------------- OCINumberExp ----------------------------------*/ + +sword OCINumberExp( OCIError *err, const OCINumber *number, + OCINumber *result ); +/* + NAME: OCINumberExp - OCINumber EXPonential + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + number (IN) - e raised to this Oracle number power + result (OUT) - output of exponentiation + DESCRIPTION: + Raises e to the specified Oracle number power + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + any of the number arguments is null + */ + +/*----------------------------- OCINumberLn ---------------------------------*/ + +sword OCINumberLn( OCIError *err, const OCINumber *number, + OCINumber *result ); +/* + NAME: OCINumberLn - OCINumber Logarithm Natural + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + number (IN) - logarithm of this number is computed + result (OUT) - logarithm result + DESCRIPTION: + Takes the logarithm of the given Oracle number with respect + to the given base. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + any of the number arguments is null + 'number' is <= 0 + */ + +/*----------------------------- OCINumberLog --------------------------------*/ + +sword OCINumberLog( OCIError *err, const OCINumber *base, + const OCINumber *number, OCINumber *result ); +/* + NAME: OCINumberLog - OCINumber LOGarithm any base + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + base (IN) - base of the logarithm + number (IN) - opearnd + result (OUT) - logarithm result + DESCRIPTION: + Takes the logarithm with the specified base of an Oracle number. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + any of the number arguments is null + 'number' is <= 0 + 'base' is <= 0 + */ + +/*****************************************************************************/ +/* ORACLE DATE TYPE */ +/*****************************************************************************/ + +struct OCITime +{ + ub1 OCITimeHH; /* hours; range is 0 <= hours <=23 */ + ub1 OCITimeMI; /* minutes; range is 0 <= minutes <= 59 */ + ub1 OCITimeSS; /* seconds; range is 0 <= seconds <= 59 */ +}; +typedef struct OCITime OCITime; + +/* + * OCITime - OCI TiMe portion of date + * + * This structure should be treated as an opaque structure as the format + * of this structure may change. Use OCIDateGetTime/OCIDateSetTime + * to manipulate time portion of OCIDate. + */ + +struct OCIDate +{ + sb2 OCIDateYYYY; /* gregorian year; range is -4712 <= year <= 9999 */ + ub1 OCIDateMM; /* month; range is 1 <= month < 12 */ + ub1 OCIDateDD; /* day; range is 1 <= day <= 31 */ + OCITime OCIDateTime; /* time */ +}; +typedef struct OCIDate OCIDate; + +/* + * OCIDate - OCI oracle Date representation in C + * + * OCIDate represents the C mapping of Oracle date. + * + * This structure should be treated as an opaque structure as the format + * of this structure may change. Use OCIDateGetDate/OCIDateSetDate + * to access/initialize OCIDate. + * + * For binding variables of type OCIDate in OCI calls (OCIBindByName(), + * OCIBindByPos(), and OCIDefineByPos()) use the type code SQLT_ODT. + */ + +/* + EXAMPLE + + The following example shows how to manipulate an attribute of type + oracle date. + + #define FMT "Month dd, YYYY, HH:MI A.M." + #define LANG "American" + + struct person + { + OCIDate start_date; + }; + typedef struct person person; + + OCIError *err; + person *joe; + sword status; /o error status o/ + + /o See oci.h for an example of how to initialize OCIError. + o For this example, assume the OCIEnv and OCIError has been + o initialized. + o/ + + /o Pin joe person object in the object cache. See ori.h + o for an example on pinning objects. For this example, assume that + o joe is pointing to the pinned object. + o/ + + /o set the start date of joe o/ + OCIDateSetTime(&joe->start_date, 8, 0, 0); + OCIDateSetDate(&joe->start_date, 1990, 10, 5); + + /o check if the date is valid o/ + uword invalid; + if (OCIDateCheck(err, &joe->start_date, &invalid) != OCI_SUCCESS) + /o error handling code o/ + if (invalid) + /o error handling code o/ + + /o convert date for display purposes o/ + char str[100]; + ub4 strlen = sizeof(str); + if (OCIDateToText(err, &joe->start_date, FMT, sizeof(FMT)-1, LANG, + sizeof(LANG)-1, &strlen, str) != OCI_SUCCESS) + /o error handling code o/ + + */ + +/*--------------------------- OCIDateGetTime --------------------------------*/ +/* void OCIDateGetTime(/o_ const OCIDate *date, ub1 *hour, ub1 *min, + ub1 *sec _o/); */ +#define OCIDateGetTime(date, hour, min, sec) \ + { \ + *hour = (date)->OCIDateTime.OCITimeHH; \ + *min = (date)->OCIDateTime.OCITimeMI; \ + *sec = (date)->OCIDateTime.OCITimeSS; \ + } +/* + NAME: OCIDateGetTime - OCIDate Get Time portion of date + PARAMETERS: + date (IN) - Oracle date whose time data is retrieved + hour (OUT) - hour value returned + min (OUT) - minute value returned + sec (OUT) - second value returned + DESCRIPTION: + Return time inforamtion stored in the given date. The time + information returned is: hour, minute and seconds. + RETURNS: + NONE + */ + +/*--------------------------- OCIDateGetDate --------------------------------*/ +/* void OCIDateGetDate(/o_ const OCIDate *date, sb2 *year, ub1 *month, + ub1 *day _o/); */ +#define OCIDateGetDate(date, year, month, day) \ + { \ + *year = (date)->OCIDateYYYY; \ + *month = (date)->OCIDateMM; \ + *day = (date)->OCIDateDD; \ + } +/* + NAME: OCIDateGetDate - OCIDate Get Date (year, month, day) portion of date + PARAMETERS: + date (IN) - Oracle date whose year, month, day data is retrieved + year (OUT) - year value returned + month (OUT) - month value returned + day (OUT) - day value returned + DESCRIPTION: + Return year, month, day inforamtion stored in the given date. + RETURNS: + NONE + */ + +/*--------------------------- OCIDateSetTime --------------------------------*/ +/* void OCIDateSetTime(/o_ OCIDate *date, ub1 hour, ub1 min, + ub1 sec _o/); */ +#define OCIDateSetTime(date, hour, min, sec) \ + { \ + (date)->OCIDateTime.OCITimeHH = hour; \ + (date)->OCIDateTime.OCITimeMI = min; \ + (date)->OCIDateTime.OCITimeSS = sec; \ + } +/* + NAME: OCIDateSetTime - OCIDate Set Time portion of date + PARAMETERS: + date (OUT) - Oracle date whose time data is set + hour (IN) - hour value to be set + min (IN) - minute value to be set + sec (IN) - second value to be set + DESCRIPTION: + Set the date with the given time inforamtion. + RETURNS: + NONE + */ + +/*--------------------------- OCIDateSetDate --------------------------------*/ +/* void OCIDateSetDate(/o_ OCIDate *date, sb2 year, ub1 month, ub1 day _o/); */ +#define OCIDateSetDate(date, year, month, day) \ + { \ + (date)->OCIDateYYYY = year; \ + (date)->OCIDateMM = month; \ + (date)->OCIDateDD = day; \ + } +/* + NAME: OCIDateSetDate - OCIDate Set Date (year, month, day) portion of date + PARAMETERS: + date (IN) - Oracle date whose year, month, day data is set + year (OUT) - year value to be set + month (OUT) - month value to be set + day (OUT) - day value to be set + DESCRIPTION: + Set the date with the given year, month, day inforamtion. + RETURNS: + NONE + */ + +/*--------------------------- OCIDateAssign ---------------------------------*/ + +sword OCIDateAssign( OCIError *err, const OCIDate *from, + OCIDate *to ); +/* + NAME: OCIDateAssign - OCIDate Assignment + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + from (IN) - date to be assigned + to (OUT) - lhs of assignment + DESCRIPTION: + Performs date assignment. + RETURNS: + OCI_SUCCESS + */ + +/*--------------------------- OCIDateToText ---------------------------------*/ + +sword OCIDateToText( OCIError *err, const OCIDate *date, + const oratext *fmt, ub1 fmt_length, + const oratext *lang_name, ub4 lang_length, + ub4 *buf_size, oratext *buf ); +/* + NAME: OCIDateToText - OCIDate convert date TO String + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + date (IN) - Oracle date to be converted + fmt (IN) - conversion format, if null string pointer (oratext*)0, then + the date is converted to a character string in the + date format "DD-MON-YY". + fmt_length (IN) - length of the 'fmt' parameter + lang_name (IN) - specifies the language in which the names and + abbreviations of months and days are returned; + default language of session is used if 'lang_name' + is null i.e. (oratext *)0 + lang_length (IN) - length of the 'nls_params' parameter + buf_size (IN/OUT) - size of the buffer; size of the resulting string + is returned via this parameter + buf (OUT) - buffer into which the converted string is placed + DESCRIPTION: + Converts the given date to a string according to the specified format. + Refer to "TO_DATE" conversion function described in + "Oracle SQL Language Reference Manual" for a description of format + and NLS arguments. The converted null-terminated date string is + stored in the buffer 'buf'. + + An error is reported upon overflow, e.g. trying to convert a number + of value 10 using format '9' causes an overflow. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + buffer too small + invalid format + unknown language + overflow error + */ + +/*---------------------------- OCIDateFromText ------------------------------*/ + +sword OCIDateFromText( OCIError *err, const oratext *date_str, + ub4 d_str_length, const oratext *fmt, ub1 fmt_length, + const oratext *lang_name, ub4 lang_length, + OCIDate *date ); +/* + NAME: OCIDateFromText - OCIDate convert String TO Date + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + date_str (IN) - input string to be converted to Oracle date + d_str_length (IN) - size of the input string, if the length is -1 + then 'date_str' is treated as a null terminated string + fmt (IN) - conversion format; if 'fmt' is a null pointer, then + the string is expected to be in 'DD-MON-YY' format. + fmt_length (IN) - length of the 'fmt' parameter + lang_name (IN) - language in which the names and abbreviations of + days and months are specified, if null i.e. (oratext *)0, + the default language of session is used, + lang_length (IN) - length of the 'lang_name' parameter + date (OUT) - given string converted to date + DESCRIPTION: + Converts the given string to Oracle date + according to the specified format. Refer to "TO_DATE" conversion + function described in "Oracle SQL Language Reference Manual" for a + description of format. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + invalid format + unknown language + invalid input string + + */ + +/*----------------------------- OCIDateCompare ------------------------------*/ + +sword OCIDateCompare( OCIError *err, const OCIDate *date1, + const OCIDate *date2, sword *result ); +/* + NAME: OCIDateCompare - OCIDate CoMPare dates + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + date1, date2 (IN) - dates to be compared + result (OUT) - comparison result, 0 if equal, -1 if date1 < date2, + 1 if date1 > date2 + DESCRIPTION: + The function OCIDateCompare compares two dates. It returns -1 if date1 + is smaller than date2, 0 if they are equal, and 1 if date1 is greater + than date2. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + invalid date + + */ + +/*------------------------- OCIDateAddMonths --------------------------------*/ + +sword OCIDateAddMonths( OCIError *err, const OCIDate *date, sb4 num_months, + OCIDate *result ); +/* + NAME: OCIDateAddMonths - OCIDate ADd or subtract Months + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + date (IN) - 'num_months' added or subtracted from 'date' + num_months (IN) - number of months to be added or subtracted + (a negative value will be subtracted) + result (IN/OUT) - result of adding or subtracting to 'date' + DESCRIPTION: + The function OCIDateAddDays adds or subtracts num_months from the + date 'date'. + If the input 'date' is the last day of a month, then + appropriate adjustments are made to ensure that the output date is + also the last day of the month. For example, Feb. 28 + 1 month = + March 31, and November 30 - 3 months = August 31. Otherwise the + 'result' date has the same day component as 'date'. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + invalid date + + */ + +/*--------------------------- OCIDateAddDays --------------------------------*/ + +sword OCIDateAddDays( OCIError *err, const OCIDate *date, sb4 num_days, + OCIDate *result ); +/* + NAME: OCIDateAddDays - OCIDate ADd or subtract Days + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + date (IN) - 'num_days' added or subtracted from 'date' + num_days (IN) - number of days to be added or subtracted + (a negative value will be subtracted) + result (IN/OUT) - result of adding or subtracting to 'date' + DESCRIPTION: + The function OCIDateAddDays adds or subtracts num_days from the + date 'date'. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + invalid date + + */ + +/*--------------------------- OCIDateLastDay --------------------------------*/ + +sword OCIDateLastDay( OCIError *err, const OCIDate *date, + OCIDate *last_day ); +/* + NAME: OCIDateLastDay - OCIDate get date of the LaST day of the month + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + date (IN) - input date + last_day (OUT) - last day of the month in date 'date' + DESCRIPTION: + The function OCIDateLastDay returns the date of the last day of the + month in date 'date'. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + invalid date + + */ + +/*----------------------- OCIDateDaysBetween --------------------------------*/ + +sword OCIDateDaysBetween( OCIError *err, const OCIDate *date1, + const OCIDate *date2, sb4 *num_days ); +/* + NAME: OCIDateDaysBetween - OCIDate get number of days BeTWeen two dates + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + date1, date2 (IN) - input dates + num_days (OUT) - number of days between date1 and date2 + DESCRIPTION: + The function OCIDateDaysBetween returns the number of days between + date1 and date2. The time is ignored in this computation. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + invalid date + + */ + +/*------------------------ OCIDateZoneToZone --------------------------------*/ + +sword OCIDateZoneToZone( OCIError *err, const OCIDate *date1, + const oratext *zon1, + ub4 zon1_length, const oratext *zon2, + ub4 zon2_length, OCIDate *date2 ); +/* + NAME: OCIDateZoneToZone - OCIDate convert date from one Zone TO another Zone + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + date1 (IN) - date to be converted + zon1 (IN) - zone of input date + zon1_length (IN) - length in bytes of string 'zon1' + zon2 (IN) - zone to be converted to + zon2_length (IN) - length in bytes of string 'zon2' + date2 (OUT) - converted date (in 'zon2') + DESCRIPTION: + Converts date from one time zone to another. Given date 'date1' + in time zone 'zon1' returns date 'date2' in time zone 'zon2'. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + invlid date + invald input time zone + invald output time zone + + */ + +/*--------------------------- OCIDateNextDay --------------------------------*/ + +sword OCIDateNextDay( OCIError *err, const OCIDate *date, + const oratext *day_p, ub4 day_length, + OCIDate *next_day ); +/* + NAME: OCIDateNextDay - OCIDate get date of Next DaY + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + date (IN) - returned date should be later than this date + day (IN) - first day of week named by this is returned + day_length (IN) - length in bytes of string 'day' + next_day (OUT) - first day of the week named by 'day' later than 'date' + DESCRIPTION: + Returns the date of the first day of the + week named by 'day' that is later than date 'date'. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + invalid date + invalid day + + */ + +/*----------------------------- OCIDateCheck --------------------------------*/ + +/* Listing of error bits used by OCIDateCheck() */ +#define OCI_DATE_INVALID_DAY 0x1 /* Bad DAy */ +#define OCI_DATE_DAY_BELOW_VALID 0x2 /* Bad DAy Low/high bit (1=low)*/ +#define OCI_DATE_INVALID_MONTH 0x4 /* Bad MOnth */ +#define OCI_DATE_MONTH_BELOW_VALID 0x8 /* Bad MOnth Low/high bit (1=low)*/ +#define OCI_DATE_INVALID_YEAR 0x10 /* Bad YeaR */ +#define OCI_DATE_YEAR_BELOW_VALID 0x20 /* Bad YeaR Low/high bit (1=low)*/ +#define OCI_DATE_INVALID_HOUR 0x40 /* Bad HouR */ +#define OCI_DATE_HOUR_BELOW_VALID 0x80 /* Bad HouR Low/high bit (1=low)*/ +#define OCI_DATE_INVALID_MINUTE 0x100 /* Bad MiNute */ +#define OCI_DATE_MINUTE_BELOW_VALID 0x200 + /* Bad MiNute Low/high bit (1=low)*/ +#define OCI_DATE_INVALID_SECOND 0x400 /* Bad SeCond */ +#define OCI_DATE_SECOND_BELOW_VALID 0x800 + /* bad second Low/high bit (1=low)*/ +#define OCI_DATE_DAY_MISSING_FROM_1582 0x1000 + /* Day is one of those "missing" from 1582 */ +#define OCI_DATE_YEAR_ZERO 0x2000 /* Year may not equal zero */ +#define OCI_DATE_INVALID_FORMAT 0x8000 /* Bad date format input */ + +sword OCIDateCheck( OCIError *err, const OCIDate *date, uword *valid ); +/* + NAME: OCIDateCheck - OCIDate CHecK if the given date is valid + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + date (IN) - date to be checked + valid (OUT) - returns zero for a valid date, otherwise + the ORed combination of all error bits specified below: + + Macro name Bit number Error + ---------- ---------- ----- + OCI_DATE_INVALID_DAY 0x1 Bad day + OCI_DATE_DAY_BELOW_VALID 0x2 Bad DAy Low/high bit (1=low) + OCI_DATE_INVALID_MONTH 0x4 Bad MOnth + OCI_DATE_MONTH_BELOW_VALID 0x8 Bad MOnth Low/high bit (1=low) + OCI_DATE_INVALID_YEAR 0x10 Bad YeaR + OCI_DATE_YEAR_BELOW_VALID 0x20 Bad YeaR Low/high bit (1=low) + OCI_DATE_INVALID_HOUR 0x40 Bad HouR + OCI_DATE_HOUR_BELOW_VALID 0x80 Bad HouR Low/high bit (1=low) + OCI_DATE_INVALID_MINUTE 0x100 Bad MiNute + OCI_DATE_MINUTE_BELOW_VALID 0x200 Bad MiNute Low/high bit (1=low) + OCI_DATE_INVALID_SECOND 0x400 Bad SeCond + OCI_DATE_SECOND_BELOW_VALID 0x800 bad second Low/high bit (1=low) + OCI_DATE_DAY_MISSING_FROM_1582 0x1000 Day is one of those "missing" + from 1582 + OCI_DATE_YEAR_ZERO 0x2000 Year may not equal zero + OCI_DATE_INVALID_FORMAT 0x8000 Bad date format input + + So, for example, if the date passed in was 2/0/1990 25:61:10 in + (month/day/year hours:minutes:seconds format), the erroor returned + would be OCI_DATE_INVALID_DAY | OCI_DATE_DAY_BELOW_VALID | + OCI_DATE_INVALID_HOUR | OCI_DATE_INVALID_MINUTE + + DESCRIPTION: + Check if the given date is valid. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + 'date' and 'valid' pointers are NULL pointers + */ + +/*--------------------------- OCIDateSysDate --------------------------------*/ + +sword OCIDateSysDate( OCIError *err, OCIDate *sys_date ); +/* + NAME: OCIDateSysDate - OCIDate get current SYStem date and time + PARAMETERS: + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + sys_date (OUT) - current system date and time + DESCRIPTION: + Returns the current system date and time. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'err' is NULL. + OCI_ERROR if + + */ + +/*****************************************************************************/ +/* FIXED-LENGTH STRING - CHAR (N) */ +/*****************************************************************************/ + +/* + * An ADT attribute declared as "x CHAR(n)" is mapped to "OCIString *x;". + * The representation of OCIString * is shown below. + */ + +/*****************************************************************************/ +/* VARIABLE-LENGTH STRING */ +/*****************************************************************************/ + +/* + * The variable-length string is represented in C as a pointer to OCIString + * structure. The OCIString structure is opaque to the user. Functions are + * provided to allow the user to manipulate a variable-length string. + * + * A variable-length string can be declared as: + * + * OCIString *vstr; + * + * For binding variables of type OCIString* in OCI calls (OCIBindByName(), + * OCIBindByPos() and OCIDefineByPos()) use the external type code SQLT_VST. + */ +typedef struct OCIString OCIString; + +/*-------------------------- OCIStringAssign --------------------------------*/ + +sword OCIStringAssign( OCIEnv *env, OCIError *err, const OCIString *rhs, + OCIString **lhs ); +/* + NAME: OCIStringAssign - OCIString Assign String to String + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + rhs (IN) - RHS of the assignment, the type of rhs is also OCIString + lhs (IN/OUT) - LHS of the assignment + DESCRIPTION: + Assign 'rhs' string to 'lhs' string. The 'lhs' string may be + resized depending upon the size of the 'rhs'. The assigned string is + null-terminated. The 'length' field will not include the extra byte + needed for null termination. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is NULL. + OCI_ERROR if + out of space error + */ + +/*---------------------- OCIStringAssignText --------------------------------*/ + +sword OCIStringAssignText( OCIEnv *env, OCIError *err, const oratext *rhs, + ub4 rhs_len, OCIString **lhs ); +/* + NAME: OCIStringAssignText - OCIString Assign Text string to String + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + rhs (IN) - RHS of the assignment, the type of rhs is a text string + rhs_len (IN) - length of the 'rhs' string + lhs (IN/OUT) - LHS of the assignment + DESCRIPTION: + Assign 'rhs' string to 'lhs' string. The 'lhs' string may be + resized depending upon the size of the 'rhs'. The assigned string is + null-terminated. The 'length' field will not include the extra byte + needed for null termination. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is NULL. + OCI_ERROR if + out of space error + */ + +/*-------------------------- OCIStringResize --------------------------------*/ + +sword OCIStringResize( OCIEnv *env, OCIError *err, ub4 new_size, + OCIString **str ); +/* + NAME: OCIStringResize - OCIString ReSiZe string memory + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + new_size (IN) - new memory size of the string in bytes + str (IN/OUT) - allocated memory for the string is freed from the + OOCI heap + DESCRIPTION: + This function resizes the memory of the given variable-length string in + the object cache. The contents of the string are NOT preserved. + This function may allocate the string in a new memory region in + which case the original memory occupied by the given string will + be freed. If the input string is null (str == NULL), then this + function will allocate memory for the string. + + If the new_size is 0, then this function frees the memory occupied + by 'str' and a null pointer value is returned. + + NOTE: The caller must compute 'new_size' taking into account space + for the null character ('\0'). + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is NULL. + OCI_ERROR if + out of space error + */ + +/*---------------------------- OCIStringSize --------------------------------*/ + +ub4 OCIStringSize( OCIEnv *env, const OCIString *vs ); +/* + NAME: OCIStringSize - OCIString Get String siZe + PARAMETERS: + env(IN) - pointer to OCI environment handle + vs (IN) - string whose size is returned + DESCRIPTION: + Return the size of the given string. + RETURNS: + size of the string in bytes is returned + */ + +/*----------------------------- OCIStringPtr --------------------------------*/ + +oratext *OCIStringPtr( OCIEnv *env, const OCIString *vs ); +/* + NAME: OCIStringPtr - OCIString Get String Pointer + PARAMETERS: + env(IN) - pointer to OCI environment handle + vs (IN) - pointer to the text of this string is returned + DESCRIPTION: + Return the pointer to the text of the given string. + RETURNS: + pointer to the text of the string is returned + */ + +/*----------------------- OCIStringAllocSize --------------------------------*/ + +sword OCIStringAllocSize( OCIEnv *env, OCIError *err, const OCIString *vs, + ub4 *allocsize ); +/* + NAME: OCIStringAllocSize - OCIString get Allocated SiZe of string memory + in bytes + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + vs (IN) - string whose allocated size in bytes is returned + allocsize (OUT) - allocated size of string memory in bytes is returned + DESCRIPTION: + Return the allocated size of the string memory in bytes. The + allocated size is >= actual string size. + REQUIRES: + vs is a non-null pointer + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is NULL. + OCI_ERROR on error + */ + +/*****************************************************************************/ +/* VARIABLE-LENGTH RAW */ +/*****************************************************************************/ + +/* + * The variable-length raw is represented in C as a pointer to OCIRaw + * structure. The OCIRaw structure is opaque to the user. Functions are + * provided to allow the user to manipulate a variable-length raw. + * + * A variable-length raw can be declared as: + * + * OCIRaw *raw; + * + * For binding variables of type OCIRaw* in OCI calls (OCIBindByName(), + * OCIBindByPos() and OCIDefineByPos()) use the external type code SQLT_LVB. + */ +typedef struct OCIRaw OCIRaw; + +/*-------------------------- OCIRawAssignRaw --------------------------------*/ + +sword OCIRawAssignRaw( OCIEnv *env, OCIError *err, const OCIRaw *rhs, + OCIRaw **lhs ); +/* + NAME: OCIRawAssignRaw - OCIRaw Assign Raw (of type OCIRaw*) to + Raw (of type OCIRaw*) + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + rhs (IN) - RHS of the assignment, the type of rhs is also OCIRaw + lhs (IN/OUT) - LHS of the assignment + DESCRIPTION: + Assign 'rhs' raw to 'lhs' raw. The 'lhs' raw may be + resized depending upon the size of the 'rhs'. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is NULL. + OCI_ERROR if + out of space error + */ + +/*------------------------ OCIRawAssignBytes --------------------------------*/ + +sword OCIRawAssignBytes( OCIEnv *env, OCIError *err, const ub1 *rhs, + ub4 rhs_len, OCIRaw **lhs ); +/* + NAME: OCIRawAssignBytes - OCIRaw Assign raw Bytes (of type ub1*) to Raw + (of type OCIRaw*) + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + rhs (IN) - RHS of the assignment, the type of rhs is ub1 * + rhs_len (IN) - length of the 'rhs' raw + lhs (IN/OUT) - LHS of the assignment + DESCRIPTION: + Assign 'rhs' raw to 'lhs' raw. The 'lhs' raw may be + resized depending upon the size of the 'rhs'. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is NULL. + OCI_ERROR if + out of space error + */ + +/*---------------------------- OCIRawResize ---------------------------------*/ + +sword OCIRawResize( OCIEnv *env, OCIError *err, ub4 new_size, + OCIRaw **raw ); +/* + NAME: OCIRawResize - OCIRaw ReSiZe memory of variable-length raw + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + new_size (IN) - new size of the raw data in bytes + raw (IN) - variable-length raw pointer; the raw is + resized to 'new_size' + DESCRIPTION: + This function resizes the memory of the given variable-length raw in + the object cache. + The previous contents of the raw are NOT preserved. + This function may allocate the raw in a new memory region in + which case the original memory occupied by the given raw will + be freed. If the input raw is null (raw == NULL), then this + function will allocate memory for the raw data. + + If the new_size is 0, then this function frees the memory occupied + by 'raw' and a null pointer value is returned. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is NULL. + OCI_ERROR if + out of space error + */ + +/*------------------------------- OCIRawSize --------------------------------*/ + +ub4 OCIRawSize( OCIEnv * env, const OCIRaw *raw ); +/* + NAME: OCIRawSize - OCIRaw Get Raw siZe + PARAMETERS: + env (IN) - pointer to OCI environment handle + raw (INT) - raw whose size is returned + DESCRIPTION: + Return the size of the given raw. + RETURNS: + size of the raw in bytes is returned + */ + +/*--------------------------------- OCIRawPtr -------------------------------*/ +ub1 *OCIRawPtr( OCIEnv * env, const OCIRaw *raw ); +/* + NAME: OCIRawPtr - OCIRaw Get Raw data Pointer + PARAMETERS: + env (IN) - pointer to OCI environment handle + raw (IN) - pointer to the data of this raw is returned + DESCRIPTION: + Return the pointer to the data of the given raw. + RETURNS: + pointer to the data of the raw is returned + */ + +/*------------------------------ OCIRawAllocSize ----------------------------*/ + +sword OCIRawAllocSize( OCIEnv *env, OCIError *err, const OCIRaw *raw, + ub4 *allocsize ); +/* + NAME: OCIRawAllocSize - OCIRaw get Allocated SiZe of raw memory in bytes + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + raw (IN) - raw whose allocated size in bytes is returned + allocsize (OUT) - allocated size of raw memory in bytes is returned + DESCRIPTION: + Return the allocated size of the raw memory in bytes. The + allocated size is >= actual raw size. + REQUIRES: + raw is a non-null pointer + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is NULL. + OCI_ERROR upon error + */ + +/*****************************************************************************/ +/* OBJECT REFERENCE OPERATIONS */ +/*****************************************************************************/ + +/* + * See the definition of OCIRef in oro.h. + * + * For binding variables of type OCIRef* in OCI calls (OCIBindByName(), + * OCIBindByPos() and OCIDefineByPos()) use the code SQLT_REF. + * + */ + +/*---------------------------- OCIRefClear ----------------------------------*/ +void OCIRefClear( OCIEnv *env, OCIRef *ref ); +/* + NAME: OCIRefClear - OCIRef CLeaR or nullify a ref + PARAMETERS: + env (IN) - pointer to OCI environment handle + ref (IN/OUT) - ref to clear + DESCRIPTION: + Clear or nullify the given ref. A ref is considered to be a null ref + if it does not contain a valid OID (and thus doesn't point to an + object). Logically, a null ref is a dangling ref. + + Note that a null ref is still a valid SQL value and is not SQL-ly null. + It can be used as a valid non-null constant ref value for NOT NULL + column or attribute of a row in a table. + + If a null pointer value is passed as a ref, + then this function is a no-op. + */ + +/*--------------------------- OCIRefAssign ----------------------------------*/ +sword OCIRefAssign( OCIEnv *env, OCIError *err, const OCIRef *source, + OCIRef **target ); +/* + NAME: OCIRefAssign - OCIRef CoPY a ref to another + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + source (IN) - ref to copy from + target (IN/OUT) - ref to copy to + DESCRIPTION: + Copy 'source' ref to 'target' ref; both then reference the same + object. If the target ref pointer is null (i.e. *target == NULL) + then the copy function will allocate memory for the target ref + in OOCI heap prior to the copy. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is NULL. + OCI_ERROR if + 1) out of memory + */ + +/*-------------------------- OCIRefIsEqual ----------------------------------*/ +boolean OCIRefIsEqual( OCIEnv *env, const OCIRef *x, const OCIRef *y ); +/* + NAME: OCIRefIsEqual - OCIRef compare two refs for EQUality + PARAMETERS: + env (IN) - pointer to OCI environment handle + x (IN) - ref to compare + y (IN) - ref to compare + DESCRIPTION: + Compare the given refs for equality. + Two refs are equal if and only if: + - they are both referencing the same persistent object, or + - they are both referencing the same transient object. + + NOTE THAT TWO NULL REFS ARE CONSIDERED NOT EQUAL BY THIS FUNCTION. + RETURNS: + TRUE if the two refs are equal + FALSE if the two refs are not equal, or X is NULL, or Y is NULL + */ + +/*--------------------------- OCIRefIsNull ----------------------------------*/ +boolean OCIRefIsNull( OCIEnv *env, const OCIRef *ref ); +/* + NAME: OCIRefIsNull - OCIRef test if a ref is NULl + PARAMETERS: + env (IN) - pointer to OCI environment handle + ref (IN) - ref to test for null + DESCRIPTION: + Return TRUE if the given ref is null; otherwise, return FALSE. + A ref is null if and only if: + - it is supposed to be referencing a persistent object, but + its OID is null, or + - it is supposed to be referencing a transient object, but it is + currently not pointing to an object. + A ref is a dangling ref if the object that it points to does not + exist. + RETURNS: + TRUE if the given ref is NULL + FALSE if the given ref is not NULL + */ + +/*-------------------------- OCIRefHexSize ----------------------------------*/ +ub4 OCIRefHexSize( OCIEnv *env, const OCIRef *ref ); +/* + NAME: OCIRefHexSize - OCIRef Hexadecimal buffer SiZe in bytes + PARAMETERS: + env (IN) - pointer to OCI environment handle + ref (IN) - ref whose size in hexadecimal representation in bytes is + returned + DESCRIPTION: + Return the size of the buffer in bytes required for the hexadecimal + representation of the ref. A buffer of at-least this size must be + passed to ref-to-hex (OCIRefToHex) conversion function. + RETURNS: + size of hexadecimal representation of ref + */ + +/*-------------------------- OCIRefFromHex ---------------------------------*/ +sword OCIRefFromHex( OCIEnv *env, OCIError *err, const OCISvcCtx *svc, + const oratext *hex, ub4 length, OCIRef **ref ); +/* + NAME: + OCIRefFromHex - OCIRef convert a Hexadecimal string TO a Ref + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by + calling OCIErrorGet(). + svc (IN) - OCI service context handle; if the resulting ref is + initialized with this service context + hex (IN) - hexadecimal string (that was produced by 'OCIRefToHex()" + previously) to be convert into a ref + length (IN) - length of the hexadecimal string + ref (IN/OUT) - ref is initialized with the given value ('hex'). + If *ref is null, then space for the ref is allocated in the + object cache, otherwise the memory occupied by the given ref + is re-used. + DESCRIPTION: + Convert the given hexadecimal string into a ref. This function + ensures that the resulting ref is well formed. It does NOT ensure + that the object pointed to by the resulting ref exists or not. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is NULL. + OCI_ERROR if + */ + +/*--------------------------- OCIRefToHex -----------------------------------*/ +sword OCIRefToHex( OCIEnv *env, OCIError *err, const OCIRef *ref, + oratext *hex, ub4 *hex_length ); +/* + NAME: + OCIRefToHex - OCIRef convert ref to a Hexadecimal string + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by + calling OCIErrorGet(). + ref (IN) - ref to be converted into a hexadecimal string; if the + ref is a null ref (i.e. OCIRefIsNull(ref) == TRUE) then + a zero hex_length value is returned + hex (OUT) - buffer that is large enough to contain the resulting + hexadecimal string; the contents of the string is opaque + to the caller + hex_length (IN/OUT) - on input specifies the size of the 'hex' buffer, + on output specifies the actual size of the hexadecimal + string being returned in 'hex' + DESCRIPTION: + Convert the given ref into a hexadecimal string, and return the length + of the string. The resulting string is opaque to the caller. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is NULL. + OCI_ERROR if + the given buffer is not big enough to hold the resulting string + */ + + +/*****************************************************************************/ +/* COLLECTION FUNCTIONS */ +/*****************************************************************************/ + +/* + The generic collection is represented by the type 'OCIColl'. The following + operations OCIColl*() are provided on a generic collection: + - get current size of collection + - get upper bound of collection + - get pointer to an element given its index + - set element at given index (assign element) + - append an element + - trim the given number of elements from the end of the collection + - collection assignment + + The following iterator based scanning functions are also provided on a + generic collection. These functions make use of an iterator which is + defined to be of type OCIIter. + + - create an iterator for scanning collection + - destroy iterator + - reset iterator to the beginning of collection + - get pointer to current element pointed by iterator + - get pointer to next element + - get pointer to previous element + + The collections variable-length array (varray) and nested table + are sub-types of generic collection. This means that the OCIColl*() + functions can also be used to manipulate varray and nested table. + + The varray is represented by OCIArray type and nested table by OCITable. + Besides OCIColl*() functions no additional functions are provided for + manipulating varrays. The OCIColl*() functions are a complete set of + functions to manipulate varrays. + + Besides OCIColl*() functions, the following functions OCITable*() can be + used to manipulate nested table. The OCITable*() functions operate on + nested tables only and should not be used on a varray. + + - delete an element at index i. Note that the position + ordinals of the remaining elements of the table is not changed by the + delete operation. So delete creates "holes" in the table. + - check if an element exists at the given index i + - return the smallest value of i for which exists(i) is true + - return the largest value of i for which exists(i) is true + - return pointer to the smallest position j, greater than i, such that + OCITableExists(j) is true + - return pointer to the largest position j, less than i, such that + OCITableExists(j) is true + + For binding variables of type OCIColl* or OCITable* in OCI calls + (OCIBindByName(), OCIBindByPos() and OCIDefineByPos()) use the external + type code SQLT_NTY. + */ + +/* OCIColl - generic collection type */ +typedef struct OCIColl OCIColl; + +/* OCIArray - varray collection type */ +typedef OCIColl OCIArray; + +/* OCITable - nested table collection type */ +typedef OCIColl OCITable; + +/* OCIIter - collection iterator */ +typedef struct OCIIter OCIIter; + +/*----------------------------- OCICollSize ---------------------------------*/ + +sword OCICollSize( OCIEnv *env, OCIError *err, const OCIColl *coll, + sb4 *size ); +/* + NAME: OCICollSize - OCIColl return current SIZe of the given collection + PARAMETERS: + env(IN) - pointer to OCI environment handle + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + coll (IN) - collection whose number of elements is returned + size (OUT) - current number of elements in the collection + DESCRIPTION: + Returns the current number of elements in the given collection. + + For collections of type nested table wherein 'delete element' + operation is allowed, the count returned by OCICollSize() will + NOT be decremented upon deleting elements. For example: + + OCICollSize(...); + // assume 'size' returned is equal to 5 + OCITableDelete(...); // delete one element + OCICollSize(...); + // 'size' returned will still be 5 + + To get the count minus the deleted elements use OCITableSize(). + Continuing the above example, + + OCITableSize(...) + // 'size' returned will be equal to 4 + + Note, a trim operation (OCICollTrim) will decrement the count + by the number of trimmed elements. Continuing the above example, + + OCICollTrim(..,1..); // trim one element + OCICollSize(...); + // 'size' returned will be equal to 4 + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is NULL. + OCI_ERROR if + error during loading of collection into object cache + any of the input parameters is null + */ + +/*------------------------------ OCICollMax ---------------------------------*/ + +sb4 OCICollMax( OCIEnv *env, const OCIColl *coll ); +/* + NAME: OCICollMax - OCIColl return MAXimum size (upper-bound) of the + given collection (in number of elements) + PARAMETERS: + env(IN) - pointer to OCI environment handle + coll (IN) - collection whose upper-bound in number of elements + is returned + DESCRIPTION: + Returns the max number of elements that the given collection can hold. + A value 0 indicates that the collection has no upper-bound. + REQUIRES: + coll must point to a valid collection descriptor + RETURNS: + upper-bound of the given collection + */ + +/*-------------------------- OCICollGetElem ---------------------------------*/ + +sword OCICollGetElem( OCIEnv *env, OCIError *err, const OCIColl *coll, + sb4 index, boolean *exists, void **elem, + void **elemind ); +/* + NAME: OCICollGetElem - OCIColl GET pointer to the element at the given index + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + coll (IN) - pointer to the element in this collection is returned + index (IN) - index of the element whose pointer is returned + exists (OUT) - set to FALSE if element at the specified index does + not exist else TRUE + elem (OUT) - address of the desired element is returned + elemind (OUT) [optional] - address of the null indicator information + is returned; if (elemind == NULL) then the null indicator + information will NOT be returned + DESCRIPTION: + Get the address of the element at the given position. Optionally + this function also returns the address of the element's null indicator + information. + + The following table describes for each collection element type + what the corresponding element pointer type is. The element pointer + is returned via the 'elem' parameter of OCICollGetElem(). + + Element Type *elem is set to + ----------------------- --------------- + Oracle Number (OCINumber) OCINumber* + Date (OCIDate) OCIDate* + Variable-length string (OCIString*) OCIString** + Variable-length raw (OCIRaw*) OCIRaw** + object reference (OCIRef*) OCIRef** + lob locator (OCILobLocator*) OCILobLocator** + object type (e.g. person) person* + + The element pointer returned by OCICollGetElem() is in a form + such that it can not only be used to access the + element data but also is in a form that can be used as the target + (i.e left-hand-side) of an assignment statement. + + For example, assume the user is iterating over the elements of + a collection whose element type is object reference (OCIRef*). A call + to OCICollGetElem() returns pointer to a reference handle + (i.e. OCIRef**). After getting, the pointer to the collection + element, the user may wish to modify it by assigning a new reference. + This can be accomplished via the ref assignment function shown below: + + sword OCIRefAssign( OCIEnv *env, OCIError *err, const OCIRef *source, + OCIRef **target ); + + Note that the 'target' parameter of OCIRefAssign() is of type + 'OCIRef**'. Hence OCICollGetElem() returns 'OCIRef**'. + If '*target == NULL' a new ref will be allocated by OCIRefAssign() + and returned via the 'target' parameter. + + Similarly, if the collection element was of type string (OCIString*), + OCICollGetElem() returns pointer to string handle + (i.e. OCIString**). If a new string is assigned, via + OCIStringAssign() or OCIStringAssignText() the type of the target + must be 'OCIString **'. + + If the collection element is of type Oracle number, OCICollGetElem() + returns OCINumber*. The prototype of OCINumberAssign() is shown below: + + sword OCINumberAssign(OCIError *err, const OCINumber *from, + OCINumber *to); + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is NULL. + OCI_ERROR if + any of the input parameters is null + */ + +/*------------------------- OCICollGetElemArray -----------------------------*/ + +sword OCICollGetElemArray( OCIEnv *env, OCIError *err, const OCIColl *coll, + sb4 index, boolean *exists, void **elem, + void **elemind, uword *nelems); +/* + NAME: OCICollGetElemArray - OCIColl GET pointers to elements from given index + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + coll (IN) - pointers to the elements in this collection is returned + index (IN) - starting index of the element + exists (OUT) - set to FALSE if element at the specified index does + not exist else TRUE + elem (OUT) - address of the desired elements is returned + elemind (OUT) [optional] - address of the null indicators information + is returned; if (elemind == NULL) then the null indicator + information will NOT be returned + nelems(IN/OUT) - Upper bound of elem and/or elemind array + DESCRIPTION: + Get the address of the elements from the given position. Optionally + this function also returns the address of the element's null indicator + information. + + The following table describes for each collection element type + what the corresponding element pointer type is. The element pointer + is returned via the 'elem' parameter of OCICollGetElem(). + + Element Type *elem is set to + ----------------------- --------------- + Oracle Number (OCINumber) OCINumber* + Date (OCIDate) OCIDate* + Variable-length string (OCIString*) OCIString** + Variable-length raw (OCIRaw*) OCIRaw** + object reference (OCIRef*) OCIRef** + lob locator (OCILobLocator*) OCILobLocator** + object type (e.g. person) person* + + The element pointer returned by OCICollGetElem() is in a form + such that it can not only be used to access the + element data but also is in a form that can be used as the target + (i.e left-hand-side) of an assignment statement. + + For example, assume the user is iterating over the elements of + a collection whose element type is object reference (OCIRef*). A call + to OCICollGetElem() returns pointer to a reference handle + (i.e. OCIRef**). After getting, the pointer to the collection + element, the user may wish to modify it by assigning a new reference. + This can be accomplished via the ref assignment function shown below: + + sword OCIRefAssign( OCIEnv *env, OCIError *err, const OCIRef *source, + OCIRef **target ); + + Note that the 'target' parameter of OCIRefAssign() is of type + 'OCIRef**'. Hence OCICollGetElem() returns 'OCIRef**'. + If '*target == NULL' a new ref will be allocated by OCIRefAssign() + and returned via the 'target' parameter. + + Similarly, if the collection element was of type string (OCIString*), + OCICollGetElem() returns pointer to string handle + (i.e. OCIString**). If a new string is assigned, via + OCIStringAssign() or OCIStringAssignText() the type of the target + must be 'OCIString **'. + + If the collection element is of type Oracle number, OCICollGetElem() + returns OCINumber*. The prototype of OCINumberAssign() is shown below: + + sword OCINumberAssign(OCIError *err, const OCINumber *from, + OCINumber *to); + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is NULL. + OCI_ERROR if + any of the input parameters is null + */ + +/*----------------------- OCICollAssignElem ---------------------------------*/ + +sword OCICollAssignElem( OCIEnv *env, OCIError *err, sb4 index, + const void *elem, + const void *elemind, OCIColl *coll ); +/* + NAME: OCICollAssignElem - OCIColl ASsign Element + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + index (IN) - index of the element whose is assigned to + elem (IN) - element which is assigned from (source element) + elemind (IN) [optional] - pointer to the element's null indicator + information; if (elemind == NULL) then the null indicator + information of the assigned element will be set to non-null. + coll (IN/OUT) - collection to be updated + DESCRIPTION: + Assign the given element value 'elem' to the element at coll[index]. + If the collection is of type nested table, the element at the given + index may not exist (i.e. may have been deleted). In this case, the + given element is inserted at index 'index'. + Otherwise, the element at index 'index' is updated with the value + of 'elem'. + + Note that the given element is deep-copied and + 'elem' is strictly an input parameter. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is NULL. + OCI_ERROR if + any of the input parameters is null + out of memory error + given index is out of bounds of the given collection + */ + +/*--------------------------- OCICollAssign ---------------------------------*/ + +sword OCICollAssign( OCIEnv *env, OCIError *err, const OCIColl *rhs, + OCIColl *lhs ); +/* + NAME: OCICollAssign - OCIColl ASsiGn collection + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + rhs (IN) - collection to be assigned from + lhs (OUT) - collection to be assigned to + DESCRIPTION: + Assign 'rhs' to 'lhs'. The 'lhs' collection may be decreased or + increased depending upon the size of 'rhs'. If the 'lhs' contains + any elements then the elements will be deleted prior to the + assignment. This function performs a deep-copy. The memory for the + elements comes from the object cache. + + An error is returned if the element types of the lhs and rhs + collections do not match. Also, an error is returned if the + upper-bound of the lhs collection is less than the current number of + elements in the rhs collection. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is NULL. + OCI_ERROR if + any of the input parameters is null + out of memory error + type mis-match of lhs and rhs collections + upper-bound of lhs collection is less than the current number of + elements in the rhs collection + */ + +/*--------------------------- OCICollAppend ---------------------------------*/ + +sword OCICollAppend( OCIEnv *env, OCIError *err, const void *elem, + const void *elemind, OCIColl *coll ); +/* + NAME: OCICollAppend - OCIColl APPend collection + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + elem (IN) - pointer to the element which is appended to the end + of the given collection + elemind (IN) [optional] - pointer to the element's null indicator + information; if (elemind == NULL) then the null indicator + information of the appended element will be set to non-null. + coll (IN/OUT) - updated collection + DESCRIPTION: + Append the given element to the end of the given collection. + Appending an element is equivalent to: + - increasing the size of the collection by 1 element + - updating (deep-copying) the last element's data with the given + element's data + + Note that the pointer to the given element 'elem' will not be saved + by this function. So 'elem' is strictly an input parameter. + An error is returned if the current size of the collection + is equal to the max size (upper-bound) of the collection prior to + appending the element. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is NULL. + OCI_ERROR if + any of the input parameters is null + out of memory error + current size of collection == max size of the collection + */ + +/*----------------------------- OCICollTrim ---------------------------------*/ + +sword OCICollTrim( OCIEnv *env, OCIError *err, sb4 trim_num, + OCIColl *coll ); +/* + NAME: OCICollTrim - OCIColl Trim elements from the end of the collection + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + trim_num (IN) - number of elements to trim + coll (IN/OUT) - 'trim_num' of elements are removed (freed) from the + end of the collection + DESCRIPTION: + Trim the collection by the given number of elements. The elements are + removed from the end of the collection. + + An error is returned if the 'trim_num' is greater than the current + size of the collection. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is NULL. + OCI_ERROR if + any of the input parameters is null + 'trim_num' is greater than the current size of the collection. + */ + +/*--------------------------- OCICollIsLocator ------------------------------*/ + +sword OCICollIsLocator(OCIEnv *env, OCIError *err, const OCIColl *coll, + boolean *result ); +/* +Name: OCICollIsLocator - OCIColl indicates whether a collection is locator + based or not. +Parameters: + env(IN) - pointer to OCI environment handle + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + coll (IN) - collection item. + result (OUT) - TRUE if the collection item is a locator, FALSE + otherwise +Description: + Returns TRUE in the result OUT parameter if the collection item is a + locator, otherwise returns FALSE. +Returns: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is NULL. +*/ + +/*---------------------------- OCIIterCreate --------------------------------*/ + +sword OCIIterCreate( OCIEnv *env, OCIError *err, const OCIColl *coll, + OCIIter **itr ); +/* + NAME: OCIIterCreate - OCIColl Create an ITerator to scan the collection + elements + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + coll (IN) - collection which will be scanned; the different + collection types are varray and nested table + itr (OUT) - address to the allocated collection iterator is + returned by this function + DESCRIPTION: + Create an iterator to scan the elements of the collection. The + iterator is created in the object cache. The iterator is initialized + to point to the beginning of the collection. + + If the next function (OCIIterNext) is called immediately + after creating the iterator then the first element of the collection + is returned. + If the previous function (OCIIterPrev) is called immediately after + creating the iterator then "at beginning of collection" error is + returned. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is NULL. + OCI_ERROR if + any of the input parameters is null + out of memory error + */ + +/*----------------------------- OCIIterDelete ------------------------------*/ + +sword OCIIterDelete( OCIEnv *env, OCIError *err, OCIIter **itr ); +/* + NAME: OCIIterDelete - OCIColl Delete ITerator + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + itr (IN/OUT) - the allocated collection iterator is destroyed and + the 'itr' is set to NULL prior to returning + DESCRIPTION: + Delete the iterator which was previously created by a call to + OCIIterCreate. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is NULL. + OCI_ERROR if + any of the input parameters is null + to be discovered + */ + +/*----------------------------- OCIIterInit ---------------------------------*/ + +sword OCIIterInit( OCIEnv *env, OCIError *err, const OCIColl *coll, + OCIIter *itr ); +/* + NAME: OCIIterInit - OCIColl Initialize ITerator to scan the given + collection + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + coll (IN) - collection which will be scanned; the different + collection types are varray and nested table + itr (IN/OUT) - pointer to an allocated collection iterator + DESCRIPTION: + Initializes the given iterator to point to the beginning of the + given collection. This function can be used to: + + a. reset an iterator to point back to the beginning of the collection + b. reuse an allocated iterator to scan a different collection + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is NULL. + OCI_ERROR if + any of the input parameters is null + */ + +/*------------------------ OCIIterGetCurrent --------------------------------*/ + +sword OCIIterGetCurrent( OCIEnv *env, OCIError *err, const OCIIter *itr, + void **elem, void **elemind ); +/* + NAME: OCIIterGetCurrent - OCIColl Iterator based, get CURrent collection + element + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + itr (IN) - iterator which points to the current element + elem (OUT) - address of the element pointed by the iterator is returned + elemind (OUT) [optional] - address of the element's null indicator + information is returned; if (elemind == NULL) then the null + indicator information will NOT be returned + DESCRIPTION: + Returns pointer to the current element and its corresponding null + information. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is NULL. + OCI_ERROR if + any of the input parameters is null + */ + +/*------------------------------ OCIIterNext --------------------------------*/ + +sword OCIIterNext( OCIEnv *env, OCIError *err, OCIIter *itr, + void **elem, void **elemind, boolean *eoc ); +/* + NAME: OCIIterNext - OCIColl Iterator based, get NeXT collection element + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + itr (IN/OUT) - iterator is updated to point to the next element + elem (OUT) - after updating the iterator to point to the next element, + address of the element is returned + elemind (OUT) [optional] - address of the element's null indicator + information is returned; if (elemind == NULL) then the null + indicator information will NOT be returned + eoc (OUT) - TRUE if iterator is at End Of Collection (i.e. next + element does not exist) else FALSE + DESCRIPTION: + Returns pointer to the next element and its corresponding null + information. The iterator is updated to point to the next element. + + If the iterator is pointing to the last element of the collection + prior to executing this function, then calling this function will + set eoc flag to TRUE. The iterator will be left unchanged in this + situation. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is NULL. + OCI_ERROR if + any of the input parameters is null + */ + +/*------------------------------ OCIIterPrev --------------------------------*/ + +sword OCIIterPrev( OCIEnv *env, OCIError *err, OCIIter *itr, + void **elem, void **elemind, boolean *boc ); +/* + NAME: OCIIterPrev - OCIColl Iterator based, get PReVious collection element + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + itr (IN/OUT) - iterator is updated to point to the previous + element + elem (OUT) - after updating the iterator to point to the previous + element, address of the element is returned + elemind (OUT) [optional] - address of the element's null indicator + information is returned; if (elemind == NULL) then the null + indicator information will NOT be returned + boc (OUT) - TRUE if iterator is at Beginning Of Collection (i.e. + previous element does not exist) else FALSE. + DESCRIPTION: + Returns pointer to the previous element and its corresponding null + information. The iterator is updated to point to the previous element. + + If the iterator is pointing to the first element of the collection + prior to executing this function, then calling this function will + set 'boc' to TRUE. The iterator will be left unchanged in this + situation. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is NULL. + OCI_ERROR if + any of the input parameters is null + */ + +/*****************************************************************************/ +/* FUNCTIONS WHICH OPERATE ONLY ON NESTED TABLE OCITable*() */ +/*****************************************************************************/ + +/*---------------------------- OCITableSize ---------------------------------*/ + +sword OCITableSize( OCIEnv *env, OCIError *err, const OCITable *tbl, + sb4 *size); +/* + NAME: OCITableSize - OCITable return current SIZe of the given + nested table (not including deleted elements) + PARAMETERS: + env(IN) - pointer to OCI environment handle + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + tbl (IN) - nested table whose number of elements is returned + size (OUT) - current number of elements in the nested table. The count + does not include deleted elements. + DESCRIPTION: + Returns the count of elements in the given nested table. + + The count returned by OCITableSize() will be decremented upon + deleting elements from the nested table. So, this count DOES NOT + includes any "holes" created by deleting elements. + For example: + + OCITableSize(...); + // assume 'size' returned is equal to 5 + OCITableDelete(...); // delete one element + OCITableSize(...); + // 'size' returned will be equal to 4 + + To get the count plus the count of deleted elements use + OCICollSize(). Continuing the above example, + + OCICollSize(...) + // 'size' returned will still be equal to 5 + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is NULL. + OCI_ERROR if + error during loading of nested table into object cache + any of the input parameters is null + */ + +/*---------------------- OCITableExists ---------------------------------*/ + +sword OCITableExists( OCIEnv *env, OCIError *err, const OCITable *tbl, + sb4 index, boolean *exists ); +/* + NAME: OCITableExists - OCITable test whether element at the given index + EXIsts + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + tbl (IN) - table in which the given index is checked + index (IN) - index of the element which is checked for existence + exists (OUT) - set to TRUE if element at given 'index' exists + else set to FALSE + DESCRIPTION: + Test whether an element exists at the given 'index'. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is NULL. + OCI_ERROR if + any of the input parameters is null + */ + +/*--------------------------- OCITableDelete -------------------------------*/ + +sword OCITableDelete( OCIEnv *env, OCIError *err, sb4 index, + OCITable *tbl ); +/* + NAME: OCITableDelete - OCITable DELete element at the specified index + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + index (IN) - index of the element which must be deleted + tbl (IN) - table whose element is deleted + DESCRIPTION: + Delete the element at the given 'index'. Note that the position + ordinals of the remaining elements of the table is not changed by the + delete operation. So delete creates "holes" in the table. + + An error is returned if the element at the specified 'index' has + been previously deleted. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is NULL. + OCI_ERROR if + any of the input parameters is null + given index is not valid + */ + +/*--------------------------- OCITableFirst ---------------------------------*/ + +sword OCITableFirst( OCIEnv *env, OCIError *err, const OCITable *tbl, + sb4 *index ); +/* + NAME: OCITableFirst - OCITable return FirST index of table + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + tbl (IN) - table which is scanned + index (OUT) - first index of the element which exists in the given + table is returned + DESCRIPTION: + Return the first index of the element which exists in the given + table. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is NULL. + OCI_ERROR if + table is empty + */ + +/*---------------------------- OCITableLast ---------------------------------*/ + +sword OCITableLast( OCIEnv *env, OCIError *err, const OCITable *tbl, + sb4 *index ); +/* + NAME: OCITableFirst - OCITable return LaST index of table + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + tbl (IN) - table which is scanned + index (OUT) - last index of the element which exists in the given + table is returned + DESCRIPTION: + Return the last index of the element which exists in the given + table. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is NULL. + OCI_ERROR if + table is empty + */ + +/*---------------------------- OCITableNext ---------------------------------*/ + +sword OCITableNext( OCIEnv *env, OCIError *err, sb4 index, + const OCITable *tbl, sb4 *next_index, + boolean *exists ); +/* + NAME: OCITableNext - OCITable return NeXT available index of table + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + index (IN) - starting at 'index' the index of the next element + which exists is returned + tbl (IN) - table which is scanned + next_index (OUT) - index of the next element which exists + is returned + exists (OUT) - FALSE if no next index available else TRUE + DESCRIPTION: + Return the smallest position j, greater than 'index', such that + exists(j) is TRUE. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is NULL. + OCI_ERROR if + no next index available + */ + +/*---------------------------- OCITablePrev ---------------------------------*/ + +sword OCITablePrev( OCIEnv *env, OCIError *err, sb4 index, + const OCITable *tbl, sb4 *prev_index, + boolean *exists ); +/* + NAME: OCITablePrev - OCITable return PReVious available index of table + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode. + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + index (IN) - starting at 'index' the index of the previous element + which exists is returned + tbl (IN) - table which is scanned + prev_index (OUT) - index of the previous element which exists + is returned + exists (OUT) - FALSE if no next index available else TRUE + DESCRIPTION: + Return the largest position j, less than 'index', such that + exists(j) is TRUE. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is NULL. + OCI_ERROR if + no previous index available + */ + +/*------------------------ OCINumberToLnx -----------------------------------*/ +/* void OCINumberToLnx(/o_ OCINumber *num _o/); */ + +#define OCINumberToLnx(num) ((lnxnum_t *)num) + +/* + NAME: OCINumberToLnx + PARAMETERS: + num (IN) - OCINumber to convert ; + DESCRIPTION: + Converts OCINumber to its internal lnx format + This is not to be used in Public interfaces , but + has been provided due to special requirements from + SQLPLUS development group as they require to call + Core funtions directly . +*/ + +/* OCI representation of XMLType */ +typedef struct OCIXMLType OCIXMLType; + +/* OCI representation of OCIDomDocument */ +typedef struct OCIDOMDocument OCIDOMDocument; + +/* OCI representation for the Binary XML repository context */ +typedef struct OCIBinXmlReposCtx OCIBinXmlReposCtx; + +#endif /* ORL_ORACLE */ diff --git a/sdk/include/oro.h b/sdk/include/oro.h new file mode 100755 index 0000000..e825a5c --- /dev/null +++ b/sdk/include/oro.h @@ -0,0 +1,883 @@ +/* Copyright (c) 1994, 2003, Oracle Corporation. All rights reserved. */ + +/* + NAME + OCI - Oracle Object Interface for External/Internal/Kernel Clients + + DESCRIPTION + This header file contains Oracle object interface definitions which + can be included by external user applications, tools, as well as + the kernel. It defines types and constants that are common to all + object interface which is being defined in several other header files + (e.g., ori.h, ort.h, and orl.h). + + RELATED DOCUMENTS + TBD + + INSPECTION STATUS [[ deletable if no inspection ]] + Inspection date: [[ date of the last logging meeting ]] + Inspection status: [[ exited, not exited, or N/A if exit is not a goal ]] + Estimated increasing cost defects per page: + Rule sets: [[ rule sets inspected against or planned to be + inspected against ]] + + ACCEPTANCE REVIEW STATUS [[ deletable if no approval review ]] + Review date: [[ date of the meeting where issues were logged and the + approval status was decided ]] + Review status: [[ current status: accepted, conditionally accepted, + major revision required, rejected ]] + Reviewers: [[ names of the members on the review team ]] + + PUBLIC FUNCTIONS + + EXAMPLES + Examples are given in the description of each function or macro where + relevant. + + MODIFIED + mnanal 06/09/03 - backout of fix 2836388 + mnanal 05/14/03 - bug-2836388 + srseshad 11/27/02 - Change OCI_TYPECODE_BFLOAT/BDOUBLE codes + rxgovind 10/09/02 - add OCI_TYPECODE_UROWID + mxyang 09/17/02 - grabtrans 'mmorsi_obj_float' + srseshad 09/11/02 - + srseshad 09/01/02 - + aahluwal 06/03/02 - bug 2360115 + celsbern 10/19/01 - merge LOG to MAIN + rxgovind 10/16/01 - update typecodes + rxgovind 09/19/01 - add typecodes + rkasamse 08/15/01 - add OCI_DURATION_USER_CALLBACK + jchai 09/24/01 - add type code for PLS_INTEGER + porangas 08/22/01 - Fix bug#1776434 + schatter 04/09/01 - merge 1456235: define OCI_DURATION_INVALID + rdani 10/12/00 - 1449943 NOCOPY and PIPELINE + ciyer 05/26/00 - short names for abstract, overriding + rkasamse 05/25/00 - OCCI enhancements + smuralid 05/11/00 - OCITypeMethodFlags - add NOT INSTANTIABLE, OVERRIDING + rxgovind 05/09/00 - add OCI_TYPECODE_NONE + tnbui 07/28/99 - Remove OCI_TYPECODE_TIMESTAMP_ITZ + tnbui 07/21/99 - TS LOCAL TZ + thoang 06/21/99 - Add OCI_TYPECODE_TIMESTAMP_ITZ + thoang 03/04/99 - Add datetime datatypes + rkasamse 10/20/98 - add OCI_ATTR_CACHE_ARRAYFLUSH + rkasamse 10/29/98 - add OCI_DURATION_CALLOUT + rkasamse 04/28/98 - OCI_OBJECT_DETECTCHANGE -> OCI_ATTR_OBJECT_DETECTCHAN + rkasamse 04/28/98 - OCI_OBJECT_NEWNOTNULL -> OCI_ATTR_OBJECT_NEWNOTNULL + rkasamse 04/23/98 - add OCI_OBJECT_DETECTCHANGE + rkasamse 04/03/98 - add OCI_OBJECT_NEWNOTNULL + pmitra 04/01/98 - OCI_LOCK_X_NOWAIT added + rxgovind 02/18/98 - add OCI_TYPECODE_OPAQUE + rkasamse 02/13/98 - Add OCI_DURATION_PROCESS + cxcheng 07/28/97 - fix compile with SLSHORTNAME + skrishna 07/14/97 - add OCIObjectGetProperty + cxcheng 04/30/97 - make OCITypeParamMode values consistent with PL/SQL + skrishna 04/28/97 - undocument OCIObjectProperty & OCIObjectEvent + cxcheng 03/29/97 - remove all remaining short names + sthakur 03/20/97 - add casts to constants + cxcheng 02/21/97 - temporarily put SLSHORTNAME for PL/SQL + cxcheng 02/06/97 - take out short name support except with SLSHORTNAME + lchidamb 01/20/97 - update OCIRef comments + sgollapu 11/19/96 - Add OCI type codes for BOOL,REC,and TAB + cxcheng 11/19/96 - more typecode changes + cxcheng 11/13/96 - add #include for ocidfn.h + cxcheng 11/13/96 - add OCI_TYPECODE_ADT for compatibility + cxcheng 11/12/96 - add SQLT_NCO for named collection + cxcheng 11/11/96 - more changes to typecodes + cxcheng 11/07/96 - #define OCI_TYPECODE_MLSLABEL to SQLT_LAB + cxcheng 11/06/96 - fix #define omission for OROTCNAT + cxcheng 10/30/96 - move OCI_TYPECODE_* to ocidfn.h as SQLT_* + cxcheng 10/28/96 - more beautification changes + jboonleu 10/29/96 - add flags for freeing object + dchatter 10/26/96 - delete redef of OCISvcCtx, OCIError, OCIEnv + cxcheng 10/15/96 - more changes + cxcheng 10/14/96 - more final fixes to constants + mluong 10/11/96 - + mluong 10/11/96 - KOCON and KONSP are in lowercase + mluong 10/11/96 - add some define per Calvin + cxcheng 10/09/96 - add #define for OROOCOSFN to OCI_COPY_NOREF + jboonleu 10/08/96 - change OROOCOSFN to OCICopyFlag + jboonleu 10/07/96 - use new OCI names for cache options + cxcheng 10/07/96 - add OROTCS02 for KOTTCBRI and OROTCS03 as spare + cxcheng 10/07/96 - more lint fixes + cxcheng 10/02/96 - move oronsp to ko.h as konsp + cxcheng 10/01/96 - add long names for readability + cxcheng 10/01/96 - remove orotty and orotal + rjenkins 09/28/96 - 2k char 4k varchar2 + jboonleu 09/27/96 - add macro used only in beta2 + cxcheng 09/27/96 - move oroenv to oroenv.h + cxcheng 09/24/96 - remove unnecessary orotyp + cxcheng 09/25/96 - add typecode OROTCS01 as placeholder for lob pointer + cxcheng 09/20/96 - add TDO load option orotgo + jboonleu 09/18/96 - add OROOPOREC + jboonleu 09/10/96 - add OROOPODFL + jweisz 08/27/96 - add SQL internal typecode OROTCS00 + cxcheng 08/02/96 - add PLSQL internal typecodes OROTCP.. + cxcheng 08/01/96 - add OROTCFAR to fill up space left by OROTCCAR + jboonleu 07/16/96 - new pin option + cxcheng 06/18/96 - add casts to OROTNOPRE and OROTNOSCL + cxcheng 05/29/96 - change OROTCNPT back to OROTCDOM + vkrishna 05/27/96 - add OROTCCAR + cxcheng 05/17/96 - replace OROTCFAR with OROTCCAR + cxcheng 05/08/96 - change orotmf from ub1 to ub2 + cxcheng 05/07/96 - fix public defines for method types + cxcheng 04/30/96 - change OROTCDOM to OROTCNPT + cxcheng 04/15/96 - remove obsolete OROTTYICT + jboonleu 04/12/96 - add new pin option + sthakur 04/12/96 - add indicator type and indicator status + cxcheng 04/10/96 - add function parameter codes for ORT/KOT + cxcheng 04/03/96 - replace OROTCFAR as OROTCCAR + jwijaya 03/29/96 - add OROTTCCAR + jwijaya 03/27/96 - better comments for orotc + cxcheng 02/23/96 - add typecodes for SMALLINT and VARCHAR2 + skrishna 02/22/96 - add oroind - null indicator type + cxcheng 02/21/96 - change lob character codes to OROTCCLB, OROTCBLB... + jboonleu 02/06/96 - new value for predefined duration + cxcheng 01/12/96 - add OROTCCLO, OROTCBLO, OROTCFIL to orotc + cxcheng 12/05/95 - add OROTCDOM and OROTCAAT to orotc + skotsovo 10/30/95 - reserve space for internal 'oid' type + jwijaya 10/20/95 - support variable-length ref + cxcheng 10/03/95 - add OROTMFOR for ordering function to orotmf + cxcheng 10/03/95 - Adding the ordering function type to orotmf + jboonleu 09/28/95 - set OROODTPRE + jboonleu 09/25/95 - add oroodt + skotsovo 03/10/95 - update to only include release 1 + jboonleu 02/15/95 - add OROOPOREC, remove orocro, oroolo + skotsovo 01/30/95 - add default max lengths for varrays and vstrings + skotsovo 01/24/95 - categorize sint32, double, and real as number types + (with precision and scale) instead of scalar types. + skotsovo 12/20/94 - add release 1 types + skotsovo 12/12/94 - update according to new ots doc + skotsovo 12/01/94 - add default precision and scale + jwijaya 11/15/94 - rename ORONSPTAB to ORONSPEXT + jwijaya 10/25/94 - tint + jwijaya 10/06/94 - add namespace + jwijaya 10/02/94 - connection handle -> connection number + skotsovo 09/12/94 - keep 0 as uninitialized value for ORT consts + skotsovo 08/24/94 - fix orotec + skotsovo 08/17/94 - modify type code names + skotsovo 08/12/94 - fix 141 lint errors + skotsovo 07/25/94 - modify categorization of complex types (orotc) + skotsovo 07/07/94 - change typecode enum values & add decimal type + skotsovo 07/01/94 - change order of typecodes + jwijaya 06/15/94 - review + jboonleu 06/13/94 - add comments for the object cache options + jwijaya 06/13/94 - adhere to the header file template + skotsovo 06/09/94 - make ots scalar type names consistent with the ots + document + jwijaya 06/07/94 - include oratypes.h instead of s.h + skotsovo 05/24/94 - change typecodes + jwijaya 05/23/94 - fix comments of ororef + skotsovo 05/19/94 - remove type composition + skotsovo 05/09/94 - modified orotc according to new OTS document + jwijaya 05/03/94 - oroid and ororef + jwijaya 01/26/94 - Creation +*/ + + +#ifndef ORATYPES +#include +#endif + +#ifndef OCIDFN_ORACLE +#include +#endif + +#ifndef ORO_ORACLE +#define ORO_ORACLE + +/*---------------------------------------------------------------------------*/ +/* SHORT NAMES SUPPORT SECTION */ +/*---------------------------------------------------------------------------*/ + +#ifdef SLSHORTNAME + +/* the following are short names that are only supported on IBM mainframes + with the SLSHORTNAME defined. + With this all subsequent long names will actually be substituted with + the short names here */ + +#define OCIDuration oroodt +#define OCIInd oroind +#define OCILockOpt oroolm +#define OCIMarkOpt oroomo +#define OCIObjectEvent orocev +#define OCIObjectProperty oroopr +#define OCIPinOpt oroopo +#define OCIRef ororef +#define OCIRefreshOpt orooro +#define OCITypeCode orotc +#define OCITypeEncap orotec +#define OCITypeGetOpt orotgo +#define OCITypeMethodFlag orotmf +#define OCITypeParamMode orotpm +#define OCIObjectPropId oroopi +#define OCIObjectLifetime oroolft +#define OCIObjectMarkstatus oroomst +#define OCI_LOCK_NONE OROOLMNUL +#define OCI_LOCK_X OROOLMX +#define OCI_LOCK_X_NOWAIT OROOLMXNW +#define OCI_MARK_DEFAULT OROOMODFL +#define OCI_MARK_NONE OROOMONON +#define OCI_MARK_UPDATE OROOMOUPD +#define OCI_OBJECTEVENT_AFTER_FLUSH OROCEVAFL +#define OCI_OBJECTEVENT_AFTER_REFRESH OROCEVARF +#define OCI_OBJECTEVENT_BEFORE_FLUSH OROCEVBFL +#define OCI_OBJECTEVENT_BEFORE_REFRESH OROCEVBRF +#define OCI_OBJECTEVENT_WHEN_LOCK OROCEVWLK +#define OCI_OBJECTEVENT_WHEN_MARK_DELETED OROCEVWDL +#define OCI_OBJECTEVENT_WHEN_MARK_UPDATED OROCEVWUP +#define OCI_OBJECTEVENT_WHEN_UNMARK OROCEVWUM +#define OCI_OBJECTPROP_DIRTIED OROOPRDRT +#define OCI_OBJECTPROP_LOADED OROOPRLOD +#define OCI_OBJECTPROP_LOCKED OROOPRLCK +#define OCI_PIN_ANY OROOPOANY +#define OCI_PIN_DEFAULT OROOPODFL +#define OCI_PIN_LATEST OROOPOLST +#define OCI_PIN_RECENT OROOPOREC +#define OCI_REFRESH_LOADED OROOROLOD +#define OCI_TYPEENCAP_PRIVATE OROTECPVT +#define OCI_TYPEENCAP_PUBLIC OROTECPUB +#define OCI_TYPEGET_ALL OROTGOALL +#define OCI_TYPEGET_HEADER OROTGOHDR +#define OCI_TYPEMETHOD_CONSTANT OROTMCON +#define OCI_TYPEMETHOD_CONSTRUCTOR OROTMCSTR +#define OCI_TYPEMETHOD_DESTRUCTOR OROTMDSTR +#define OCI_TYPEMETHOD_INLINE OROTMINL +#define OCI_TYPEMETHOD_MAP OROTMMAP +#define OCI_TYPEMETHOD_OPERATOR OROTMOP +#define OCI_TYPEMETHOD_ORDER OROTMOR +#define OCI_TYPEMETHOD_RNDS OROTMRDS +#define OCI_TYPEMETHOD_RNPS OROTMRPS +#define OCI_TYPEMETHOD_SELFISH OROTMSLF +#define OCI_TYPEMETHOD_VIRTUAL OROTMVRT +#define OCI_TYPEMETHOD_WNDS OROTMWDS +#define OCI_TYPEMETHOD_WNPS OROTMWPS +#define OCI_TYPEMETHOD_ABSTRACT OROTMABSTRACT +#define OCI_TYPEMETHOD_OVERRIDING OROTMOVERRIDING +#define OCI_TYPEMETHOD_PIPELINED OROTMPIPELINED +#define OCI_TYPEPARAM_BYREF OROTPMREF +#define OCI_TYPEPARAM_IN OROTPMIN +#define OCI_TYPEPARAM_INOUT OROTPMIO +#define OCI_TYPEPARAM_OUT OROTPMOUT +#define OCI_TYPEPARAM_OUTNCPY OROTPMOUTNCPY +#define OCI_TYPEPARAM_INOUTNCPY OROTPMIONCPY + +#endif /* SLSHORTNAME */ + + +/*---------------------------------------------------------------------------*/ +/* PUBLIC TYPES, CONSTANTS AND MACROS */ +/*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*/ +/* GENERAL OBJECT TYPES, CONSTANTS, MACROS */ +/*---------------------------------------------------------------------------*/ + +/*------------------------- OBJECT REFERENCE (REF) --------------------------*/ + +typedef struct OCIRef OCIRef; +/* + * OCIRef - OCI object REFerence + * + * In the Oracle object runtime environment, an object is identified by an + * object reference (ref) which contains the object identifier plus other + * runtime information. The contents of a ref is opaque to clients. Use + * OCIObjectNew() to construct a ref. + */ + + +/*--------------------------- OBJECT INDICATOR ------------------------------*/ + +typedef sb2 OCIInd; +/* + * OCIInd -- a variable of this type contains (null) indicator information + */ + +#define OCI_IND_NOTNULL (OCIInd)0 /* not NULL */ +#define OCI_IND_NULL (OCIInd)(-1) /* NULL */ +#define OCI_IND_BADNULL (OCIInd)(-2) /* BAD NULL */ +#define OCI_IND_NOTNULLABLE (OCIInd)(-3) /* not NULLable */ + +/*---------------------------------------------------------------------------*/ +/* OBJECT CACHE */ +/*---------------------------------------------------------------------------*/ + +/* To enable object change detection mode, set this to TRUE */ +#define OCI_ATTR_OBJECT_DETECTCHANGE 0x00000020 + +/* To enable object creation with non-NULL attributes by default, set the + following to TRUE. + By default, object is created with NULL attributes +*/ +#define OCI_ATTR_OBJECT_NEWNOTNULL 0x00000010 + +/* To enable sorting of the objects that belong to the same table + before being flushed through OCICacheFlush. + Please note that by enabling this object cache will not be flushing + the objects in the same order they were dirtied */ +#define OCI_ATTR_CACHE_ARRAYFLUSH 0x00000040 + +/*--------------------------- OBJECT PIN OPTION -----------------------------*/ + +enum OCIPinOpt +{ + /* 0 = uninitialized */ + OCI_PIN_DEFAULT = 1, /* default pin option */ + OCI_PIN_ANY = 3, /* pin any copy of the object */ + OCI_PIN_RECENT = 4, /* pin recent copy of the object */ + OCI_PIN_LATEST = 5 /* pin latest copy of the object */ +}; +typedef enum OCIPinOpt OCIPinOpt; + +/* + * OCIPinOpt - OCI object Pin Option + * + * In the Oracle object runtime environment, the program has the option to + * specify which copy of the object to pin. + * + * OCI_PINOPT_DEFAULT pins an object using the default pin option. The default + * pin option can be set as an attribute of the OCI environment handle + * (OCI_ATTR_PINTOPTION). The value of the default pin option can be + * OCI_PINOPT_ANY, OCI_PINOPT_RECENT, or OCI_PIN_LATEST. The default option + * is initialized to OCI_PINOPT_ANY. + * + * OCI_PIN_ANY pins any copy of the object. The object is pinned + * using the following criteria: + * If the object copy is not loaded, load it from the persistent store. + * Otherwise, the loaded object copy is returned to the program. + * + * OCI_PIN_RECENT pins the latest copy of an object. The object is + * pinned using the following criteria: + * If the object is not loaded, load the object from the persistent store + * from the latest version. + * If the object is not loaded in the current transaction and it is not + * dirtied, the object is refreshed from the latest version. + * Otherwise, the loaded object copy is returned to the program. + * + * OCI_PINOPT_LATEST pins the latest copy of an object. The object copy is + * pinned using the following criteria: + * If the object copy is not loaded, load it from the persistent store. + * If the object copy is loaded and dirtied, it is returned to the program. + * Otherwise, the loaded object copy is refreshed from the persistent store. + */ + + + +/*--------------------------- OBJECT LOCK OPTION ----------------------------*/ + +enum OCILockOpt +{ + /* 0 = uninitialized */ + OCI_LOCK_NONE = 1, /* null (same as no lock) */ + OCI_LOCK_X = 2, /* exclusive lock */ + OCI_LOCK_X_NOWAIT = 3 /* exclusive lock, do not wait */ +}; +typedef enum OCILockOpt OCILockOpt; +/* + * OCILockOpt - OCI object LOCK Option + * + * This option is used to specify the locking preferences when an object is + * loaded from the server. + */ + + +/*------------------------- OBJECT MODIFYING OPTION -------------------------*/ + +enum OCIMarkOpt +{ + /* 0 = uninitialized */ + OCI_MARK_DEFAULT = 1, /* default (the same as OCI_MARK_NONE) */ + OCI_MARK_NONE = OCI_MARK_DEFAULT, /* object has not been modified */ + OCI_MARK_UPDATE /* object is to be updated */ +}; +typedef enum OCIMarkOpt OCIMarkOpt; +/* + * OCIMarkOpt - OCI object Mark option + * + * When the object is marked updated, the client has to specify how the + * object is intended to be changed. + */ + +/*-------------------------- OBJECT Duration --------------------------------*/ + +typedef ub2 OCIDuration; + +#define OCI_DURATION_INVALID 0xFFFF /* Invalid duration */ +#define OCI_DURATION_BEGIN (OCIDuration)10 + /* beginning sequence of duration */ +#define OCI_DURATION_NULL (OCIDuration)(OCI_DURATION_BEGIN-1) + /* null duration */ +#define OCI_DURATION_DEFAULT (OCIDuration)(OCI_DURATION_BEGIN-2) /* default */ +#define OCI_DURATION_USER_CALLBACK (OCIDuration)(OCI_DURATION_BEGIN-3) +#define OCI_DURATION_NEXT (OCIDuration)(OCI_DURATION_BEGIN-4) + /* next special duration */ +#define OCI_DURATION_SESSION (OCIDuration)(OCI_DURATION_BEGIN) + /* the end of user session */ +#define OCI_DURATION_TRANS (OCIDuration)(OCI_DURATION_BEGIN+1) + /* the end of user transaction */ +/****************************************************************************** +** DO NOT USE OCI_DURATION_CALL. IT IS UNSUPPORTED ** +** WILL BE REMOVED/CHANGED IN A FUTURE RELEASE ** +******************************************************************************/ +#define OCI_DURATION_CALL (OCIDuration)(OCI_DURATION_BEGIN+2) + /* the end of user client/server call */ +#define OCI_DURATION_STATEMENT (OCIDuration)(OCI_DURATION_BEGIN+3) + +/* This is to be used only during callouts. It is similar to that +of OCI_DURATION_CALL, but lasts only for the duration of a callout. +Its heap is from PGA */ +#define OCI_DURATION_CALLOUT (OCIDuration)(OCI_DURATION_BEGIN+4) + +#define OCI_DURATION_LAST OCI_DURATION_CALLOUT + /* last of predefined durations */ + +/* This is not being treated as other predefined durations such as + SESSION, CALL etc, because this would not have an entry in the duration + table and its functionality is primitive such that only allocate, free, + resize memory are allowed, but one cannot create subduration out of this +*/ +#define OCI_DURATION_PROCESS (OCIDuration)(OCI_DURATION_BEGIN-5) + +/* + * OCIDuration - OCI object duration + * + * A client can specify the duration of which an object is pinned (pin + * duration) and the duration of which the object is in memory (allocation + * duration). If the objects are still pinned at the end of the pin duration, + * the object cache manager will automatically unpin the objects for the + * client. If the objects still exist at the end of the allocation duration, + * the object cache manager will automatically free the objects for the client. + * + * Objects that are pinned with the option OCI_DURATION_TRANS will get unpinned + * automatically at the end of the current transaction. + * + * Objects that are pinned with the option OCI_DURATION_SESSION will get + * unpinned automatically at the end of the current session (connection). + * + * The option OCI_DURATION_NULL is used when the client does not want to set + * the pin duration. If the object is already loaded into the cache, then the + * pin duration will remain the same. If the object is not yet loaded, the + * pin duration of the object will be set to OCI_DURATION_DEFAULT. + */ + +/*----------------------------- OBJECT PROPERTY -----------------------------*/ + +/****************************************************************************** +** DO NOT USE OCIObjectProperty. IT IS UNSUPPORTED ** +** WILL BE REMOVED/CHANGED IN A FUTURE RELEASE ** +******************************************************************************/ +enum OCIObjectProperty +{ + /* 0 = uninitialized */ + OCI_OBJECTPROP_DIRTIED = 1, /* dirty objects */ + OCI_OBJECTPROP_LOADED, /* objects loaded in the transaction */ + OCI_OBJECTPROP_LOCKED /* locked objects */ +}; +typedef enum OCIObjectProperty OCIObjectProperty; +/* + * OCIObjectProperty -- OCI Object Property + * This specifies the properties of objects in the object cache. + */ + +/*------------------------- CACHE REFRESH OPTION ---------------------------*/ + +enum OCIRefreshOpt +{ + /* 0 = uninitialized */ + OCI_REFRESH_LOADED = 1 /* refresh objects loaded in the transaction */ +}; +typedef enum OCIRefreshOpt OCIRefreshOpt; +/* + * OCIRefreshOpt - OCI cache Refresh Option + * This option is used to specify the set of objects to be refreshed. + * + * OCI_REFRESH_LOAD refreshes the objects that are loaded in the current + * transaction. + */ + +/*-------------------------------- OBJECT EVENT -----------------------------*/ + +/****************************************************************************** +** DO NOT USE OCIObjectEvent. IT IS UNSUPPORTED ** +** WILL BE REMOVED/CHANGED IN A FUTURE RELEASE ** +******************************************************************************/ +enum OCIObjectEvent +{ + /* 0 = uninitialized */ + OCI_OBJECTEVENT_BEFORE_FLUSH = 1, /* before flushing the cache */ + OCI_OBJECTEVENT_AFTER_FLUSH, /* after flushing the cache */ + OCI_OBJECTEVENT_BEFORE_REFRESH, /* before refreshing the cache */ + OCI_OBJECTEVENT_AFTER_REFRESH, /* after refreshing the cache */ + OCI_OBJECTEVENT_WHEN_MARK_UPDATED, /* when an object is marked updated */ + OCI_OBJECTEVENT_WHEN_MARK_DELETED, /* when an object is marked deleted */ + OCI_OBJECTEVENT_WHEN_UNMARK, /* when an object is being unmarked */ + OCI_OBJECTEVENT_WHEN_LOCK /* when an object is being locked */ +}; +typedef enum OCIObjectEvent OCIObjectEvent; +/* + * OCIObjectEvent -- OCI Object Event + * This specifies the kind of event that is supported by the object + * cache. The program can register a callback that is invoked when the + * specified event occurs. + */ + +/*----------------------------- OBJECT COPY OPTION --------------------------*/ +#define OCI_OBJECTCOPY_NOREF (ub1)0x01 +/* + * OCIObjectCopyFlag - Object copy flag + * + * If OCI_OBJECTCOPY_NOREF is specified when copying an instance, the + * reference and lob will not be copied to the target instance. + */ + +/*----------------------------- OBJECT FREE OPTION --------------------------*/ +#define OCI_OBJECTFREE_FORCE (ub2)0x0001 +#define OCI_OBJECTFREE_NONULL (ub2)0x0002 +#define OCI_OBJECTFREE_HEADER (ub2)0x0004 +/* + * OCIObjectFreeFlag - Object free flag + * + * If OCI_OBJECTCOPY_FORCE is specified when freeing an instance, the instance + * is freed regardless it is pinned or diritied. + * If OCI_OBJECTCOPY_NONULL is specified when freeing an instance, the null + * structure is not freed. + */ + +/*----------------------- OBJECT PROPERTY ID -------------------------------*/ + +typedef ub1 OCIObjectPropId; +#define OCI_OBJECTPROP_LIFETIME 1 /* persistent or transient or value */ +#define OCI_OBJECTPROP_SCHEMA 2 /* schema name of table containing object */ +#define OCI_OBJECTPROP_TABLE 3 /* table name of table containing object */ +#define OCI_OBJECTPROP_PIN_DURATION 4 /* pin duartion of object */ +#define OCI_OBJECTPROP_ALLOC_DURATION 5 /* alloc duartion of object */ +#define OCI_OBJECTPROP_LOCK 6 /* lock status of object */ +#define OCI_OBJECTPROP_MARKSTATUS 7 /* mark status of object */ +#define OCI_OBJECTPROP_VIEW 8 /* is object a view object or not? */ + +/* + * OCIObjectPropId - OCI Object Property Id + * Identifies the different properties of objects. + */ + +/*----------------------- OBJECT LIFETIME ----------------------------------*/ + +enum OCIObjectLifetime +{ + /* 0 = uninitialized */ + OCI_OBJECT_PERSISTENT = 1, /* persistent object */ + OCI_OBJECT_TRANSIENT, /* transient object */ + OCI_OBJECT_VALUE /* value object */ +}; +typedef enum OCIObjectLifetime OCIObjectLifetime; +/* + * OCIObjectLifetime - OCI Object Lifetime + * Classifies objects depending upon the lifetime and referenceability + * of the object. + */ + +/*----------------------- OBJECT MARK STATUS -------------------------------*/ + +typedef uword OCIObjectMarkStatus; +#define OCI_OBJECT_NEW 0x0001 /* new object */ +#define OCI_OBJECT_DELETED 0x0002 /* object marked deleted */ +#define OCI_OBJECT_UPDATED 0x0004 /* object marked updated */ +/* + * OCIObjectMarkStatus - OCI Object Mark Status + * Status of the object - new or updated or deleted + */ + +/* macros to test the object mark status */ +#define OCI_OBJECT_IS_UPDATED(flag) bit((flag), OCI_OBJECT_UPDATED) +#define OCI_OBJECT_IS_DELETED(flag) bit((flag), OCI_OBJECT_DELETED) +#define OCI_OBJECT_IS_NEW(flag) bit((flag), OCI_OBJECT_NEW) +#define OCI_OBJECT_IS_DIRTY(flag) \ + bit((flag), OCI_OBJECT_UPDATED|OCI_OBJECT_NEW|OCI_OBJECT_DELETED) + +/*---------------------------------------------------------------------------*/ +/* TYPE MANAGER */ +/*---------------------------------------------------------------------------*/ + +/*------------------------------ TYPE CODE ----------------------------------*/ + +/* + * Type manager typecodes + * + * These are typecodes designed to be used with the type manager; + * they also include longer, more readable versions of existing SQLT names. + * Those types that are directly related to existing SQLT types are #define'd + * to their SQLT equivalents. + * + * The type manager typecodes are designed to be useable for all OCI calls. + * They are in the range from 192 to 320 for typecodes, so as not to conflict + * with existing OCI SQLT typecodes (see ocidfn.h). + */ + +#define OCI_TYPECODE_REF SQLT_REF /* SQL/OTS OBJECT REFERENCE */ +#define OCI_TYPECODE_DATE SQLT_DAT /* SQL DATE OTS DATE */ +#define OCI_TYPECODE_SIGNED8 27 /* SQL SIGNED INTEGER(8) OTS SINT8 */ +#define OCI_TYPECODE_SIGNED16 28 /* SQL SIGNED INTEGER(16) OTS SINT16 */ +#define OCI_TYPECODE_SIGNED32 29 /* SQL SIGNED INTEGER(32) OTS SINT32 */ +#define OCI_TYPECODE_REAL 21 /* SQL REAL OTS SQL_REAL */ +#define OCI_TYPECODE_DOUBLE 22 /* SQL DOUBLE PRECISION OTS SQL_DOUBLE */ +#define OCI_TYPECODE_BFLOAT SQLT_IBFLOAT /* Binary float */ +#define OCI_TYPECODE_BDOUBLE SQLT_IBDOUBLE /* Binary double */ +#define OCI_TYPECODE_FLOAT SQLT_FLT /* SQL FLOAT(P) OTS FLOAT(P) */ +#define OCI_TYPECODE_NUMBER SQLT_NUM/* SQL NUMBER(P S) OTS NUMBER(P S) */ +#define OCI_TYPECODE_DECIMAL SQLT_PDN + /* SQL DECIMAL(P S) OTS DECIMAL(P S) */ +#define OCI_TYPECODE_UNSIGNED8 SQLT_BIN + /* SQL UNSIGNED INTEGER(8) OTS UINT8 */ +#define OCI_TYPECODE_UNSIGNED16 25 /* SQL UNSIGNED INTEGER(16) OTS UINT16 */ +#define OCI_TYPECODE_UNSIGNED32 26 /* SQL UNSIGNED INTEGER(32) OTS UINT32 */ +#define OCI_TYPECODE_OCTET 245 /* SQL ??? OTS OCTET */ +#define OCI_TYPECODE_SMALLINT 246 /* SQL SMALLINT OTS SMALLINT */ +#define OCI_TYPECODE_INTEGER SQLT_INT /* SQL INTEGER OTS INTEGER */ +#define OCI_TYPECODE_RAW SQLT_LVB /* SQL RAW(N) OTS RAW(N) */ +#define OCI_TYPECODE_PTR 32 /* SQL POINTER OTS POINTER */ +#define OCI_TYPECODE_VARCHAR2 SQLT_VCS + /* SQL VARCHAR2(N) OTS SQL_VARCHAR2(N) */ +#define OCI_TYPECODE_CHAR SQLT_AFC /* SQL CHAR(N) OTS SQL_CHAR(N) */ +#define OCI_TYPECODE_VARCHAR SQLT_CHR + /* SQL VARCHAR(N) OTS SQL_VARCHAR(N) */ +#define OCI_TYPECODE_MLSLABEL SQLT_LAB /* OTS MLSLABEL */ +#define OCI_TYPECODE_VARRAY 247 /* SQL VARRAY OTS PAGED VARRAY */ +#define OCI_TYPECODE_TABLE 248 /* SQL TABLE OTS MULTISET */ +#define OCI_TYPECODE_OBJECT SQLT_NTY /* SQL/OTS NAMED OBJECT TYPE */ +#define OCI_TYPECODE_OPAQUE 58 /* SQL/OTS Opaque Types */ +#define OCI_TYPECODE_NAMEDCOLLECTION SQLT_NCO + /* SQL/OTS NAMED COLLECTION TYPE */ +#define OCI_TYPECODE_BLOB SQLT_BLOB /* SQL/OTS BINARY LARGE OBJECT */ +#define OCI_TYPECODE_BFILE SQLT_BFILE /* SQL/OTS BINARY FILE OBJECT */ +#define OCI_TYPECODE_CLOB SQLT_CLOB /* SQL/OTS CHARACTER LARGE OBJECT */ +#define OCI_TYPECODE_CFILE SQLT_CFILE /* SQL/OTS CHARACTER FILE OBJECT */ + +/* the following are ANSI datetime datatypes added in 8.1 */ +#define OCI_TYPECODE_TIME SQLT_TIME /* SQL/OTS TIME */ +#define OCI_TYPECODE_TIME_TZ SQLT_TIME_TZ /* SQL/OTS TIME_TZ */ +#define OCI_TYPECODE_TIMESTAMP SQLT_TIMESTAMP /* SQL/OTS TIMESTAMP */ +#define OCI_TYPECODE_TIMESTAMP_TZ SQLT_TIMESTAMP_TZ /* SQL/OTS TIMESTAMP_TZ */ + +#define OCI_TYPECODE_TIMESTAMP_LTZ SQLT_TIMESTAMP_LTZ /* TIMESTAMP_LTZ */ + +#define OCI_TYPECODE_INTERVAL_YM SQLT_INTERVAL_YM /* SQL/OTS INTRVL YR-MON */ +#define OCI_TYPECODE_INTERVAL_DS SQLT_INTERVAL_DS /* SQL/OTS INTRVL DAY-SEC */ +#define OCI_TYPECODE_UROWID SQLT_RDD /* Urowid type */ + + +#define OCI_TYPECODE_OTMFIRST 228 /* first Open Type Manager typecode */ +#define OCI_TYPECODE_OTMLAST 320 /* last OTM typecode */ +#define OCI_TYPECODE_SYSFIRST 228 /* first OTM system type (internal) */ +#define OCI_TYPECODE_SYSLAST 235 /* last OTM system type (internal) */ +#define OCI_TYPECODE_PLS_INTEGER 266 /* type code for PLS_INTEGER */ + +/* the following are PL/SQL-only internal. They should not be used */ +#define OCI_TYPECODE_ITABLE SQLT_TAB /* PLSQL indexed table */ +#define OCI_TYPECODE_RECORD SQLT_REC /* PLSQL record */ +#define OCI_TYPECODE_BOOLEAN SQLT_BOL /* PLSQL boolean */ + +/* NOTE : The following NCHAR related codes are just short forms for saying + OCI_TYPECODE_VARCHAR2 with a charset form of SQLCS_NCHAR. These codes are + intended for use in the OCIAnyData API only and nowhere else. */ +#define OCI_TYPECODE_NCHAR 286 +#define OCI_TYPECODE_NVARCHAR2 287 +#define OCI_TYPECODE_NCLOB 288 + + +/* To indicate absence of typecode being specified */ +#define OCI_TYPECODE_NONE 0 +/* To indicate error has to be taken from error handle - reserved for + sqlplus use */ +#define OCI_TYPECODE_ERRHP 283 + +/* The OCITypeCode type is interchangeable with the existing SQLT type + which is a ub2 */ +typedef ub2 OCITypeCode; + + +/*----------------------- GET OPTIONS FOR TDO ------------------------------*/ + +enum OCITypeGetOpt +{ + OCI_TYPEGET_HEADER, + /* load only the header portion of the TDO when getting type */ + OCI_TYPEGET_ALL /* load all attribute and method descriptors as well */ +}; +typedef enum OCITypeGetOpt OCITypeGetOpt; + +/* + * OCITypeGetOpt + * + * This is the flag passed to OCIGetTypeArray() to indicate how the TDO is + * going to be loaded into the object cache. + * OCI_TYPEGET_HEADER implies that only the header portion is to be loaded + * initially, with the rest loaded in on a 'lazy' basis. Only the header is + * needed for PL/SQL and OCI operations. OCI_TYPEGET_ALL implies that ALL + * the attributes and methods belonging to a TDO will be loaded into the + * object cache in one round trip. Hence it will take much longer to execute, + * but will ensure that no more loading needs to be done when pinning ADOs + * etc. This is only needed if your code needs to examine and manipulate + * attribute and method information. + * + * The default is OCI_TYPEGET_HEADER. + */ + + +/*------------------------ TYPE ENCAPSULTATION LEVEL ------------------------*/ + +enum OCITypeEncap +{ + /* 0 = uninitialized */ + OCI_TYPEENCAP_PRIVATE, /* private: only internally visible */ + OCI_TYPEENCAP_PUBLIC /* public: visible to both internally and externally */ +}; +typedef enum OCITypeEncap OCITypeEncap; +/* + * OCITypeEncap - OCI Encapsulation Level + */ + + +/*---------------------------- TYPE METHOD FLAGS ----------------------------*/ + +enum OCITypeMethodFlag +{ + OCI_TYPEMETHOD_INLINE = 0x0001, /* inline */ + OCI_TYPEMETHOD_CONSTANT = 0x0002, /* constant */ + OCI_TYPEMETHOD_VIRTUAL = 0x0004, /* virtual */ + OCI_TYPEMETHOD_CONSTRUCTOR = 0x0008, /* constructor */ + OCI_TYPEMETHOD_DESTRUCTOR = 0x0010, /* destructor */ + OCI_TYPEMETHOD_OPERATOR = 0x0020, /* operator */ + OCI_TYPEMETHOD_SELFISH = 0x0040, /* selfish method (generic otherwise) */ + + OCI_TYPEMETHOD_MAP = 0x0080, /* map (relative ordering) */ + OCI_TYPEMETHOD_ORDER = 0x0100, /* order (relative ordering) */ + /* OCI_TYPEMETHOD_MAP and OCI_TYPEMETHOD_ORDER are mutually exclusive */ + + OCI_TYPEMETHOD_RNDS= 0x0200, /* Read no Data State (default) */ + OCI_TYPEMETHOD_WNDS= 0x0400, /* Write no Data State */ + OCI_TYPEMETHOD_RNPS= 0x0800, /* Read no Process State */ + OCI_TYPEMETHOD_WNPS= 0x1000, /* Write no Process State */ + OCI_TYPEMETHOD_ABSTRACT = 0x2000, /* abstract (not instantiable) method */ + OCI_TYPEMETHOD_OVERRIDING = 0x4000, /* overriding method */ + OCI_TYPEMETHOD_PIPELINED = 0x8000 /* method is pipelined */ +}; +typedef enum OCITypeMethodFlag OCITypeMethodFlag; + +/* macros to test the type method flags */ +#define OCI_METHOD_IS_INLINE(flag) bit((flag), OCI_TYPEMETHOD_INLINE) +#define OCI_METHOD_IS_CONSTANT(flag) bit((flag), OCI_TYPEMETHOD_CONSTANT) +#define OCI_METHOD_IS_VIRTUAL(flag) bit((flag), OCI_TYPEMETHOD_VIRTUAL) +#define OCI_METHOD_IS_CONSTRUCTOR(flag) bit((flag), OCI_TYPEMETHOD_CONSTRUCTOR) +#define OCI_METHOD_IS_DESTRUCTOR(flag) bit((flag), OCI_TYPEMETHOD_DESTRUCTOR) +#define OCI_METHOD_IS_OPERATOR(flag) bit((flag), OCI_TYPEMETHOD_OPERATOR) +#define OCI_METHOD_IS_SELFISH(flag) bit((flag), OCI_TYPEMETHOD_SELFISH) +#define OCI_METHOD_IS_MAP(flag) bit((flag), OCI_TYPEMETHOD_MAP) +#define OCI_METHOD_IS_ORDER(flag) bit((flag), OCI_TYPEMETHOD_ORDER) +#define OCI_METHOD_IS_RNDS(flag) bit((flag), OCI_TYPEMETHOD_RNDS) +#define OCI_METHOD_IS_WNDS(flag) bit((flag), OCI_TYPEMETHOD_WNDS) +#define OCI_METHOD_IS_RNPS(flag) bit((flag), OCI_TYPEMETHOD_RNPS) +#define OCI_METHOD_IS_WNPS(flag) bit((flag), OCI_TYPEMETHOD_WNPS) +#define OCI_METHOD_IS_ABSTRACT(flag) bit((flag), OCI_TYPEMETHOD_ABSTRACT) +#define OCI_METHOD_IS_OVERRIDING(flag) bit((flag), OCI_TYPEMETHOD_OVERRIDING) +#define OCI_METHOD_IS_PIPELINED(flag) bit((flag), OCI_TYPEMETHOD_PIPELINED) + +#define OCI_TYPEMETHOD_IS_INLINE(flag) bit((flag), OCI_TYPEMETHOD_INLINE) +#define OCI_TYPEMETHOD_IS_CONSTANT(flag) bit((flag), OCI_TYPEMETHOD_CONSTANT) +#define OCI_TYPEMETHOD_IS_VIRTUAL(flag) bit((flag), OCI_TYPEMETHOD_VIRTUAL) +#define OCI_TYPEMETHOD_IS_CONSTRUCTOR(flag) \ + bit((flag), OCI_TYPEMETHOD_CONSTRUCTOR) +#define OCI_TYPEMETHOD_IS_DESTRUCTOR(flag) \ + bit((flag), OCI_TYPEMETHOD_DESTRUCTOR) +#define OCI_TYPEMETHOD_IS_OPERATOR(flag) bit((flag), OCI_TYPEMETHOD_OPERATOR) +#define OCI_TYPEMETHOD_IS_SELFISH(flag) bit((flag), OCI_TYPEMETHOD_SELFISH) +#define OCI_TYPEMETHOD_IS_MAP(flag) bit((flag), OCI_TYPEMETHOD_MAP) +#define OCI_TYPEMETHOD_IS_ORDER(flag) bit((flag), OCI_TYPEMETHOD_ORDER) +#define OCI_TYPEMETHOD_IS_RNDS(flag) bit((flag), OCI_TYPEMETHOD_RNDS) +#define OCI_TYPEMETHOD_IS_WNDS(flag) bit((flag), OCI_TYPEMETHOD_WNDS) +#define OCI_TYPEMETHOD_IS_RNPS(flag) bit((flag), OCI_TYPEMETHOD_RNPS) +#define OCI_TYPEMETHOD_IS_WNPS(flag) bit((flag), OCI_TYPEMETHOD_WNPS) +#define OCI_TYPEMETHOD_IS_ABSTRACT(flag) bit((flag), OCI_TYPEMETHOD_ABSTRACT) +#define OCI_TYPEMETHOD_IS_OVERRIDING(flag) \ + bit((flag), OCI_TYPEMETHOD_OVERRIDING) +#define OCI_TYPEMETHOD_IS_PIPELINED(flag) bit((flag), OCI_TYPEMETHOD_PIPELINED) + +/* macros to set the type method flags */ +#define OCI_TYPEMETHOD_SET_INLINE(flag) bis((flag), OCI_TYPEMETHOD_INLINE) +#define OCI_TYPEMETHOD_SET_CONSTANT(flag) bis((flag), OCI_TYPEMETHOD_CONSTANT) +#define OCI_TYPEMETHOD_SET_VIRTUAL(flag) bis((flag), OCI_TYPEMETHOD_VIRTUAL) +#define OCI_TYPEMETHOD_SET_CONSTRUCTOR(flag) \ + bis((flag), OCI_TYPEMETHOD_CONSTRUCTOR) +#define OCI_TYPEMETHOD_SET_DESTRUCTOR(flag) \ + bis((flag), OCI_TYPEMETHOD_DESTRUCTOR) +#define OCI_TYPEMETHOD_SET_OPERATOR(flag) bis((flag), OCI_TYPEMETHOD_OPERATOR) +#define OCI_TYPEMETHOD_SET_SELFISH(flag) bis((flag), OCI_TYPEMETHOD_SELFISH) +#define OCI_TYPEMETHOD_SET_MAP(flag) bis((flag), OCI_TYPEMETHOD_MAP) +#define OCI_TYPEMETHOD_SET_ORDER(flag) bis((flag), OCI_TYPEMETHOD_ORDER) +#define OCI_TYPEMETHOD_SET_RNDS(flag) bis((flag), OCI_TYPEMETHOD_RNDS) +#define OCI_TYPEMETHOD_SET_WNDS(flag) bis((flag), OCI_TYPEMETHOD_WNDS) +#define OCI_TYPEMETHOD_SET_RNPS(flag) bis((flag), OCI_TYPEMETHOD_RNPS) +#define OCI_TYPEMETHOD_SET_WNPS(flag) bis((flag), OCI_TYPEMETHOD_WNPS) + +/* macros to clear the type method flags */ +#define OCI_TYPEMETHOD_CLEAR_INLINE(flag) bic((flag), OCI_TYPEMETHOD_INLINE) +#define OCI_TYPEMETHOD_CLEAR_CONSTANT(flag) \ + bic((flag), OCI_TYPEMETHOD_CONSTANT) +#define OCI_TYPEMETHOD_CLEAR_VIRTUAL(flag) bic((flag), OCI_TYPEMETHOD_VIRTUAL) +#define OCI_TYPEMETHOD_CLEAR_CONSTRUCTOR(flag) \ + bic((flag), OCI_TYPEMETHOD_CONSTRUCTOR) +#define OCI_TYPEMETHOD_CLEAR_DESTRUCTOR(flag) \ + bic((flag), OCI_TYPEMETHOD_DESTRUCTOR) +#define OCI_TYPEMETHOD_CLEAR_OPERATOR(flag) \ + bic((flag), OCI_TYPEMETHOD_OPERATOR) +#define OCI_TYPEMETHOD_CLEAR_SELFISH(flag) bic((flag), OCI_TYPEMETHOD_SELFISH) +#define OCI_TYPEMETHOD_CLEAR_MAP(flag) bic((flag), OCI_TYPEMETHOD_MAP) +#define OCI_TYPEMETHOD_CLEAR_ORDER(flag) bic((flag), OCI_TYPEMETHOD_ORDER) +#define OCI_TYPEMETHOD_CLEAR_RNDS(flag) bic((flag), OCI_TYPEMETHOD_RNDS) +#define OCI_TYPEMETHOD_CLEAR_WNDS(flag) bic((flag), OCI_TYPEMETHOD_WNDS) +#define OCI_TYPEMETHOD_CLEAR_RNPS(flag) bic((flag), OCI_TYPEMETHOD_RNPS) +#define OCI_TYPEMETHOD_CLEAR_WNPS(flag) bic((flag), OCI_TYPEMETHOD_WNPS) + +/*--------------------------- TYPE PARAMETER MODE ---------------------------*/ + +enum OCITypeParamMode +{ + /* PL/SQL starts this from 0 */ + OCI_TYPEPARAM_IN = 0, /* in */ + OCI_TYPEPARAM_OUT, /* out */ + OCI_TYPEPARAM_INOUT, /* in-out */ + OCI_TYPEPARAM_BYREF, /* call by reference (implicitly in-out) */ + OCI_TYPEPARAM_OUTNCPY, /* OUT with NOCOPY modifier */ + OCI_TYPEPARAM_INOUTNCPY /* IN OUT with NOCOPY modifier */ +}; +typedef enum OCITypeParamMode OCITypeParamMode; + + +/*-------------------------------- DEFAULTS ---------------------------------*/ + +/* default binary and decimal precision and scale */ + +#define OCI_NUMBER_DEFAULTPREC ((ub1)0) /* no precision specified */ +#define OCI_NUMBER_DEFAULTSCALE ((sb1)MAXSB1MINVAL) + /* no binary/decimal scale specified */ + +/* default maximum length for varrays and vstrings (used in sql.bsq) */ + +#define OCI_VARRAY_MAXSIZE 4000 + /* default maximum number of elements for a varray */ +#define OCI_STRING_MAXLEN 4000 /* default maximum length of a vstring */ + +/*---------------------------------------------------------------------------*/ +/* This set of macro is used only in beta2. They should be removed as soon as + * PLSQL has made the changes of not using these macros. + */ + +/* Special duration for allocating memory only. No instance can be allocated + * given these durations. + */ +#define OCICoherency OCIRefreshOpt +#define OCI_COHERENCY_NONE (OCIRefreshOpt)2 +#define OCI_COHERENCY_NULL (OCIRefreshOpt)4 +#define OCI_COHERENCY_ALWAYS (OCIRefreshOpt)5 + +#endif /* ORO_ORACLE */ + diff --git a/sdk/include/ort.h b/sdk/include/ort.h new file mode 100755 index 0000000..9562f2e --- /dev/null +++ b/sdk/include/ort.h @@ -0,0 +1,2594 @@ +/* @(#)ort.h 1.44 95/07/07 */ + +/* Copyright (c) 1994, 2005, Oracle. All rights reserved. */ + +/* + NAME + + ORT - ORacle's external open Type interface to the open type manager (OTM) + + DESCRIPTION + + The open type manager interface includes dynamic type operations to + create, delete, update, and access types. See the "Functional + Specification for Oracle Object Call Interface (Objects Project), + Version 1.0" for a user level description of the OTM. For a more + detailed description, see the "Component Document for the Open Type + Manager, Version 1.0". + + NOTE: MOST Of the functions in this header file are being desupported. + Please use the OCIDescribeAny interface as described in oci.h + instead. + The OCIType, OCITypeElem, OCITypeMethod abstract types continue + to be supported. The only two functions that remain to be documented + are OCITypeArrayByName and OCITypeArrayByRef. + All obsolete types/functions are marked accordingly below. + + RELATED DOCUMENTS + + For the functional specification for the OTM, see: + [1] Kotsovolos, Susan, "Functional Specification for Oracle Object + Call Interface (Objects Project), Version 1.0", Oracle + Corporation, February 1995. + For the internal design of the OTM, see the following: + [2] Kotsovolos, Susan, "Component Document for the Open Type Manager", + Oracle Corporation, November 1994. + [3] Kotsovolos, Susan, "Design for The Open Type Manager, Oracle + Object Management Subsystem Version 1.0", Oracle Corporation, + March 1994. + [4] Kotsovolos, Susan and Tin A. Nguyen, "The Open Type Manager", + Oracle Corporation, March 1994. + [5] Kotsovolos, Susan and Tin A. Nguyen, "Schema Evolution", + Oracle Corporation, March 1994. + For a description of the types the OTM must support, see: + [6] Nguyen, Tin A., "The Open Type System", Oracle Corporation, + February 1994. + + INSPECTION STATUS + + Inspection date: + Inspection status: + Estimated increasing cost defects per page: + Rule sets: + + ACCEPTANCE REVIEW STATUS + + Review date: + Review status: + Reviewers: + + + **** ALL OBSOLETE FUNCTIONS/TYPES ARE MARKED ACCORDINGLY *** + + EXPORT FUNCTIONS + + None + + PUBLIC DATA STRUCTURES + + OCIType - type descriptor in the object cache + OCITypeElem - type element descriptor in the object cache + (used for attributes and paramters) + OCITypeCode - Open Type System type code. + OCITypeMethod - method descriptor in the object cache + OCITypeParamMode - parameter modes (ie. IN, IN-OUT etc) + + PUBLIC FUNCTIONS + + ITERATOR (for OCITypeAttrNext and OCITypeMethodNext) + + OCITypeIterNew - ** OBSOLETE ** Create new instance of an iteraton. + OCITypeIterSet - ** OBSOLETE ** Initialize iterator. + OCITypeIterFree - ** OBSOLETE ** Free instance of iterator. + + TYPE GET + + OCITypeByName - ** OBSOLETE ** Get a type by name. + OCITypeArrayByName - Get an array of types by their names. + OCITypeByRef - ** OBSOLETE ** Get a type by its CREF. + OCITypeArrayByRef - Get an array of types by their CREFs. + + TYPE ACCESSORS + + OCITypeName - ** OBSOLETE ** OCI Get a type's name. + OCITypeSchema - ** OBSOLETE ** OCI Get a type's schema name. + OCITypeTypeCode - ** OBSOLETE ** OCI Get a type's type code. + OCITypeVersion - ** OBSOLETE ** OCI Get a Type's user-readable Version. + OCITypeAttrs - ** OBSOLETE ** OCI Get a Type's Number of Attributes. + OCITypeMethods - ** OBSOLETE ** OCI Get a Type's Number of Methods. + + TYPE ELEMENT ACCESSORS (they represent attributes/parameters/results) + + OCITypeElemName - ** OBSOLETE ** Get a type element's (only for + attributes) name. + OCITypeElemType - ** OBSOLETE ** Get a type element's type + descriptor. + OCITypeElemTypeCode - ** OBSOLETE ** Get a type element's typecode. + OCITypeElemParameterizedType - ** OBSOLETE ** Get a type element's + parameterized type's type descriptor. + OCITypeElemNumPrec - ** OBSOLETE ** Get a number's precision. + OCITypeElemNumScale - ** OBSOLETE ** Get a decimal or oracle Number's + Scale + OCITypeElemCharSetID - ** OBSOLETE ** Get a fixed or variable length + string's character set ID. + OCITypeElemCharSetForm - ** OBSOLETE ** Get a fixed or variable length + string's character set form (how + character set information has + been specified). + OCITypeElemLength - ** OBSOLETE ** Get a raw, fixed or variable + length string's length. + OCITypeElemParamMode - ** OBSOLETE ** Get element's parameter's mode + (only valid for parameter). + OCITypeElemDefaultValue - ** OBSOLETE ** Get element's Default Value. + + ATTRIBUTE ACCESSORS + + OCITypeAttrByName - ** OBSOLETE ** Get an Attribute by Name. + OCITypeAttrNext - ** OBSOLETE ** Get an Attribute by Iteration. + + COLLECTION ACCESSORS + + OCITypeCollTypeCode - ** OBSOLETE ** Get a named collection's typecode. + OCITypeCollElem - ** OBSOLETE ** Get a named collection's element's + type element information. + OCITypeCollSize - ** OBSOLETE ** Get a named collection's size in + number of elements. + + METHOD ACCESSORS + + OCITypeMethodOverload - ** OBSOLETE ** Get number of overloaded methods + with the given method name. + (no direct equivalent for + OCIDescribe interface) + OCITypeMethodByName - ** OBSOLETE ** Get one or more methods by name. + OCITypeMethodNext - ** OBSOLETE ** Iterate to the next method to + retrieve. + OCITypeMethodName - ** OBSOLETE ** Get method's name. + OCITypeMethodEncap - ** OBSOLETE ** Get method's encapsulation level. + OCITypeMethodFlags - ** OBSOLETE ** et method's flags. + OCITypeMethodMap - ** OBSOLETE ** Get type's map function. + OCITypeMethodOrder - ** OBSOLETE ** Get type's order function. + OCITypeMethodParams - ** OBSOLETE ** Get a method's number of + parameters. + + RESULT ACCESSORS + + OCITypeResult - ** OBSOLETE ** OCI Get a method's Result. + + See also ATTRIBUTE/PARAMETER/RESULT TYPE ACCESSORS. + + PARAMETER ACCESSORS + + OCITypeParamByPos - ** OBSOLETE ** Get a Parameter in a method By + Position. + OCITypeParamByName - ** OBSOLETE ** Get a Parameter in a method By Name. + OCITypeParamPos - ** OBSOLETE ** Get a Parameter's PoSition in a + method. + + CALL GRAPHS: + + Only type accessors are supported for 8.0. + ** OBSOLETE ** please use OCIDescribe interface + + TYPE ACCESSOR EXAMPLE + + CREATE TYPE CAR + ( + name vstring, + age number, + number car_age; /o Oracle number o/ + weight car_weight; /o abstract type o/ + + PUBLIC: + + /o methods o/ + car(orlvs a_name, number an_age, WEIGHT a_weight); + ~car(); + inline number get_age() const; + + /o relative ordering (map) functions o/ + number car_map + ); + + /o the following code accesses the type created above o/ + + ub1 meth_flags; + ub4 i, j; + ub4 text_len, position; + ub4 count; + ub4 length; + OCITypeCode typecode; + OCIRef *attr_ref; + OCIRef *param_ref; + OCIType *tdo, new_tdo, final_tdo; + OCITypeElem *elem; + OCITypeIter *iterator_ort; + oratext (*names)[]; + ub4 lengths[]; + ub4 *positions; + oratext *name; + oratext name_buffer[M_IDEN]; + + /o initialize the references o/ + DISCARD orlrini(env, err, (dvoid *)&attr_ref); + DISCARD orlrini(env, err, (dvoid *)¶m_ref); + + /o ----------------- GET INFORMATION ABOUT A TYPE ----------------- o/ + + /o start a transaction o/ + + /o Pin the type until the end of the transaction. Pinning the type is + o required before using any type accessors. + o/ + if (OCITypeByName(env, err, svc, (oratext *)0, 0, "CAR", strlen("CAR"), + OCI_DURATION_TRANS, &car_ref, &car_tdo) != OCI_SUCCESS) + /o error o/ ; + + /o get the type's name o/ + if (!memcmp(OCITypeName(env, err, car_tdo, &text_len), "person", + text_len)) + /o do something o/ ; + + /o get the type's schema name o/ + if (!memcmp(OCITypeSchema(env, err, car_tdo, &text_len), "john", + text_len)) + /o do something o/ ; + + /o get the type code of the type o/ + if (OCITypeTypeCode(env, err, car_tdo) == OCI_TYPECODE_ADT) + /o do something o/ ; + + /o get the type version o/ + if (!memcmp(OCITypeVersion(env, err, car_tdo, &text_len), "1", text_len)) + /o do something o/ ; + + /o ------- GET FLATTENED POSITION OF AN ATTRIBUTES IN A TYPE ------- o/ + + names = malloc(sizeof(oratext *) * 2); + names[0] = malloc(strlen("car_weight")); + names[1] = malloc(strlen("ounces")); + memcpy(names[0], "car_weight", strlen("car_weight")); + memcpy(names[1], "ounces", strlen("ounces")); + + lengths = malloc(sizeof(ub4) * 2); + lengths[0] = strlen("car_weight"); + lengths[1] = strlen("ounces"); + + /o ---------- GET IMMEDIATE ATTRIBUTES IN A TYPE ---------- o/ + + /o loop through all attributes in the type with iterator o/ + if (OCITypeIterNew(env, err, car_tdo, &iterator_ort) != OCI_SUCCESS) + /o do something o/ + + while (OCITypeAttrNext(env, err, iterator_ort, &ado) != OCI_NO_DATA) + { + /o get the attribute's name o/ + if (!memcmp(OCITypeElemName(env, err, ado, &text_len), + "tiger", text_len)) + /o do something o/ ; + + /o get the attribute's type descriptor o/ + if (OCITypeElemType(env, err, ado, &tdo) != OCI_SUCCESS) + /o error o/ ; + + /o get the attribute's type code o/ + typecode = OCITypeElemTypeCode(env, err, ado); + + switch (typecode) + { + /o scalar types o/ + case OCI_TYPECODE_DATE: /o date o/ + case OCI_TYPECODE_SIGNED8: /o byte o/ + case OCI_TYPECODE_SIGNED16: /o short o/ + case OCI_TYPECODE_UNSIGNED8: /o unsigned byte o/ + case OCI_TYPECODE_UNSIGNED16: /o unsigned short o/ + case OCI_TYPECODE_OCTET: /o octet o/ + case OCI_TYPECODE_TABLE: /o nested table o/ + case OCI_TYPECODE_CLOB: /o character lob o/ + case OCI_TYPECODE_BLOB: /o binary lob o/ + case OCI_TYPECODE_CFILE: /o character file object o/ + case OCI_TYPECODE_BFILE: /o binary file object o/ + + /o do something o/ + break; + + /o number types o/ + case OCI_TYPECODE_NUMBER: /o oracle number o/ + case OCI_TYPECODE_DECIMAL: /o decimal o/ + { + /o get the scale of the number o/ + if (OCITypeElemNumScale(env, err, ado) == 3) + /o do something o/ ; + } + /o fall through to get the precision o/ + + case OCI_TYPECODE_FLOAT: /o float o/ + case OCI_TYPECODE_SIGNED32: /o long o/ + case OCI_TYPECODE_UNSIGNED32: /o unsigned long o/ + case OCI_TYPECODE_REAL: /o real o/ + case OCI_TYPECODE_DOUBLE: /o double o/ + { + /o get the precision of the number o/ + if (OCITypeElemNumPrec(env, err, ado) == 2) + /o do something o/ ; + } + break; + + /o string types o/ + case OCI_TYPECODE_CHAR: /o fixed length string o/ + case OCI_TYPECODE_VARCHAR2: /o variable length string o/ + case OCI_TYPECODE_RAW: /o raw o/ + { + /o get the length of the fixed or variable length string o/ + if (OCITypeElemLength(env, err, ado) < 100) + /o do something o/ + } + break; + + /o parameterized types o/ + case OCI_TYPECODE_REF: /o reference o/ + case OCI_TYPECODE_PTR: /o pointer o/ + { + /o get the type stored in the parameterized type o/ + if (OCITypeElemParameterizedType(env, err, ado, &tdo) + != OCI_SUCCESS) + /o error o/ ; + + /o do something o/ + if (OCI_TYPEELEM_IS_REF(OCITypeElemFlags(env, err, ado)))... + } + break; + + /o domain type o/ + case OCI_TYPECODE_NAMEDCOLLECTION: + switch (OCITypeCollTypeCode(env, err, tdo)) + { + case OCI_TYPECODE_VARRAY: /o variable array o/ + ub4 num_elems; + OCIType *element_type; + + /o get the number of elements in the farray or the maximum number + o of elements in the varray. + o/ + OCITypeCollSize(env, err, tdo, &num_elems); + + /o get the type of the array o/ + OCITypeElemType(env, err, tdo, &element_type); + } + break; + + case OCI_TYPECODE_TABLE: /o multiset o/ + { + OCIType *table_type; + + /o get the type of the multiset o/ + OCITypeElemType(env, err, tdo, &table_type); + + /o do something o/ + } + } + + /o abstract type o/ + case OCI_TYPECODE_ADT: /o abstract data type o/ + { + /o get the adt information o/ + if (OCITypeElemType(env, err, ado, &tdo) != OCI_SUCCESS) + /o error o/ ; + + /o do something o/ + } + break; + + default: + DISCARD printf("Error: invalid type code\n"); + + } /o end of typecode switch o/ + + } /o end of loop through all attributes in a type o/ + + + /o ------------ GET THE IMMEDIATE METHODS OF A TYPE ------------ o/ + + /o loop through all methods in the type by reusing iterator o/ + if (OCITypeIterSet(env, err, car_tdo, iterator_ort) != OCI_SUCCESS) + /o do something o/ + + while (OCITypeMethodNext(env, err, iterator_ort) != OCI_NO_DATA) + { + /o get the method's name o/ + if (!memcmp(OCITypeMethodName(env, err, mdo, &text_len), "car", + text_len)) + /o do something o/ ; + + /o get the method's encapsulation o/ + if (OCITypeMethodEncap(env, err, mdo) == OCI_TYPEENCAP_PUBLIC) + /o do something o/ ; + + /o get the method's flags o/ + meth_flags = OCITypeMethodFlags(env, err, mdo); + if (meth_flags & OCI_TYPEMETHOD_VIRTUAL) + /o do something o/ ; + + + /o ------------ GET THE PARAMETERS IN A METHOD ------------ o/ + + /o loop through all parameters in the method o/ + count = OCITypeMethodParams(env, err, mdo); + for (j = 1; j <= count; j++) + { + /o get the parameter information by position o/ + if (OCITypeParamByPos(env, err, mdo, i, &elem) != OCI_SUCCESS) + /o error o/ ; + + /o get the parameter's name o/ + if (!memcmp(OCITypeElemName(env, err, elem, &text_len), "an_age", + text_len)) + /o do something o/ ; + + /o get the parameter's mode o/ + if (OCITypeElemMode(env, err, elem) == OCI_PARAM_OUT) + /o do something o/ ; + + /o get the parameter's required flag o/ + if (ortgprq(env, err, elem)) + /o do something o/ ; + } + } + + /o get a method by name o/ + if (OCITypeMethodByName(env, err, car_tdo, "car_constructor", + strlen("car_constructor"), NULLP(OCIRef), &mdo) + != OCI_SUCCESS) + /o error o/ ; + + /o get a parameter in a method by name o/ + if (OCITypeParamByName(env, err, mdo, "an_age", strlen("an_age"), &elem) + != OCI_SUCCESS) + /o error o/ ; + + /o get a parameter's typecode o/ + typecode = OCITypeElemTypeCode(env, err, elem); + + /o get a parameter's type object o/ + if (OCITypeElemType(env, err, elem, &tdo)) != OCI_SUCCESS) + /o error o/ ; + + /o get a parameter's position in a method o/ + if (ortgpps(env, err, mdo, "an_age", strlen("an_age"), + &position, NULLP(OCIRef), NULLP(OCITypeElem)) != OCI_SUCCESS) + /o error o/ ; + + /o ------------ GET THE METHOD's RESULT ------------ o/ + + /o get a method by name o/ + if (OCITypeMethodByName(env, err, car_tdo, "get_age", strlen("get_age"), + &mdo) != OCI_SUCCESS) + /o error o/ ; + + /o get the typecode of the method's result o/ + typecode = OCITypeElemTypeCode(env, err, mdo); + + + /o ----------------- END ---------------- o/ + + /o free the references implicitly allocated o/ + DISCARD orlrfre(env, err, (dvoid *)&attr_ref); + DISCARD orlrfre(env, err, (dvoid *)¶m_ref); + + NOTES + + MODIFIED + dmukhin 06/29/05 - ANSI prototypes; miscellaneous cleanup + srseshad 03/12/03 - convert oci public api to ansi + aahluwal 06/03/02 - bug 2360115 + skabraha 04/16/02 - fix compiler warnings + rkasamse 03/02/01 - do not use iterator : keyword in MSVB + bpalaval 02/09/01 - Change text to oratext. + rxgovind 01/31/00 - add OCIType interfaces for transient types + whe 09/01/99 - 976457:check __cplusplus for C++ code + cxcheng 05/06/97 - make OCI_TYPE?? test macros return either 1 or 0 + cxcheng 04/22/97 - add comment on desupporting OCIType functions + skrishna 03/18/97 - fix ifdef for supporting ansi and k&r proto-types + cxcheng 02/26/97 - fix lint problem with oro names + cxcheng 02/06/97 - take out short name support except with SLSHORTNAME + cxcheng 01/15/97 - change prototype of OCITypeElemParameterizedType() + cxcheng 01/03/97 - replace bit in OCI_TYPEPARAM_IS_REQUIRED with bitwis + cxcheng 12/31/96 - replace OCI_PARAM_IS_REQUIRED with OCI_TYPEPARAM_IS_ + cxcheng 12/09/96 - add prototype for OCITypeElemExtTypeCode and OCIType + cxcheng 11/25/96 - add schema name parameter to OCITypeVTInsert() + cxcheng 11/20/96 - fix prototype for OCITypeByName() + cxcheng 11/11/96 - fix prototype for OCITypeByName() + cxcheng 11/05/96 - remove OCITypeElemExtTypeCode and OCITypeCollExtType + dchatter 10/28/96 - change ortgatyp to be OCITypeArrayByName + cxcheng 10/25/96 - fix problem with ortgatyp at end + cxcheng 10/22/96 - add OCITypeByRef and OCITypeArrayByRef + cxcheng 10/20/96 - remove ortgtyp() from #define section at end + cxcheng 10/18/96 - rename OCITypeGetArray to OCITypeArrayByName + cxcheng 10/17/96 - final change to prototype for OCI_TYPEPARAM_IS_REQUI + cxcheng 10/15/96 - rename OCIEncapLevel and OCIMethodFlag + cxcheng 10/14/96 - change prototype of OCITypeResult + mluong 10/11/96 - fix compile error + jwijaya 10/10/96 - fix bug on OCI_PARAM_IS_REQUIRED + cxcheng 10/09/96 - more lint and link fixes + cxcheng 10/08/96 - more lint fixes + cxcheng 10/07/96 - more changes + cxcheng 10/04/96 - replace short names with long names + cxcheng 10/01/96 - change to long names for readability + cxcheng 09/27/96 - rename ortgatyp() to ortgtya() for lint + cxcheng 09/20/96 - add ortgatyp() for array get type + cxcheng 09/18/96 - add array pin and iterator functions + cxcheng 08/09/96 - add version table calls + cxcheng 07/22/96 - add OCITypeElemType() to top + jwijaya 07/03/96 - add ANSI prototypes + cxcheng 06/28/96 - add OCITypeElemCharSetForm() + cxcheng 06/26/96 - fix comment on OCITypeParamByPos()/ortgpps() + cxcheng 06/18/96 - fix comments on OCITypeResult() + cxcheng 06/17/96 - improve comments + skrishna 06/03/96 - change OCITypeCollElem() prototype + vkrishna 05/29/96 - replace OROTCFAR with OROTCCAR + cxcheng 05/28/96 - fix comments, remove non-beta1 functions + cxcheng 05/02/96 - fix prototype bugs + cxcheng 04/29/96 - rename OCITypeElemm() to ortanct() + cxcheng 04/26/96 - add ortgrbp and ortftyi, + fix comments and examples + cxcheng 04/22/96 - big merge to main branch + cxcheng 04/17/96 - fix syntax + cxcheng 04/08/96 - change prototype to ortaty() + skrishna 04/08/96 - change ort*() to take OCIEnv* and OCIError* instead + of oroenv* + cxcheng 03/28/96 - add ortslob(), change ortsstr() prototype + cxcheng 03/13/96 - change alter type interface + cxcheng 03/11/96 - ORT interface changes + cxcheng 02/27/96 - correct comments + jboonleu 02/09/96 - rename oroopd to OCIDuration + cxcheng 01/19/96 - change ORTCTYVAL to ORTCTYEMB for embedded ADT + cxcheng 02/14/96 - add more comments + jboonleu 02/09/96 - rename oroopd to OCIDuration + cxcheng 02/07/96 - fix comments and examples + cxcheng 01/19/96 - new ORT interface without korfc's + cxcheng 01/08/96 - consolidate collection functions + cxcheng 12/14/95 - remove obsolete ortgcol() and ortrelease() + jweisz 12/12/95 - merge screwup: ortdth twice + cxcheng 12/05/95 - change multiset interface for new standard + skotsovo 12/01/95 - merge from /vobs/rdbms/public/ort.h@@/main/ + st_rdbms_big_dev/st_rdbms_obj/ + st_rdbms_jwijaya_variable_ref + cxcheng 11/13/95 - add ortaty()/orteaty() + cxcheng 11/13/95 - add new collection type accessors + skotsovo 10/30/95 - add 'oid' type b/c extent type uses it. + skotsovo 10/24/95 - update according to new variable length ref + cxcheng 10/05/95 - add null support, change prototypes to calls + cxcheng 10/03/95 - add OCITypeMethodOrder() to get ORDER method + cxcheng 09/28/95 - add OCITypeElemm() for collection types support + skotsovo 06/05/95 - add adt_type parameter to ortsab() + skotsovo 05/10/95 - ifdef'd out ortgafp() + skotsovo 03/07/95 - update interface to only include release 1 + skotsovo 02/22/95 - add multiset accessors + skotsovo 02/09/95 - update according to new ots doc + skotsovo 01/31/95 - add rest of release 1 types + skotsovo 01/24/95 - categorize sint32, double, and real as number types + (with precision and scale) instead of scalar types. + skotsovo 01/12/95 - remove dependency from ortdty interface + skotsovo 01/03/95 - remove orotyp accessors + skotsovo 12/12/94 - update comments + skotsovo 12/05/94 - change OCITypeElemParameterizedTyper interface + skotsovo 10/26/94 - add type version table + skotsovo 10/17/94 - fix ortgafp() comments + skotsovo 10/14/94 - modify ortgafp() parameters + skotsovo 10/14/94 - add examples + skotsovo 10/13/94 - add a few new routines + jwijaya 10/07/94 - add namespace to pin by name + jwijaya 10/02/94 - connection handle -> connection number + skotsovo 09/13/94 - modify example to use updated oririni interface + skotsovo 08/25/94 - change scale to sb1 from sb2 + skotsovo 07/28/94 - add ortbeg() and ortend() + skotsovo 07/14/94 - add decimal type & call graph + skotsovo 06/28/94 - subset by removing miscellaneous functions + skotsovo 06/28/94 - consistently put comments before typedefs + skotsovo 06/27/94 - modify according to new header file template, add + more examples, and change ortcty() to return a + reference to the type + skotsovo 06/24/94 - add functions to get type information from orotyp + skotsovo 06/20/94 - finish modifying according to header template + skotsovo 06/09/94 - modify according to header file template + skotsovo 06/08/94 - replace s.h with oratypes.h + skotsovo 05/24/94 - modify comments & update example + skotsovo 05/23/94 - modify fnt names for create, alter and drop type + skotsovo 05/18/94 - remove ortdme() -- delete a method + skotsovo 05/17/94 - add tdo parameter to all type modifiers + skotsovo 05/11/94 - return text* instead of including it in arglist + skotsovo 11/16/93 - creation + +*/ + +#ifndef ORATYPES +#include +#endif +#ifndef ORO_ORACLE +#include +#endif +#ifndef OCI_ORACLE +#include +#endif + +#ifndef ORT_ORACLE +#define ORT_ORACLE + +/*---------------------------------------------------------------------------*/ +/* SHORT NAMES SUPPORT SECTION */ +/*---------------------------------------------------------------------------*/ + +#ifdef SLSHORTNAME + +/* the following are short names that are only supported on IBM mainframes + with the SLSHORTNAME defined. + With this all subsequent long names will actually be substituted with + the short names here */ + +#define OCITypeArrayByName ortgatyp +#define OCITypeAttrByName ortgabn +#define OCITypeAttrNext ortgabi +#define OCITypeAttrs ortgtna +#define OCITypeByRef ortgtbrf +#define OCITypeCollElem ortgcel +#define OCITypeCollExtTypeCode ortgcsqt +#define OCITypeCollSize ortgcne +#define OCITypeCollTypeCode ortgdttc +#define OCITypeElem ortado +#define OCITypeElemCharSetForm ortgscform +#define OCITypeElemCharSetID ortgscid +#define OCITypeElemDefaultValue ortgpdv +#define OCITypeElemExtTypeCode ortgasqt +#define OCITypeElemLength ortgsl +#define OCITypeElemName ortganm +#define OCITypeElemNumPrec ortgnp +#define OCITypeElemNumScale ortgns +#define OCITypeElemParamMode ortgpmo +#define OCITypeElemParameterizedType ortgpa +#define OCITypeElemType ortgaty +#define OCITypeElemTypeCode ortgatc +#define OCITypeIter ortitr +#define OCITypeIterFree ortifre +#define OCITypeIterNew ortinew +#define OCITypeIterSet ortiset +#define OCITypeMethod ortmdo +#define OCITypeMethodByName ortgmbn +#define OCITypeMethodEncap ortgmen +#define OCITypeMethodFlags ortgmfl +#define OCITypeMethodMap ortgmmap +#define OCITypeMethodName ortgmnm +#define OCITypeMethodNext ortgmbi +#define OCITypeMethodOrder ortgmor +#define OCITypeMethodOverload ortgmno +#define OCITypeMethodParams ortgmnp +#define OCITypeMethods ortgtnm +#define OCITypeName ortgtme +#define OCITypeParamByName ortgpbn +#define OCITypeParamPos ortgpps +#define OCITypeSchema ortgtsch +#define OCITypeTypeCode ortgttc +#define OCITypeVTInit ortvini +#define OCITypeVTInsert ortvins +#define OCITypeVTSelect ortvsel +#define OCITypeVersion ortgtvn + +#endif /* SLSHORTNAME */ + + +/*============================*/ +/* PUBLIC TYPES AND CONSTANTS */ +/*============================*/ + +/*----------------------------- TYPE DESCRIPTION ----------------------------*/ + +/* + * OCIType - OCI Type Description Object + * + * The contents of an 'OCIType' is private/opaque to clients. Clients just + * need to declare and pass 'OCIType' pointers in to the type manage + * functions. + * The pointer points to the type in the object cache. Thus, clients don't + * need to allocate space for this type and must NEVER free the pointer to the + * 'OCIType'. + */ + +typedef struct OCIType OCIType; + +/*------------------------- TYPE ELEMENT DESCRIPTION ------------------------*/ + + +/* + * OCITypeElem - OCI Type Element object + * + * The contents of an 'OCITypeElem' is private/opaque to clients. Clients just + * need to declare and pass 'OCITypeElem' pointers in to the type manager + * functions. + * + * 'OCITypeElem' objects contains type element information such as the numeric + * precision for example, for number objects, and the number of elements for + * arrays. + * They ARE used to describe type attributes, collection elements, + * method parameters, and method results. Hence they are pass in or returned + * by attribute, collection, and method parameter/result accessors. + */ + +typedef struct OCITypeElem OCITypeElem; + + +/*--------------------------- METHOD DESCRIPTION ---------------------------*/ + + +/* + * OCITypeMethod - OCI Method Description object + * + * The contents of an 'OCITypeMethod' is private/opaque to clients. Clients + * just need to declare and pass 'OCITypeMethod' pointers in to the type + * manager functions. + * The pointer points to the method in the object cache. Thus, clients don't + * need to allocate space for this type and must NEVER free the pointer to + * the 'OCITypeMethod'. + */ + +typedef struct OCITypeMethod OCITypeMethod; + + +/*--------------------------- TYPE ACCESS ITERATOR --------------------------*/ + +/* + * OCITypeIter- OCI Type Iterator + * + * The contents of an 'orti' is private/opaque to clients. Clients just + * need to declare and pass 'orti' pointers in to the type manager functions. + * The iterator is used to retreive MDO's and ADO's that belong to the TDO + * one at a time. It needs to be allocated by the 'OCITypeIterNew()' function + * call and deallocated with the 'OCITypeIterFree()' function call. + */ + +typedef struct OCITypeIter OCITypeIter; + + +/*==================*/ +/* PUBLIC FUNCTIONS */ +/*==================*/ + +/*--------------------------------------------------------------------------*/ +/* ITERATOR */ +/*--------------------------------------------------------------------------*/ + +/*-----------------------_- OCITypeIterNew ---------------------------------*/ + +/* ** OBSOLETE ** */ +sword OCITypeIterNew( OCIEnv *env, OCIError *err, OCIType *tdo, + OCITypeIter **iterator_ort ); + +/* + NAME: OCITypeIterNew - OCI Iterator NEW + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + tdo (IN) - pointer to the pinned type in the object cache to + initialize the iterator with + iterator_ort (OUT) - pointer to the pointer to the new iterator created + DESCRIPTION: + Create a new instance of a method/attribute iterator and initalize + it's values. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is null. + OCI_ERROR if + 1) any of the required parameters is null. + 2) error while allocating space for the iterator. +*/ + +/*------------------------ OCITypeIterSet ---------------------------------*/ + +/* ** OBSOLETE ** */ +sword OCITypeIterSet( OCIEnv *env, OCIError *err, OCIType *tdo, + OCITypeIter *iterator_ort ); + +/* + NAME: OCITypeIterSet - OCI Iterator SET + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + tdo (IN) - pointer to the pinned type in the object cache to + initialize the iterator with + iterator_ort (IN/OUT) - pointer to the iterator to set + DESCRIPTION: + Initializes the iterator. This is used to reset the state of the + iterator. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is null. + OCI_ERROR if + 1) any of the required parameters is null. +*/ + +/*------------------------ OCITypeIterFree ---------------------------------*/ + +/* ** OBSOLETE ** */ +sword OCITypeIterFree( OCIEnv *env, OCIError *err, OCITypeIter + *iterator_ort ); + +/* + NAME: OCITypeIterFree - OCI Iterator FREe + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + iterator_ort (IN/OUT) - pointer to the iterator to free + DESCRIPTION: + Free space allocated for the iterator. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is null. + OCI_ERROR if + 1) any of the required parameters is null. + 2) error while freeing the iterator, probably bad iterator pointer. +*/ + + +/*--------------------------------------------------------------------------*/ +/* TYPE GET */ +/*--------------------------------------------------------------------------*/ + +/* ** OBSOLETE ** */ +sword OCITypeByName( OCIEnv *env, OCIError *err, const OCISvcCtx *svc, + const oratext *schema_name, ub4 s_length, + const oratext *type_name, ub4 t_length, + const oratext *version_name, ub4 v_length, + OCIDuration pin_duration, OCITypeGetOpt get_option, + OCIType **tdo ); +/* + NAME: OCITypeByName - OCI Get the most current version of an existing TYPe + by name. + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + svc (IN) - OCI service handle + schema_name (IN, optional) - name of schema associated with the + type. By default, the user's schema name is used. + s_length (IN) - length of the 'schema_name' parameter + type_name (IN) - name of the type to get + t_length (IN) - length of the 'type_name' parameter + version_name (IN, optional) - user readable version of the type. + Pass (oratext *)0 for the most current version. + v_length (IN) - length of version_name in bytes. Should be 0 if + the most current version is to be retrieved. + pin_duration (IN) - pin duration (e.g. until the end of current + transaction). See 'oro.h' for a description of + each option. + get_option (IN) - options for loading the types. It can be one of two + values: + OCI_TYPEGET_HEADER for only the header to be loaded, or + OCI_TYPEGET_ALL for the TDO and all ADO and MDOs to be + loaded. + tdo (OUT) - pointer to the pinned type in the object cache + DESCRIPTION: + Get a pointer to a version of the existing type associated + with schema/type name. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is null. + OCI_ERROR if + 1) any of the required parameters is null. + 2) the adt type associated with schema/type name does not exist. + NOTE: + Schema and type names are CASE-SENSITIVE. If they have been created + via SQL, you need to use uppercase names. +*/ + +sword OCITypeArrayByName( OCIEnv *env, OCIError *err, const OCISvcCtx *svc, + ub4 array_len, + const oratext *schema_name[], ub4 s_length[], + const oratext *type_name[], ub4 t_length[], + const oratext *version_name[], ub4 v_length[], + OCIDuration pin_duration, + OCITypeGetOpt get_option, OCIType **tdo ); + +/* + NAME: OCITypeArrayByName - OCI Get array of TYPes by name. + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + svc (IN) - OCI service handle + array_len (IN) - number of schema_name/type_name/version_name entries to + be retrieved. + schema_name (IN, optional) - array of schema names associated with the + types to be retrieved. The array must have array_len + elements if specified. + If 0 is supplied, the default schema is assumed, otherwise + it MUST have array_len number of elements. + 0 can be supplied for one or more of the entries to indicate + that the default schema is desired for those entries. + s_length (IN) - array of schema_name lengths with each entry + corresponding to the length of the corresponding schema_name + entry in the schema_name array in bytes. + The array must either have array_len number of elements or + it MUST be 0 if schema_name is not specified. + type_name (IN) - array of the names of the types to retrieve. This + MUST have array_len number of elements. + t_length (IN) - array of the lengths of type names in the type_name + array in bytes. + version_name (IN) - array of the version names of the types to retrieve + corresponding. This can be 0 to indicate retrieval of the + most current versions, or it MUST have array_len number of + elements. + If 0 is supplied, the most current version is assumed, + otherwise it MUST have array_len number of elements. + 0 can be supplied for one or more of the entries to indicate + that the current version is desired for those entries. + v_length (IN) - array of the lengths of version names in the + version_name array in bytes. + pin_duration (IN) - pin duration (e.g. until the end of current + transaction) for the types retreieve. See 'oro.h' for a + description of each option. + get_option (IN) - options for loading the types. It can be one of two + values: + OCI_TYPEGET_HEADER for only the header to be loaded, or + OCI_TYPEGET_ALL for the TDO and all ADO and MDOs to be + loaded. + tdo (OUT) - output array for the pointers to each pinned type in the + object cache. It must have space for array_len pointers. + Use OCIObjectGetObjectRef() to obtain the CREF to each + pinned type descriptor. + DESCRIPTION: + Get pointers to the existing types associated with the schema/type name + array. This is similar to OCITypeByName() except that all the TDO's are + retreived via a single network roundtrip. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is null. + OCI_ERROR if + 1) any of the required parameters is null. + 2) one or more adt types associated with a schema/type name entry + does not exist. +*/ + +sword OCITypeByRef( OCIEnv *env, OCIError *err, + const OCIRef *type_ref, OCIDuration pin_duration, + OCITypeGetOpt get_option, OCIType **tdo ); + +/* + NAME: OCITypeArrayByRef - OCI Get array of TYPes by REF. + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + type_ref (IN) - OCIRef * pointing to the particular version of + the type descriptor object to obtain. + The array must have array_len elements if specified. + pin_duration (IN) - pin duration (e.g. until the end of current + transaction) for the type to retreieve. See 'oro.h' for a + description of each option. + get_option (IN) - options for loading the type. It can be one of two + values: + OCI_TYPEGET_HEADER for only the header to be loaded, or + OCI_TYPEGET_ALL for the TDO and all ADO and MDOs to be + loaded. + tdo (OUT) - pointer to the pinned type in the object cache + DESCRIPTION: + Get pointers to the + with the schema/type name array. This is similar to OCITypeByName() + except that all the TDO's are retreived via a single network roundtrip. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is null. + OCI_ERROR if + 1) any of the required parameters is null. + 2) one or more adt types associated with a schema/type name entry + does not exist. +*/ + +sword OCITypeArrayByRef( OCIEnv *env, OCIError *err, + ub4 array_len, const OCIRef **type_ref, + OCIDuration pin_duration, + OCITypeGetOpt get_option, OCIType **tdo ); + +/* + NAME: OCITypeArrayByRef - OCI Get array of TYPes by REF. + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + array_len (IN) - number of schema_name/type_name/version_name entries to + be retrieved. + type_ref (IN) - array of OCIRef * pointing to the particular version of + the type descriptor object to obtain. + The array must have array_len elements if specified. + pin_duration (IN) - pin duration (e.g. until the end of current + transaction) for the types retreieve. See 'oro.h' for a + description of each option. + get_option (IN) - options for loading the types. It can be one of two + values: + OCI_TYPEGET_HEADER for only the header to be loaded, or + OCI_TYPEGET_ALL for the TDO and all ADO and MDOs to be + loaded. + tdo (OUT) - output array for the pointers to each pinned type in the + object cache. It must have space for array_len pointers. + Use OCIObjectGetObjectRef() to obtain the CREF to each + pinned type descriptor. + DESCRIPTION: + Get pointers to the + with the schema/type name array. This is similar to OCITypeByName() + except that all the TDO's are retreived via a single network roundtrip. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is null. + OCI_ERROR if + 1) any of the required parameters is null. + 2) one or more adt types associated with a schema/type name entry + does not exist. +*/ + + +/*--------------------------------------------------------------------------*/ +/* TYPE ACCESSORS */ +/*--------------------------------------------------------------------------*/ + +/*---------------------------- OCITypeName ---------------------------------*/ + +/* ** OBSOLETE ** */ +oratext* OCITypeName( OCIEnv *env, OCIError *err, const OCIType *tdo, + ub4 *n_length ); +/* + NAME: OCITypeName - ORT Get a Type's naME. + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + tdo (IN) - pointer to to the type descriptor in the object cache + n_length (OUT) - length (in bytes) of the returned type name. The + caller must allocate space for the ub4 before calling this + routine. + REQUIRES: + 1) All type accessors require that the type be pinned before calling + any accessor. + 2) All input parameters must not be NULL and must be valid. + 3) 'n_length' must point to an allocated ub4. + DESCRIPTION: + Get the name of the type. + RETURNS: + the name of the type + NOTES: + The type descriptor, 'tdo', must be unpinned when the accessed + information is no longer needed. + */ + +/*------------------------ OCITypeSchema ---------------------------------*/ + +/* ** OBSOLETE ** */ +oratext* OCITypeSchema( OCIEnv *env, OCIError *err, const OCIType *tdo, + ub4 *n_length ); +/* + NAME: OCITypeSchema - ORT Get a Type's SCHema name. + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + tdo (IN) - pointer to to the type descriptor in the object cache + n_length (OUT) - length (in bytes) of the returned schema name. The + caller must allocate space for the ub4 before calling this + routine. + REQUIRES: + 1) All type accessors require that the type be pinned before calling + any accessor. + 2) All input parameters must not be NULL and must be valid. + 3) 'n_length' must point to an allocated ub4. + DESCRIPTION: + Get the schema name of the type. + RETURNS: + the schema name of the type + NOTES: + The type descriptor, 'tdo', must be unpinned when the accessed + information is no longer needed. + */ + +/*------------------------ OCITypeTypeCode ---------------------------------*/ + +/* ** OBSOLETE ** */ +OCITypeCode OCITypeTypeCode( OCIEnv *env, OCIError *err, + const OCIType *tdo ); +/* + NAME: OCITypeTypeCode - OCI Get a Type's Type Code. + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + tdo (IN) - pointer to to the type descriptor in the object cache + REQUIRES: + 1) All type accessors require that the type be pinned before calling + any accessor. + 2) All input parameters must not be NULL and must be valid. + DESCRIPTION: + Get the type code of the type. + RETURNS: + The type code of the type. + NOTES: + The type descriptor, 'tdo', must be unpinned when the accessed + information is no longer needed. + */ + +/*----------------------- OCITypeCollTypeCode -------------------------------*/ + +/* ** OBSOLETE ** */ +OCITypeCode OCITypeCollTypeCode( OCIEnv *env, OCIError *err, + const OCIType *tdo ); +/* + NAME: OCITypeCollTypeCode - OCI Get a Domain Type's Type Code. + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + tdo (IN) - pointer to to the type descriptor in the object cache + REQUIRES: + 1) All type accessors require that the type be pinned before calling + any accessor. + 2) All input parameters must not be NULL and must be valid. + 3) 'tdo' MUST point to a named collection type. + DESCRIPTION: + Get the type code of the named collection type. For V8.0, named + collection types can only be variable length arrays and nested tables. + RETURNS: + OCI_TYPECODE_VARRAY for variable length array, and + OCI_TYPECODE_TABLE for nested tables. + NOTES: + The type descriptor, 'tdo', should be unpinned when the accessed + information is no longer needed. + */ + +/*------------------------- OCITypeVersion ---------------------------------*/ + +/* ** OBSOLETE ** */ +oratext* OCITypeVersion( OCIEnv *env, OCIError *err, const OCIType *tdo, + ub4 *v_length ); +/* + NAME: OCITypeVersion - OCI Get a Type's user-readable VersioN. + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + tdo (IN) - pointer to to the type descriptor in the object cache + v_length (OUT) - length (in bytes) of the returned user-readable + version. The caller must allocate space for the ub4 before + calling this routine. + REQUIRES: + 1) All type accessors require that the type be pinned before calling + any accessor. + 2) All input parameters must not be NULL and must be valid. + 3) 'v_length' must point to an allocated ub4. + DESCRIPTION: + Get the user-readable version of the type. + RETURNS: + The user-readable version of the type + NOTES: + The type descriptor, 'tdo', must be unpinned when the accessed + information is no longer needed. + */ + +/*--------------------------- OCITypeAttrs ---------------------------------*/ + +/* ** OBSOLETE ** */ +ub4 OCITypeAttrs( OCIEnv *env, OCIError *err, const OCIType *tdo ); +/* + NAME: OCITypeAttrs - OCI Get a Type's Number of Attributes. + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + tdo (IN) - pointer to to the type descriptor in the object cache + REQUIRES: + 1) All type accessors require that the type be pinned before calling + any accessor. + 2) All input parameters must not be NULL and must be valid. + DESCRIPTION: + Get the number of attributes in the type. + RETURNS: + The number of attributes in the type. 0 for ALL non-ADTs. + NOTES: + The type descriptor, 'tdo', must be unpinned when the accessed + information is no longer needed. + */ + +/*------------------------- OCITypeMethods ---------------------------------*/ + +/* ** OBSOLETE ** */ +ub4 OCITypeMethods( OCIEnv *env, OCIError *err, const OCIType *tdo ); +/* + NAME: OCITypeMethods - OCI Get a Type's Number of Methods. + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + tdo (IN) - pointer to to the type descriptor in the object cache + REQUIRES: + 1) All type accessors require that the type be pinned before calling + any accessor. + 2) All input parameters must not be NULL and must be valid. + DESCRIPTION: + Get the number of methods in a type. + RETURNS: + The number of methods in the type + NOTES: + The type descriptor, 'tdo', must be unpinned when the accessed + information is no longer needed. + */ + + +/*--------------------------------------------------------------------------*/ +/* TYPE ELEMENT INFORMATION ACCESSORS */ +/*--------------------------------------------------------------------------*/ + +/*------------------------ OCITypeElemName ---------------------------------*/ + +/* ** OBSOLETE ** */ +oratext* OCITypeElemName( OCIEnv *env, OCIError *err, + const OCITypeElem *elem, ub4 *n_length ); +/* + NAME: OCITypeElemName - OCI Get an Attribute's NaMe. + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + elem (IN) - pointer to the type element descriptor in the object cache + n_length (OUT) - length (in bytes) of the returned attribute name. + The caller must allocate space for the ub4 before calling this + routine. + REQUIRES: + 1) All type accessors require that the type be pinned before calling + any accessor. + 2) All input parameters must not be NULL and must be valid. + 3) 'n_length' must point to an allocated ub4. + DESCRIPTION: + Get the name of the attribute. + RETURNS: + the name of the attribute and the length in n_length + NOTES: + The type must be unpinned when the accessed information is no + longer needed. + */ + +/*------------------------ OCITypeElemTypeCode ------------------------------*/ + +/* ** OBSOLETE ** */ +OCITypeCode OCITypeElemTypeCode( OCIEnv *env, OCIError *err, + const OCITypeElem *elem ); +/* + NAME: OCITypeElemTypeCode - OCI Get an Attribute's TypeCode. + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + elem (IN) - pointer to the type element descriptor in the object cache + REQUIRES: + 1) All type accessors require that the type be pinned before calling + any accessor. + 2) All input parameters must not be NULL and must be valid. + DESCRIPTION: + Get the typecode of an attribute's type. + RETURNS: + the typecode of the attribute's type. If this is a scalar type, the + typecode sufficiently describes the scalar type and no further calls + need to be made. Valid scalar types include: OCI_TYPECODE_SIGNED8, + OCI_TYPECODE_UNSIGNED8, OCI_TYPECODE_SIGNED16, OCI_TYPECODE_UNSIGNED16, + OCI_TYPECODE_SIGNED32, OCI_TYPECODE_UNSIGNED32, OCI_TYPECODE_REAL, + OCI_TYPECODE_DOUBLE, OCI_TYPECODE_DATE, + OCI_TYPECODE_MLSLABEL, OROTCOID, OCI_TYPECODE_OCTET, or OROTCLOB. + This function converts the CREF (stored in the attribute) into a + typecode. + NOTES: + The type must be unpinned when the accessed information is no + longer needed. + */ + +/*------------------------ OCITypeElemType ---------------------------------*/ + +/* ** OBSOLETE ** */ +sword OCITypeElemType( OCIEnv *env, OCIError *err, const OCITypeElem *elem, + OCIType **elem_tdo ); +/* + PARAMETERS + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + elem (IN) - pointer to the type element descriptor in the object cache + elem_tdo (OUT) - If the function completes successfully, 'elem_tdo' + points to the type descriptor (in the object cache) of the type of + the element. + + REQUIRES + 1) All type accessors require that the type be pinned before calling + any accessor. This can be done by calling 'OCITypeByName()'. + 2) if 'elem' is not null, it must point to a valid type element descriptor + in the object cache. + + DESCRIPTION + Get the type tdo of the type of this element. + RETURNS + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is null. + OCI_ERROR if + 1) any of the parameters is null. + + NOTES + The type must be unpinned when the accessed information is no + longer needed. This can be done by calling 'OCIObjectUnpin()'. + */ + +/*------------------------- OCITypeElemFlags -------------------------------*/ + +/* ** OBSOLETE ** */ +ub4 OCITypeElemFlags( OCIEnv *env, OCIError *err, + const OCITypeElem *elem ); +/* + NAME: OCITypeElemFlags - OCI Get a Elem's FLags + (inline, constant, virtual, constructor, + destructor). + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + elem (IN) - pointer to the type element descriptor in the object cache + REQUIRES: + 1) All type accessors require that the type be pinned before calling + any accessor. + 2) All input parameters must not be NULL and must be valid. + DESCRIPTION: + Get the flags of a type element (attribute, parameter). + RETURNS: + The flags of the type element. + NOTES: + The flag bits are not externally documented. Use only the macros + in the last section (ie. OCI_TYPEPARAM_IS_REQUIRED, and + OCI_TYPEELEM_IS_REF) to test for them only. The type must be unpinned + when the accessed information is no longer needed. + */ + +/*------------------------ OCITypeElemNumPrec ------------------------------*/ + +/* ** OBSOLETE ** */ +ub1 OCITypeElemNumPrec( OCIEnv *env, OCIError *err, + const OCITypeElem *elem ); +/* + NAME: OCITypeElemNumPrec - Get a Number's Precision. This includes float, + decimal, real, double, and oracle number. + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + elem (IN) - pointer to the type element descriptor in the object cache + REQUIRES: + All input parameters must not be NULL and must be valid. + DESCRIPTION: + Get the precision of a float, decimal, long, unsigned long, real, + double, or Oracle number type. + RETURNS: + the precision of the float, decimal, long, unsigned long, real, double, + or Oracle number + */ + +/*------------------------- OCITypeElemNumScale -----------------------------*/ + +/* ** OBSOLETE ** */ +sb1 OCITypeElemNumScale( OCIEnv *env, OCIError *err, + const OCITypeElem *elem ); +/* + NAME: OCITypeElemNumScale - Get a decimal or oracle Number's Scale + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + elem (IN) - pointer to the type element descriptor in the object cache + REQUIRES: + All input parameters must not be NULL and must be valid. + DESCRIPTION: + Get the scale of a decimal, or Oracle number type. + RETURNS: + the scale of the decimal, or Oracle number + */ + +/*------------------------ OCITypeElemLength -------------------------------*/ + +/* ** OBSOLETE ** */ +ub4 OCITypeElemLength( OCIEnv *env, OCIError *err, + const OCITypeElem *elem ); +/* + NAME: OCITypeElemLength - Get a raw, fixed or variable length String's + length in bytes. + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + elem (IN) - pointer to the type element descriptor in the object cache + REQUIRES: + All input parameters must not be NULL and must be valid. + DESCRIPTION: + Get the length of a raw, fixed or variable length string type. + RETURNS: + length of the raw, fixed or variable length string + */ + +/*----------------------- OCITypeElemCharSetID -----------------------------*/ + +/* ** OBSOLETE ** */ +ub2 OCITypeElemCharSetID( OCIEnv *env, OCIError *err, + const OCITypeElem *elem ); +/* + NAME: OCITypeElemCharSetID - Get a fixed or variable length String's + character set ID + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + elem (IN) - pointer to the type element descriptor in the object cache + REQUIRES: + All input parameters must not be NULL and must be valid. + DESCRIPTION: + Get the character set ID of a fixed or variable length string type. + RETURNS: + character set ID of the fixed or variable length string + */ + +/*---------------------- OCITypeElemCharSetForm ----------------------------*/ + +/* ** OBSOLETE ** */ +ub2 OCITypeElemCharSetForm( OCIEnv *env, OCIError *err, + const OCITypeElem *elem ); +/* + NAME: OCITypeElemCharSetForm - Get a fixed or variable length String's + character set specification form. + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + elem (IN) - pointer to the attribute information in the object cache + REQUIRES: + All input parameters must not be NULL and must be valid. + DESCRIPTION: + Get the character form of a fixed or variable length string type. + The character form is an enumerated value that can be one of the + 4 values below: + SQLCS_IMPLICIT for CHAR, VARCHAR2, CLOB w/o a specified set + SQLCS_NCHAR for NCHAR, NCHAR VARYING, NCLOB + SQLCS_EXPLICIT for CHAR, etc, with "CHARACTER SET ..." syntax + SQLCS_FLEXIBLE for PL/SQL "flexible" parameters + RETURNS: + character form of the fixed or variable string + */ + +/*--------------------- OCITypeElemParameterizedType ------------------------*/ + +/* ** OBSOLETE ** */ +sword OCITypeElemParameterizedType( OCIEnv *env, OCIError *err, + const OCITypeElem *elem, + OCIType **type_stored ); +/* + NAME: OCITypeElemParameterizedType + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + elem (IN) - pointer to the type element descriptor in the object cache + type_stored (OUT) - If the function completes successfully, + and the parameterized type is complex, 'type_stored' is NULL. + Otherwise, 'type_stored' points to the type descriptor (in the + object cache) of the type that is stored in the parameterized + type. The caller must allocate space for the OCIType* + before calling this routine and must not write into the space. + REQUIRES: + All input parameters must be valid. + DESCRIPTION: + Get a descriptor to the parameter type of a parameterized type. + Parameterized types are types of the form: + REF T + VARRAY (n) OF T + etc, where T is the parameter in the parameterized type. + Additionally is_ref is set if the parameter is a PTR or REF. + For example, it is set for REF T or VARRAY(n) OF REF T. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is null. + OCI_ERROR if + 1) any of the parameters is null. + 2) 'type_stored' is not NULL but points to NULL data. + NOTES: + Complex parameterized types will be in a future release (once + typedefs are supported. When setting the parameterized type + information, the user must typedef the contents if it's a + complex parameterized type. Ex. for varray>, use + 'typedef varray varcar' and then use varray. + */ + +/*----------------------- OCITypeElemExtTypeCode ----------------------------*/ + +/* ** OBSOLETE ** */ +OCITypeCode OCITypeElemExtTypeCode( OCIEnv *env, OCIError *err, + const OCITypeElem *elem ); +/* + NAME: OCITypeElemExtTypeCode - OCI Get an element's SQLT constant. + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + elem (IN) - pointer to the type element descriptor in the object cache + REQUIRES: + 1) All type accessors require that the type be pinned before calling + any accessor. + 2) All input parameters must not be NULL and must be valid. + DESCRIPTION: + Get the internal Oracle typecode associated with an attribute's type. + This is the actual typecode for the attribute when it gets mapped + to a column in the Oracle database. + RETURNS: + The Oracle typecode associated with the attribute's type. + NOTES: + The type must be unpinned when the accessed information is no + longer needed. + */ + +/*--------------------------------------------------------------------------*/ +/* ATTRIBUTE ACCESSORS */ +/*--------------------------------------------------------------------------*/ + +/*------------------------ OCITypeAttrByName -------------------------------*/ + +/* ** OBSOLETE ** */ +sword OCITypeAttrByName( OCIEnv *env, OCIError *err, const OCIType *tdo, + const oratext *name, ub4 n_length, + OCITypeElem **elem ); +/* + NAME: OCITypeAttrByName - OCI Get an Attribute By Name. + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + tdo (IN) - pointer to to the type descriptor in the object cache + name (IN) - the attribute's name + n_length (IN) - length (in bytes) of the 'name' parameter + elem (OUT) - If this function completes successfully, 'elem' points to + the selected type element descriptor pertaining to the + attributein the object cache. + REQUIRES: + 1) All type accessors require that the type be pinned before calling + any accessor. + 2) if 'tdo' is not null, it must point to a valid type descriptor + in the object cache. + DESCRIPTION: + Get an attribute given its name. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is null. + OCI_ERROR if + 1) any of the required parameters is null. + 2) the type does not contain an attribute with the input 'name'. + 3) 'name' is NULL. + NOTES: + The type descriptor, 'tdo', must be unpinned when the accessed + information is no longer needed. + Schema and type names are CASE-SENSITIVE. If they have been created + via SQL, you need to use uppercase names. + */ + +/*------------------------ OCITypeAttrNext ---------------------------------*/ + +/* ** OBSOLETE ** */ +sword OCITypeAttrNext( OCIEnv *env, OCIError *err, + OCITypeIter *iterator_ort, OCITypeElem **elem ); + +/* + NAME: OCITypeAttrNext - OCI Get an Attribute By Iteration. + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + iterator_ort (IN/OUT) - iterator for retrieving the next attribute; + see OCITypeIterNew() to initialize iterator. + elem (OUT) - If this function completes successfully, 'elem' points to + the selected type element descriptor pertaining to the + attributein the object cache. + REQUIRES: + 1) All type accessors require that the type be pinned before calling + any accessor. + 2) if 'tdo' is not null, it must point to a valid type descriptor + in the object cache. + DESCRIPTION: + Iterate to the next attribute to retrieve. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_NO_DATA if there are no more attributes to iterate on; use + OCITypeIterSet() to reset the iterator if necessary. + OCI_INVALID_HANDLE if 'env' or 'err' is null. + OCI_ERROR if + 1) any of the required parameters is null. + NOTES: + The type must be unpinned when the accessed information is no + longer needed. + */ + +/*--------------------------------------------------------------------------*/ +/* COLLECTION ACCESSORS */ +/*--------------------------------------------------------------------------*/ + +/*------------------------ OCITypeCollElem ---------------------------------*/ + +/* ** OBSOLETE ** */ +sword OCITypeCollElem( OCIEnv *env, OCIError *err, const OCIType *tdo, + OCITypeElem **element ); +/* + NAME: OCITypeCollElem + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + tdo (IN) - pointer to the type descriptor in the object cache + element (IN/OUT) - If the function completes successfully, this + points to the descriptor for the collection's element. + It is stored in the same format as an ADT attribute's + descriptor. + If *element is NULL, OCITypeCollElem() implicitly allocates a + new instance of OCITypeElem in the object cache. This instance + will be + automatically freed at the end of the session, and does not have + to be freed explicitly. + If *element is not NULL, OCITypeCollElem() assumes that it + points to a valid OCITypeElem descriptor and will copy the + results into it. + REQUIRES: + All input parameters must be valid. + DESCRIPTION: + Get a pointer to the descriptor (OCITypeElem) of the element of an + array or the rowtype of a nested table. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is null. + OCI_ERROR if + 1) any of the parameters is null. + 2) the type TDO does not point to a valid collection's type. + NOTES: + Complex parameterized types will be in a future release (once + typedefs are supported. When setting the parameterized type + information, the user must typedef the contents if it's a + complex parameterized type. Ex. for varray>, use + 'typedef varray varcar' and then use varray. + */ + +/*------------------------ OCITypeCollSize ---------------------------------*/ + +/* ** OBSOLETE ** */ +sword OCITypeCollSize( OCIEnv *env, OCIError *err, const OCIType *tdo, + ub4 *num_elems ); +/* + NAME: OCITypeCollSize - OCI Get a Collection's Number of Elements. + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + tdo (IN) - pointer to the type descriptor in the object cache + num_elems (OUT) - number of elements in collection + REQUIRES: + All input parameters must be valid. tdo points to an array type + defined as a domain. + DESCRIPTION: + Get the number of elements stored in a fixed array or the maximum + number of elements in a variable array. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is null. + OCI_ERROR if + 1) any of the parameters is null. + 2) 'tdo' does not point to a domain with a collection type. + NOTES: + Complex parameterized types will be in a future release (once + typedefs are supported. When setting the parameterized type + information, the user must typedef the contents if it's a + complex parameterized type. Ex. for varray>, use + 'typedef varray varcar' and then use varray. + */ + +/*------------------------ OCITypeCollExtTypeCode ---------------------------*/ + +/* ** OBSOLETE ** */ +sword OCITypeCollExtTypeCode( OCIEnv *env, OCIError *err, + const OCIType *tdo, OCITypeCode *sqt_code ); +/* + NAME: ortcsqt - OCI Get a Collection element's DTY constant. + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + tdo (IN) - pointer to the type descriptor in the object cache + sqt_code (OUT) - SQLT code of type element. + REQUIRES: + 1) All type accessors require that the type be pinned before calling + any accessor. + 2) All input parameters must not be NULL and must be valid. + DESCRIPTION: + Get the SQLT constant associated with an domain's element type. + The SQLT codes are defined in and are needed for OCI/OOCI + use. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is null. + OCI_ERROR if + 1) any of the parameters is null. + 2) 'tdo' does not point to a domain with a collection type. + NOTES: + The type must be unpinned when the accessed information is no + longer needed. + */ + + +/*--------------------------------------------------------------------------*/ +/* METHOD ACCESSORS */ +/*--------------------------------------------------------------------------*/ + +/*------------------------- OCITypeMethodOverload --------------------------*/ + +/* ** OBSOLETE ** */ +ub4 OCITypeMethodOverload( OCIEnv *env, OCIError *err, const OCIType *tdo, + const oratext *method_name, ub4 m_length ); +/* + NAME: OCITypeMethodOverload - OCI Get type's Number of Overloaded names + for the given method name. + PARAMETERS: + gp (IN/OUT) - pga environment handle. Any errors are recorded here. + tdo (IN) - pointer to to the type descriptor in the object cache + method_name (IN) - the method's name + m_length (IN) - length (in bytes) of the 'method_name' parameter + REQUIRES: + 1) All type accessors require that the type be pinned before calling + any accessor. + 2) if 'tdo' is not null, it must point to a valid type descriptor + in the object cache. + DESCRIPTION: + Overloading of methods implies that more than one method may have the + same method name. This routine returns the number of methods that + have the given method name. If there are no methods with the input + method name, 'num_methods' is 0. The caller uses this information when + allocating space for the array of mdo and/or position pointers before + calling 'OCITypeMethodByName()' or 'ortgmps()'. + RETURNS: + The number of methods with the given name. 0 if none contains the + name. + NOTES: + Schema and type names are CASE-SENSITIVE. If they have been created + via SQL, you need to use uppercase names. + */ + +/*------------------------ OCITypeMethodByName ------------------------------*/ + +/* ** OBSOLETE ** */ +sword OCITypeMethodByName( OCIEnv *env, OCIError *err, const OCIType *tdo, + const oratext *method_name, ub4 m_length, + OCITypeMethod **mdos ); +/* + NAME: OCITypeMethodByName - OCI Get one or more Methods with Name. + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + tdo (IN) - pointer to to the type descriptor in the object cache + method_name (IN) - the methods' name + m_length (IN) - length (in bytes) of the 'name' parameter + mdos (OUT) - If this function completes successfully, 'mdos' points to + the selected methods in the object cache. The caller must + allocate space for the array of OCITypeMethod pointers before + calling this routine and must not write into the space. + The number of OCITypeMethod pointers that will be returned can + be obtained by calling 'OCITypeMethodOverload()'. + REQUIRES: + 1) All type accessors require that the type be pinned before calling + any accessor. + 2) if 'tdo' is not null, it must point to a valid type descriptor + in the object cache. + DESCRIPTION: + Get one or more methods given the name. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is null. + OCI_ERROR if + 1) any of the required parameters is null. + 2) No methods in type has name 'name'. + 3) 'mdos' is not NULL but points to NULL data. + NOTES: + The type must be unpinned when the accessed information is no + longer needed. + Schema and type names are CASE-SENSITIVE. If they have been created + via SQL, you need to use uppercase names. + */ + +/*------------------------ OCITypeMethodNext --------------------------------*/ + +/* ** OBSOLETE ** */ +sword OCITypeMethodNext( OCIEnv *env, OCIError *err, + OCITypeIter *iterator_ort, + OCITypeMethod **mdo ); + +/* + NAME: OCITypeMethodNext - OCI Get a Method By Iteration. + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + iterator_ort (IN/OUT) - iterator for retrieving the next method; + see OCITypeIterNew() to set iterator. + mdo (OUT) - If this function completes successfully, 'mdo' points to + the selected method descriptor in the object cache. Positions + start at 1. The caller must allocate space for the + OCITypeMethod* before calling this routine and must not write + nto the space. + REQUIRES: + 1) All type accessors require that the type be pinned before calling + any accessor. + 2) if 'tdo' is not null, it must point to a valid type descriptor + in the object cache. + DESCRIPTION: + Iterate to the next method to retrieve. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_NO_DATA if there are no more attributes to iterate on; use + OCITypeIterSet() to reset the iterator if necessary. + OCI_INVALID_HANDLE if 'env' or 'err' is null. + OCI_ERROR if + 1) any of the required parameters is null. + 2) 'mdo' is not NULL but points to NULL data. + NOTES: + The type must be unpinned when the accessed information is no + longer needed. + */ + +/*------------------------ OCITypeMethodName --------------------------------*/ + +/* ** OBSOLETE ** */ +oratext *OCITypeMethodName( OCIEnv *env, OCIError *err, + const OCITypeMethod *mdo, ub4 *n_length ); +/* + NAME: OCITypeMethodName - OCI Get a Method's NaMe. + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + mdo (IN) - pointer to the method descriptor in the object cache + n_length (OUT) - length (in bytes) of the 'name' parameter. The caller + must allocate space for the ub4 before calling this routine. + REQUIRES: + 1) All type accessors require that the type be pinned before calling + any accessor. + 2) All input parameters must not be NULL and must be valid. + DESCRIPTION: + Get the (non-unique) real name of the method. + RETURNS: + the non-unique name of the method or NULL if there is an error. + NOTES: + The type must be unpinned when the accessed information is no + longer needed. + */ + +/*------------------------ OCITypeMethodEncap -------------------------------*/ + +/* ** OBSOLETE ** */ +OCITypeEncap OCITypeMethodEncap( OCIEnv *env, OCIError *err, + const OCITypeMethod *mdo ); +/* + NAME: OCITypeMethodEncap - Get a Method's ENcapsulation (private/public). + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + mdo (IN) - pointer to the method descriptor in the object cache + REQUIRES: + 1) All type accessors require that the type be pinned before calling + any accessor. + 2) All input parameters must not be NULL and must be valid. + DESCRIPTION: + Get the encapsulation (private, or public) of a method. + RETURNS: + the encapsulation (private, or public) of the method + NOTES: + The type must be unpinned when the accessed information is no + longer needed. + */ + +/*------------------------ OCITypeMethodFlags -------------------------------*/ + +/* ** OBSOLETE ** */ +OCITypeMethodFlag OCITypeMethodFlags( OCIEnv *env, OCIError *err, + const OCITypeMethod *mdo ); +/* + NAME: OCITypeMethodFlags - OCI Get a Method's FLags + (inline, constant, virtual, constructor, + destructor). + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + mdo (IN) - pointer to the method descriptor in the object cache + REQUIRES: + 1) All type accessors require that the type be pinned before calling + any accessor. + 2) All input parameters must not be NULL and must be valid. + DESCRIPTION: + Get the flags (inline, constant, virutal, constructor, destructor) of + a method. + RETURNS: + the flags (inline, constant, virutal, constructor, destructor) of + the method + NOTES: + The type must be unpinned when the accessed information is no + longer needed. + */ + +/*------------------------ OCITypeMethodMap ---------------------------------*/ + +/* ** OBSOLETE ** */ +sword OCITypeMethodMap( OCIEnv *env, OCIError *err, const OCIType *tdo, + OCITypeMethod **mdo ); +/* + NAME: OCITypeMethodMap - OCI Get the Method's MAP function. + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + tdo (IN) - pointer to to the type descriptor in the object cache + mdo (OUT) - If this function completes successfully, and there is a + map function for this type, 'mdo' points to the selected method + descriptor in the object cache. Otherwise, 'mdo' is null. + REQUIRES: + 1) All type accessors require that the type be pinned before calling + any accessor. + 2) All required input parameters must not be NULL and must be valid. + DESCRIPTION: + A type may have only one map function. 'OCITypeMethodMap()' finds + this function, if it exists, and returns a reference and a pointer to + the method descriptor in the object cache. If the type does not have a + map (relative ordering) function, then 'mdo_ref' and 'mdo' are set + to null and an error is returned. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is null. + OCI_ERROR if + the type does not contain a map function. + NOTES: + The type must be unpinned when the accessed information is no + longer needed. + */ + +/*------------------------ OCITypeMethodOrder -------------------------------*/ + +/* ** OBSOLETE ** */ +sword OCITypeMethodOrder( OCIEnv *env, OCIError *err, const OCIType *tdo, + OCITypeMethod **mdo ); +/* + NAME: OCITypeMethodOrder - OCI Get the Method's ORder function. + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + tdo (IN) - pointer to to the type descriptor in the object cache + mdo (OUT) - If this function completes successfully, and there is a + map function for this type, 'mdo' points to the selected method + descriptor in the object cache. Otherwise, 'mdo' is null. + REQUIRES: + 1) All type accessors require that the type be pinned before calling + any accessor. + 2) All required input parameters must not be NULL and must be valid. + DESCRIPTION: + A type may have only one ORder or MAP function. 'OCITypeMethodOrder()' + finds this function, if it exists, and returns a ref and a pointer + to the method descriptor in the object cache. If the type does not + have a map (relative ordering) function, then 'mdo_ref' and 'mdo' are + set to null and an error is returned. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is null. + OCI_ERROR if + the type does not contain a map function. + NOTES: + The type must be unpinned when the accessed information is no + longer needed. + */ + +/*------------------------ OCITypeMethodParams ------------------------------*/ + +/* ** OBSOLETE ** */ +ub4 OCITypeMethodParams( OCIEnv *env, OCIError *err, + const OCITypeMethod *mdo ); +/* + NAME: OCITypeMethodParams - OCI Get a Method's Number of Parameters. + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + mdo (IN) - pointer to the method descriptor in the object cache + REQUIRES: + 1) All type accessors require that the type be pinned before calling + any accessor. + 2) All input parameters must not be NULL and must be valid. + DESCRIPTION: + Get the number of parameters in a method. + RETURNS: + the number of parameters in the method + NOTES: + The type must be unpinned when the accessed information is no + longer needed. + */ + + +/*--------------------------------------------------------------------------*/ +/* RESULT ACCESSORS */ +/*--------------------------------------------------------------------------*/ + +/*-------------------------- OCITypeResult ---------------------------------*/ + +/* ** OBSOLETE ** */ +sword OCITypeResult( OCIEnv *env, OCIError *err, const OCITypeMethod *mdo, + OCITypeElem **elem ); +/* + NAME: OCITypeResult - OCI Get a method's result type descriptor. + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + mdo (IN) - pointer to the method descriptor in the object cache + elem (OUT) - If this function completes successfully, 'rdo' points to + the selected result (parameter) descriptor in the object cache. + REQUIRES: + 1) All type accessors require that the type be pinned before calling + any accessor. + 2) 'elem' MUST be the address of an OCITypeElem pointer. + DESCRIPTION: + Get the result of a method. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is null. + OCI_ERROR if + 1) any of the required parameters is null. + 2) method returns no results. + NOTES: + The method must be unpinned when the accessed information is no + longer needed. + */ + + +/*--------------------------------------------------------------------------*/ +/* PARAMETER ACCESSORS */ +/*--------------------------------------------------------------------------*/ + +/*------------------------ OCITypeParamByPos -------------------------------*/ + +/* ** OBSOLETE ** */ +sword OCITypeParamByPos( OCIEnv *env, OCIError *err, + const OCITypeMethod *mdo, ub4 position, + OCITypeElem **elem ); +/* + NAME: OCITypeParamByPos - OCI Get a Parameter in a method By Position. + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + mdo (IN) - pointer to the method descriptor in the object cache + position (IN) - the parameter's position. Positions start at 1. + elem (OUT) - If this function completes successfully, 'elem' points to + the selected parameter descriptor in the object cache. + REQUIRES: + 1) All type accessors require that the type be pinned before calling + any accessor. + DESCRIPTION: + Get a parameter given its position in the method. Positions start + at 1. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is null. + OCI_ERROR if + 1) any of the required parameters is null. + 2) 'position' is not >= 1 and <= the number of parameters in the + method. + NOTES: + The type must be unpinned when the accessed information is no + longer needed. + */ + +/*------------------------ OCITypeParamByName -------------------------------*/ + +/* ** OBSOLETE ** */ +sword OCITypeParamByName( OCIEnv *env, OCIError *err, + const OCITypeMethod *mdo, + const oratext *name, ub4 n_length, + OCITypeElem **elem ); +/* + NAME: OCITypeParamByName - OCI Get a Parameter in a method By Name. + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + mdo (IN) - pointer to the method descriptor in the object cache + name (IN) - the parameter's name + n_length (IN) - length (in bytes) of the 'name' parameter + elem (OUT) - If this function completes successfully, 'elem' points to + the selected parameter descriptor in the object cache. + REQUIRES: + 1) All type accessors require that the type be pinned before calling + any accessor. + 2) if 'mdo' is not null, it must point to a valid method descriptor + in the object cache. + DESCRIPTION: + Get a parameter given its name. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is null. + OCI_ERROR if + 1) any of the required parameters is null. + 2) the method does not contain a parameter with the input 'name'. + NOTES: + The type must be unpinned when the accessed information is no + longer needed. + */ + +/*------------------------ OCITypeParamPos ---------------------------------*/ + +/* ** OBSOLETE ** */ +sword OCITypeParamPos( OCIEnv *env, OCIError *err, + const OCITypeMethod *mdo, + const oratext *name, ub4 n_length, ub4 *position, + OCITypeElem **elem ); +/* + NAME: OCITypeParamPos - OCI Get a parameter's position in a method + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + mdo (IN) - pointer to the method descriptor in the object cache + name (IN) - the parameter's name + n_length (IN) - length (in bytes) of the 'name' parameter + position (OUT) - If this function completes successfully, 'position' + points to the position of the parameter in the method starting + at position 1. position MUST point to space for a ub4. + elem (OUT) - If this function completes successfully, and + the input 'elem' is not NULL, 'elem' points to the selected + parameter descriptor in the object cache. + REQUIRES: + 1) All type accessors require that the type be pinned before calling + any accessor. + 2) if 'mdo' is not null, it must point to a valid method descriptor + in the object cache. + DESCRIPTION: + Get the position of a parameter in a method. Positions start at 1. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is null. + OCI_ERROR if + 1) any of the parameters is null. + 2) the method does not contain a parameter with the input 'name'. + NOTES: + The type must be unpinned when the accessed information is no + longer needed. + */ + +/*------------------------ OCITypeParamElemMode -----------------------------*/ + +/* ** OBSOLETE ** */ +OCITypeParamMode OCITypeElemParamMode( OCIEnv *env, OCIError *err, + const OCITypeElem *elem ); +/* + NAME: OCITypeElemParamMode - OCI Get a parameter's mode + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + elem (IN) - pointer to the parameter descriptor in the object cache + (represented by an OCITypeElem) + REQUIRES: + 1) All type accessors require that the type be pinned before calling + any accessor. + 2) All input parameters must not be NULL and must be valid. + DESCRIPTION: + Get the mode (in, out, or in/out) of the parameter. + RETURNS: + the mode (in, out, or in/out) of the parameter + NOTES: + The type must be unpinned when the accessed information is no + longer needed. + */ + +/*------------------------- OCITypeElemDefaultValue -------------------------*/ + +/* ** OBSOLETE ** */ +oratext* OCITypeElemDefaultValue( OCIEnv *env, OCIError *err, + const OCITypeElem *elem, + ub4 *d_v_length ); +/* + NAME: OCITypeElemDefaultValue - OCI Get the element's Default Value. + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + elem (IN) - pointer to the parameter descriptor in the object cache + (represented by an OCITypeElem) + d_v_length (OUT) - length (in bytes) of the returned default value. + The caller must allocate space for the ub4 before calling this + routine. + REQUIRES: + 1) All type accessors require that the type be pinned before calling + any accessor. + 2) All input parameters must not be NULL and must be valid. + DESCRIPTION: + Get the default value in text form (PL/SQL) of an element. For V8.0, + this only makes sense for a method parameter. + RETURNS: + The default value (text) of the parameter. + NOTES: + The type must be unpinned when the accessed information is no + longer needed. + */ + + +/*--------------------------------------------------------------------------*/ +/* TYPE VERSION TABLE */ +/*--------------------------------------------------------------------------*/ + +/* For V8.0, the type version table is meant to be an internal data structure + only for Oracle clients for type version maintanence purposes. A more + general version of the API may be made public in subsequent releases. */ + + +/*--------------------------- OCITypeVTInit --------------------------------*/ + +/* ** OBSOLETE ** */ +sword OCITypeVTInit( OCIEnv *env, OCIError *err ); +/* + NAME: OCITypeVTInit - OCI type Version table INItialize + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + REQUIRES: + none + DESCRIPTION: + Allocate space for and initialize the type version table and the type + version table's index. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is null. + OCI_ERROR if internal errors occurrs during initialization. + */ + +/*--------------------------- OCITypeVTInsert -------------------------------*/ + +/* ** OBSOLETE ** */ +sword OCITypeVTInsert( OCIEnv *env, OCIError *err, + const oratext *schema_name, ub4 s_n_length, + const oratext *type_name, ub4 t_n_length, + const oratext *user_version, ub4 u_v_length ); +/* + NAME: OCITypeVTInsert - OCI type Version table INSert entry. + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + schema_name (IN, optional) - name of schema associated with the + type. By default, the user's schema name is used. + s_n_length (IN) - length of the 'schema_name' parameter + type_name (IN) - type name to insert + t_n_length (IN) - length (in bytes) of the 'type_name' parameter + user_version (IN) - user readable version of the type + u_v_length (IN) - length (in bytes) of the 'user_version' parameter + REQUIRES: + none + DESCRIPTION: + Insert an entry into the type version table and the type version + table's index. The entry's type name and user readable version + fields are updated with the input values. All other fields are + initialized to null. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is null. + OCI_ERROR if + 1) any of the parameters is invalid. + 2) an entry for 'type_name' has already been registered in the + type version table. + */ + +/*------------------------------ OCITypeVTSelect ----------------------------*/ + +/* OCITypeVTSelect - OCI type VERSion table SELECT entry */ +/* ** OBSOLETE ** */ +sword OCITypeVTSelect( OCIEnv *env, OCIError *err, + const oratext *schema_name, ub4 s_n_length, + const oratext *type_name, ub4 t_n_length, + oratext **user_version, ub4 *u_v_length, + ub2 *version ); +/* + NAME: OCITypeVTSelect - OCI type Version table SELect entry. + PARAMETERS: + env (IN/OUT) - OCI environment handle initialized in object mode + err (IN/OUT) - error handle. If there is an error, it is + recorded in 'err' and this function returns OCI_ERROR. + The error recorded in 'err' can be retrieved by calling + OCIErrorGet(). + schema_name (IN, optional) - name of schema associated with the + type. By default, the user's schema name is used. + s_n_length (IN) - length of the 'schema_name' parameter + type_name (IN) - type name to select + t_n_length (IN) - length (in bytes) of the 'type_name' parameter + user_version (OUT, optional) - pointer to user readable version of the + type + u_v_length (OUT, optional) - length (in bytes) of the 'user_version' + parameter + version (OUT, optional) - internal type version + REQUIRES: + All input parameters must not be NULL and must be valid. + DESCRIPTION: + Select an entry in the type version table by name. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_INVALID_HANDLE if 'env' or 'err' is null. + OCI_ERROR if + 1) any of the parameters is invalid. + 2) an entry with 'type_name' does not exist. + */ + +/* Compatibility function - following function prototype retained for + compatibility only */ +sword ortgcty( OCIEnv *env, OCIError *err, OCIType *coll_tdo, + OCIType **collelem_tdo ); + +/*---------------------------------------------------------------------------*/ +/* Transient Type Construction functions */ +/*---------------------------------------------------------------------------*/ + +sword OCITypeBeginCreate(OCISvcCtx *svchp, OCIError *errhp, OCITypeCode tc, + OCIDuration dur, OCIType **type); +/* + NAME: OCITypeBeginCreate - OCI Type Begin Creation of a transient type. + REMARKS + Begins the construction process for a transient type. The type will be + anonymous (no name). To create a persistent named type, the CREATE TYPE + statement should be used from SQL. Transient types have no identity. + They are pure values. + PARAMETERS: + svchp (IN) - The OCI Service Context. + errhp (IN/OUT) - The OCI error handle. If there is an error, it is + recorded in errhp and this function returns + OCI_ERROR. Diagnostic information can be obtained by + calling OCIErrorGet(). + tc - The TypeCode for the type. The Typecode could + correspond to a User Defined Type or a Built-in type. + Currently, the permissible values for User Defined + Types are OCI_TYPECODE_OBJECT for an Object Type + (structured), OCI_TYPECODE_VARRAY for a VARRAY + collection type or OCI_TYPECODE_TABLE for a nested + table collection type. For Object types, + OCITypeAddAttr() needs to be called to add each of + the attribute types. For Collection types, + OCITypeSetCollection() needs to be called. + Subsequently, OCITypeEndCreate() needs to be called + to finish the creation process. + The permissible values for Built-in type codes are + specified in the user manual. Additional information + on built-ins if any (like precision, scale for + numbers, character set info for VARCHAR2s etc.) must + be set with a subsequent call to OCITypeSetBuiltin(). + Subsequently OCITypeEndCreate() needs to be called + to finish the creation process. + dur - The allocation duration for the Type. Could be a + predefined or a user defined duration. + type(OUT) - The OCIType (Type Descriptor) that is being + constructed. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_ERROR on error. +*/ + + +sword OCITypeSetCollection(OCISvcCtx *svchp, OCIError *errhp, OCIType *type, + OCIParam *collelem_info, ub4 coll_count); +/* + NAME: OCITypeSetCollection - OCI Type Set Collection information + REMARKS : + Set Collection type information. This call can be called only if the + OCIType has been constructed with a collection typecode. + PARAMETERS: + svchp (IN) - The OCI Service Context. + errhp (IN/OUT) - The OCI error handle. If there is an error, it is + recorded in errhp and this function returns + OCI_ERROR. Diagnostic information can be obtained by + calling OCIErrorGet(). + type(IN OUT) - The OCIType (Type Descriptor) that is being + constructed. + collelem_info - collelem_info provides information on the collection + element. It is obtained by allocating an OCIParam + (parameter handle) and setting type information in + the OCIParam using OCIAttrSet() calls. + coll_count - The count of elements in the collection. Pass 0 for + a nested table (unbounded). + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_ERROR on error. +*/ + +sword OCITypeSetBuiltin(OCISvcCtx *svchp, OCIError *errhp, OCIType *type, + OCIParam *builtin_info); +/* + NAME: OCITypeSetBuiltin - OCI Type Set Builtin information. + REMARKS: + Set Built-in type information. This call can be called only if the + OCIType has been constructed with a built-in typecode + (OCI_TYPECODE_NUMBER etc.). + PARAMETERS: + svchp (IN) - The OCI Service Context. + errhp (IN/OUT) - The OCI error handle. If there is an error, it is + recorded in errhp and this function returns + OCI_ERROR. Diagnostic information can be obtained by + calling OCIErrorGet(). + type(IN OUT) - The OCIType (Type Descriptor) that is being + constructed. + builtin_info - builtin_info provides information on the built-in + (like precision, scale, charater set etc.). It is + obtained by allocating an OCIParam (parameter handle) + and setting type information in the OCIParam using + OCIAttrSet() calls. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_ERROR on error. +*/ + +sword OCITypeAddAttr(OCISvcCtx *svchp, OCIError *errhp, OCIType *type, + const oratext *a_name, ub4 a_length, + OCIParam *attr_info); +/* + NAME: OCITypeAddAttr - OCI Type Add Attribute to an Object Type. + REMARKS: + Adds an attribute to an Object type (that was constructed earlier with + typecode OCI_TYPECODE_OBJECT). + PARAMETERS: + svchp (IN) - The OCI Service Context + errhp (IN/OUT) - The OCI error handle. If there is an error, it is + recorded in errhp and this function returns + OCI_ERROR. Diagnostic information can be obtained by + calling OCIErrorGet(). + type (IN/OUT) - The Type description that is being constructed. + a_name(IN) - Optional. gives the name of the attribute. + a_length - Optional. gives length of attribute name. + attr_info - Information on the attribute. It is obtained by + allocating an OCIParam (parameter handle) and setting + type information in the OCIParam using OCIAttrSet() + calls. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_ERROR on error. +*/ + +sword OCITypeEndCreate(OCISvcCtx *svchp, OCIError *errhp, OCIType *type); +/* + NAME: OCITypeEndCreate - OCI Type End Creation + REMARKS: + Finishes construction of a type description.Subsequently, only access + will be allowed. + PARAMETERS: + svchp (IN) - The OCI Service Context + errhp (IN/OUT) - The OCI error handle. If there is an error, it is + recorded in errhp and this function returns + OCI_ERROR. Diagnostic information can be obtained by + calling OCIErrorGet(). + type (IN/OUT) - The Type description that is being constructed. + RETURNS: + OCI_SUCCESS if the function completes successfully. + OCI_ERROR on error. +*/ + +/*=========================*/ +/* PUBLIC MACROS AND FLAGS */ +/*=========================*/ + +/*--------------------------------------------------------------------------*/ +/* TYPE ELEMENT FLAGS */ +/*--------------------------------------------------------------------------*/ + +#define OCI_TYPEELEM_REF 0x8000 /* element is a REF */ +#define OCI_TYPEPARAM_REQUIRED 0x0800 /* parameter is required */ + +/* macros to test flags */ +#define OCI_TYPEELEM_IS_REF(elem_flag) \ + (((elem_flag) & OCI_TYPEELEM_REF)!=0) +#define OCI_TYPEPARAM_IS_REQUIRED(param_flag) \ + (((param_flag) & OCI_TYPEPARAM_REQUIRED)!=0) + + +#endif /* ORT_ORACLE */ + diff --git a/sdk/include/sql2oci.h b/sdk/include/sql2oci.h new file mode 100755 index 0000000..eb97d32 --- /dev/null +++ b/sdk/include/sql2oci.h @@ -0,0 +1,204 @@ + +/* + * $Header: sql2oci.h 08-may-2002.12:13:40 apopat Exp $ + */ + +/* Copyright (c) 1996, 2002, Oracle Corporation. All rights reserved. */ + +/* NOTE: See 'header_template.doc' in the 'doc' dve under the 'forms' + directory for the header file template that includes instructions. +*/ + +/* + NAME + sql2oci.h - SQLLIB functions for V8 OCI interoperability + + DESCRIPTION + This file contains SQLLIB functions to obtain OCI environment handle + and OCI service context in a Pro*c program. + + RELATED DOCUMENTS + + INSPECTION STATUS + Inspection date: + Inspection status: + Estimated increasing cost defects per page: + Rule sets: + + ACCEPTANCE REVIEW STATUS + Review date: + Review status: + Reviewers: + + PUBLIC FUNCTION(S) + SQLEnvGet() + SQLSvcCtxGet() + + PRIVATE FUNCTION(S) + NONE + + EXAMPLES + + NOTES + + + MODIFIED (MM/DD/YY) + apopat 05/08/02 - [2362423] MVS PE to make lines shorter than 79 + apopat 07/31/99 - [707588] TAB to blanks for OCCS + apopat 04/06/99 - [563753] Allowing prototypes for C++ + lvbcheng 06/23/98 - Add SQLRowidGet + sylin 02/25/98 - [600216] Add C++ support + lvbcheng 05/13/97 - Desupport wrappers + lvbcheng 01/13/97 - fix non-ANSI SQLNumberFromFloat error + lvbcheng 01/03/97 - test + lvbcheng 01/03/97 - Revert back to OCINumber * + lvbcheng 12/12/96 - Finalize + lvbcheng 12/06/96 - test + lvbcheng 12/06/96 - test + lvbcheng 12/05/96 - Add default context code + lvbcheng 12/05/96 - Add connection to sqlcpr.h and sql[a|k]pr.h + lvbcheng 12/05/96 - Remove merge conflicts + lvbcheng 12/02/96 - Change Interface of sql2oci wrappers + lvbcheng 10/21/96 - Add OCINumber set procedures + lvbcheng 10/21/96 - Add vstr wrappers + jbasu 08/02/96 - Remove private include files + jbasu 07/05/96 - [8.0] SQLSvcCtxGet() enhancements + jbasu 06/04/96 - Support for V80 objects + jbasu 06/04/96 - Creation + +*/ + +#ifndef SQL2OCI_ORACLE +# define SQL2OCI_ORACLE + +#ifndef OCI_ORACLE +# include +#endif /* OCI_ORACLE */ + +#ifndef ORL_ORACLE +# include +#endif /* ORL_ORACLE */ + +#ifndef SQLCPR_ORACLE +# include +#endif /* SQLCPR_ORACLE */ + +#if defined (__STDC__) || defined (__cplusplus) + +/* --------------------- */ +/* Includes for ANSI C */ +/* --------------------- */ +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef SQLAPR_ORACLE +# include +#endif /* SQLAPR_ORACLE */ + +/* Get Procedures for OCI Env and Svc Ctx */ + +extern sword SQLEnvGet(dvoid *rctx, OCIEnv **oeh); + +extern sword SQLSvcCtxGet(dvoid *rctx, text *dbname, sb4 dbnamelen, + OCISvcCtx **svc); + +#ifdef __cplusplus +} +#endif + +#else /* k&r style - non-ANSI code */ + +/* -------------------- */ +/* Includes for K&R C */ +/* -------------------- */ + +#ifndef SQLKPR_ORACLE +# include +#endif /* SQLKPR_ORACLE */ + +/* ------------------------------------ */ +/* Get rowid of last exec sql statement */ +/* ------------------------------------ */ + +void SQLRowidGet(/*_ dvoid *rctx, OCIRowid **urid _*/); + +/* + NAME: SQLRowidGet - SQLLIB Rowid Get + + PARAMETERS: + rctx (IN): pointer to a sqllib runtime context + urid (OUT): pointer to an allocated rowid descriptor + + DESCRIPTION: + Sets urid to be the rowid of the last row inserted, + updated or selected + + */ + + + + + + + +/* ------------------------------------------- */ +/* Get 8.0 OCI environment handle from SQLLIB */ +/* ------------------------------------------- */ + +sword SQLEnvGet(/*_ dvoid *rctx, OCIEnv **oeh _*/); +/* + NAME: SQLEnvGet - SQLLIB Get Environment from the Runtime Context + + PARAMETERS: + rctx (IN): pointer to a sqllib runtime context + oeh (IN/OUT): OCIEnv ptr + + DESCRIPTION: + Sets oeh to the OCIEnv corresponding to the runtime context. + + RETURNS: + status - SQL_SUCCESS on success, SQL_ERROR on failure. + + */ + +/* ---------------------------------------------- */ + +/* Get 8.0 OCI Service Context for a database connection in Pro*C */ + +/* non-threaded, no Pro*C runtime context */ +sword SQLSvcCtxGet(/*_ dvoid *rctx, text *dbname, sb4 dbnamelen, + OCISvcCtx **svc _*/); +/* + NAME: SQLSvcCtxGet - SQLLIB Service Context Get + + PARAMETERS: + rctx (IN): pointer to a sqllib runtime context + dbname (IN): buffer containing the "logical" name for this connection. + dbnamelen (IN): length of the dbname buffer + svc (IN/OUT): address of an OCISvcCtx ptr + + DESCRIPTION: + Sets svc to the OCI Service Context corresponding to the runtime context. + + RETURNS: + status - SQL_SUCCESS on success, SQL_ERROR on failure. + + NOTES: + 'dbname' is the buffer containing the "logical" name for this connection. + This would be the same identifier used in an AT clause in an embedded + SQL statement. + + 'dbnamelen' is the length of buffer containing dbname. + + If dbname is a NULL ptr or dbnamelen is 0, then the "default" database + connection is assumed (as in a SQL statement with no AT clause). + + A value of -1 for dbnamelen can be used to indicate that dbname + is a NULL-terminated string. + + */ + +#endif /* k&r style - non-ANSI code */ + +#endif /* SQL2OCI_ORACLE */ diff --git a/sdk/include/sqlapr.h b/sdk/include/sqlapr.h new file mode 100755 index 0000000..4510533 --- /dev/null +++ b/sdk/include/sqlapr.h @@ -0,0 +1,132 @@ +/* + * $Header: sqlapr.h 08-may-2002.12:13:40 apopat Exp $ + */ + +/* Copyright (c) 1994, 2002, Oracle Corporation. All rights reserved. */ +/* + NAME + sqlapr.h - SQLlib ANSI PRototypes + DESCRIPTION + Defines ANSI prototypes for externalized SQLLIB functions used in + conjunction with OCI + PUBLIC FUNCTION(S) + sqllda: Get Logon Data Area for connection + sqlld2: Logon Data area form 2 -- with host name + sqlcda: Cursor data area from result set cursor + sqlcur: PCC cursor from cursor data area + + NOTES + + MODIFIED (MM/DD/YY) + apopat 05/08/02 - [2362423] MVS PE to make lines shorter than 79 + apopat 09/20/00 - [1356099] Clarification on use of sqllda + lvbcheng 01/16/97 - Fix for b2 + jbasu 02/08/95 - Add new prototypes for thread entry pts + jbasu 09/21/94 - Update sqlcda,sqlcur; move sqlrcn,sqlfcn to sqlefn.h + jbasu 09/13/94 - Move XA prototypes to sqlefn.h + jbasu 08/16/94 - use OCI cda_def type from ocidfn.h instead of sqlold + jbasu 08/16/94 - Creation +*/ + +#ifndef SQLAPR +# define SQLAPR + +#ifndef OCIDFN +# include +#endif + +#define SQLLDAGetCurrent(arg1, arg2) sqlldat(arg1, arg2) + +void sqllda( Lda_Def *lda ); + /* LDA version 1. Creates an lda for use in OCI programs. + ** Assumes that we are logged on through an embedded SQL statement. + ** The lda is filled in using the connect information from the most + ** recently executed embedded SQL statement. So the ONLY way to use + ** sqllda() is to call sqllda() immediately after the + ** EXEC SQL CONNECT... statement. + */ + +void sqlldat(dvoid *sqluga, Lda_Def *lda ); + /* Thread-safe version of sqllda. Takes an extra parameter sqluga, which + * is the SQLLIB runtime context. + */ + +/* **************************************************************************/ +/* ** SQLLD2 ** "sqlld2" is an extended version of */ +/* the sqllda function used to pass a connection to OCI. */ +/* "sqlld2" can be used at any time to set up an "lda" for use */ +/* by OCI. It does not need to called immediately after a SQL */ +/* statement using the particular connection (typically the */ +/* CONNECT itself). */ +/****************************************************************************/ + +#define SQLDAGetNamed(arg1, arg2, arg3, arg4) sqlld2t(arg1, arg2, arg3, arg4) + +void sqlld2( Lda_Def *lda, text *hname, sb4 *hnamel ); + /* LDa version 2. Creates an lda for use in OCI programs. The difference + ** between sqlld2 and sqllda is that sqlld2 allows specification of + ** the database host name to determine the connection to use in + ** establishing the lda. + ** hname - buffer containing the "logical" name for this connection. This + ** would be the same identifier used in an AT clause in an + ** embedded SQL statement. A null ptr indicates the "default" + ** database used when there is no AT clause in a SQL statement. + ** hnamel - length of buffer containing hname. + */ + +void sqlld2t( dvoid *sqluga, Lda_Def *lda, text *hname, sb4 *hnamel ); + /* Thread-safe version of sqlld2. Takes an extra parameter sqluga, which + * is the SQLLIB runtime context. + */ + +#define SQLCDAFromResultSetCursor(arg1, arg2, arg3, arg4) \ + sqlcdat(arg1, arg2, arg3, arg4) + +void sqlcda( Cda_Def *cda, dvoid *cur, sword *retval ); +/* + * Name: sqlcda() - SQLlib result set cursor to a Cursor Data Area in OCI + * Description: Translates a result set cursor in SQLLIB to a cursor data area + * in OCI. Both of these structs should have been previously + * created/allocated. + * Input : cur - pointer to a result set cursor struct allocated thru Pro* + * Output : cda - pointer to destination cursor data area in OCI + * retval- Return value: 0 if no error,SQLLIB error number otherwise + * + * Notes: 1. In case of an error, the v2_rc and rc fields of the cda are + * populated with the negative and positive error codes respectively. + * 2. The 'rows processed count' in the cda structure is NOT populated + * in this routine. This field is set to the correct value only + * AFTER a fetch is done in OCI using the cda. Same + * comment applies to other cda fields like the function type. + * =========================================================================== + */ +void sqlcdat(dvoid *sqluga, Cda_Def *cda, dvoid *cur, sword *retval ); + /* Thread-safe version of sqlcda(). Takes an extra parameter sqluga, which + * is the SQLLIB runtime context. + */ + +#define SQLCDAToResultSetCursor(SQL_SINGLE_RCTX, arg1, arg2, arg3) \ + sqlcurt(arg1, arg2, arg3, arg4) + +void sqlcur( dvoid *cur, Cda_Def *cda, sword *retval ); +/* + * Name: sqlcur() - SQLlib result set CURsor from an oci cursor data area + * Description: Translates a cursor data area in OCI to a result set cursor + * in SQLLIB. Both of these structs should have been previously + * created/allocated. + * Input : cda - pointer to a cursor data area in OCI + * Output : cur - pointer to a result set cursor struct (previously + * allocated thru PCC) + * retval - Return value: 0 if no error, error code otherwise. + * Notes : The sqlca structure for PCC is NOT updated by this routine. This + * structure gets populated (with error code, rows fetched count etc) + * only AFTER a database operation is performed through PCC using the + * translated cursor. + *============================================================================ + */ +void sqlcurt(dvoid *sqluga, dvoid *cur, Cda_Def *cda, sword *retval ); + /* Thread-safe version of sqlcur(). Takes an extra parameter sqluga, which + * is the SQLLIB runtime context. + */ + +#endif /* SQLAPR */ diff --git a/sdk/include/sqlca.h b/sdk/include/sqlca.h new file mode 100755 index 0000000..daaead7 --- /dev/null +++ b/sdk/include/sqlca.h @@ -0,0 +1,99 @@ +/* + * $Header: sqlca.h 24-apr-2003.12:50:58 mkandarp Exp $ sqlca.h + */ + +/* Copyright (c) 1985, 2003, Oracle Corporation. All rights reserved. */ + +/* +NAME + SQLCA : SQL Communications Area. +FUNCTION + Contains no code. Oracle fills in the SQLCA with status info + during the execution of a SQL stmt. +NOTES + ************************************************************** + *** *** + *** This file is SOSD. Porters must change the data types *** + *** appropriately on their platform. See notes/pcport.doc *** + *** for more information. *** + *** *** + ************************************************************** + + If the symbol SQLCA_STORAGE_CLASS is defined, then the SQLCA + will be defined to have this storage class. For example: + + #define SQLCA_STORAGE_CLASS extern + + will define the SQLCA as an extern. + + If the symbol SQLCA_INIT is defined, then the SQLCA will be + statically initialized. Although this is not necessary in order + to use the SQLCA, it is a good pgming practice not to have + unitialized variables. However, some C compilers/OS's don't + allow automatic variables to be init'd in this manner. Therefore, + if you are INCLUDE'ing the SQLCA in a place where it would be + an automatic AND your C compiler/OS doesn't allow this style + of initialization, then SQLCA_INIT should be left undefined -- + all others can define SQLCA_INIT if they wish. + + If the symbol SQLCA_NONE is defined, then the SQLCA variable will + not be defined at all. The symbol SQLCA_NONE should not be defined + in source modules that have embedded SQL. However, source modules + that have no embedded SQL, but need to manipulate a sqlca struct + passed in as a parameter, can set the SQLCA_NONE symbol to avoid + creation of an extraneous sqlca variable. + +MODIFIED + lvbcheng 07/31/98 - long to int + jbasu 12/12/94 - Bug 217878: note this is an SOSD file + losborne 08/11/92 - No sqlca var if SQLCA_NONE macro set + Clare 12/06/84 - Ch SQLCA to not be an extern. + Clare 10/21/85 - Add initialization. + Bradbury 01/05/86 - Only initialize when SQLCA_INIT set + Clare 06/12/86 - Add SQLCA_STORAGE_CLASS option. +*/ + +#ifndef SQLCA +#define SQLCA 1 + +struct sqlca + { + /* ub1 */ char sqlcaid[8]; + /* b4 */ int sqlabc; + /* b4 */ int sqlcode; + struct + { + /* ub2 */ unsigned short sqlerrml; + /* ub1 */ char sqlerrmc[70]; + } sqlerrm; + /* ub1 */ char sqlerrp[8]; + /* b4 */ int sqlerrd[6]; + /* ub1 */ char sqlwarn[8]; + /* ub1 */ char sqlext[8]; + }; + +#ifndef SQLCA_NONE +#ifdef SQLCA_STORAGE_CLASS +SQLCA_STORAGE_CLASS struct sqlca sqlca +#else + struct sqlca sqlca +#endif + +#ifdef SQLCA_INIT + = { + {'S', 'Q', 'L', 'C', 'A', ' ', ' ', ' '}, + sizeof(struct sqlca), + 0, + { 0, {0}}, + {'N', 'O', 'T', ' ', 'S', 'E', 'T', ' '}, + {0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0} + } +#endif + ; +#endif + +#endif + +/* end SQLCA */ diff --git a/sdk/include/sqlcpr.h b/sdk/include/sqlcpr.h new file mode 100755 index 0000000..54df232 --- /dev/null +++ b/sdk/include/sqlcpr.h @@ -0,0 +1,184 @@ +/* + * $Header: sqlcpr.h 28-dec-2005.15:32:23 apopat Exp $ + */ + +/* Copyright (c) 1988, 2005, Oracle. All rights reserved. */ + +/* NAME + sqlcpr.h + FUNCTION + Contains 'customer' prototypes for the sql* routines generated by the + precompiler. + sqlald, sqlglm, sqlnul and sqlprc are included because, although we don't + generate calls to them, users may include calls to them. + + 'customer' prototypes for dynamic method 4 (i.e., sqlda) reside + in the sqlda.h public header file. + + NOTES + There should be no 'modified' notes in this file when it goes to the + customer. Remove them as they are put in. */ + +#ifndef SQLCA +# include +#endif +#ifndef ORACA +# include +#endif + +#ifndef SQLPRO +# define SQLPRO + +/* -------------------- */ +/* defines for sqlcpr.h */ +/* -------------------- */ + +#define SQL_SUCCESS (sword)0 +#define SQL_ERROR (sword)-1 + +#ifndef SQL_SINGLE_RCTX +#define SQL_SINGLE_RCTX (dvoid *)0 +#endif /* SQL_SINGLE_RCTX */ + +#define SQLErrorGetText(arg1, arg2, arg3, arg4) sqlglmt(arg1, arg2, arg3, arg4) + +#define SQLStmtGetText(arg1, arg2, arg3, arg4) sqlglst(arg1, arg2, arg3, arg4) + +#define SQLColumnNullCheck(arg1, arg2, arg3, arg4) \ + sqlnult(arg1, arg2, arg3, arg4) + +#define SQLNumberPrecV6(arg1, arg2, arg3, arg4) sqlprct(arg1, arg2, arg3, arg4) + +#define SQLNumberPrecv7(arg1, arg2, arg3, arg4) sqlpr2t(arg1, arg2, arg3, arg4) + +#define SQLVarcharGetLength(arg1, arg2, arg3) sqlvcpt(arg1, arg2, arg3) + +#define SQLGetStride(arg1, arg2, arg3, arg4) sqlstrdt(arg1, arg2, arg3, arg4) + +#if defined (__STDC__) || defined (__cplusplus) + +#ifdef __cplusplus +extern "C" { +#endif + +/* user-callable functions - non-threaded */ +/* -------------------------------------- */ + +extern void sqlglm( unsigned char*, size_t*, size_t* ); +extern void sqlgls( char*, size_t*, size_t* ); +extern void sqliem( unsigned char*, signed int* ); +extern void sqlnul( unsigned short*, unsigned short*, int* ); +extern void sqlprc( unsigned int*, int*, int* ); +extern void sqlpr2( unsigned int*, int*, int*); +extern void sqlvcp( unsigned int*, unsigned int* ); + +/* user-callable functions -- thread safe */ +/* -------------------------------------- */ + +extern void sqlglmt( void*, unsigned char*, size_t*, size_t* ); + +extern void sqlglst( void*, char*, size_t*, size_t* ); + +extern void sqliemt( void*, unsigned char*, signed int*); + +extern void sqlnult( void*, unsigned short*, unsigned short*, int*); + +extern void sqlpr2t( void*, unsigned int*, int*, int*); + +extern void sqlprct( void*, unsigned int*, int*, int*); + +extern void sqlvcpt( void*, unsigned int*, unsigned int*); + +extern void SQLExtProcError( void*, char*, size_t ); + +/* Removed generated Pro* 1.3 entry points */ +/* --------------------------------------- */ + +/* Forms 3.0 compatibility functions */ +/* --------------------------------- */ + +extern int iapprs( unsigned char* ); +extern int iappfo( unsigned char*, unsigned char*, size_t ); +extern int exiterr( unsigned char* ); + +/* user-callable functions - non-threaded */ +/* -------------------------------------- */ + +extern struct SQLDA *sqlald( int, size_t, size_t ); +extern void sqlclu( struct SQLDA*); + +/* user-callable functions -- thread safe */ +/* -------------------------------------- */ + +extern struct SQLDA *sqlaldt( void*, int, size_t, size_t ); + +extern void sqlclut( void*, struct SQLDA*); + +#ifdef __cplusplus +} +#endif + +#else /* k&r C - not ANSI standard */ + + +/* user-callable functions - non-threaded */ +/* -------------------------------------- */ + +extern void sqlglm( /*_ char*, size_t*, size_t* _*/ ); +extern void sqlgls( /*_ char*, size_t*, size_t* _*/); +extern void sqliem( /*_ char*, int* _*/ ); +extern void sqlnul( /*_ unsigned short*, unsigned short*, int* _*/ ); +extern void sqlprc( /*_ unsigned int*, int*, int* _*/ ); +extern void sqlpr2( /*_ unsigned int*, int*, int* _*/); +extern void sqlvcp( /*_ unsigned int *, unsigned int * _*/); +extern void sqlstrd(/*_ ub1 *, ub1 *, size_t _*/); + +/* user-callable functions -- thread safe */ +/* -------------------------------------- */ + +extern void sqlglmt(/*_ void*, char*, size_t*, size_t* _*/ ); + +extern void sqlglst(/*_ void*, char*, size_t*, size_t* _*/); + +extern void sqliemt(/*_ void*, char*, int* _*/ ); + +extern void sqlnult(/*_ void*, unsigned short*, unsigned short*, int* _*/ ); + +extern void sqlprct(/*_ void*, unsigned int*, int*, int* _*/ ); + +extern void sqlpr2t(/*_ void*, unsigned int*, int*, int* _*/); + +extern void sqlvcpt(/*_ void*, unsigned int *, unsigned int * _*/); + +extern void sqlstrdt(/*_ void *, ub1 *, ub1 *, size_t _*/); + +extern void SQLExtProcError(/*_ void*, char*, size_t _*/); + +extern void SQLRowidGet(/*_ void*, OCIRowid **urid _*/); + +/* Removed generated Pro* 1.3 entry points */ +/* --------------------------------------- */ + + +/* Forms 3.0 compatibility functions */ +/* --------------------------------- */ + +extern int iapprs( /*_ char* _*/ ); +extern int iappfo( /*_ char*, char*, unsigned int _*/ ); +extern int exiterr( /*_ char* _*/ ); + +/* user-callable functions - non-threaded */ +/* -------------------------------------- */ + +extern struct SQLDA *sqlald( /*_ int, size_t, size_t _*/ ); +extern void sqlclu( /*_ struct SQLDA* _*/); + +/* user-callable functions -- thread safe */ +/* -------------------------------------- */ + +extern struct SQLDA *sqlaldt(/*_ void*, int, size_t, size_t _*/ ); +extern void sqlclut(/*_ void*, struct SQLDA* _*/); + +#endif /* k&r C - not ANSI standard */ + +#endif /* SQLPRO */ diff --git a/sdk/include/sqlda.h b/sdk/include/sqlda.h new file mode 100755 index 0000000..d542c0a --- /dev/null +++ b/sdk/include/sqlda.h @@ -0,0 +1,89 @@ +/* + * $Header: sqlda.h 08-may-2007.05:58:33 ardesai Exp $ sqlda.h + */ + +/*************************************************************** +* The SQLDA descriptor definition * +*--------------------------------------------------------------* +* VAX/3B Version * +* * +* Copyright (c) 1987, 2007, Oracle. All rights reserved. * +***************************************************************/ + + +/* NOTES + ************************************************************** + *** *** + *** This file is SOSD. Porters must change the data types *** + *** appropriately on their platform. See notes/pcport.doc *** + *** for more information. *** + *** *** + ************************************************************** +*/ + +/* MODIFIED + ardesai 05/08/07 - Bug[6037057] Undef Y + apopat 05/08/02 - [2362423] MVS PE to make lines shorter than 79 + apopat 07/31/99 - [707588] TAB to blanks for OCCS + lvbcheng 10/27/98 - change long to int for sqlda + lvbcheng 08/15/97 - Move sqlda protos to sqlcpr.h + lvbcheng 06/25/97 - Move sqlda protos to this file + jbasu 01/29/95 - correct typo + jbasu 01/27/95 - correct comment - ub2->sb2 + jbasu 12/12/94 - Bug 217878: note this is an SOSD file + Morse 12/01/87 - undef L and S for v6 include files + Richey 07/13/87 - change int defs to long + Clare 09/13/84 - Port: Ch types to match SQLLIB structs + Clare 10/02/86 - Add ifndef SQLDA +*/ + +#ifndef SQLDA_ +#define SQLDA_ 1 + +#ifdef T +# undef T +#endif +#ifdef F +# undef F +#endif + +#ifdef S +# undef S +#endif +#ifdef L +# undef L +#endif + +#ifdef Y + # undef Y +#endif + +struct SQLDA { + /* ub4 */ int N; /* Descriptor size in number of entries */ + /* text** */ char **V; /* Ptr to Arr of addresses of main variables */ + /* ub4* */ int *L; /* Ptr to Arr of lengths of buffers */ + /* sb2* */ short *T; /* Ptr to Arr of types of buffers */ + /* sb2** */ short **I; /* Ptr to Arr of addresses of indicator vars */ + /* sb4 */ int F; /* Number of variables found by DESCRIBE */ + /* text** */ char **S; /* Ptr to Arr of variable name pointers */ + /* ub2* */ short *M; /* Ptr to Arr of max lengths of var. names */ + /* ub2* */ short *C; /* Ptr to Arr of current lengths of var. names */ + /* text** */ char **X; /* Ptr to Arr of ind. var. name pointers */ + /* ub2* */ short *Y; /* Ptr to Arr of max lengths of ind. var. names*/ + /* ub2* */ short *Z; /* Ptr to Arr of cur lengths of ind. var. names*/ + }; + +typedef struct SQLDA SQLDA; + +#endif + +/* ----------------- */ +/* defines for sqlda */ +/* ----------------- */ + +#define SQLSQLDAAlloc(arg1, arg2, arg3, arg4) sqlaldt(arg1, arg2, arg3, arg4) + +#define SQLSQLDAFree(arg1, arg2) sqlclut(arg1, arg2) + + + diff --git a/sdk/include/sqlkpr.h b/sdk/include/sqlkpr.h new file mode 100755 index 0000000..507c2ef --- /dev/null +++ b/sdk/include/sqlkpr.h @@ -0,0 +1,134 @@ +/* + * $Header: sqlkpr.h 25-aug-2005.21:32:24 subanerj Exp $ + */ + +/* Copyright (c) 1994, 2005, Oracle. All rights reserved. */ +/* + NAME + sqlkpr.h - SQLlib K&R PRototypes + DESCRIPTION + Defines k&r prototypes for externalized SQLLIB functions used in + conjunction with OCI + PUBLIC FUNCTION(S) + sqllda: Get Logon Data Area for connection + sqlld2: Logon Data area form 2 -- with host name + sqlcda: Cursor data area from result set cursor + sqlcur: PCC cursor from cursor data area + + NOTES + + MODIFIED (MM/DD/YY) + subanerj 08/25/05 - ANSI prototypes; miscellaneous cleanup + apopat 05/08/02 - [2362423] MVS PE to make lines shorter than 79 + apopat 09/20/00 - [1356099] Clarification on use of sqllda + lvbcheng 01/16/97 - Fix for b2 + jbasu 02/08/95 - Add prototypes for new thread entry pts + jbasu 09/21/94 - Update sqlcda,sqlcur; move sqlrcn,sqlfcn to sqlefn.h + jbasu 09/13/94 - Move XA prototypes to sqlefn.h + jbasu 08/16/94 - use OCI cda_def type from ocidfn.h instead of sqlold + jbasu 08/16/94 - Creation +*/ + +#ifndef SQLKPR +# define SQLKPR + +#ifndef OCIDFN +# include +#endif + +#define SQLLDAGetCurrent(arg1, arg2) sqlldat(arg1, arg2) + +void sqllda(Lda_Def *lda); + /* LDA version 1. Creates an lda for use in OCI programs. + ** Assumes that we are logged on through an embedded SQL statement. + ** The lda is filled in using the connect information from the most + ** recently executed embedded SQL statement. So the ONLY way to use + ** sqllda() is to call sqllda() immediately after the + ** EXEC SQL CONNECT... statement. + */ + + +void sqlldat(dvoid *sqluga, Lda_Def *lda); + /* Thread-safe version of sqllda. Takes an extra parameter sqluga, which is + * the SQLLIB runtime context. + */ + +/* **************************************************************************/ +/* ** SQLLD2 ** "sqlld2" is an extended version of */ +/* the sqllda function used to pass a connection to OCI. */ +/* "sqlld2" can be used at any time to set up an "lda" for use */ +/* by OCI. It does not need to called immediately after a SQL */ +/* statement using the particular connection (typically the */ +/* CONNECT itself). */ +/****************************************************************************/ + +#define SQLDAGetNamed(arg1, arg2, arg3, arg4) sqlld2t(arg1, arg2, arg3, arg4) + +void sqlld2(Lda_Def *lda, text *hname, sb4 *hnamel); + /* LDa version 2. Creates an lda for use in OCI programs. The difference + ** between sqlld2 and sqllda is that sqlld2 allows specification of + ** the database host name to determine the connection to use in + ** establishing the lda. + ** hname - buffer containing the "logical" name for this connection. This + ** would be the same identifier used in an AT clause in an + ** embedded SQL statement. A null ptr indicates the "default" + ** database used when there is no AT clause in a SQL statement. + ** hnamel - length of buffer containing hname. + */ + +void sqlld2t(dvoid *sqluga, Lda_Def *lda, text *hname, sb4 *hnamel); + /* Thread-safe version of sqlld2. Takes an extra parameter sqluga, which is + * the SQLLIB runtime context. + */ + +#define SQLCDAFromResultSetCursor(arg1, arg2, arg3, arg4) \ + sqlcdat(arg1, arg2, arg3, arg4) + +void sqlcda(/*_ Cda_Def *cda, dvoid *cur, sword *retval _*/); +/* + * Name: sqlcda() - SQLlib result set cursor to a Cursor Data Area in OCI + * Description: Translates a result set cursor in SQLLIB to a cursor data area + * in OCI. Both of these structs should have been previously + * created/allocated. + * Input : cur -pointer to a result set cursor struct allocated thru Pro* + * Output : cda -pointer to destination cursor data area in OCI + * retval -Return value: 0 if no error,SQLLIB error number otherwise + * + * Notes: 1.In case of an error, the v2_rc and rc fields of the cda are + * populated with the negative and positive error codes respectively. + * 2.The 'rows processed count' in the cda structure is NOT populated + * in this routine. This field is set to the correct value only + * AFTER a fetch is done in OCI using the cda. Same + * comment applies to other cda fields like the function type. + * =========================================================================== + */ +void sqlcdat(/*_ dvoid *sqluga, Cda_Def *cda, dvoid *cur, sword *retval _*/); + /* Thread-safe version of sqlcda(). Takes an extra parameter sqluga, which + * is the SQLLIB runtime context. + */ + +#define SQLCDAToResultSetCursor(SQL_SINGLE_RCTX, arg1, arg2, arg3) \ + sqlcurt(arg1, arg2, arg3, arg4) + +void sqlcur(/*_ dvoid *cur, Cda_Def *cda, sword *retval _*/); +/* + * Name: sqlcur() - SQLlib result set CURsor from an oci cursor data area + * Description: Translates a cursor data area in OCI to a result set cursor + * in SQLLIB. Both of these structs should have been previously + * created/allocated. + * Input : cda - pointer to a cursor data area in OCI + * Output : cur - pointer to a result set cursor struct (previously + * allocated thru PCC) + * retval - Return value: 0 if no error, error code otherwise. + * Notes :The sqlca structure for PCC is NOT updated by this routine. This + * structure gets populated (with error code, rows fetched count etc) + * only AFTER a database operation is performed through PCC using the + * translated cursor. + *============================================================================ + */ +void sqlcurt(/*_ dvoid *sqluga, dvoid *cur, Cda_Def *cda, sword *retval _*/); + /* Thread-safe version of sqlcur(). Takes an extra parameter sqluga, which + * is the SQLLIB runtime context. + */ + +#endif /* SQLKPR */ diff --git a/sdk/include/sqlucs2.h b/sdk/include/sqlucs2.h new file mode 100755 index 0000000..f335d4f --- /dev/null +++ b/sdk/include/sqlucs2.h @@ -0,0 +1,32 @@ +/* +ORACLE, Copyright (c) 1998, 2000 ORACLE Corporation +ORACLE Utilities, Copyright (c) 1981, 1982, 1983, 1986, 1990, 1991,, 1998, 2000 1995, + 1998 ORACLE Corp + +Restricted Rights +This program is an unpublished work under the Copyright Act of the +United States and is subject to the terms and conditions stated in +your license agreement with ORACORP including retrictions on +use, duplication, and disclosure. + +Certain uncopyrighted ideas and concepts are also contained herein. +These are trade secrets of ORACORP and cannot be used except in +accordance with the written permission of ORACLE Corporation. +*/ + +#ifndef SQLUCS2_ORACLE +#define SQLUCS2_ORACLE + +#ifndef ORATYPES +# ifndef S_ORACLE +# include +# endif /* S_ORACLE */ +#endif /* ORATYPES */ + +struct uvarchar {ub2 len; utext arr[1];}; +typedef struct uvarchar uvarchar; + +struct ulong_varchar {ub4 len; utext arr[1];}; +typedef struct ulong_varchar ulong_varchar; + +#endif /* SQLUCS2_ORACLE */ diff --git a/sdk/include/xa.h b/sdk/include/xa.h new file mode 100755 index 0000000..9dcd519 --- /dev/null +++ b/sdk/include/xa.h @@ -0,0 +1,200 @@ +/* Copyright (c) 1992, 2006, Oracle. All rights reserved. */ + +/* + NAME + xa.h - + DESCRIPTION + + PUBLIC FUNCTION(S) + + PRIVATE FUNCTION(S) + + RETURNS + + NOTES + + + This is the public XA .h file + + MODIFIED (MM/DD/YY) + yohu 08/27/06 - XA/RAC project changes: XAER_AFFINITY + dmukhin 06/29/05 - ANSI prototypes; miscellaneous cleanup + whe 09/01/99 - 976457:check __cplusplus for C++ code + ntang 10/20/98 - Remove TMCACHE & TMFORCL + abhide 08/04/97 - implement xaoforcl + abhide 07/23/97 - XA OTS project changes + schandra 02/20/96 - lint + abhide 04/07/94 - merge changes from branch 1.1.710.1 + abhide 02/14/94 - Creation + abhide 02/10/94 - Creation + abhide 02/10/94 - Creation +*/ +/* + * xa.h header + * Typed in from X/Open doc of March 13, 1990 + * Updated to Parsippany II draft, March, 1991 + * Updated to Co Review draft, 19 Sep 1991 + */ + +#ifndef XA_H +#define XA_H + + +/* + * Transaction branch identification: XID and NULLXID: + */ + + +#define XIDDATASIZE 128 /* size in bytes */ +#define MAXGTRIDSIZE 64 /* maximum size in bytes of gtrid */ +#define MAXBQUALSIZE 64 /* maximum size in bytes of bqual */ +struct xid_t { + long formatID; /* format identifier */ + long gtrid_length; /* value from 1 through 64 */ + long bqual_length; /* value from 1 through 64 */ + char data[XIDDATASIZE]; +}; +typedef struct xid_t XID; + +/* + * A value of -1 in formatID means that the XID is null. + */ +/* + * Declarations of routines by which RMs call TMs: + */ + +int ax_reg(int, XID *, long); +int ax_unreg(int, long); +/* + * XA Switch Data Structure + */ +#define RMNAMESZ 32 /* length of resource manager name, */ + /* including the null terminator */ +#define MAXINFOSIZE 256 /* maximum size in bytes of xa_info strings, */ + /* including the null terminator */ +struct xa_switch_t { + char name[RMNAMESZ]; /* name of resource manager */ + long flags; /* resource manager specific options */ + long version; /* must be 0 */ + + int (*xa_open_entry)(char *, int, long); /*xa_open function pointer*/ + int (*xa_close_entry)(char *, int, long); /*xa_close function pointer*/ + int (*xa_start_entry)(XID *, int, long); /*xa_start function pointer*/ + int (*xa_end_entry)(XID *, int, long); /*xa_end function pointer*/ + int (*xa_rollback_entry)(XID *, int, long); + /*xa_rollback function pointer*/ + int (*xa_prepare_entry)(XID *, int, long); /*xa_prepare function pointer*/ + int (*xa_commit_entry)(XID *, int, long); /*xa_commit function pointer*/ + int (*xa_recover_entry)(XID *, long, int, long); + /*xa_recover function pointer*/ + int (*xa_forget_entry)(XID *, int, long); /*xa_forget function pointer*/ + int (*xa_complete_entry)(int *, int *, int, long); +}; + +/* + * Flag definition for the RM switch + */ +#define TMNOFLAGS 0x00000000L /* no resource manager features + selected */ +#define TMREGISTER 0x00000001L /* resource manager dynamically + registers */ +#define TMNOMIGRATE 0x00000002L /* resource manager does not support + association migration */ +#define TMUSEASYNC 0x00000004L /* resource manager supports + asynchronous operations */ +/* + * Flag definitions for xa_ and ax_ routines + */ +/* Use TMNOFLAGS, defined above, when not specifying other flags */ +#define TMASYNC 0x80000000L /* perform routine asynchronously */ +#define TMONEPHASE 0x40000000L /* caller is using one-phase commit + optimisation */ +#define TMFAIL 0x20000000L /* dissociates caller and marks + transaction branch rollback-only */ +#define TMNOWAIT 0x10000000L /* return if blocking condition + exists */ +#define TMRESUME 0x08000000L /* caller is resuming association + with suspended transaction branch */ +#define TMSUCCESS 0x04000000L /* dissociate caller from transaction + branch */ +#define TMSUSPEND 0x02000000L /* caller is suspending, not ending, + association */ +#define TMSTARTRSCAN 0x01000000L /* start a recovery scan */ +#define TMENDRSCAN 0x00800000L /* end a recovery scan */ +#define TMMULTIPLE 0x00400000L /* wait for any asynchronous + operation */ +#define TMJOIN 0x00200000L /* caller is joining existing + transaction branch */ +#define TMMIGRATE 0x00100000L /* caller intends to perform + migration */ + +/* + * ax_() return codes (transaction manager reports to resource manager) + */ +#define TM_JOIN 2 /* caller is joining existing transaction + branch */ +#define TM_RESUME 1 /* caller is resuming association with + suspended transaction branch */ +#define TM_OK 0 /* normal execution */ +#define TMER_TMERR -1 /* an error occurred in the transaction + manager */ +#define TMER_INVAL -2 /* invalid arguments were given */ +#define TMER_PROTO -3 /* routine invoked in an improper context */ + +/* + * xa_() return codes (resource manager reports to transaction manager) + */ +#define XA_RBBASE 100 /* The inclusive lower bound of the + rollback codes */ +#define XA_RBROLLBACK XA_RBBASE /* The rollback was caused by an + unspecified reason */ +#define XA_RBCOMMFAIL XA_RBBASE+1 /* The rollback was caused by a + communication failure */ +#define XA_RBDEADLOCK XA_RBBASE+2 /* A deadlock was detected */ +#define XA_RBINTEGRITY XA_RBBASE+3 /* A condition that violates the + integrity of the resources was + detected */ +#define XA_RBOTHER XA_RBBASE+4 /* The resource manager rolled back the + transaction for a reason not on this + list */ +#define XA_RBPROTO XA_RBBASE+5 /* A protocal error occurred in the + resource manager */ +#define XA_RBTIMEOUT XA_RBBASE+6 /* A transaction branch took too long*/ +#define XA_RBTRANSIENT XA_RBBASE+7 /* May retry the transaction branch */ +#define XA_RBEND XA_RBTRANSIENT /* The inclusive upper bound of the + rollback codes */ + +#define XA_NOMIGRATE 9 /* resumption must occur where + suspension occurred */ +#define XA_HEURHAZ 8 /* the transaction branch may have been + heuristically completed */ +#define XA_HEURCOM 7 /* the transaction branch has been + heuristically comitted */ +#define XA_HEURRB 6 /* the transaction branch has been + heuristically rolled back */ +#define XA_HEURMIX 5 /* the transaction branch has been + heuristically committed and rolled + back */ +#define XA_RETRY 4 /* routine returned with no effect + and may be re-issued */ +#define XA_RDONLY 3 /* the transaction was read-only + and has been committed */ +#define XA_OK 0 /* normal execution */ +#define XAER_ASYNC -2 /* asynchronous operation already + outstanding */ +#define XAER_RMERR -3 /* a resource manager error occurred + in the transaction branch */ +#define XAER_NOTA -4 /* the XID is not valid */ +#define XAER_INVAL -5 /* invalid arguments were given */ +#define XAER_PROTO -6 /* routine invoked in an improper + context */ +#define XAER_RMFAIL -7 /* resource manager unavailable */ +#define XAER_DUPID -8 /* the XID already exists */ +#define XAER_OUTSIDE -9 /* resource manager doing work */ + /* outside global transaction */ + +#define XAER_AFFINITY -10 /* XA on RAC: resumption must occur on + RAC instance where the transaction + branch was created */ + +#endif /* ifndef XA_H */ diff --git a/sdk/ott b/sdk/ott new file mode 100755 index 0000000..461ff54 --- /dev/null +++ b/sdk/ott @@ -0,0 +1,36 @@ +#! /bin/sh +# Script for running ott in instant client. +# Before running this script: +# set jdk1.5/bin in your PATH +# set LD_LIBRARY_PATH to include the directory containing the instant client +# libraries +# set ottclasses.zip, ojdbc5.jar, orai18n.jar as part of your CLASSPATH + +OS=`uname` +MACHINE=`uname -m` +JREOPTIONS= + +if [ "$OS" = "HP-UX" ]; then + if [ "$MACHINE" = "ia64" -o "$MACHINE" = "9000/800" ]; then + JREOPTIONS=-d64 + fi +fi +if [ "$OS" = "SunOS" ]; then + if [ "$MACHINE" = "sun4u" -o "$MACHINE" = "sun4v" ]; then + JREOPTIONS=-d64 + fi +fi + +while [ $# -gt 0 ] +do + case $1 in + user*) + OTTUSER="$OTTUSER $1" + export OTTUSER ;; + *) + args="$args $1";; + esac +shift +done + +exec java $JREOPTIONS oracle.ott.c.CMain nlslang=${NLS_LANG} $args diff --git a/sdk/ottclasses.zip b/sdk/ottclasses.zip new file mode 100644 index 0000000..14cfe26 Binary files /dev/null and b/sdk/ottclasses.zip differ diff --git a/sdk/proc b/sdk/proc new file mode 100755 index 0000000..0a35bad Binary files /dev/null and b/sdk/proc differ diff --git a/sdk/procob b/sdk/procob new file mode 100755 index 0000000..d17a6fa Binary files /dev/null and b/sdk/procob differ diff --git a/sdk/rtsora b/sdk/rtsora new file mode 100755 index 0000000..32ab909 Binary files /dev/null and b/sdk/rtsora differ diff --git a/uidrvci b/uidrvci new file mode 100755 index 0000000..142aa3f Binary files /dev/null and b/uidrvci differ diff --git a/xstreams.jar b/xstreams.jar new file mode 100644 index 0000000..b43a700 Binary files /dev/null and b/xstreams.jar differ