| TerraLib 4.1

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files
- Examples

- File List
- File Members

E:/Projetos_Primeiro_Semestre_2012/TerraView/terralib/src/terralib/drivers/Oracle/OCI/include/occiControl.h
Go to the documentation of this file.

    00001 /* Copyright  Oracle Corporation 2000, 2001. All Rights Reserved. */
    00002
    00003 /*
    00004    NAME
    00005      occiControl.h - header file for OCCI control classes
    00006
    00007    DESCRIPTION
    00008      Class definitions for MetaData,SQLException,Environment,
    00009      Connection,Statement, ConnectionPool, StatelessConnectionPool
    00010
    00011    RELATED DOCUMENTS
    00012      <note any documents related to this facility>
    00013
    00014    EXPORT FUNCTION(S)
    00015      <external functions declared for use outside package - one-line
    00016      descriptions>
    00017
    00018    INTERNAL FUNCTION(S)
    00019      <other external functions declared - one-line descriptions>
    00020
    00021    EXAMPLES
    00022
    00023    NOTES
    00024      <other useful comments, qualifications, etc.>
    00025
    00026    MODIFIED   (MM/DD/YY)
    00027    rvadraha    09/30/03 - New Binary/CharacterStreamMode for Statement class
    00028    rvallam     02/12/03 - modify BFloat/BDouble interface to use the new
    00029                           BFloat/BDouble type
    00030    shiyer      01/21/03 - add getPoolNameUString to ConnectionPool
    00031    shiyer      12/19/02 - Add cache sorted flush get/set to Environment
    00032    shiyer      12/31/02 - added OCI_ATTR_CHAR_SIZE to typeattr attrs
    00033    shiyer      12/09/02 - ensure new virtual interfaces are in order
    00034    cparampa    10/12/02 - AQ Additions
    00035    rvallam     10/12/02 - added  new methods for array pin
    00036    shiyer      10/09/02 - Statement caching, Stateless Connection
    00037                           Pooling - UTF16 support. Added NLS versions
    00038                           of getErrorMessage in SQLException
    00039    rvallam     10/11/02 - added native float/double API - get(set) methods
    00040                           for Statement and ResultSet class
    00041    cparampa    09/23/02 - added methods for statement caching
    00042    shiyer      10/01/02 - setVector versions for Windows
    00043    shiyer      07/31/02 - 10iR1, OCCI Globalization support
    00044    cparampa    09/23/02 - added methods for statement caching
    00045    praghuna    09/23/02 - 2333038:Fwd merge to 10i/MAIN
    00046    cparampa    08/26/02 - added class StatelessConnectionPool
    00047                           added create/terminateStatelessConnnectionPool in Env
    00048    vvinay      08/06/02 - XA additions
    00049    vvinay      06/25/02 - fix #2415021: math moved to occiHeapAlloc.h
    00050    aahluwal    06/04/02 - bug 2360115
    00051    vvinay      02/21/02 - operator= added for SQLException
    00052    gayyappa    12/27/01 - add set/getDatabaseNCharParam
    00053    gayyappa    11/22/01 - modify interface to use strings for CharSet
    00054    gayyappa    10/01/01 - call reserve() on vector in set/getVector
    00055    rkasamse    07/30/01 -
    00056    rkasamse    07/26/01 - add env handle attrs - cache max/opt size
    00057    rvallam     07/23/01 - bug 1891228 - added throw() in destructor
    00058                           of SQLException
    00059    rvallam     06/14/01 - replace call to get(set)VectorOfRefs in
    00060                           get(set)Vector for Ref<T> with code in
    00061                           get(set)VectorOfRefs
    00062    rvallam     11/06/01 - renamed internal methods in get/setVector to
    00063                           get(set)VectorOfPObjects/get(set)VectorOfOCIRefs
    00064                           as part of NT porting fix
    00065                           added destructors to SQLException and MetaData
    00066    rvallam     05/03/01 - added const to the vector parameter in setVector
    00067                           of Statement for Ref<T>
    00068    rratnam     04/10/01 - removed references to wstring
    00069    kmohan      04/04/01 - include math.h for WIN32COMMON
    00070    rvallam     04/02/01 - fixed linux porting bug 1654670
    00071    gayyappa    03/27/01 - add code for templated getVector on stmt for objects.
    00072    rvallam     03/20/01 - passed dummy parameter for Type in getVector for
    00073                           void * in statement and ResultSet
    00074    rratnam     03/15/01 - fixed set and getRef / get and setVector for NULL
    00075                           Refs
    00076    rkasamse    03/19/01 - 1676579: HP compilation errors
    00077    rratnam     03/07/01 - derived SQLException from exception, added what()
    00078    chliang     03/05/01 - disable olint
    00079    rvallam     02/23/01 - made getReadSQL/getWriteSQL methods const
    00080    rratnam     01/29/01 - add closeStream() to Statement/ResultSet
    00081    rvallam     01/30/01 - added private method getListType() to
    00082                           MetaData
    00083    rratnam     01/03/01 - removed preTruncationLength() and isTruncated(),
    00084                           added setBinary/CharacterStreamMode()
    00085    rratnam     01/03/01 - added new method setErrorOnBusy in ConnectionPool
    00086    rratnam     12/29/00 - added a createProxyConnection without roles
    00087    gayyappa    12/14/00 - add virtual functions getStatement/getConnection
    00088                           to resultset and statement (fix bug# 1529888)
    00089    gayyappa    12/13/00 - remove setErrorOnTruncate from Statement/resultset.
    00090    rvallam     11/30/00 - removed #define NEVER
    00091    gayyappa    11/17/00 - split get method in Map to getReadSQL
    00092                           and getWriteSQL
    00093    rvallam     10/20/00 - modify cacheflush() to flushCache()
    00094                           added enums to MetaData
    00095    rvallam     09/14/00 - uncomment result set getMetaData method
    00096                           rename it to getColumnListMetaData.
    00097                           add get/set interval methods to stmt.
    00098                           add getinterval methods to resultset.
    00099    gayyappa    08/30/00 - added virtual destructor to occiconnection.
    00100                           add default values to registerOutParam in
    00101                           occistatement.
    00102                           removed get/set vector and anydata in statement.
    00103                           removed Stream header in ifdef directive.
    00104    rvallam     08/10/00 - uncomment gets(), update occiConnection, update
    00105                           Stream
    00106    slari       08/06/00 - add statement stream methods
    00107    slari       08/04/00 - add Statement::getXXX methods
    00108    slari       08/02/00 - add Stream
    00109    rratnam     08/04/00 - put in connection-cloning, proxy connections
    00110    rvallam     08/04/00 - changed metadata header - method signatures
    00111    rkasamse    08/04/00 - add setObject,setRef methods on Statement
    00112    slari       07/27/00 - add Statement::setNull
    00113    slari       07/26/00 - disable getBytes
    00114    slari       07/25/00 - enable getBytes and getRowid
    00115    rratnam     07/25/00 - Conn Pooling changes - added ConnectionPool,
    00116                           Connection, removed Session
    00117                           modified Environment (made getOCIEnvironment(),
    00118                           getMap() and getMode() const,
    00119                           added create/terminateConnectionPool(),
    00120                           added userName and password to createConnection() )
    00121    rkasamse    07/26/00 - uncomment getObject methods
    00122    slari       07/10/00 - enable getString
    00123    slari       07/05/00 - add result set methods
    00124    rkasamse    07/17/00 - add get function to Map
    00125    rratnam     06/16/00 - updated Session::getMetaData() to take the
    00126                           parameter type
    00127    rvallam     06/13/00 - updated MetaData
    00128    rratnam     06/13/00 - added getRef() to Statement
    00129                            and ResultSet,
    00130                            made getOCIError(), getOCIEnvironment()
    00131                            and getOCIServiceContext() in
    00132                            Connection const
    00133    kmohan      05/31/00 - Datamember Session * changed to
    00134                           SessionImpl *
    00135                           in the class MetaData
    00136                           change ORASTRINGSTL to ORASTRING
    00137    slari       05/26/00 - change ORAVECTOR to ORAVECTORSTL
    00138    slari       05/22/00 - add initial Statement class methods
    00139    slari       05/10/00 - enable Connection and Session methods
    00140    slari       04/21/00 - provide trivial implementation for
    00141                           ~Connection
    00142    slari       04/17/00 - make Environment methods abstract
    00143    slari       04/13/00 - add Environment
    00144    gayyappa    04/18/00 - changed defn of SQLException
    00145    kmohan      04/11/00 - added class definitions
    00146    rkasamse    04/03/00 - header (interface) files for OCCI
    00147                           control classes.
    00148    rkasamse    04/03/00 - Creation
    00149
    00150 */
    00151
    00152 #ifndef _olint   /* disable olint check */
    00153
    00154 #ifndef OCCICONTROL_ORACLE
    00155 # define OCCICONTROL_ORACLE
    00156
    00157 #ifndef OCCICOMMON_ORACLE
    00158 #include <occiCommon.h>
    00159 #endif
    00160
    00161 #ifndef ORAEXCEPTION
    00162 #define ORAEXCEPTION
    00163 #include <exception>
    00164 #endif
    00165
    00166 namespace oracle {
    00167 namespace occi {
    00168 /*---------------------------------------------------------------------------
    00169                      PUBLIC TYPES AND CONSTANTS
    00170   ---------------------------------------------------------------------------*/
    00171
    00172 class MetaData
    00173 {
    00174   public :
    00175
    00176       enum AttrId
    00177       {ATTR_PTYPE = OCI_ATTR_PTYPE,
    00178       ATTR_TIMESTAMP = OCI_ATTR_TIMESTAMP,
    00179       ATTR_OBJ_ID = OCI_ATTR_OBJ_ID,
    00180       ATTR_OBJ_NAME = OCI_ATTR_OBJ_NAME,
    00181       ATTR_OBJ_SCHEMA = OCI_ATTR_OBJ_SCHEMA,
    00182       ATTR_OBJID = OCI_ATTR_OBJID,
    00183       ATTR_NUM_COLS = OCI_ATTR_NUM_COLS,
    00184       ATTR_LIST_COLUMNS = OCI_ATTR_LIST_COLUMNS,
    00185       ATTR_REF_TDO = OCI_ATTR_REF_TDO,
    00186       ATTR_IS_TEMPORARY = OCI_ATTR_IS_TEMPORARY,
    00187       ATTR_IS_TYPED = OCI_ATTR_IS_TYPED,
    00188       ATTR_DURATION = OCI_ATTR_DURATION,
    00189       ATTR_COLLECTION_ELEMENT = OCI_ATTR_COLLECTION_ELEMENT,
    00190       ATTR_RDBA = OCI_ATTR_RDBA,
    00191       ATTR_TABLESPACE = OCI_ATTR_TABLESPACE,
    00192       ATTR_CLUSTERED = OCI_ATTR_CLUSTERED,
    00193       ATTR_PARTITIONED = OCI_ATTR_PARTITIONED,
    00194       ATTR_INDEX_ONLY = OCI_ATTR_INDEX_ONLY,
    00195       ATTR_LIST_ARGUMENTS = OCI_ATTR_LIST_ARGUMENTS,
    00196       ATTR_IS_INVOKER_RIGHTS = OCI_ATTR_IS_INVOKER_RIGHTS,
    00197       ATTR_LIST_SUBPROGRAMS = OCI_ATTR_LIST_SUBPROGRAMS,
    00198       ATTR_NAME = OCI_ATTR_NAME,
    00199       ATTR_OVERLOAD_ID = OCI_ATTR_OVERLOAD_ID,
    00200       ATTR_TYPECODE = OCI_ATTR_TYPECODE,
    00201       ATTR_COLLECTION_TYPECODE = OCI_ATTR_COLLECTION_TYPECODE,
    00202       ATTR_VERSION = OCI_ATTR_VERSION,
    00203       ATTR_IS_INCOMPLETE_TYPE = OCI_ATTR_IS_INCOMPLETE_TYPE,
    00204       ATTR_IS_SYSTEM_TYPE = OCI_ATTR_IS_SYSTEM_TYPE,
    00205       ATTR_IS_PREDEFINED_TYPE = OCI_ATTR_IS_PREDEFINED_TYPE,
    00206       ATTR_IS_TRANSIENT_TYPE = OCI_ATTR_IS_TRANSIENT_TYPE,
    00207       ATTR_IS_SYSTEM_GENERATED_TYPE =
    00208               OCI_ATTR_IS_SYSTEM_GENERATED_TYPE,
    00209       ATTR_HAS_NESTED_TABLE = OCI_ATTR_HAS_NESTED_TABLE,
    00210       ATTR_HAS_LOB = OCI_ATTR_HAS_LOB,
    00211       ATTR_HAS_FILE = OCI_ATTR_HAS_FILE,
    00212       ATTR_NUM_TYPE_ATTRS = OCI_ATTR_NUM_TYPE_ATTRS,
    00213       ATTR_LIST_TYPE_ATTRS = OCI_ATTR_LIST_TYPE_ATTRS,
    00214       ATTR_NUM_TYPE_METHODS = OCI_ATTR_NUM_TYPE_METHODS,
    00215       ATTR_LIST_TYPE_METHODS = OCI_ATTR_LIST_TYPE_METHODS,
    00216       ATTR_MAP_METHOD = OCI_ATTR_MAP_METHOD,
    00217       ATTR_ORDER_METHOD = OCI_ATTR_ORDER_METHOD,
    00218       ATTR_DATA_SIZE = OCI_ATTR_DATA_SIZE,
    00219       ATTR_DATA_TYPE = OCI_ATTR_DATA_TYPE,
    00220       ATTR_PRECISION = OCI_ATTR_PRECISION,
    00221       ATTR_SCALE = OCI_ATTR_SCALE,
    00222       ATTR_TYPE_NAME = OCI_ATTR_TYPE_NAME,
    00223       ATTR_SCHEMA_NAME = OCI_ATTR_SCHEMA_NAME,
    00224       ATTR_CHARSET_ID = OCI_ATTR_CHARSET_ID,
    00225       ATTR_CHARSET_FORM = OCI_ATTR_CHARSET_FORM,
    00226       ATTR_ENCAPSULATION = OCI_ATTR_ENCAPSULATION,
    00227       ATTR_IS_CONSTRUCTOR = OCI_ATTR_IS_CONSTRUCTOR,
    00228       ATTR_IS_DESTRUCTOR = OCI_ATTR_IS_DESTRUCTOR,
    00229       ATTR_IS_OPERATOR = OCI_ATTR_IS_OPERATOR,
    00230       ATTR_IS_SELFISH = OCI_ATTR_IS_SELFISH,
    00231       ATTR_IS_MAP = OCI_ATTR_IS_MAP,
    00232       ATTR_IS_ORDER = OCI_ATTR_IS_ORDER,
    00233       ATTR_IS_RNDS = OCI_ATTR_IS_RNDS,
    00234       ATTR_IS_RNPS = OCI_ATTR_IS_RNPS,
    00235       ATTR_IS_WNDS = OCI_ATTR_IS_WNDS,
    00236       ATTR_IS_WNPS = OCI_ATTR_IS_WNPS,
    00237       ATTR_NUM_ELEMS = OCI_ATTR_NUM_ELEMS,
    00238       ATTR_LINK = OCI_ATTR_LINK,
    00239       ATTR_MIN = OCI_ATTR_MIN,
    00240       ATTR_MAX = OCI_ATTR_MAX,
    00241       ATTR_INCR = OCI_ATTR_INCR,
    00242       ATTR_CACHE = OCI_ATTR_CACHE,
    00243       ATTR_ORDER = OCI_ATTR_ORDER,
    00244       ATTR_HW_MARK  = OCI_ATTR_HW_MARK,
    00245       ATTR_IS_NULL = OCI_ATTR_IS_NULL,
    00246       ATTR_POSITION = OCI_ATTR_POSITION,
    00247       ATTR_HAS_DEFAULT =  OCI_ATTR_HAS_DEFAULT,
    00248       ATTR_LEVEL = OCI_ATTR_LEVEL,
    00249       ATTR_IOMODE = OCI_ATTR_IOMODE,
    00250       ATTR_RADIX = OCI_ATTR_RADIX,
    00251       ATTR_SUB_NAME = OCI_ATTR_SUB_NAME,
    00252       ATTR_LIST_OBJECTS = OCI_ATTR_LIST_OBJECTS,
    00253       ATTR_NCHARSET_ID = OCI_ATTR_NCHARSET_ID,
    00254       ATTR_LIST_SCHEMAS = OCI_ATTR_LIST_SCHEMAS,
    00255       ATTR_MAX_PROC_LEN = OCI_ATTR_MAX_PROC_LEN,
    00256       ATTR_MAX_COLUMN_LEN = OCI_ATTR_MAX_COLUMN_LEN,
    00257       ATTR_CURSOR_COMMIT_BEHAVIOR =
    00258           OCI_ATTR_CURSOR_COMMIT_BEHAVIOR,
    00259       ATTR_MAX_CATALOG_NAMELEN = OCI_ATTR_MAX_CATALOG_NAMELEN,
    00260       ATTR_CATALOG_LOCATION = OCI_ATTR_CATALOG_LOCATION,
    00261       ATTR_SAVEPOINT_SUPPORT =  OCI_ATTR_SAVEPOINT_SUPPORT,
    00262       ATTR_NOWAIT_SUPPORT =  OCI_ATTR_NOWAIT_SUPPORT,
    00263       ATTR_AUTOCOMMIT_DDL =  OCI_ATTR_AUTOCOMMIT_DDL,
    00264       ATTR_LOCKING_MODE =  OCI_ATTR_LOCKING_MODE,
    00265       ATTR_IS_FINAL_TYPE = OCI_ATTR_IS_FINAL_TYPE,
    00266       ATTR_IS_INSTANTIABLE_TYPE = OCI_ATTR_IS_INSTANTIABLE_TYPE,
    00267       ATTR_IS_SUBTYPE = OCI_ATTR_IS_SUBTYPE,
    00268       ATTR_SUPERTYPE_SCHEMA_NAME = OCI_ATTR_SUPERTYPE_SCHEMA_NAME,
    00269       ATTR_SUPERTYPE_NAME = OCI_ATTR_SUPERTYPE_NAME,
    00270       ATTR_FSPRECISION = OCI_ATTR_FSPRECISION,
    00271       ATTR_LFPRECISION = OCI_ATTR_LFPRECISION,
    00272       ATTR_IS_FINAL_METHOD = OCI_ATTR_IS_FINAL_METHOD,
    00273       ATTR_IS_INSTANTIABLE_METHOD = OCI_ATTR_IS_INSTANTIABLE_METHOD,
    00274       ATTR_IS_OVERRIDING_METHOD = OCI_ATTR_IS_OVERRIDING_METHOD,
    00275       ATTR_CHAR_USED = OCI_ATTR_CHAR_USED,
    00276       ATTR_CHAR_SIZE = OCI_ATTR_CHAR_SIZE
    00277      };
    00278
    00279      enum ParamType
    00280          {
    00281            PTYPE_TABLE = OCI_PTYPE_TABLE
    00282           ,PTYPE_VIEW = OCI_PTYPE_VIEW
    00283           ,PTYPE_PROC = OCI_PTYPE_PROC
    00284           ,PTYPE_FUNC = OCI_PTYPE_FUNC
    00285           ,PTYPE_PKG = OCI_PTYPE_PKG
    00286           ,PTYPE_TYPE = OCI_PTYPE_TYPE
    00287           ,PTYPE_TYPE_ATTR = OCI_PTYPE_TYPE_ATTR
    00288           ,PTYPE_TYPE_COLL = OCI_PTYPE_TYPE_COLL
    00289           ,PTYPE_TYPE_METHOD = OCI_PTYPE_TYPE_METHOD
    00290           ,PTYPE_SYN = OCI_PTYPE_SYN
    00291           ,PTYPE_SEQ = OCI_PTYPE_SEQ
    00292           ,PTYPE_COL = OCI_PTYPE_COL
    00293           ,PTYPE_ARG = OCI_PTYPE_ARG
    00294           ,PTYPE_TYPE_ARG = OCI_PTYPE_TYPE_ARG
    00295           ,PTYPE_TYPE_RESULT = OCI_PTYPE_TYPE_RESULT
    00296           ,PTYPE_SCHEMA = OCI_PTYPE_SCHEMA
    00297           ,PTYPE_DATABASE = OCI_PTYPE_DATABASE
    00298           ,PTYPE_UNK = OCI_PTYPE_UNK
    00299          };
    00300
    00301
    00302      enum { DURATION_SESSION = OCI_DURATION_SESSION
    00303           ,DURATION_TRANS = OCI_DURATION_TRANS
    00304           ,DURATION_NULL = OCI_DURATION_NULL
    00305           ,TYPEENCAP_PRIVATE = OCI_TYPEENCAP_PRIVATE
    00306           ,TYPEENCAP_PUBLIC = OCI_TYPEENCAP_PUBLIC
    00307           ,TYPEPARAM_IN = OCI_TYPEPARAM_IN
    00308           ,TYPEPARAM_OUT = OCI_TYPEPARAM_OUT
    00309           ,TYPEPARAM_INOUT = OCI_TYPEPARAM_INOUT
    00310           ,CURSOR_OPEN = OCI_CURSOR_OPEN
    00311           ,CURSOR_CLOSED = OCI_CURSOR_CLOSED
    00312           ,CL_START = OCI_CL_START
    00313           ,CL_END = OCI_CL_END
    00314           ,SP_SUPPORTED = OCI_SP_SUPPORTED
    00315           ,SP_UNSUPPORTED = OCI_SP_UNSUPPORTED
    00316           ,NW_SUPPORTED = OCI_NW_SUPPORTED
    00317           ,NW_UNSUPPORTED = OCI_NW_UNSUPPORTED
    00318           ,AC_DDL = OCI_AC_DDL
    00319           ,NO_AC_DDL = OCI_NO_AC_DDL
    00320           ,LOCK_IMMEDIATE = OCI_LOCK_IMMEDIATE
    00321           ,LOCK_DELAYED = OCI_LOCK_DELAYED
    00322          };
    00323
    00324       MetaData(const MetaData &omd);
    00325       unsigned int getAttributeCount() const
    00326       ;
    00327       AttrId getAttributeId(unsigned int attributenum) const
    00328       ;
    00329       Type getAttributeType(unsigned int attributenum) const
    00330       ;
    00331       int getInt(MetaData::AttrId attrid) const
    00332       ;
    00333       bool getBoolean(MetaData::AttrId attrid) const
    00334       ;
    00335       unsigned int getUInt(MetaData::AttrId attrid) const
    00336       ;
    00337       OCCI_STD_NAMESPACE::string getString(MetaData::AttrId attrid) const
    00338       ;
    00339       UString getUString(MetaData::AttrId attrid) const
    00340       ;
    00341       Number getNumber(MetaData::AttrId attrid) const
    00342       ;
    00343       RefAny getRef(MetaData::AttrId attrid) const
    00344       ;
    00345       Timestamp getTimestamp(MetaData::AttrId attrid) const
    00346       ;
    00347       MetaData getMetaData(MetaData::AttrId attrid) const
    00348       ;
    00349       OCCI_STD_NAMESPACE::vector<MetaData> getVector(MetaData::AttrId attrid)
    00350       const ;
    00351       void  operator  =(const MetaData &omd);
    00352
    00353       ~MetaData();
    00354
    00355    private:
    00356
    00357   enum ociAttrType { OCI_UB1,
    00358                          OCI_UB2,
    00359                          OCI_UB4,
    00360                          OCI_SB1,
    00361                          OCI_WORD,
    00362                          OCI_UB1_BOOL,
    00363                          OCI_UB1PTR_TIMESTAMP,
    00364                          OCI_UB1PTR_NUMBER,
    00365                          OCI_TEXTPTR,
    00366                          OCI_DVOIDPTR_PARAM,
    00367                          OCI_DVOIDPTR_PARAMLIST,
    00368                          OCI_OCIREFPTR,
    00369                          OCI_OCIDURATION,
    00370                          OCI_OCITYPECODE,
    00371                          OCI_OCITYPEENCAP,
    00372                          OCI_OCITYPEPARAMMODE,
    00373                          OCI_OCIPRECISION
    00374                       };
    00375
    00376   enum AttrCount {COMMON_ATTR_COUNT = 5,
    00377         TABLE_ATTR_COUNT = 12,
    00378         VIEW_ATTR_COUNT = 7,
    00379         FUNCPROC_ATTR_COUNT = 4,
    00380         PKG_ATTR_COUNT = 2,
    00381         TYP_ATTR_COUNT = 27,
    00382         TYPEATTR_ATTR_COUNT = 14,
    00383         TYPEMTHD_ATTR_COUNT = 16,
    00384         COLL_ATTR_COUNT = 12,
    00385         SYN_ATTR_COUNT = 4,
    00386         SEQ_ATTR_COUNT = 7,
    00387         COL_ATTR_COUNT = 13,
    00388         ARG_TYPARG_TYPRES_ATTR_COUNT = 20,
    00389         SCHEMA_ATTR_COUNT = 1,
    00390         DATABASE_ATTR_COUNT = 13,
    00391         UNK_ATTR_COUNT = 0
    00392         };
    00393
    00394   static const AttrId commonAttrId[COMMON_ATTR_COUNT];
    00395   static const ociAttrType commonAttrType[COMMON_ATTR_COUNT];
    00396   static const AttrId tableAttrId[TABLE_ATTR_COUNT];
    00397   static const ociAttrType tableAttrType[TABLE_ATTR_COUNT];
    00398   static const AttrId viewAttrId[VIEW_ATTR_COUNT];
    00399   static const ociAttrType viewAttrType[VIEW_ATTR_COUNT];
    00400   static const AttrId funcprocAttrId[FUNCPROC_ATTR_COUNT];
    00401   static const ociAttrType funcprocAttrType[FUNCPROC_ATTR_COUNT];
    00402   static const AttrId pkgAttrId[PKG_ATTR_COUNT];
    00403   static const ociAttrType pkgAttrType[PKG_ATTR_COUNT];
    00404   static const AttrId typAttrId[TYP_ATTR_COUNT];
    00405   static const ociAttrType typAttrType[TYP_ATTR_COUNT];
    00406   static const AttrId typeattrAttrId[TYPEATTR_ATTR_COUNT];
    00407   static const ociAttrType typeattrAttrType[TYPEATTR_ATTR_COUNT];
    00408   static const AttrId typmethdAttrId[TYPEMTHD_ATTR_COUNT];
    00409   static const ociAttrType typemthdAttrType[TYPEMTHD_ATTR_COUNT];
    00410   static const AttrId collAttrId[COLL_ATTR_COUNT];
    00411   static const ociAttrType collAttrType[COLL_ATTR_COUNT];
    00412   static const AttrId synAttrId[SYN_ATTR_COUNT];
    00413   static const ociAttrType synAttrType[SYN_ATTR_COUNT];
    00414   static const AttrId seqAttrId[SEQ_ATTR_COUNT];
    00415   static const ociAttrType seqAttrType[SEQ_ATTR_COUNT];
    00416   static const AttrId colAttrId[COL_ATTR_COUNT];
    00417   static const ociAttrType colAttrType[COL_ATTR_COUNT];
    00418   static const AttrId argtargtresAttrId[ARG_TYPARG_TYPRES_ATTR_COUNT];
    00419   static const ociAttrType argtargtresAttrType[
    00420                    ARG_TYPARG_TYPRES_ATTR_COUNT];
    00421   static const AttrId schemaAttrId[SCHEMA_ATTR_COUNT];
    00422   static const ociAttrType schemaAttrType[SCHEMA_ATTR_COUNT];
    00423   static const AttrId databaseAttrId[DATABASE_ATTR_COUNT];
    00424   static const ociAttrType databaseAttrType[DATABASE_ATTR_COUNT];
    00425
    00426   Ptr<MetaDataImpl> metaDataImplPtr;
    00427   const OCIParam* paramhp;
    00428   const ConnectionImpl* sesn;
    00429   const AttrId* attrIdArray;
    00430   const ociAttrType* attrTypeArray;
    00431   AttrCount attrCount;
    00432
    00433   MetaData(const Connection *sessp, const OCCI_STD_NAMESPACE::string& objName,
    00434   ParamType prmtyp ) ;
    00435   MetaData(const Connection *sessp, const UString& objName,
    00436   ParamType prmtyp ) ;
    00437   MetaData(const Connection *sessp,
    00438   const RefAny& ref) ;
    00439   MetaData(const Connection *sessp, MetaDataImpl *implPtr,
    00440   OCIParam* parm) ;
    00441   MetaData(const Connection *sessp, MetaDataImpl *implPtr,
    00442   OCIParam *parm, ub1 parmTyp) ;
    00443   ub1 getParamType(OCIParam* prm) const ;
    00444   const AttrId* getAttrIdArrayAddr(ub1 prmTyp) const;
    00445   const ociAttrType* getAttrTypeArrayAddr(ub1 prmTyp) const;
    00446   AttrCount getAttrCount(ub1 prmTyp) const;
    00447   Type getType(ociAttrType typ) const;
    00448   bool isListTypeAttribute(AttrId attrid,ub1 ptyp) const;
    00449   boolean isInvalidAttrId(AttrId attrid,sb4* pos,
    00450             boolean* isTypeSpecificAttrPtr) const;
    00451   ociAttrType getValidAttrType(sb4 index, boolean isTypeSpecificAttr)
    00452   const;
    00453
    00454   int getListType (const OCIParam *plist) const;
    00455   unsigned int getLowerBound(int ltype) const;
    00456   unsigned int getUpperBound(unsigned int ltype,
    00457     unsigned int paramnum) const;
    00458   friend class ConnectionImpl;
    00459   friend class ResultSetImpl;
    00460
    00461 };
    00462
    00463 class Connection
    00464 {
    00465    public :
    00466
    00467       // specifies the type of proxy to be created,
    00468       // used for future enhancements
    00469       enum ProxyType
    00470       {PROXY_DEFAULT
    00471       };
    00472
    00473       virtual ~Connection() { }
    00474       virtual Statement* createStatement(
    00475         const OCCI_STD_NAMESPACE::string  &sql = "")
    00476          =0;
    00477       virtual void terminateStatement(Statement *statement) =0;
    00478       virtual void commit()  =0;
    00479       virtual void rollback()  =0;
    00480       virtual MetaData getMetaData(const OCCI_STD_NAMESPACE::string &object,
    00481         MetaData::ParamType prmtyp
    00482         = MetaData::PTYPE_UNK) const
    00483          =0;
    00484       virtual MetaData getMetaData(const RefAny &ref) const
    00485          =0;
    00486       virtual OCCI_STD_NAMESPACE::string getClientCharSet() const
    00487          =0;
    00488       virtual OCCI_STD_NAMESPACE::string getClientNCHARCharSet() const
    00489          =0;
    00490       virtual void changePassword(const OCCI_STD_NAMESPACE::string &user,
    00491         const OCCI_STD_NAMESPACE::string &oldPassword,
    00492         const OCCI_STD_NAMESPACE::string &newPassword)
    00493          =0;
    00494       virtual void flushCache()  =0;
    00495
    00496       virtual OCIServer*  getOCIServer() const =0;
    00497       virtual OCISvcCtx*  getOCIServiceContext() const =0;
    00498       virtual OCISession* getOCISession() const =0;
    00499
    00500       //new interfaces
    00501
    00502       virtual Statement* createStatement(const UString &sql) = 0;
    00503       virtual MetaData getMetaData(const UString &object,
    00504         MetaData::ParamType prmtyp
    00505         = MetaData::PTYPE_UNK) const
    00506          =0;
    00507       virtual UString getClientCharSetUString() const
    00508          =0;
    00509       virtual UString getClientNCHARCharSetUString() const
    00510          =0;
    00511       virtual void changePassword(const UString &user,
    00512         const UString &oldPassword,
    00513         const UString &newPassword)
    00514          =0;
    00515       virtual OCCI_STD_NAMESPACE::string getTag() const =0;
    00516       virtual void setStmtCacheSize(unsigned int cacheSize) = 0;
    00517       virtual unsigned int getStmtCacheSize() const =0;
    00518       virtual Statement* createStatement(const OCCI_STD_NAMESPACE::string &sql,
    00519                     const OCCI_STD_NAMESPACE::string &tag) = 0;
    00520       virtual void terminateStatement(Statement* stmt,
    00521                     const OCCI_STD_NAMESPACE::string &tag) = 0;
    00522       virtual bool isCached(const OCCI_STD_NAMESPACE::string &sql,
    00523                     const OCCI_STD_NAMESPACE::string &tag = "") = 0;
    00524       virtual void registerSubscriptions(
    00525        const OCCI_STD_NAMESPACE::vector<aq::Subscription>& sub) =0;
    00526       virtual void unregisterSubscription(const aq::Subscription& sub) =0;
    00527       virtual void postToSubscriptions(
    00528        const OCCI_STD_NAMESPACE::vector<aq::Subscription>& sub) =0;
    00529       virtual Statement* createStatement(const UString &sql,
    00530                     const UString &tag) = 0;
    00531       virtual void terminateStatement(Statement* stmt,
    00532                     const UString &tag) = 0;
    00533       virtual bool isCached(const UString &sql,
    00534                     const UString &tag) = 0;
    00535 };
    00536
    00537 class StatelessConnectionPool
    00538 {
    00539   public :
    00540
    00541     enum PoolType
    00542     {
    00543       HETEROGENEOUS = OCI_DEFAULT,
    00544       HOMOGENEOUS = OCI_SPC_HOMOGENEOUS
    00545     };
    00546
    00547     enum BusyOption
    00548     {
    00549        WAIT = OCI_SPOOL_ATTRVAL_WAIT,
    00550        NOWAIT = OCI_SPOOL_ATTRVAL_NOWAIT,
    00551        FORCEGET = OCI_SPOOL_ATTRVAL_FORCEGET
    00552     };
    00553
    00554     enum DestroyMode
    00555     {
    00556        DEFAULT = OCI_DEFAULT,
    00557        SPD_FORCE = OCI_SPD_FORCE
    00558     };
    00559
    00560     virtual ~StatelessConnectionPool() {}
    00561     virtual unsigned int getBusyConnections() const =0;
    00562     virtual unsigned int getOpenConnections() const =0;
    00563     virtual unsigned int getMinConnections() const =0;
    00564     virtual unsigned int getMaxConnections() const =0;
    00565     virtual unsigned int getIncrConnections() const =0;
    00566     virtual OCCI_STD_NAMESPACE::string getPoolName() const =0;
    00567     virtual unsigned int getTimeOut() const =0;
    00568     virtual void setBusyOption(BusyOption busyOption) =0;
    00569     virtual BusyOption getBusyOption() const =0;
    00570     virtual void setTimeOut(unsigned int connTimeOut =0) =0;
    00571     virtual void setPoolSize(unsigned int maxConn =1,
    00572       unsigned int minConn =0, unsigned int incrConn =1) =0;
    00573     virtual Connection* getConnection(
    00574       const OCCI_STD_NAMESPACE::string &tag ="") =0;
    00575     virtual Connection* getConnection(
    00576       const OCCI_STD_NAMESPACE::string &userName,
    00577       const OCCI_STD_NAMESPACE::string &password,
    00578       const OCCI_STD_NAMESPACE::string &tag = "") =0;
    00579     virtual Connection* getAnyTaggedConnection(
    00580       const OCCI_STD_NAMESPACE::string &tag = "") =0;
    00581     virtual Connection* getAnyTaggedConnection(
    00582       const OCCI_STD_NAMESPACE::string &userName,
    00583       const OCCI_STD_NAMESPACE::string &Password,
    00584       const OCCI_STD_NAMESPACE::string &tag = "") =0;
    00585     virtual Connection* getProxyConnection(
    00586       const OCCI_STD_NAMESPACE::string &name,
    00587       OCCI_STD_NAMESPACE::string roles[], unsigned int numRoles,
    00588       const OCCI_STD_NAMESPACE::string &tag = "",
    00589       Connection::ProxyType proxyType = Connection::PROXY_DEFAULT) =0;
    00590     virtual Connection* getProxyConnection(
    00591       const OCCI_STD_NAMESPACE::string &name,
    00592       const OCCI_STD_NAMESPACE::string &tag = "" ,
    00593       Connection::ProxyType proxyType = Connection::PROXY_DEFAULT) =0;
    00594     virtual Connection* getAnyTaggedProxyConnection(
    00595       const OCCI_STD_NAMESPACE::string &name,
    00596       OCCI_STD_NAMESPACE::string roles[], unsigned int numRoles,
    00597       const OCCI_STD_NAMESPACE::string &tag = "",
    00598       Connection::ProxyType proxyType = Connection::PROXY_DEFAULT) =0;
    00599     virtual Connection* getAnyTaggedProxyConnection(
    00600       const OCCI_STD_NAMESPACE::string &name,
    00601       const OCCI_STD_NAMESPACE::string &tag="",
    00602       Connection::ProxyType proxyType = Connection::PROXY_DEFAULT ) =0;
    00603     virtual void releaseConnection (Connection *connection,
    00604       const OCCI_STD_NAMESPACE::string &tag = "") =0;
    00605     virtual void terminateConnection (Connection *connection) =0;
    00606     virtual void setStmtCacheSize(unsigned int cacheSize) =0;
    00607     virtual unsigned int getStmtCacheSize() const =0;
    00608
    00609     virtual Connection* getConnection(const UString &tag)=0;
    00610     virtual Connection* getConnection(const UString &userName,
    00611       const UString &password,
    00612       const UString &tag)=0;
    00613     virtual Connection* getAnyTaggedConnection(const UString &tag)=0;
    00614     virtual Connection* getAnyTaggedConnection( const UString &userName,
    00615       const UString &Password, const UString &tag)=0 ;
    00616     virtual Connection* getProxyConnection(const UString &name,
    00617       OCCI_STD_NAMESPACE::string roles[], unsigned int numRoles,
    00618       const UString &tag,
    00619       Connection::ProxyType proxyType = Connection::PROXY_DEFAULT)=0;
    00620     virtual Connection* getProxyConnection(const UString &name,
    00621       const UString &tag, Connection::ProxyType
    00622       proxyType = Connection::PROXY_DEFAULT)=0;
    00623     virtual Connection* getAnyTaggedProxyConnection(const UString &name,
    00624       OCCI_STD_NAMESPACE::string roles[], unsigned int numRoles,
    00625       const UString &tag,
    00626       Connection::ProxyType proxyType = Connection::PROXY_DEFAULT)=0;
    00627     virtual Connection* getAnyTaggedProxyConnection(const UString &name,
    00628       const UString &tag,
    00629       Connection::ProxyType proxyType = Connection::PROXY_DEFAULT )=0;
    00630     virtual void releaseConnection(Connection *connection,
    00631       const UString  &tag)=0;
    00632
    00633 };
    00634
    00635
    00636 class ConnectionPool
    00637 {
    00638   public :
    00639
    00640     virtual ~ConnectionPool() {}
    00641     virtual unsigned int getBusyConnections() const
    00642        =0;
    00643     virtual unsigned int getOpenConnections() const
    00644        =0;
    00645     virtual unsigned int getMinConnections() const
    00646        =0;
    00647     virtual unsigned int getMaxConnections() const
    00648        =0;
    00649     virtual unsigned int getIncrConnections() const
    00650        =0;
    00651     virtual OCCI_STD_NAMESPACE::string getPoolName() const
    00652        =0;
    00653     virtual unsigned int getTimeOut() const
    00654        =0;
    00655     virtual void setErrorOnBusy()
    00656        =0;
    00657     virtual void setTimeOut(unsigned int connTimeOut =0)
    00658        =0;
    00659     virtual void setPoolSize(unsigned int minConn =0,
    00660       unsigned int maxConn =1, unsigned int incrConn =1)
    00661        =0;
    00662     virtual Connection* createConnection(
    00663       const OCCI_STD_NAMESPACE::string &userName,
    00664       const OCCI_STD_NAMESPACE::string &password)  =0;
    00665
    00666     virtual Connection* createProxyConnection(
    00667       const OCCI_STD_NAMESPACE::string &name,
    00668       OCCI_STD_NAMESPACE::string roles[], unsigned int numRoles,
    00669       Connection::ProxyType proxyType =
    00670       Connection::PROXY_DEFAULT)  =0;
    00671
    00672     virtual Connection* createProxyConnection(
    00673       const OCCI_STD_NAMESPACE::string &name,
    00674       Connection::ProxyType proxyType =
    00675       Connection::PROXY_DEFAULT)  =0;
    00676
    00677     virtual void terminateConnection
    00678       (Connection *connection) =0;
    00679
    00680     //new interfaces
    00681
    00682     virtual Connection* createConnection(
    00683       const UString &userName,
    00684       const UString &password)  =0;
    00685
    00686     virtual Connection* createProxyConnection(const UString &name,
    00687       OCCI_STD_NAMESPACE::string roles[], unsigned int numRoles,
    00688       Connection::ProxyType proxyType =
    00689       Connection::PROXY_DEFAULT)  =0;
    00690
    00691     virtual Connection* createProxyConnection(const UString &name,
    00692       Connection::ProxyType proxyType =
    00693       Connection::PROXY_DEFAULT)  =0;
    00694
    00695     virtual void setStmtCacheSize(unsigned int cacheSize) =0;
    00696     virtual unsigned int getStmtCacheSize() const =0;
    00697
    00698     virtual UString getPoolNameUString() const
    00699        =0;
    00700 };
    00701
    00702 class   Environment
    00703 {
    00704  public:
    00705                     // class constants
    00706
    00707   enum Mode
    00708   {
    00709     DEFAULT = OCI_DEFAULT,
    00710     OBJECT = OCI_OBJECT,
    00711     SHARED = OCI_SHARED,
    00712     NO_USERCALLBACKS = OCI_NO_UCB,
    00713     THREADED_MUTEXED = OCI_THREADED,
    00714     THREADED_UNMUTEXED = OCI_THREADED | OCI_ENV_NO_MUTEX,
    00715     EVENTS = OCI_EVENTS,
    00716     USE_LDAP = OCI_USE_LDAP
    00717   };
    00718
    00719   virtual ~Environment(){}
    00720
    00721                     // public methods
    00722
    00723   static Environment * createEnvironment(
    00724                               Mode mode = DEFAULT,
    00725                               void *ctxp = 0,
    00726                               void *(*malocfp)(void *ctxp, size_t size) = 0,
    00727                               void *(*ralocfp)(void *ctxp, void *memptr,
    00728                                                size_t newsize) = 0,
    00729                               void (*mfreefp)(void *ctxp, void *memptr) = 0);
    00730
    00731   static Environment * createEnvironment(
    00732                               const OCCI_STD_NAMESPACE::string &charset,
    00733                               const OCCI_STD_NAMESPACE::string &ncharset,
    00734                               Mode mode = DEFAULT,
    00735                               void *ctxp = 0,
    00736                               void *(*malocfp)(void *ctxp, size_t size) = 0,
    00737                               void *(*ralocfp)(void *ctxp, void *memptr,
    00738                                                size_t newsize) = 0,
    00739                               void (*mfreefp)(void *ctxp, void *memptr) = 0);
    00740
    00741   static void terminateEnvironment(Environment *env);
    00742
    00743   static Environment* getXAEnvironment(const
    00744                            OCCI_STD_NAMESPACE::string& dbname);
    00745
    00746   static void releaseXAEnvironment(Environment *env);
    00747
    00748   virtual Connection * createConnection(
    00749     const OCCI_STD_NAMESPACE::string &userName,
    00750     const OCCI_STD_NAMESPACE::string &password,
    00751     const OCCI_STD_NAMESPACE::string &connectString = "") = 0;
    00752
    00753   virtual void terminateConnection(Connection *connection) = 0;
    00754
    00755   virtual ConnectionPool* createConnectionPool(
    00756     const OCCI_STD_NAMESPACE::string &poolUserName,
    00757     const OCCI_STD_NAMESPACE::string &poolPassword,
    00758     const OCCI_STD_NAMESPACE::string &connectString ="",
    00759     unsigned int minConn =0,
    00760     unsigned int maxConn =1, unsigned int incrConn =1) = 0;
    00761
    00762   virtual void terminateConnectionPool(ConnectionPool *poolp) = 0;
    00763
    00764   virtual unsigned int getCurrentHeapSize() const = 0;
    00765
    00766   virtual OCIEnv * getOCIEnvironment() const = 0;
    00767
    00768   virtual Map *getMap() const = 0;
    00769
    00770   virtual void setCacheMaxSize(unsigned int maxSize) = 0;
    00771
    00772   virtual unsigned int getCacheMaxSize() const = 0;
    00773
    00774   virtual void setCacheOptSize(unsigned int OptSize) = 0;
    00775
    00776   virtual unsigned int getCacheOptSize() const = 0;
    00777
    00778
    00779   //new interfaces
    00780
    00781   virtual Connection * createConnection(const UString &userName,
    00782     const UString &password, const UString &connectString) = 0;
    00783
    00784   virtual ConnectionPool* createConnectionPool(
    00785     const UString &poolUserName,
    00786     const UString &poolPassword, const UString &connectString,
    00787     unsigned int minConn =0,
    00788     unsigned int maxConn =1, unsigned int incrConn =1) = 0;
    00789
    00790   virtual Connection* getXAConnection(const
    00791                            OCCI_STD_NAMESPACE::string& dbname) = 0;
    00792
    00793   virtual void releaseXAConnection(Connection* conn) =0;
    00794
    00795   virtual StatelessConnectionPool* createStatelessConnectionPool(
    00796     const OCCI_STD_NAMESPACE::string &poolUserName,
    00797     const OCCI_STD_NAMESPACE::string &poolPassword,
    00798     const OCCI_STD_NAMESPACE::string &connectString = "",
    00799     unsigned int maxConn = 1, unsigned int minConn = 0,
    00800     unsigned int incrConn = 1,
    00801     StatelessConnectionPool::PoolType pType
    00802                                  = StatelessConnectionPool::HETEROGENEOUS) = 0;
    00803
    00804   virtual StatelessConnectionPool* createStatelessConnectionPool(
    00805     const UString &poolUserName,
    00806     const UString &poolPassword,
    00807     const UString &connectString,
    00808     unsigned int maxConn = 1, unsigned int minConn = 0,
    00809     unsigned int incrConn = 1,
    00810     StatelessConnectionPool::PoolType pType
    00811                                  = StatelessConnectionPool::HETEROGENEOUS) = 0;
    00812
    00813   virtual void terminateStatelessConnectionPool(StatelessConnectionPool *poolp,
    00814   StatelessConnectionPool::DestroyMode mode = StatelessConnectionPool::DEFAULT)
    00815       = 0;
    00816   virtual void setLDAPAuthentication(unsigned int mode) =0;
    00817
    00818   virtual unsigned int getLDAPAuthentication() const =0;
    00819
    00820   virtual void setLDAPLoginNameAndPassword(
    00821      const OCCI_STD_NAMESPACE::string &login,
    00822      const OCCI_STD_NAMESPACE::string &passwd) =0;
    00823
    00824   virtual void setLDAPAdminContext(const OCCI_STD_NAMESPACE::string &ctx)=0;
    00825
    00826   virtual OCCI_STD_NAMESPACE::string getLDAPAdminContext() const =0;
    00827
    00828   virtual void setLDAPHostAndPort(const OCCI_STD_NAMESPACE::string &host,
    00829      unsigned int port) =0;
    00830
    00831   virtual OCCI_STD_NAMESPACE::string getLDAPHost() const =0;
    00832
    00833   virtual unsigned int getLDAPPort() const =0;
    00834
    00835   virtual void registerSubscriptions(
    00836      const OCCI_STD_NAMESPACE::vector<aq::Subscription>& sub) =0;
    00837
    00838   virtual void unregisterSubscription(const aq::Subscription& sub) =0;
    00839
    00840   virtual void enableSubscription(const aq::Subscription& sub) =0;
    00841
    00842   virtual void disableSubscription(const aq::Subscription& sub) =0;
    00843
    00844   virtual bool getCacheSortedFlush() const = 0;
    00845
    00846   virtual void setCacheSortedFlush(bool flag) = 0;
    00847
    00848   private:
    00849
    00850 };
    00851
    00852
    00853
    00854 class Map
    00855 {
    00856  public:
    00857
    00858   virtual ~Map(){}
    00859   virtual void put(const OCCI_STD_NAMESPACE::string&, void *(*)(void *),
    00860                 void (*)(void *, void *)) = 0;
    00861   virtual void getReadSQL(
    00862     void *, unsigned int, void *, unsigned int, void **) const = 0;
    00863   virtual void getWriteSQL(
    00864     void *, unsigned int, void *, unsigned int, void **) const = 0;
    00865   virtual void put(const OCCI_STD_NAMESPACE::string&,
    00866                 const OCCI_STD_NAMESPACE::string&, void *(*)(void *),
    00867                 void (*)(void *, void *)) = 0;
    00868   virtual void putUTF16(const OCCI_STD_NAMESPACE::string&,
    00869                 const OCCI_STD_NAMESPACE::string&, void *(*)(void *),
    00870                 void (*)(void *, void *)) = 0;
    00871
    00872  private:
    00873 };
    00874
    00875
    00876
    00877 class SQLException : public OCCI_STD_NAMESPACE::exception
    00878 {
    00879  public:
    00880
    00881   virtual int getErrorCode() const;
    00882
    00883   virtual OCCI_STD_NAMESPACE::string getMessage() const;
    00884
    00885   const char *what() const throw();
    00886
    00887   virtual void setErrorCtx(void *ctx);
    00888
    00889   SQLException();
    00890
    00891   SQLException(const SQLException &e);
    00892
    00893   void operator=(const SQLException &other);
    00894
    00895   virtual ~SQLException() throw();
    00896
    00897   virtual int getXAErrorCode(const OCCI_STD_NAMESPACE::string& dbname) const;
    00898
    00899   virtual UString getUStringMessage() const;
    00900
    00901   virtual OCCI_STD_NAMESPACE::string getNLSMessage(Environment *env) const;
    00902
    00903   virtual UString getNLSUStringMessage(Environment *env) const;
    00904
    00905  private:
    00906
    00907   Ptr<SQLExceptionImpl> ptr_;
    00908   SQLException(SQLExceptionImpl *ptr);
    00909   friend SQLException SQLExceptionCreate(int errorCode);
    00910   friend SQLException SQLExceptionCreate(dvoid *handle,
    00911   int handleType);
    00912
    00913 };
    00914
    00915
    00916 class Statement
    00917 {
    00918  public:
    00919                                 // class constants
    00920
    00921   virtual ~Statement() {}
    00922
    00923   enum Status
    00924   {
    00925     UNPREPARED,
    00926     PREPARED,
    00927     RESULT_SET_AVAILABLE,
    00928     UPDATE_COUNT_AVAILABLE,
    00929     NEEDS_STREAM_DATA,
    00930     STREAM_DATA_AVAILABLE
    00931   };
    00932
    00933                                 // common methods
    00934
    00935   virtual void setSQL(const OCCI_STD_NAMESPACE::string &sql) = 0;
    00936
    00937   virtual OCCI_STD_NAMESPACE::string getSQL() const = 0;
    00938
    00939   virtual Status execute(const OCCI_STD_NAMESPACE::string &sql = "") = 0;
    00940
    00941   virtual ResultSet * getResultSet() = 0;
    00942
    00943   virtual unsigned int getUpdateCount() const = 0;
    00944
    00945   virtual ResultSet * executeQuery(
    00946     const OCCI_STD_NAMESPACE::string &sql = "") = 0;
    00947
    00948   virtual unsigned int executeUpdate(
    00949     const OCCI_STD_NAMESPACE::string &sql = "") = 0;
    00950
    00951   virtual Status status() const = 0;
    00952
    00953   virtual void closeResultSet(ResultSet *resultSet) = 0;
    00954
    00955   virtual void setPrefetchRowCount(unsigned int rowCount) = 0;
    00956
    00957   virtual void setPrefetchMemorySize(unsigned int bytes) = 0;
    00958
    00959   virtual void setAutoCommit(bool autoCommit) = 0;
    00960
    00961   virtual bool getAutoCommit() const = 0;
    00962
    00963   virtual OCIStmt * getOCIStatement() const = 0;
    00964
    00965
    00966                     // methods for prepared statements with IN
    00967                     // parameters
    00968
    00969   virtual void setMaxParamSize(unsigned int paramIndex,unsigned int maxSize)=0;
    00970
    00971   virtual unsigned int getMaxParamSize(unsigned int paramIndex) const = 0;
    00972
    00973   virtual void setNull(unsigned int paramIndex, Type type) = 0;
    00974
    00975   virtual void setInt(unsigned int paramIndex, int x) = 0;
    00976
    00977   virtual void setUInt(unsigned int paramIndex, unsigned int x) = 0;
    00978
    00979   virtual void setFloat(unsigned int paramIndex, float x) = 0;
    00980
    00981   virtual void setDouble(unsigned int paramIndex, double x) = 0;
    00982
    00983   virtual void setNumber(unsigned int paramIndex, const Number &x) = 0;
    00984
    00985   virtual void setString(unsigned int paramIndex,
    00986     const OCCI_STD_NAMESPACE::string &x) = 0;
    00987
    00988   virtual void setBytes(unsigned int paramIndex, const Bytes &x) = 0;
    00989
    00990   virtual void setDate(unsigned int paramIndex, const Date &x) = 0;
    00991
    00992   virtual void setTimestamp(unsigned int paramIndex, const Timestamp &x) = 0;
    00993
    00994   virtual void setBlob(unsigned int paramIndex, const Blob &x) = 0;
    00995
    00996   virtual void setClob(unsigned int paramIndex, const Clob &x) = 0;
    00997
    00998   virtual void setBfile(unsigned int paramIndex, const Bfile &x) = 0;
    00999
    01000   virtual void setIntervalYM(unsigned int paramIndex, const IntervalYM &x) = 0;
    01001
    01002   virtual void setIntervalDS(unsigned int paramIndex, const IntervalDS &x) = 0;
    01003
    01004   virtual void setRowid(unsigned int paramIndex, const Bytes &x) = 0;
    01005
    01006   virtual void setRef(unsigned int paramIndex, const RefAny &x) = 0;
    01007
    01008   virtual void setObject(unsigned int paramIndex, PObject * x) = 0;
    01009
    01010   virtual void setDataBuffer(unsigned int paramIndex, void *buffer,
    01011                              Type type,
    01012                              sb4 size, ub2 *length, sb2 *ind = NULL,
    01013                              ub2 *rc = NULL) = 0;
    01014
    01015   virtual void setDataBufferArray(unsigned int paramIndex, void *buffer,
    01016                                   Type type,
    01017                                   ub4 arraySize, ub4 *arrayLength,
    01018                                   sb4 elementSize,
    01019                                   ub2 *elementLength, sb2 *ind = NULL,
    01020                                   ub2 *rc = NULL) = 0;
    01021
    01022   virtual void setCharSet(unsigned int paramIndex,
    01023   const OCCI_STD_NAMESPACE::string & charSet) = 0;
    01024
    01025   virtual OCCI_STD_NAMESPACE::string getCharSet(unsigned int paramIndex)
    01026   const = 0;
    01027
    01028   virtual void setDatabaseNCHARParam(
    01029     unsigned int paramIndex, bool isNCHAR) = 0;
    01030
    01031   virtual bool getDatabaseNCHARParam(unsigned int paramIndex) const = 0;
    01032
    01033   virtual void closeStream(Stream *stream) =0;
    01034
    01035   virtual Stream * getStream(unsigned int paramIndex) = 0;
    01036
    01037   virtual unsigned int getCurrentStreamParam() const = 0;
    01038
    01039   virtual unsigned int getCurrentStreamIteration() const = 0;
    01040
    01041   virtual void setBinaryStreamMode(unsigned int colIndex,
    01042     unsigned int size) =0;
    01043
    01044   virtual void setCharacterStreamMode(unsigned int colIndex,
    01045     unsigned int size) =0;
    01046
    01047   virtual void setMaxIterations(unsigned int maxIterations) = 0;
    01048
    01049   virtual unsigned int getMaxIterations() const = 0;
    01050
    01051   virtual void addIteration() = 0;
    01052
    01053   virtual unsigned int getCurrentIteration() const = 0;
    01054
    01055   virtual Status executeArrayUpdate(unsigned int arrayLength) = 0;
    01056
    01057
    01058                     // methods for Callable Statements
    01059
    01060   virtual void registerOutParam(unsigned int paramIndex, Type type,
    01061   unsigned int maxSize=0, const OCCI_STD_NAMESPACE::string &sqltype="") = 0;
    01062
    01063   virtual bool isNull(unsigned int paramIndex) const = 0;
    01064
    01065   virtual bool isTruncated(unsigned int paramIndex) const
    01066    =0;
    01067
    01068
    01069   virtual void setErrorOnNull(unsigned int paramIndex,
    01070     bool causeException) = 0;
    01071
    01072   virtual void setErrorOnTruncate(unsigned int paramIndex,
    01073   bool causeException)  = 0;
    01074
    01075   virtual int preTruncationLength(unsigned int paramIndex) const
    01076    =0;
    01077
    01078
    01079   virtual int getInt(unsigned int paramIndex)  = 0;
    01080
    01081   virtual unsigned int getUInt(unsigned int paramIndex)  = 0;
    01082
    01083   virtual float getFloat(unsigned int paramIndex)  = 0;
    01084
    01085   virtual double getDouble(unsigned int paramIndex)  = 0;
    01086
    01087   virtual Number getNumber(unsigned int paramIndex)  = 0;
    01088
    01089   virtual OCCI_STD_NAMESPACE::string getString(unsigned int paramIndex)  = 0;
    01090
    01091   virtual Bytes getBytes(unsigned int paramIndex)  = 0;
    01092
    01093   virtual Date getDate(unsigned int paramIndex)  = 0;
    01094
    01095   virtual Timestamp getTimestamp(unsigned int paramIndex)  = 0;
    01096
    01097   virtual Bytes getRowid(unsigned int paramIndex)  = 0;
    01098
    01099   virtual PObject * getObject(unsigned int paramIndex)  = 0;
    01100
    01101   virtual Blob getBlob(unsigned int paramIndex)  = 0;
    01102
    01103   virtual Clob getClob(unsigned int paramIndex)  = 0;
    01104
    01105   virtual Bfile getBfile(unsigned int paramIndex)  = 0;
    01106
    01107   virtual IntervalYM getIntervalYM(unsigned int paramIndex)  = 0;
    01108
    01109   virtual IntervalDS getIntervalDS(unsigned int paramIndex)  = 0;
    01110
    01111   virtual RefAny getRef(unsigned int paramIndex)  = 0;
    01112
    01113   virtual ResultSet * getCursor(unsigned int paramIndex)   = 0;
    01114
    01115   virtual Connection* getConnection() const =0;
    01116
    01117   //new interfaces
    01118
    01119   virtual void setRef(unsigned int paramIndex, const RefAny &x,
    01120                       const OCCI_STD_NAMESPACE::string &typName,
    01121                       const OCCI_STD_NAMESPACE::string &schName = "") = 0;
    01122
    01123   virtual void setSQLUString(const UString &sql) = 0;
    01124
    01125   virtual UString getSQLUString() const = 0;
    01126
    01127   virtual Status execute(const UString &sql) = 0;
    01128
    01129   virtual ResultSet * executeQuery(
    01130     const UString &sql) = 0;
    01131
    01132   virtual unsigned int executeUpdate(
    01133     const UString &sql) = 0;
    01134
    01135   virtual void setBFloat(unsigned int paramIndex, const BFloat &fval) = 0;
    01136
    01137   virtual void setBDouble(unsigned int paramIndex, const BDouble &dval) = 0;
    01138
    01139   virtual void setUString(unsigned int paramIndex,
    01140     const UString &x) = 0;
    01141
    01142   virtual void setCharSetUString(unsigned int paramIndex,
    01143   const UString & charSet) = 0;
    01144
    01145   virtual UString getCharSetUString(unsigned int paramIndex)
    01146   const = 0;
    01147
    01148   virtual void registerOutParam(unsigned int paramIndex, Type type,
    01149   unsigned int maxSize, const OCCI_STD_NAMESPACE::string &typName,
    01150   const OCCI_STD_NAMESPACE::string &schName) = 0;
    01151
    01152   virtual void registerOutParam(unsigned int paramIndex, Type type,
    01153   unsigned int maxSize, const UString &typName,
    01154   const UString &schName) = 0;
    01155
    01156   virtual BFloat getBFloat(unsigned int paramIndex)  = 0;
    01157
    01158   virtual BDouble getBDouble(unsigned int paramIndex)  = 0;
    01159
    01160   virtual UString getUString(unsigned int paramIndex)  = 0;
    01161
    01162   virtual void disableCaching() =0;
    01163
    01164   virtual void setRef(unsigned int paramIndex, const RefAny &x,
    01165                       const UString &typName,
    01166                       const UString &schName) = 0;
    01167
    01168   virtual void setBinaryStreamMode(unsigned int colIndex,
    01169     unsigned int size, bool INArg) =0;
    01170
    01171   virtual void setCharacterStreamMode(unsigned int colIndex,
    01172     unsigned int size, bool INArg) =0;
    01173
    01174 };
    01175
    01176
    01177
    01178 class ResultSet
    01179 {
    01180  public:
    01181                                 // class constants
    01182
    01183   enum Status
    01184   {
    01185     END_OF_FETCH = 0,
    01186     DATA_AVAILABLE,
    01187     STREAM_DATA_AVAILABLE
    01188   };
    01189   virtual ~ResultSet(){}
    01190
    01191                                 // public methods
    01192
    01193   virtual Status next(unsigned int numRows = 1) = 0;
    01194
    01195   virtual Status status() const = 0;
    01196
    01197   virtual unsigned int getNumArrayRows()  const = 0;
    01198
    01199   virtual void cancel() = 0;
    01200
    01201   virtual void setMaxColumnSize(unsigned int colIndex, unsigned int max) = 0;
    01202
    01203   virtual unsigned int getMaxColumnSize(unsigned int colIndex) const = 0;
    01204
    01205   virtual bool isNull(unsigned int colIndex) const = 0;
    01206
    01207   virtual bool isTruncated(unsigned int paramIndex) const
    01208    =0;
    01209
    01210   virtual void setErrorOnNull(unsigned int colIndex, bool causeException) = 0;
    01211   virtual void setErrorOnTruncate(unsigned int paramIndex,
    01212   bool causeException)   =0;
    01213
    01214   virtual int preTruncationLength(unsigned int paramIndex) const
    01215    =0;
    01216
    01217   virtual int getInt(unsigned int colIndex)   = 0;
    01218
    01219   virtual unsigned int getUInt(unsigned int colIndex)   = 0;
    01220
    01221   virtual float getFloat(unsigned int colIndex)  = 0;
    01222
    01223   virtual double getDouble(unsigned int colIndex)  = 0;
    01224
    01225   virtual Number getNumber(unsigned int colIndex)  = 0;
    01226
    01227   virtual OCCI_STD_NAMESPACE::string getString(unsigned int colIndex)  = 0;
    01228
    01229   virtual Bytes getBytes(unsigned int colIndex)  = 0;
    01230
    01231   virtual Date getDate(unsigned int colIndex)  = 0;
    01232
    01233   virtual Timestamp getTimestamp(unsigned int colIndex)  = 0;
    01234
    01235   virtual Bytes getRowid(unsigned int colIndex)  = 0;
    01236
    01237   virtual PObject * getObject(unsigned int colIndex)  = 0;
    01238
    01239   virtual Blob getBlob(unsigned int colIndex)  = 0;
    01240
    01241   virtual Clob getClob(unsigned int colIndex)  =0;
    01242
    01243   virtual Bfile getBfile(unsigned int colIndex)  = 0;
    01244
    01245   virtual  IntervalYM getIntervalYM(unsigned int colIndex)  =0;
    01246
    01247   virtual  IntervalDS getIntervalDS(unsigned int colIndex)  =0;
    01248
    01249   virtual RefAny getRef(unsigned int colIndex)  = 0;
    01250
    01251   virtual Bytes getRowPosition() const = 0;
    01252
    01253   virtual ResultSet * getCursor(unsigned int colIndex)  = 0;
    01254
    01255   virtual void setDataBuffer(unsigned int colIndex, void *buffer, Type type,
    01256                              sb4 size = 0, ub2 *length = NULL,
    01257                              sb2 *ind = NULL, ub2 *rc = NULL) = 0;
    01258
    01259   virtual void setCharSet(unsigned int colIndex,
    01260   const OCCI_STD_NAMESPACE::string & charSet) = 0;
    01261
    01262   virtual OCCI_STD_NAMESPACE::string getCharSet(unsigned int colIndex)
    01263   const = 0;
    01264
    01265   virtual void setBinaryStreamMode(unsigned int colIndex, unsigned int size)
    01266     = 0;
    01267
    01268   virtual void setCharacterStreamMode(unsigned int colIndex, unsigned int size)
    01269     = 0;
    01270
    01271   virtual void setDatabaseNCHARParam(unsigned int paramIndex,
    01272     bool isNCHAR) = 0;
    01273
    01274   virtual bool getDatabaseNCHARParam(unsigned int paramIndex) const = 0;
    01275
    01276   virtual Stream * getStream(unsigned int colIndex)  = 0;
    01277
    01278   virtual void closeStream(Stream *stream) =0;
    01279
    01280   virtual unsigned int getCurrentStreamColumn() const= 0;
    01281
    01282   virtual unsigned int getCurrentStreamRow() const= 0;
    01283
    01284   virtual OCCI_STD_NAMESPACE::vector<MetaData> getColumnListMetaData() const
    01285     = 0;
    01286
    01287   virtual Statement* getStatement() const=0;
    01288
    01289   //new interfaces
    01290
    01291   virtual BFloat getBFloat(unsigned int colIndex)  = 0;
    01292
    01293   virtual BDouble getBDouble(unsigned int colIndex)  = 0;
    01294
    01295   virtual UString getUString(unsigned int colIndex)  = 0;
    01296
    01297   virtual void setCharSetUString(unsigned int colIndex,
    01298   const UString & charSet) = 0;
    01299
    01300   virtual UString getCharSetUString(unsigned int colIndex)
    01301   const = 0;
    01302
    01303 };
    01304
    01305
    01306 class Stream
    01307 {
    01308   public :
    01309
    01310     enum Status {READY_FOR_READ, READY_FOR_WRITE, INACTIVE};
    01311
    01312     virtual ~Stream(){}
    01313     virtual int readBuffer(char *buffer, unsigned int size)
    01314        =0;
    01315     virtual int readLastBuffer(char *buffer, unsigned int size)
    01316        =0;
    01317     virtual void writeBuffer(char *buffer, unsigned int size)
    01318        =0;
    01319     virtual void writeLastBuffer(char *buffer, unsigned int size)
    01320        =0;
    01321     virtual Status status() const  =0;
    01322
    01323 };
    01324
    01325 /*---------------------------------------------------------------------------
    01326                 PROTOTYPES USED BY FUNCTION TEMPLATES
    01327  -------------------------------------------------------------------------*/
    01328   void getVectorOfPObjects( ResultSet *rs, unsigned int index,
    01329   OCCI_STD_NAMESPACE::vector<PObject *> &vect) ;
    01330   void getVectorOfOCIRefs(ResultSet  *rs, unsigned int index,
    01331   OCCI_STD_NAMESPACE::vector<void *> &vect) ;
    01332   void getVectorOfPObjects( Statement *rs, unsigned int index,
    01333   OCCI_STD_NAMESPACE::vector<PObject *> &vect) ;
    01334   void getVectorOfOCIRefs(Statement  *rs, unsigned int index,
    01335   OCCI_STD_NAMESPACE::vector<void *> &vect) ;
    01336   void setVectorOfPObjects( Statement *stmt, unsigned int paramIndex,
    01337   const OCCI_STD_NAMESPACE::vector<PObject *> &vect,
    01338   const OCCI_STD_NAMESPACE::string &sqltype) ;
    01339   void setVectorOfPObjects( Statement *stmt, unsigned int paramIndex,
    01340   const OCCI_STD_NAMESPACE::vector<PObject *> &vect,
    01341   const OCCI_STD_NAMESPACE::string &schemaName,
    01342   const OCCI_STD_NAMESPACE::string &typeName) ;
    01343   void setVectorOfPObjects( Statement *stmt, unsigned int paramIndex,
    01344   const OCCI_STD_NAMESPACE::vector<PObject *> &vect,
    01345   const UString &schemaName,
    01346   const UString &typeName) ;
    01347   void setVectorOfOCIRefs(Statement *stmt, unsigned int paramIndex,
    01348   const  OCCI_STD_NAMESPACE::vector<void *> &vect,
    01349   const OCCI_STD_NAMESPACE::vector<OCIInd> &vecind,
    01350   const OCCI_STD_NAMESPACE::string &sqltype) ;
    01351   void setVectorOfOCIRefs(Statement *stmt, unsigned int paramIndex,
    01352   const  OCCI_STD_NAMESPACE::vector<void *> &vect,
    01353   const OCCI_STD_NAMESPACE::vector<OCIInd> &vecind,
    01354   const OCCI_STD_NAMESPACE::string &schemaName,
    01355   const OCCI_STD_NAMESPACE::string &typeName) ;
    01356   void setVectorOfOCIRefs(Statement *stmt, unsigned int paramIndex,
    01357   const  OCCI_STD_NAMESPACE::vector<void *> &vect,
    01358   const OCCI_STD_NAMESPACE::vector<OCIInd> &vecind,
    01359   const UString &schemaName,
    01360   const UString &typeName) ;
    01361   void pinVectorOfOCIRefs(const Connection *conn,
    01362   OCCI_STD_NAMESPACE::vector<void *> & vecRef,
    01363   OCCI_STD_NAMESPACE::vector<void *> & vecCor,
    01364   OCCI_STD_NAMESPACE::vector<PObject *> &vecPObj,LockOptions &lockOpt );
    01365
    01366
    01367 /*---------------------------------------------------------------------------
    01368                            EXPORT FUNCTIONS
    01369   ---------------------------------------------------------------------------*/
    01370
    01371 /*------------------------ getVector for objects ---------------------------*/
    01372 /*
    01373    NAME
    01374       getVector - overloaded function. Retrieves the attribute in the current
    01375 position as a vector of objects
    01376
    01377    PARAMETERS
    01378       rs - ResultSet
    01379       vect- reference to vector of objects(OUT parameter).
    01380
    01381    DESCRIPTION
    01382      Retrieves the column in the specified position as a vector of RefAny.
    01383    The attribute at the current position should be a collection type (varray or
    01384    nested table). The SQL type of the elements in the collection should be
    01385    compatible with objects.
    01386
    01387    RETURNS
    01388      nothing
    01389
    01390    NOTES
    01391         compatible SQL types : NTY
    01392
    01393         will call getVector(..., vector<PObject*>)
    01394 */
    01395 #ifdef WIN32COMMON
    01396 // and other platforms that do not support
    01397 // partial function template specialization
    01398
    01399 template <class T>
    01400 void getVector( ResultSet *rs, unsigned int index,OCCI_STD_NAMESPACE::vector<T>
    01401 & vect)
    01402 {
    01403   OCCI_STD_NAMESPACE::vector<PObject *> vec_pobj;
    01404   getVectorOfPObjects(rs, index, vec_pobj);
    01405
    01406   vect.clear();
    01407   unsigned int size = vec_pobj.size();
    01408   vect.reserve( size );
    01409   for ( unsigned int i=0; i< size; i++)
    01410     vect.push_back((T)vec_pobj[i]);
    01411 }
    01412
    01413 #else
    01414 template <class T>
    01415 void getVector( ResultSet *rs, unsigned int index, OCCI_STD_NAMESPACE::vector<T
    01416  *> &vect)
    01417 {
    01418   OCCI_STD_NAMESPACE::vector<PObject *> vec_pobj;
    01419   getVectorOfPObjects(rs, index, vec_pobj);
    01420
    01421   vect.clear();
    01422   unsigned int size = vec_pobj.size();
    01423   vect.reserve( size );
    01424   for (unsigned int i=0; i< size; i++)
    01425     vect.push_back((T *)vec_pobj[i]);
    01426 }
    01427 #endif
    01428
    01429 /*------------------------ getVector for objects ---------------------------*/
    01430 /*
    01431    NAME
    01432       getVector - overloaded function. Retrieves the attribute in the current
    01433 position as a vector of objects
    01434
    01435    PARAMETERS
    01436       stmt - Statement
    01437       vect- reference to vector of objects(OUT parameter).
    01438
    01439    DESCRIPTION
    01440      Retrieves the column in the specified position as a vector of RefAny.
    01441    The attribute at the current position should be a collection type (varray or
    01442    nested table). The SQL type of the elements in the collection should be
    01443    compatible with objects.
    01444
    01445    RETURNS
    01446      nothing
    01447
    01448    NOTES
    01449         compatible SQL types : NTY
    01450
    01451         will call getVector(..., vector<PObject*>)
    01452 */
    01453 #ifdef WIN32COMMON
    01454 // and other platforms that do not support
    01455 // partial function template specialization
    01456
    01457 template <class T>
    01458 void getVector( Statement *stmt, unsigned int index,
    01459 OCCI_STD_NAMESPACE::vector<T> &vect)
    01460 {
    01461   OCCI_STD_NAMESPACE::vector<PObject *> vec_pobj;
    01462   getVectorOfPObjects(stmt, index, vec_pobj);
    01463   vect.clear();
    01464   unsigned int size = vec_pobj.size();
    01465   vect.reserve( size );
    01466   for (unsigned int i=0; i< size; i++)
    01467     vect.push_back((T)vec_pobj[i]);
    01468 }
    01469 #else
    01470 template <class T>
    01471 void getVector( Statement *stmt, unsigned int index,
    01472 OCCI_STD_NAMESPACE::vector<T *> &vect)
    01473 {
    01474   OCCI_STD_NAMESPACE::vector<PObject *> vec_pobj;
    01475   getVectorOfPObjects(stmt, index, vec_pobj);
    01476   vect.clear();
    01477   unsigned int size = vec_pobj.size();
    01478   vect.reserve( size );
    01479   for (unsigned int i=0; i< size; i++)
    01480     vect.push_back((T *)vec_pobj[i]);
    01481 }
    01482 #endif
    01483
    01484 /*------------------------ getVector for Ref<T> ---------------------------*/
    01485 /*
    01486    NAME
    01487       getVector - overloaded function. Retrieves the attribute in the current
    01488 position as a vector of Ref<T>
    01489
    01490    PARAMETERS
    01491       rs - ResultSet
    01492       vect- reference to vector of Ref<T>(OUT parameter).
    01493
    01494    DESCRIPTION
    01495      Retrieves the column in the specified position as a vector of Ref<T>.
    01496    The attribute at the current position should be a collection type (varray or
    01497    nested table). The SQL type of the elements in the collection should be
    01498    compatible with Ref<T>.
    01499
    01500    RETURNS
    01501      nothing
    01502
    01503    NOTES
    01504         compatible SQL types : REF
    01505 */
    01506 #ifndef WIN32COMMON
    01507 template <class T>
    01508 void getVector( ResultSet *rs, unsigned int index,
    01509                 OCCI_STD_NAMESPACE::vector<Ref<T> > &vect)
    01510 {
    01511   OCCI_STD_NAMESPACE::vector<void *> vec_ref;
    01512   getVectorOfOCIRefs(rs, index, vec_ref);
    01513
    01514   const Connection *sess = rs->getStatement()->getConnection();
    01515
    01516   vect.clear();
    01517   unsigned int size = vec_ref.size();
    01518   vect.reserve( size );
    01519   for (unsigned int i=0; i< size; i++)
    01520   {
    01521     if (vec_ref[i] == (OCIRef *)0)
    01522        vect.push_back(Ref<T>());     // pushing a default-constructed Ref
    01523      else
    01524        vect.push_back(Ref<T>(sess, (OCIRef *)vec_ref[i], FALSE));
    01525   }
    01526 }
    01527 #endif
    01528
    01529 /*------------------------ setVector for PObject*---------------------------*/
    01530 /*
    01531    NAME
    01532       SetVector - overloaded function. Binds the attribute in the current
    01533       position with a vector of objects.
    01534
    01535    PARAMETERS
    01536       rs - ResultSet
    01537       vect- reference to vector of objects(OUT parameter).
    01538
    01539    DESCRIPTION
    01540      Binds the column in the specified position with a vector of signed int .
    01541    The column at the current position should be a collection type (varray or
    01542    nested table). The SQL type of the elements in the collection should be
    01543    compatible with objects .
    01544
    01545    RETURNS
    01546      nothing
    01547
    01548    NOTES
    01549      compatible SQL types : SQLT_NTY
    01550
    01551      This will be calling setVector(..., vector<PObject*>,..)
    01552
    01553 */
    01554 #ifdef WIN32COMMON
    01555 // and other platforms that do not support
    01556 // partial function template specialization
    01557
    01558 template <class T>
    01559 void setVector( Statement *stmt, unsigned int index,
    01560                 const OCCI_STD_NAMESPACE::vector<T> &vect,
    01561                 const OCCI_STD_NAMESPACE::string &sqltype)
    01562 {
    01563   OCCI_STD_NAMESPACE::vector<PObject *> vec_pobj;
    01564   unsigned int size = vect.size();
    01565   vec_pobj.reserve( size );
    01566
    01567   for (unsigned int i = 0; i < size; i++)
    01568     vec_pobj.push_back((PObject *)vect[i]);
    01569
    01570   setVectorOfPObjects(stmt, index, vec_pobj, sqltype);
    01571 }
    01572
    01573 template <class T>
    01574 void setVector( Statement *stmt, unsigned int index, const OCCI_STD_NAMESPACE::
    01575 vector<T> &vect, const OCCI_STD_NAMESPACE::string &schemaName,
    01576 const OCCI_STD_NAMESPACE::string &typeName)
    01577 {
    01578   OCCI_STD_NAMESPACE::vector<PObject *> vec_pobj;
    01579   unsigned int size = vect.size();
    01580   vec_pobj.reserve( size );
    01581
    01582   for (unsigned int i = 0; i < size; i++)
    01583     vec_pobj.push_back((PObject *)vect[i]);
    01584
    01585   setVectorOfPObjects(stmt, index, vec_pobj, schemaName, typeName);
    01586 }
    01587
    01588 template <class T>
    01589 void setVector( Statement *stmt, unsigned int index, const OCCI_STD_NAMESPACE::
    01590 vector<T> &vect, const UString &schemaName,
    01591 const UString &typeName)
    01592 {
    01593   OCCI_STD_NAMESPACE::vector<PObject *> vec_pobj;
    01594   unsigned int size = vect.size();
    01595   vec_pobj.reserve( size );
    01596
    01597   for (unsigned int i = 0; i < size; i++)
    01598     vec_pobj.push_back((PObject *)vect[i]);
    01599
    01600   setVectorOfPObjects(stmt, index, vec_pobj, schemaName, typeName);
    01601 }
    01602 #else
    01603 template <class T>
    01604 void setVector( Statement *stmt, unsigned int index, const OCCI_STD_NAMESPACE::
    01605 vector<T *> &vect, const OCCI_STD_NAMESPACE::string &sqltype)
    01606 {
    01607   OCCI_STD_NAMESPACE::vector<PObject *> vec_pobj;
    01608   unsigned int size = vect.size();
    01609   vec_pobj.reserve( size );
    01610
    01611   for (unsigned int i = 0; i < size; i++)
    01612     vec_pobj.push_back((PObject *)vect[i]);
    01613
    01614   setVectorOfPObjects(stmt, index, vec_pobj, sqltype);
    01615 }
    01616
    01617 template <class T>
    01618 void setVector( Statement *stmt, unsigned int index, const OCCI_STD_NAMESPACE::
    01619 vector<T *> &vect, const OCCI_STD_NAMESPACE::string &schemaName,
    01620 const OCCI_STD_NAMESPACE::string &typeName)
    01621 {
    01622   OCCI_STD_NAMESPACE::vector<PObject *> vec_pobj;
    01623   unsigned int size = vect.size();
    01624   vec_pobj.reserve( size );
    01625
    01626   for (unsigned int i = 0; i < size; i++)
    01627     vec_pobj.push_back((PObject *)vect[i]);
    01628
    01629   setVectorOfPObjects(stmt, index, vec_pobj, schemaName, typeName);
    01630 }
    01631
    01632 template <class T>
    01633 void setVector( Statement *stmt, unsigned int index, const OCCI_STD_NAMESPACE::
    01634 vector<T *> &vect, const UString &schemaName,
    01635 const UString &typeName)
    01636 {
    01637   OCCI_STD_NAMESPACE::vector<PObject *> vec_pobj;
    01638   unsigned int size = vect.size();
    01639   vec_pobj.reserve( size );
    01640
    01641   for (unsigned int i = 0; i < size; i++)
    01642     vec_pobj.push_back((PObject *)vect[i]);
    01643
    01644   setVectorOfPObjects(stmt, index, vec_pobj, schemaName, typeName);
    01645 }
    01646 #endif
    01647
    01648 /*------------------------ setVector for Ref<T>---------------------------*/
    01649 /*
    01650    NAME
    01651       setVector - overloaded function. Binds the attribute in the current
    01652       position with a vector of Ref<T>.
    01653
    01654    PARAMETERS
    01655       rs - ResultSet
    01656       vect- reference to vector of REF
    01657
    01658    DESCRIPTION
    01659      Binds the column in the specified position with a vector of signed int .
    01660    The column at the current position should be a collection type (varray or
    01661    nested table). The SQL type of the elements in the collection should be
    01662    compatible with OCIRef* .
    01663
    01664    RETURNS
    01665      nothing
    01666
    01667    NOTES
    01668      compatible SQL types : REF
    01669
    01670      This will just call setVector(..., vector<OCIRef*>,..)
    01671
    01672
    01673 */
    01674 #ifndef WIN32COMMON
    01675 template <class T>
    01676 void setVector( Statement *stmt, unsigned int index,
    01677                 const OCCI_STD_NAMESPACE::vector<Ref<T> > &vect,
    01678                 const OCCI_STD_NAMESPACE::string &sqltype)
    01679 {
    01680   OCCI_STD_NAMESPACE::vector<void *> vec_ref;
    01681   OCCI_STD_NAMESPACE::vector<OCIInd> vec_ind;
    01682   unsigned int size = vect.size();
    01683   vec_ref.reserve( size );
    01684   vec_ind.reserve( size );
    01685
    01686   for (unsigned int i = 0; i < size; i++)
    01687   {
    01688     vec_ref.push_back((void *)vect[i].getRef());
    01689     vec_ind.push_back( vect[i].isNull() ? OCI_IND_NULL : OCI_IND_NOTNULL);
    01690   }
    01691
    01692   setVectorOfOCIRefs(stmt, index, vec_ref, vec_ind, sqltype);
    01693 }
    01694
    01695 template <class T>
    01696 void setVector( Statement *stmt, unsigned int index,
    01697                 const OCCI_STD_NAMESPACE::vector<Ref<T> > &vect,
    01698                 const OCCI_STD_NAMESPACE::string &schemaName,
    01699                 const OCCI_STD_NAMESPACE::string &typeName)
    01700 {
    01701   OCCI_STD_NAMESPACE::vector<void *> vec_ref;
    01702   OCCI_STD_NAMESPACE::vector<OCIInd> vec_ind;
    01703   unsigned int size = vect.size();
    01704   vec_ref.reserve( size );
    01705   vec_ind.reserve( size );
    01706
    01707   for (unsigned int i = 0; i < size; i++)
    01708   {
    01709     vec_ref.push_back((void *)vect[i].getRef());
    01710     vec_ind.push_back( vect[i].isNull() ? OCI_IND_NULL : OCI_IND_NOTNULL);
    01711   }
    01712
    01713   setVectorOfOCIRefs(stmt, index, vec_ref, vec_ind, schemaName, typeName);
    01714 }
    01715
    01716 template <class T>
    01717 void setVector( Statement *stmt, unsigned int index,
    01718                 const OCCI_STD_NAMESPACE::vector<Ref<T> > &vect,
    01719                 const UString &schemaName,
    01720                 const UString &typeName)
    01721 {
    01722   OCCI_STD_NAMESPACE::vector<void *> vec_ref;
    01723   OCCI_STD_NAMESPACE::vector<OCIInd> vec_ind;
    01724   unsigned int size = vect.size();
    01725   vec_ref.reserve( size );
    01726   vec_ind.reserve( size );
    01727
    01728   for (unsigned int i = 0; i < size; i++)
    01729   {
    01730     vec_ref.push_back((void *)vect[i].getRef());
    01731     vec_ind.push_back( vect[i].isNull() ? OCI_IND_NULL : OCI_IND_NOTNULL);
    01732   }
    01733
    01734   setVectorOfOCIRefs(stmt, index, vec_ref, vec_ind, schemaName, typeName);
    01735 }
    01736 #endif
    01737
    01738 /*------------------------ getVector for Ref<T> ---------------------------*/
    01739 /*
    01740    NAME
    01741       getVector - overloaded function. Retrieves the attribute in the current
    01742 position as a vector of Ref<T>
    01743
    01744    PARAMETERS
    01745       stmt - Statement
    01746       vect- reference to vector of Ref<T>(OUT parameter).
    01747
    01748    DESCRIPTION
    01749      Retrieves the column in the specified position as a vector of Ref<T>.
    01750    The attribute at the current position should be a collection type (varray or
    01751    nested table). The SQL type of the elements in the collection should be
    01752    compatible with Ref<T>.
    01753
    01754    RETURNS
    01755      nothing
    01756
    01757    NOTES
    01758         compatible SQL types : REF
    01759 */
    01760 #ifndef WIN32COMMON
    01761 template <class T>
    01762 void getVector( Statement *stmt, unsigned int index,
    01763                 OCCI_STD_NAMESPACE::vector<Ref<T> > &vect)
    01764 {
    01765   OCCI_STD_NAMESPACE::vector<void *> vec_ref;
    01766   getVectorOfOCIRefs(stmt, index, vec_ref);
    01767
    01768   const Connection *sess = stmt->getConnection();
    01769
    01770   vect.clear();
    01771   unsigned int size = vec_ref.size();
    01772   vect.reserve( size );
    01773   for (unsigned int i=0; i< size; i++)
    01774   {
    01775     if (vec_ref[i] == (OCIRef *)0)
    01776        vect.push_back(Ref <T>());     // pushing a default-constructed Ref
    01777      else
    01778        vect.push_back(Ref<T> (sess, (OCIRef *)vec_ref[i], FALSE));
    01779   }
    01780
    01781 }
    01782 #endif
    01783
    01784 // Platform independent get/setVectorOfRefs method added
    01785 // get(set)Vector of Ref<T> and get(set)VectorOfRefs are identical
    01786 // in functionality.
    01787
    01788 /*------------------------ getVectorOfRefs for Ref<T> ----------------------*/
    01789 /*
    01790    NAME
    01791       getVectorOfRefs - overloaded function. Retrieves the attribute in the
    01792       current position as a vector of Ref<T>
    01793
    01794    PARAMETERS
    01795       rs - ResultSet
    01796       vect- reference to vector of Ref<T>(OUT parameter).
    01797
    01798    DESCRIPTION
    01799      Retrieves the column in the specified position as a vector of Ref<T>.
    01800    The attribute at the current position should be a collection type (varray or
    01801    nested table). The SQL type of the elements in the collection should be
    01802    compatible with Ref<T>.
    01803
    01804    RETURNS
    01805      nothing
    01806
    01807    NOTES
    01808         compatible SQL types : REF
    01809 */
    01810
    01811 template <class T>
    01812 void getVectorOfRefs( ResultSet *rs, unsigned int index,
    01813 OCCI_STD_NAMESPACE::vector<Ref<T> > &vect)
    01814 {
    01815   OCCI_STD_NAMESPACE::vector<void *> vec_ref;
    01816   getVectorOfOCIRefs(rs, index, vec_ref);
    01817
    01818   const Connection *sess = rs->getStatement()->getConnection();
    01819
    01820   vect.clear();
    01821   unsigned int size = vec_ref.size();
    01822   vect.reserve( size );
    01823   for (unsigned int i=0; i< size; i++)
    01824   {
    01825     if (vec_ref[i] == (OCIRef *)0)
    01826        vect.push_back(Ref<T>());     // pushing a default-constructed Ref
    01827      else
    01828        vect.push_back(Ref<T>(sess, (OCIRef *)vec_ref[i], FALSE));
    01829   }
    01830 }
    01831
    01832 /*------------------------ setVectorOfRefs for Ref<T>-----------------------*/
    01833 /*
    01834    NAME
    01835       setVectorOfRefs - overloaded function. Binds the attribute in the current
    01836       position with a vector of Ref<T>.
    01837
    01838    PARAMETERS
    01839       rs - ResultSet
    01840       vect- reference to vector of REF
    01841
    01842    DESCRIPTION
    01843      Binds the column in the specified position with a vector of signed int .
    01844    The column at the current position should be a collection type (varray or
    01845    nested table). The SQL type of the elements in the collection should be
    01846    compatible with OCIRef* .
    01847
    01848    RETURNS
    01849      nothing
    01850
    01851    NOTES
    01852      compatible SQL types : REF
    01853
    01854      This will just call setVector(..., vector<OCIRef*>,..)
    01855
    01856
    01857 */
    01858
    01859 template <class T>
    01860 void setVectorOfRefs( Statement *stmt, unsigned int index,
    01861 const OCCI_STD_NAMESPACE::vector<Ref<T> > &vect,
    01862 const OCCI_STD_NAMESPACE::string &sqltype)
    01863 {
    01864   OCCI_STD_NAMESPACE::vector<void *> vec_ref;
    01865   OCCI_STD_NAMESPACE::vector<OCIInd> vec_ind;
    01866   unsigned int size = vect.size();
    01867   vec_ref.reserve( size );
    01868   vec_ind.reserve( size );
    01869
    01870   for (unsigned int i = 0; i < size; i++)
    01871   {
    01872     vec_ref.push_back((void *)vect[i].getRef());
    01873     vec_ind.push_back( vect[i].isNull() ? OCI_IND_NULL : OCI_IND_NOTNULL);
    01874   }
    01875
    01876   setVectorOfOCIRefs(stmt, index, vec_ref, vec_ind, sqltype);
    01877 }
    01878
    01879 template <class T>
    01880 void setVectorOfRefs( Statement *stmt, unsigned int index,
    01881 const OCCI_STD_NAMESPACE::vector<Ref<T> > &vect,
    01882 const OCCI_STD_NAMESPACE::string &schemaName,
    01883 const OCCI_STD_NAMESPACE::string &typeName)
    01884 {
    01885   OCCI_STD_NAMESPACE::vector<void *> vec_ref;
    01886   OCCI_STD_NAMESPACE::vector<OCIInd> vec_ind;
    01887   unsigned int size = vect.size();
    01888   vec_ref.reserve( size );
    01889   vec_ind.reserve( size );
    01890
    01891   for (unsigned int i = 0; i < size; i++)
    01892   {
    01893     vec_ref.push_back((void *)vect[i].getRef());
    01894     vec_ind.push_back( vect[i].isNull() ? OCI_IND_NULL : OCI_IND_NOTNULL);
    01895   }
    01896
    01897   setVectorOfOCIRefs(stmt, index, vec_ref, vec_ind, schemaName, typeName);
    01898 }
    01899
    01900 template <class T>
    01901 void setVectorOfRefs( Statement *stmt, unsigned int index,
    01902 const OCCI_STD_NAMESPACE::vector<Ref<T> > &vect,
    01903 const UString &schemaName,
    01904 const UString &typeName)
    01905 {
    01906   OCCI_STD_NAMESPACE::vector<void *> vec_ref;
    01907   OCCI_STD_NAMESPACE::vector<OCIInd> vec_ind;
    01908   unsigned int size = vect.size();
    01909   vec_ref.reserve( size );
    01910   vec_ind.reserve( size );
    01911
    01912   for (unsigned int i = 0; i < size; i++)
    01913   {
    01914     vec_ref.push_back((void *)vect[i].getRef());
    01915     vec_ind.push_back( vect[i].isNull() ? OCI_IND_NULL : OCI_IND_NOTNULL);
    01916   }
    01917
    01918   setVectorOfOCIRefs(stmt, index, vec_ref, vec_ind, schemaName, typeName);
    01919 }
    01920
    01921 /*------------------------ getVectorOfRefs for Ref<T> ----------------------*/
    01922 /*
    01923    NAME
    01924       getVectorOfRefs - overloaded function. Retrieves the attribute in the
    01925       current position as a vector of Ref<T>
    01926
    01927    PARAMETERS
    01928       stmt - Statement
    01929       vect- reference to vector of Ref<T>(OUT parameter).
    01930
    01931    DESCRIPTION
    01932      Retrieves the column in the specified position as a vector of Ref<T>.
    01933    The attribute at the current position should be a collection type (varray or
    01934    nested table). The SQL type of the elements in the collection should be
    01935    compatible with Ref<T>.
    01936
    01937    RETURNS
    01938      nothing
    01939
    01940    NOTES
    01941         compatible SQL types : REF
    01942 */
    01943
    01944 template <class T>
    01945 void getVectorOfRefs( Statement *stmt, unsigned int index,
    01946 OCCI_STD_NAMESPACE::vector <Ref<T> > &vect)
    01947 {
    01948   OCCI_STD_NAMESPACE::vector<void *> vec_ref;
    01949   getVectorOfOCIRefs(stmt, index, vec_ref);
    01950
    01951   const Connection *sess = stmt->getConnection();
    01952
    01953   vect.clear();
    01954   unsigned int size = vec_ref.size();
    01955   vect.reserve( size );
    01956   for (unsigned int i=0; i< size; i++)
    01957   {
    01958     if (vec_ref[i] == (OCIRef *)0)
    01959        vect.push_back(Ref <T>());     // pushing a default-constructed Ref
    01960      else
    01961        vect.push_back(Ref<T> (sess, (OCIRef *)vec_ref[i], FALSE));
    01962   }
    01963 }
    01964 /*----------------------------- pinVectorOfRefs---------------------*/
    01965 /*
    01966    NAME
    01967     pinVectorOfRefs - array pin implementation
    01968
    01969    PARAMETERS
    01970      conn- Connection object
    01971      vecRef - vector of OCIRefs *
    01972      vecCor - vector of OCIComplexObject *
    01973      vecPOBj - vector of PObject * ( OUT )
    01974
    01975    DESCRIPTION
    01976     implements the array pin of refs passed and returns the corresponding
    01977     PObject s
    01978
    01979    RETURNS
    01980
    01981    NOTES
    01982 */
    01983 template <class T>
    01984 void pinVectorOfRefs( const Connection *conn,
    01985 OCCI_STD_NAMESPACE::vector<Ref<T> > &vect,
    01986 OCCI_STD_NAMESPACE::vector<T* > &vectObj, LockOptions lockOpt)
    01987 {
    01988
    01989  OCCI_STD_NAMESPACE::vector<void *> vecRef;
    01990  OCCI_STD_NAMESPACE::vector<void *> vecCor;
    01991  OCCI_STD_NAMESPACE::vector<PObject *> vecPObj;
    01992  unsigned int sz = vect.size();
    01993  vecRef.reserve( sz );
    01994  vecCor.reserve( sz );
    01995
    01996  for ( unsigned int  i=0; i < sz; i++)
    01997  {
    01998    vecRef.push_back((void *)vect[i].getRef());
    01999    vecCor.push_back((void *)vect[i].getCor());
    02000  }
    02001  pinVectorOfOCIRefs(conn, vecRef, vecCor, vecPObj, lockOpt);
    02002  for ( unsigned int  k=0; k < sz; k++)
    02003  {
    02004    vectObj.push_back((T *)vecPObj[k]);
    02005    vect[k].setPinnedObject(vecPObj[k]);
    02006  }
    02007 }
    02008
    02009 /*----------------------------- pinVectorOfRefs---------------------*/
    02010 /*
    02011    NAME
    02012     pinVectorOfRefs - array pin implementation
    02013
    02014    PARAMETERS
    02015      conn- Connection object
    02016      vecRef - vector of OCIRefs *
    02017      vecCor - vector of OCIComplexObject *
    02018
    02019    DESCRIPTION
    02020     implements the array pin of refs passed
    02021
    02022    RETURNS
    02023
    02024    NOTES
    02025 */
    02026 template <class T>
    02027 void pinVectorOfRefs( const Connection *conn,
    02028 OCCI_STD_NAMESPACE::vector<Ref<T> > &vect,
    02029 LockOptions lockOpt)
    02030 {
    02031
    02032  OCCI_STD_NAMESPACE::vector<void *> vecRef;
    02033  OCCI_STD_NAMESPACE::vector<void *> vecCor;
    02034  OCCI_STD_NAMESPACE::vector<PObject *> vecPObj;
    02035  unsigned int sz = vect.size();
    02036  vecRef.reserve( sz );
    02037  vecCor.reserve( sz );
    02038
    02039  for ( unsigned int  i=0; i < sz; i++)
    02040  {
    02041    vecRef.push_back((void *)vect[i].getRef());
    02042    vecCor.push_back((void *)vect[i].getCor());
    02043  }
    02044  pinVectorOfOCIRefs(conn, vecRef, vecCor,vecPObj, lockOpt);
    02045  for ( unsigned int  k=0; k < sz; k++)
    02046    vect[k].setPinnedObject(vecPObj[k]);
    02047 }
    02048
    02049
    02050
    02051 /*---------------------------------------------------------------------------
    02052                           INTERNAL FUNCTIONS
    02053   ---------------------------------------------------------------------------*/
    02054
    02055
    02056 } /* end of namespace occi */
    02057 } /* end of namespace oracle */
    02058 #endif                                              /* OCCICONTROL_ORACLE */
    02059
    02060 #endif                                              /* _olint */

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines