~ubuntu-branches/ubuntu/hardy/libterralib/hardy

« back to all changes in this revision

Viewing changes to src/terralib/drivers/OracleSpatial/OCI/include/occiControl.h

  • Committer: Bazaar Package Importer
  • Author(s): Daniel T Chen
  • Date: 2005-11-25 22:32:59 UTC
  • Revision ID: james.westby@ubuntu.com-20051125223259-3zubal8ux4ki4fjg
Tags: upstream-3.0.3b2
ImportĀ upstreamĀ versionĀ 3.0.3b2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright  Oracle Corporation 2000, 2001. All Rights Reserved. */ 
 
2
 
 
3
/* 
 
4
   NAME 
 
5
     occiControl.h - header file for OCCI control classes
 
6
 
 
7
   DESCRIPTION 
 
8
     Class definitions for MetaData,SQLException,Environment,
 
9
     Connection,Statement, ConnectionPool, StatelessConnectionPool
 
10
 
 
11
   RELATED DOCUMENTS 
 
12
     <note any documents related to this facility>
 
13
 
 
14
   EXPORT FUNCTION(S) 
 
15
     <external functions declared for use outside package - one-line 
 
16
     descriptions>
 
17
 
 
18
   INTERNAL FUNCTION(S)
 
19
     <other external functions declared - one-line descriptions>
 
20
 
 
21
   EXAMPLES
 
22
 
 
23
   NOTES
 
24
     <other useful comments, qualifications, etc.>
 
25
 
 
26
   MODIFIED   (MM/DD/YY)
 
27
   rvadraha    09/30/03 - New Binary/CharacterStreamMode for Statement class
 
28
   rvallam     02/12/03 - modify BFloat/BDouble interface to use the new 
 
29
                          BFloat/BDouble type 
 
30
   shiyer      01/21/03 - add getPoolNameUString to ConnectionPool
 
31
   shiyer      12/19/02 - Add cache sorted flush get/set to Environment
 
32
   shiyer      12/31/02 - added OCI_ATTR_CHAR_SIZE to typeattr attrs
 
33
   shiyer      12/09/02 - ensure new virtual interfaces are in order
 
34
   cparampa    10/12/02 - AQ Additions
 
35
   rvallam     10/12/02 - added  new methods for array pin 
 
36
   shiyer      10/09/02 - Statement caching, Stateless Connection
 
37
                          Pooling - UTF16 support. Added NLS versions
 
38
                          of getErrorMessage in SQLException
 
39
   rvallam     10/11/02 - added native float/double API - get(set) methods
 
40
                          for Statement and ResultSet class
 
41
   cparampa    09/23/02 - added methods for statement caching
 
42
   shiyer      10/01/02 - setVector versions for Windows
 
43
   shiyer      07/31/02 - 10iR1, OCCI Globalization support
 
44
   cparampa    09/23/02 - added methods for statement caching 
 
45
   praghuna    09/23/02 - 2333038:Fwd merge to 10i/MAIN 
 
46
   cparampa    08/26/02 - added class StatelessConnectionPool
 
47
                          added create/terminateStatelessConnnectionPool in Env 
 
48
   vvinay      08/06/02 - XA additions
 
49
   vvinay      06/25/02 - fix #2415021: math moved to occiHeapAlloc.h
 
50
   aahluwal    06/04/02 - bug 2360115
 
51
   vvinay      02/21/02 - operator= added for SQLException
 
52
   gayyappa    12/27/01 - add set/getDatabaseNCharParam 
 
53
   gayyappa    11/22/01 - modify interface to use strings for CharSet
 
54
   gayyappa    10/01/01 - call reserve() on vector in set/getVector 
 
55
   rkasamse    07/30/01 - 
 
56
   rkasamse    07/26/01 - add env handle attrs - cache max/opt size
 
57
   rvallam     07/23/01 - bug 1891228 - added throw() in destructor
 
58
                          of SQLException
 
59
   rvallam     06/14/01 - replace call to get(set)VectorOfRefs in 
 
60
                          get(set)Vector for Ref<T> with code in 
 
61
                          get(set)VectorOfRefs
 
62
   rvallam     11/06/01 - renamed internal methods in get/setVector to
 
63
                          get(set)VectorOfPObjects/get(set)VectorOfOCIRefs
 
64
                          as part of NT porting fix
 
65
                          added destructors to SQLException and MetaData
 
66
   rvallam     05/03/01 - added const to the vector parameter in setVector
 
67
                          of Statement for Ref<T>
 
68
   rratnam     04/10/01 - removed references to wstring
 
69
   kmohan      04/04/01 - include math.h for WIN32COMMON
 
70
   rvallam     04/02/01 - fixed linux porting bug 1654670
 
71
   gayyappa    03/27/01 - add code for templated getVector on stmt for objects.
 
72
   rvallam     03/20/01 - passed dummy parameter for Type in getVector for
 
73
                          void * in statement and ResultSet
 
74
   rratnam     03/15/01 - fixed set and getRef / get and setVector for NULL 
 
75
                          Refs
 
76
   rkasamse    03/19/01 - 1676579: HP compilation errors
 
77
   rratnam     03/07/01 - derived SQLException from exception, added what()
 
78
   chliang     03/05/01 - disable olint
 
79
   rvallam     02/23/01 - made getReadSQL/getWriteSQL methods const
 
80
   rratnam     01/29/01 - add closeStream() to Statement/ResultSet 
 
81
   rvallam     01/30/01 - added private method getListType() to
 
82
                          MetaData
 
83
   rratnam     01/03/01 - removed preTruncationLength() and isTruncated(),
 
84
                          added setBinary/CharacterStreamMode()
 
85
   rratnam     01/03/01 - added new method setErrorOnBusy in ConnectionPool 
 
86
   rratnam     12/29/00 - added a createProxyConnection without roles
 
87
   gayyappa    12/14/00 - add virtual functions getStatement/getConnection
 
88
                          to resultset and statement (fix bug# 1529888)
 
89
   gayyappa    12/13/00 - remove setErrorOnTruncate from Statement/resultset.
 
90
   rvallam     11/30/00 - removed #define NEVER
 
91
   gayyappa    11/17/00 - split get method in Map to getReadSQL
 
92
                          and getWriteSQL    
 
93
   rvallam     10/20/00 - modify cacheflush() to flushCache()
 
94
                          added enums to MetaData
 
95
   rvallam     09/14/00 - uncomment result set getMetaData method
 
96
                          rename it to getColumnListMetaData.
 
97
                          add get/set interval methods to stmt.
 
98
                          add getinterval methods to resultset.
 
99
   gayyappa    08/30/00 - added virtual destructor to occiconnection.
 
100
                          add default values to registerOutParam in
 
101
                          occistatement.
 
102
                          removed get/set vector and anydata in statement.
 
103
                          removed Stream header in ifdef directive.
 
104
   rvallam     08/10/00 - uncomment gets(), update occiConnection, update
 
105
                          Stream
 
106
   slari       08/06/00 - add statement stream methods
 
107
   slari       08/04/00 - add Statement::getXXX methods
 
108
   slari       08/02/00 - add Stream
 
109
   rratnam     08/04/00 - put in connection-cloning, proxy connections
 
110
   rvallam     08/04/00 - changed metadata header - method signatures
 
111
   rkasamse    08/04/00 - add setObject,setRef methods on Statement
 
112
   slari       07/27/00 - add Statement::setNull
 
113
   slari       07/26/00 - disable getBytes
 
114
   slari       07/25/00 - enable getBytes and getRowid
 
115
   rratnam     07/25/00 - Conn Pooling changes - added ConnectionPool,
 
116
                          Connection, removed Session
 
117
                          modified Environment (made getOCIEnvironment(),
 
118
                          getMap() and getMode() const,
 
119
                          added create/terminateConnectionPool(),
 
120
                          added userName and password to createConnection() )
 
121
   rkasamse    07/26/00 - uncomment getObject methods
 
122
   slari       07/10/00 - enable getString
 
123
   slari       07/05/00 - add result set methods
 
124
   rkasamse    07/17/00 - add get function to Map
 
125
   rratnam     06/16/00 - updated Session::getMetaData() to take the
 
126
                          parameter type
 
127
   rvallam     06/13/00 - updated MetaData
 
128
   rratnam     06/13/00 - added getRef() to Statement
 
129
                           and ResultSet,
 
130
                           made getOCIError(), getOCIEnvironment()
 
131
                           and getOCIServiceContext() in
 
132
                           Connection const
 
133
   kmohan      05/31/00 - Datamember Session * changed to 
 
134
                          SessionImpl *
 
135
                          in the class MetaData
 
136
                          change ORASTRINGSTL to ORASTRING
 
137
   slari       05/26/00 - change ORAVECTOR to ORAVECTORSTL
 
138
   slari       05/22/00 - add initial Statement class methods
 
139
   slari       05/10/00 - enable Connection and Session methods
 
140
   slari       04/21/00 - provide trivial implementation for 
 
141
                          ~Connection
 
142
   slari       04/17/00 - make Environment methods abstract
 
143
   slari       04/13/00 - add Environment
 
144
   gayyappa    04/18/00 - changed defn of SQLException
 
145
   kmohan      04/11/00 - added class definitions
 
146
   rkasamse    04/03/00 - header (interface) files for OCCI 
 
147
                          control classes.
 
148
   rkasamse    04/03/00 - Creation
 
149
 
 
150
*/
 
151
 
 
152
#ifndef _olint   /* disable olint check */
 
153
 
 
154
#ifndef OCCICONTROL_ORACLE
 
155
# define OCCICONTROL_ORACLE
 
156
 
 
157
#ifndef OCCICOMMON_ORACLE
 
158
#include <occiCommon.h>
 
159
#endif
 
160
 
 
161
#ifndef ORAEXCEPTION
 
162
#define ORAEXCEPTION
 
163
#include <exception>
 
164
#endif
 
165
 
 
166
namespace oracle {
 
167
namespace occi {
 
168
/*---------------------------------------------------------------------------
 
169
                     PUBLIC TYPES AND CONSTANTS
 
170
  ---------------------------------------------------------------------------*/
 
171
 
 
172
class MetaData
 
173
{
 
174
  public :
 
175
    
 
176
      enum AttrId 
 
177
      {ATTR_PTYPE = OCI_ATTR_PTYPE,
 
178
      ATTR_TIMESTAMP = OCI_ATTR_TIMESTAMP, 
 
179
      ATTR_OBJ_ID = OCI_ATTR_OBJ_ID,
 
180
      ATTR_OBJ_NAME = OCI_ATTR_OBJ_NAME, 
 
181
      ATTR_OBJ_SCHEMA = OCI_ATTR_OBJ_SCHEMA,
 
182
      ATTR_OBJID = OCI_ATTR_OBJID,
 
183
      ATTR_NUM_COLS = OCI_ATTR_NUM_COLS,
 
184
      ATTR_LIST_COLUMNS = OCI_ATTR_LIST_COLUMNS,
 
185
      ATTR_REF_TDO = OCI_ATTR_REF_TDO,
 
186
      ATTR_IS_TEMPORARY = OCI_ATTR_IS_TEMPORARY,
 
187
      ATTR_IS_TYPED = OCI_ATTR_IS_TYPED,
 
188
      ATTR_DURATION = OCI_ATTR_DURATION,
 
189
      ATTR_COLLECTION_ELEMENT = OCI_ATTR_COLLECTION_ELEMENT,
 
190
      ATTR_RDBA = OCI_ATTR_RDBA,
 
191
      ATTR_TABLESPACE = OCI_ATTR_TABLESPACE,
 
192
      ATTR_CLUSTERED = OCI_ATTR_CLUSTERED,
 
193
      ATTR_PARTITIONED = OCI_ATTR_PARTITIONED,
 
194
      ATTR_INDEX_ONLY = OCI_ATTR_INDEX_ONLY,
 
195
      ATTR_LIST_ARGUMENTS = OCI_ATTR_LIST_ARGUMENTS,
 
196
      ATTR_IS_INVOKER_RIGHTS = OCI_ATTR_IS_INVOKER_RIGHTS,
 
197
      ATTR_LIST_SUBPROGRAMS = OCI_ATTR_LIST_SUBPROGRAMS,
 
198
      ATTR_NAME = OCI_ATTR_NAME,
 
199
      ATTR_OVERLOAD_ID = OCI_ATTR_OVERLOAD_ID,
 
200
      ATTR_TYPECODE = OCI_ATTR_TYPECODE,
 
201
      ATTR_COLLECTION_TYPECODE = OCI_ATTR_COLLECTION_TYPECODE,
 
202
      ATTR_VERSION = OCI_ATTR_VERSION,
 
203
      ATTR_IS_INCOMPLETE_TYPE = OCI_ATTR_IS_INCOMPLETE_TYPE,
 
204
      ATTR_IS_SYSTEM_TYPE = OCI_ATTR_IS_SYSTEM_TYPE,
 
205
      ATTR_IS_PREDEFINED_TYPE = OCI_ATTR_IS_PREDEFINED_TYPE,
 
206
      ATTR_IS_TRANSIENT_TYPE = OCI_ATTR_IS_TRANSIENT_TYPE,
 
207
      ATTR_IS_SYSTEM_GENERATED_TYPE = 
 
208
              OCI_ATTR_IS_SYSTEM_GENERATED_TYPE,
 
209
      ATTR_HAS_NESTED_TABLE = OCI_ATTR_HAS_NESTED_TABLE,
 
210
      ATTR_HAS_LOB = OCI_ATTR_HAS_LOB,
 
211
      ATTR_HAS_FILE = OCI_ATTR_HAS_FILE,
 
212
      ATTR_NUM_TYPE_ATTRS = OCI_ATTR_NUM_TYPE_ATTRS,
 
213
      ATTR_LIST_TYPE_ATTRS = OCI_ATTR_LIST_TYPE_ATTRS,
 
214
      ATTR_NUM_TYPE_METHODS = OCI_ATTR_NUM_TYPE_METHODS, 
 
215
      ATTR_LIST_TYPE_METHODS = OCI_ATTR_LIST_TYPE_METHODS,
 
216
      ATTR_MAP_METHOD = OCI_ATTR_MAP_METHOD,
 
217
      ATTR_ORDER_METHOD = OCI_ATTR_ORDER_METHOD,
 
218
      ATTR_DATA_SIZE = OCI_ATTR_DATA_SIZE,
 
219
      ATTR_DATA_TYPE = OCI_ATTR_DATA_TYPE,
 
220
      ATTR_PRECISION = OCI_ATTR_PRECISION,
 
221
      ATTR_SCALE = OCI_ATTR_SCALE,
 
222
      ATTR_TYPE_NAME = OCI_ATTR_TYPE_NAME,
 
223
      ATTR_SCHEMA_NAME = OCI_ATTR_SCHEMA_NAME,
 
224
      ATTR_CHARSET_ID = OCI_ATTR_CHARSET_ID,
 
225
      ATTR_CHARSET_FORM = OCI_ATTR_CHARSET_FORM,
 
226
      ATTR_ENCAPSULATION = OCI_ATTR_ENCAPSULATION,
 
227
      ATTR_IS_CONSTRUCTOR = OCI_ATTR_IS_CONSTRUCTOR,
 
228
      ATTR_IS_DESTRUCTOR = OCI_ATTR_IS_DESTRUCTOR,
 
229
      ATTR_IS_OPERATOR = OCI_ATTR_IS_OPERATOR,
 
230
      ATTR_IS_SELFISH = OCI_ATTR_IS_SELFISH,
 
231
      ATTR_IS_MAP = OCI_ATTR_IS_MAP,
 
232
      ATTR_IS_ORDER = OCI_ATTR_IS_ORDER,
 
233
      ATTR_IS_RNDS = OCI_ATTR_IS_RNDS,
 
234
      ATTR_IS_RNPS = OCI_ATTR_IS_RNPS,
 
235
      ATTR_IS_WNDS = OCI_ATTR_IS_WNDS,
 
236
      ATTR_IS_WNPS = OCI_ATTR_IS_WNPS,
 
237
      ATTR_NUM_ELEMS = OCI_ATTR_NUM_ELEMS,
 
238
      ATTR_LINK = OCI_ATTR_LINK,
 
239
      ATTR_MIN = OCI_ATTR_MIN,
 
240
      ATTR_MAX = OCI_ATTR_MAX,
 
241
      ATTR_INCR = OCI_ATTR_INCR,
 
242
      ATTR_CACHE = OCI_ATTR_CACHE,
 
243
      ATTR_ORDER = OCI_ATTR_ORDER,
 
244
      ATTR_HW_MARK  = OCI_ATTR_HW_MARK,
 
245
      ATTR_IS_NULL = OCI_ATTR_IS_NULL,
 
246
      ATTR_POSITION = OCI_ATTR_POSITION,
 
247
      ATTR_HAS_DEFAULT =  OCI_ATTR_HAS_DEFAULT,
 
248
      ATTR_LEVEL = OCI_ATTR_LEVEL,
 
249
      ATTR_IOMODE = OCI_ATTR_IOMODE,
 
250
      ATTR_RADIX = OCI_ATTR_RADIX,
 
251
      ATTR_SUB_NAME = OCI_ATTR_SUB_NAME,
 
252
      ATTR_LIST_OBJECTS = OCI_ATTR_LIST_OBJECTS,
 
253
      ATTR_NCHARSET_ID = OCI_ATTR_NCHARSET_ID,
 
254
      ATTR_LIST_SCHEMAS = OCI_ATTR_LIST_SCHEMAS,
 
255
      ATTR_MAX_PROC_LEN = OCI_ATTR_MAX_PROC_LEN,
 
256
      ATTR_MAX_COLUMN_LEN = OCI_ATTR_MAX_COLUMN_LEN,
 
257
      ATTR_CURSOR_COMMIT_BEHAVIOR = 
 
258
          OCI_ATTR_CURSOR_COMMIT_BEHAVIOR,
 
259
      ATTR_MAX_CATALOG_NAMELEN = OCI_ATTR_MAX_CATALOG_NAMELEN,
 
260
      ATTR_CATALOG_LOCATION = OCI_ATTR_CATALOG_LOCATION,
 
261
      ATTR_SAVEPOINT_SUPPORT =  OCI_ATTR_SAVEPOINT_SUPPORT,
 
262
      ATTR_NOWAIT_SUPPORT =  OCI_ATTR_NOWAIT_SUPPORT,
 
263
      ATTR_AUTOCOMMIT_DDL =  OCI_ATTR_AUTOCOMMIT_DDL,
 
264
      ATTR_LOCKING_MODE =  OCI_ATTR_LOCKING_MODE,
 
265
      ATTR_IS_FINAL_TYPE = OCI_ATTR_IS_FINAL_TYPE,
 
266
      ATTR_IS_INSTANTIABLE_TYPE = OCI_ATTR_IS_INSTANTIABLE_TYPE,
 
267
      ATTR_IS_SUBTYPE = OCI_ATTR_IS_SUBTYPE,
 
268
      ATTR_SUPERTYPE_SCHEMA_NAME = OCI_ATTR_SUPERTYPE_SCHEMA_NAME,
 
269
      ATTR_SUPERTYPE_NAME = OCI_ATTR_SUPERTYPE_NAME,
 
270
      ATTR_FSPRECISION = OCI_ATTR_FSPRECISION,
 
271
      ATTR_LFPRECISION = OCI_ATTR_LFPRECISION,
 
272
      ATTR_IS_FINAL_METHOD = OCI_ATTR_IS_FINAL_METHOD,
 
273
      ATTR_IS_INSTANTIABLE_METHOD = OCI_ATTR_IS_INSTANTIABLE_METHOD,
 
274
      ATTR_IS_OVERRIDING_METHOD = OCI_ATTR_IS_OVERRIDING_METHOD,
 
275
      ATTR_CHAR_USED = OCI_ATTR_CHAR_USED,
 
276
      ATTR_CHAR_SIZE = OCI_ATTR_CHAR_SIZE
 
277
     };
 
278
 
 
279
     enum ParamType
 
280
         { 
 
281
           PTYPE_TABLE = OCI_PTYPE_TABLE
 
282
          ,PTYPE_VIEW = OCI_PTYPE_VIEW
 
283
          ,PTYPE_PROC = OCI_PTYPE_PROC
 
284
          ,PTYPE_FUNC = OCI_PTYPE_FUNC
 
285
          ,PTYPE_PKG = OCI_PTYPE_PKG
 
286
          ,PTYPE_TYPE = OCI_PTYPE_TYPE
 
287
          ,PTYPE_TYPE_ATTR = OCI_PTYPE_TYPE_ATTR
 
288
          ,PTYPE_TYPE_COLL = OCI_PTYPE_TYPE_COLL
 
289
          ,PTYPE_TYPE_METHOD = OCI_PTYPE_TYPE_METHOD
 
290
          ,PTYPE_SYN = OCI_PTYPE_SYN
 
291
          ,PTYPE_SEQ = OCI_PTYPE_SEQ
 
292
          ,PTYPE_COL = OCI_PTYPE_COL
 
293
          ,PTYPE_ARG = OCI_PTYPE_ARG
 
294
          ,PTYPE_TYPE_ARG = OCI_PTYPE_TYPE_ARG
 
295
          ,PTYPE_TYPE_RESULT = OCI_PTYPE_TYPE_RESULT
 
296
          ,PTYPE_SCHEMA = OCI_PTYPE_SCHEMA
 
297
          ,PTYPE_DATABASE = OCI_PTYPE_DATABASE
 
298
          ,PTYPE_UNK = OCI_PTYPE_UNK
 
299
         };
 
300
 
 
301
 
 
302
     enum { DURATION_SESSION = OCI_DURATION_SESSION
 
303
          ,DURATION_TRANS = OCI_DURATION_TRANS
 
304
          ,DURATION_NULL = OCI_DURATION_NULL
 
305
          ,TYPEENCAP_PRIVATE = OCI_TYPEENCAP_PRIVATE
 
306
          ,TYPEENCAP_PUBLIC = OCI_TYPEENCAP_PUBLIC
 
307
          ,TYPEPARAM_IN = OCI_TYPEPARAM_IN
 
308
          ,TYPEPARAM_OUT = OCI_TYPEPARAM_OUT
 
309
          ,TYPEPARAM_INOUT = OCI_TYPEPARAM_INOUT
 
310
          ,CURSOR_OPEN = OCI_CURSOR_OPEN
 
311
          ,CURSOR_CLOSED = OCI_CURSOR_CLOSED
 
312
          ,CL_START = OCI_CL_START
 
313
          ,CL_END = OCI_CL_END
 
314
          ,SP_SUPPORTED = OCI_SP_SUPPORTED
 
315
          ,SP_UNSUPPORTED = OCI_SP_UNSUPPORTED
 
316
          ,NW_SUPPORTED = OCI_NW_SUPPORTED
 
317
          ,NW_UNSUPPORTED = OCI_NW_UNSUPPORTED
 
318
          ,AC_DDL = OCI_AC_DDL
 
319
          ,NO_AC_DDL = OCI_NO_AC_DDL
 
320
          ,LOCK_IMMEDIATE = OCI_LOCK_IMMEDIATE
 
321
          ,LOCK_DELAYED = OCI_LOCK_DELAYED  
 
322
         }; 
 
323
 
 
324
      MetaData(const MetaData &omd);
 
325
      unsigned int getAttributeCount() const 
 
326
      ;
 
327
      AttrId getAttributeId(unsigned int attributenum) const 
 
328
      ;
 
329
      Type getAttributeType(unsigned int attributenum) const 
 
330
      ;
 
331
      int getInt(MetaData::AttrId attrid) const 
 
332
      ;
 
333
      bool getBoolean(MetaData::AttrId attrid) const 
 
334
      ;
 
335
      unsigned int getUInt(MetaData::AttrId attrid) const 
 
336
      ;
 
337
      OCCI_STD_NAMESPACE::string getString(MetaData::AttrId attrid) const 
 
338
      ;
 
339
      UString getUString(MetaData::AttrId attrid) const 
 
340
      ;
 
341
      Number getNumber(MetaData::AttrId attrid) const
 
342
      ;
 
343
      RefAny getRef(MetaData::AttrId attrid) const 
 
344
      ;
 
345
      Timestamp getTimestamp(MetaData::AttrId attrid) const 
 
346
      ;
 
347
      MetaData getMetaData(MetaData::AttrId attrid) const
 
348
      ;
 
349
      OCCI_STD_NAMESPACE::vector<MetaData> getVector(MetaData::AttrId attrid)
 
350
      const ;
 
351
      void  operator  =(const MetaData &omd);
 
352
 
 
353
      ~MetaData();  
 
354
     
 
355
   private:
 
356
 
 
357
  enum ociAttrType { OCI_UB1, 
 
358
                         OCI_UB2, 
 
359
                         OCI_UB4,
 
360
                         OCI_SB1, 
 
361
                         OCI_WORD,
 
362
                         OCI_UB1_BOOL,     
 
363
                         OCI_UB1PTR_TIMESTAMP,
 
364
                         OCI_UB1PTR_NUMBER,
 
365
                         OCI_TEXTPTR,
 
366
                         OCI_DVOIDPTR_PARAM,
 
367
                         OCI_DVOIDPTR_PARAMLIST,
 
368
                         OCI_OCIREFPTR,
 
369
                         OCI_OCIDURATION,
 
370
                         OCI_OCITYPECODE,
 
371
                         OCI_OCITYPEENCAP,
 
372
                         OCI_OCITYPEPARAMMODE,
 
373
                         OCI_OCIPRECISION
 
374
                      };
 
375
 
 
376
  enum AttrCount {COMMON_ATTR_COUNT = 5,
 
377
        TABLE_ATTR_COUNT = 12,
 
378
        VIEW_ATTR_COUNT = 7, 
 
379
        FUNCPROC_ATTR_COUNT = 4,
 
380
        PKG_ATTR_COUNT = 2,
 
381
        TYP_ATTR_COUNT = 27, 
 
382
        TYPEATTR_ATTR_COUNT = 14,
 
383
        TYPEMTHD_ATTR_COUNT = 16,
 
384
        COLL_ATTR_COUNT = 12,
 
385
        SYN_ATTR_COUNT = 4,
 
386
        SEQ_ATTR_COUNT = 7,
 
387
        COL_ATTR_COUNT = 13,
 
388
        ARG_TYPARG_TYPRES_ATTR_COUNT = 20, 
 
389
        SCHEMA_ATTR_COUNT = 1,
 
390
        DATABASE_ATTR_COUNT = 13,
 
391
        UNK_ATTR_COUNT = 0
 
392
        };
 
393
 
 
394
  static const AttrId commonAttrId[COMMON_ATTR_COUNT];
 
395
  static const ociAttrType commonAttrType[COMMON_ATTR_COUNT];
 
396
  static const AttrId tableAttrId[TABLE_ATTR_COUNT];
 
397
  static const ociAttrType tableAttrType[TABLE_ATTR_COUNT];
 
398
  static const AttrId viewAttrId[VIEW_ATTR_COUNT];
 
399
  static const ociAttrType viewAttrType[VIEW_ATTR_COUNT];
 
400
  static const AttrId funcprocAttrId[FUNCPROC_ATTR_COUNT];
 
401
  static const ociAttrType funcprocAttrType[FUNCPROC_ATTR_COUNT];
 
402
  static const AttrId pkgAttrId[PKG_ATTR_COUNT];
 
403
  static const ociAttrType pkgAttrType[PKG_ATTR_COUNT];
 
404
  static const AttrId typAttrId[TYP_ATTR_COUNT];
 
405
  static const ociAttrType typAttrType[TYP_ATTR_COUNT];
 
406
  static const AttrId typeattrAttrId[TYPEATTR_ATTR_COUNT];
 
407
  static const ociAttrType typeattrAttrType[TYPEATTR_ATTR_COUNT];
 
408
  static const AttrId typmethdAttrId[TYPEMTHD_ATTR_COUNT];
 
409
  static const ociAttrType typemthdAttrType[TYPEMTHD_ATTR_COUNT];
 
410
  static const AttrId collAttrId[COLL_ATTR_COUNT];
 
411
  static const ociAttrType collAttrType[COLL_ATTR_COUNT];
 
412
  static const AttrId synAttrId[SYN_ATTR_COUNT];
 
413
  static const ociAttrType synAttrType[SYN_ATTR_COUNT];
 
414
  static const AttrId seqAttrId[SEQ_ATTR_COUNT];
 
415
  static const ociAttrType seqAttrType[SEQ_ATTR_COUNT];
 
416
  static const AttrId colAttrId[COL_ATTR_COUNT];
 
417
  static const ociAttrType colAttrType[COL_ATTR_COUNT];
 
418
  static const AttrId argtargtresAttrId[ARG_TYPARG_TYPRES_ATTR_COUNT];
 
419
  static const ociAttrType argtargtresAttrType[
 
420
                   ARG_TYPARG_TYPRES_ATTR_COUNT];
 
421
  static const AttrId schemaAttrId[SCHEMA_ATTR_COUNT];
 
422
  static const ociAttrType schemaAttrType[SCHEMA_ATTR_COUNT];
 
423
  static const AttrId databaseAttrId[DATABASE_ATTR_COUNT];
 
424
  static const ociAttrType databaseAttrType[DATABASE_ATTR_COUNT];
 
425
 
 
426
  Ptr<MetaDataImpl> metaDataImplPtr;
 
427
  const OCIParam* paramhp;
 
428
  const ConnectionImpl* sesn;
 
429
  const AttrId* attrIdArray;
 
430
  const ociAttrType* attrTypeArray;
 
431
  AttrCount attrCount;
 
432
  
 
433
  MetaData(const Connection *sessp, const OCCI_STD_NAMESPACE::string& objName,
 
434
  ParamType prmtyp ) ;
 
435
  MetaData(const Connection *sessp, const UString& objName,
 
436
  ParamType prmtyp ) ;
 
437
  MetaData(const Connection *sessp, 
 
438
  const RefAny& ref) ;
 
439
  MetaData(const Connection *sessp, MetaDataImpl *implPtr,
 
440
  OCIParam* parm) ;
 
441
  MetaData(const Connection *sessp, MetaDataImpl *implPtr,
 
442
  OCIParam *parm, ub1 parmTyp) ;
 
443
  ub1 getParamType(OCIParam* prm) const ;
 
444
  const AttrId* getAttrIdArrayAddr(ub1 prmTyp) const;
 
445
  const ociAttrType* getAttrTypeArrayAddr(ub1 prmTyp) const;
 
446
  AttrCount getAttrCount(ub1 prmTyp) const; 
 
447
  Type getType(ociAttrType typ) const;
 
448
  bool isListTypeAttribute(AttrId attrid,ub1 ptyp) const;
 
449
  boolean isInvalidAttrId(AttrId attrid,sb4* pos, 
 
450
            boolean* isTypeSpecificAttrPtr) const;
 
451
  ociAttrType getValidAttrType(sb4 index, boolean isTypeSpecificAttr)
 
452
  const;
 
453
 
 
454
  int getListType (const OCIParam *plist) const;
 
455
  unsigned int getLowerBound(int ltype) const;
 
456
  unsigned int getUpperBound(unsigned int ltype, 
 
457
    unsigned int paramnum) const;
 
458
  friend class ConnectionImpl;
 
459
  friend class ResultSetImpl;
 
460
 
 
461
};
 
462
 
 
463
class Connection
 
464
{
 
465
   public :
 
466
 
 
467
      // specifies the type of proxy to be created,
 
468
      // used for future enhancements
 
469
      enum ProxyType
 
470
      {PROXY_DEFAULT
 
471
      };
 
472
 
 
473
      virtual ~Connection() { }
 
474
      virtual Statement* createStatement(
 
475
        const OCCI_STD_NAMESPACE::string  &sql = "") 
 
476
         =0; 
 
477
      virtual void terminateStatement(Statement *statement) =0;
 
478
      virtual void commit()  =0; 
 
479
      virtual void rollback()  =0;
 
480
      virtual MetaData getMetaData(const OCCI_STD_NAMESPACE::string &object, 
 
481
        MetaData::ParamType prmtyp 
 
482
        = MetaData::PTYPE_UNK) const 
 
483
         =0; 
 
484
      virtual MetaData getMetaData(const RefAny &ref) const
 
485
         =0; 
 
486
      virtual OCCI_STD_NAMESPACE::string getClientCharSet() const 
 
487
         =0; 
 
488
      virtual OCCI_STD_NAMESPACE::string getClientNCHARCharSet() const 
 
489
         =0; 
 
490
      virtual void changePassword(const OCCI_STD_NAMESPACE::string &user,
 
491
        const OCCI_STD_NAMESPACE::string &oldPassword,
 
492
        const OCCI_STD_NAMESPACE::string &newPassword) 
 
493
         =0; 
 
494
      virtual void flushCache()  =0; 
 
495
 
 
496
      virtual OCIServer*  getOCIServer() const =0;
 
497
      virtual OCISvcCtx*  getOCIServiceContext() const =0;
 
498
      virtual OCISession* getOCISession() const =0;
 
499
 
 
500
      //new interfaces
 
501
 
 
502
      virtual Statement* createStatement(const UString &sql) = 0;
 
503
      virtual MetaData getMetaData(const UString &object, 
 
504
        MetaData::ParamType prmtyp 
 
505
        = MetaData::PTYPE_UNK) const 
 
506
         =0; 
 
507
      virtual UString getClientCharSetUString() const 
 
508
         =0; 
 
509
      virtual UString getClientNCHARCharSetUString() const 
 
510
         =0; 
 
511
      virtual void changePassword(const UString &user,
 
512
        const UString &oldPassword,
 
513
        const UString &newPassword) 
 
514
         =0; 
 
515
      virtual OCCI_STD_NAMESPACE::string getTag() const =0;
 
516
      virtual void setStmtCacheSize(unsigned int cacheSize) = 0;
 
517
      virtual unsigned int getStmtCacheSize() const =0;
 
518
      virtual Statement* createStatement(const OCCI_STD_NAMESPACE::string &sql,
 
519
                    const OCCI_STD_NAMESPACE::string &tag) = 0;
 
520
      virtual void terminateStatement(Statement* stmt, 
 
521
                    const OCCI_STD_NAMESPACE::string &tag) = 0;
 
522
      virtual bool isCached(const OCCI_STD_NAMESPACE::string &sql,
 
523
                    const OCCI_STD_NAMESPACE::string &tag = "") = 0;
 
524
      virtual void registerSubscriptions(
 
525
       const OCCI_STD_NAMESPACE::vector<aq::Subscription>& sub) =0;
 
526
      virtual void unregisterSubscription(const aq::Subscription& sub) =0;
 
527
      virtual void postToSubscriptions(
 
528
       const OCCI_STD_NAMESPACE::vector<aq::Subscription>& sub) =0;
 
529
      virtual Statement* createStatement(const UString &sql,
 
530
                    const UString &tag) = 0;
 
531
      virtual void terminateStatement(Statement* stmt, 
 
532
                    const UString &tag) = 0;
 
533
      virtual bool isCached(const UString &sql,
 
534
                    const UString &tag) = 0;
 
535
};
 
536
 
 
537
class StatelessConnectionPool
 
538
{
 
539
  public :
 
540
 
 
541
    enum PoolType
 
542
    {
 
543
      HETEROGENEOUS = OCI_DEFAULT,
 
544
      HOMOGENEOUS = OCI_SPC_HOMOGENEOUS
 
545
    };
 
546
 
 
547
    enum BusyOption
 
548
    {
 
549
       WAIT = OCI_SPOOL_ATTRVAL_WAIT,
 
550
       NOWAIT = OCI_SPOOL_ATTRVAL_NOWAIT,
 
551
       FORCEGET = OCI_SPOOL_ATTRVAL_FORCEGET
 
552
    };
 
553
 
 
554
    enum DestroyMode
 
555
    {
 
556
       DEFAULT = OCI_DEFAULT,
 
557
       SPD_FORCE = OCI_SPD_FORCE
 
558
    };
 
559
 
 
560
    virtual ~StatelessConnectionPool() {}
 
561
    virtual unsigned int getBusyConnections() const =0;
 
562
    virtual unsigned int getOpenConnections() const =0;
 
563
    virtual unsigned int getMinConnections() const =0;
 
564
    virtual unsigned int getMaxConnections() const =0;
 
565
    virtual unsigned int getIncrConnections() const =0;
 
566
    virtual OCCI_STD_NAMESPACE::string getPoolName() const =0;
 
567
    virtual unsigned int getTimeOut() const =0;
 
568
    virtual void setBusyOption(BusyOption busyOption) =0;
 
569
    virtual BusyOption getBusyOption() const =0;
 
570
    virtual void setTimeOut(unsigned int connTimeOut =0) =0;
 
571
    virtual void setPoolSize(unsigned int maxConn =1,
 
572
      unsigned int minConn =0, unsigned int incrConn =1) =0;
 
573
    virtual Connection* getConnection( 
 
574
      const OCCI_STD_NAMESPACE::string &tag ="") =0;
 
575
    virtual Connection* getConnection(
 
576
      const OCCI_STD_NAMESPACE::string &userName,
 
577
      const OCCI_STD_NAMESPACE::string &password,
 
578
      const OCCI_STD_NAMESPACE::string &tag = "") =0;
 
579
    virtual Connection* getAnyTaggedConnection(
 
580
      const OCCI_STD_NAMESPACE::string &tag = "") =0;
 
581
    virtual Connection* getAnyTaggedConnection(
 
582
      const OCCI_STD_NAMESPACE::string &userName,
 
583
      const OCCI_STD_NAMESPACE::string &Password,
 
584
      const OCCI_STD_NAMESPACE::string &tag = "") =0;
 
585
    virtual Connection* getProxyConnection(
 
586
      const OCCI_STD_NAMESPACE::string &name,
 
587
      OCCI_STD_NAMESPACE::string roles[], unsigned int numRoles,
 
588
      const OCCI_STD_NAMESPACE::string &tag = "",
 
589
      Connection::ProxyType proxyType = Connection::PROXY_DEFAULT) =0;
 
590
    virtual Connection* getProxyConnection(
 
591
      const OCCI_STD_NAMESPACE::string &name,
 
592
      const OCCI_STD_NAMESPACE::string &tag = "" ,
 
593
      Connection::ProxyType proxyType = Connection::PROXY_DEFAULT) =0;
 
594
    virtual Connection* getAnyTaggedProxyConnection(
 
595
      const OCCI_STD_NAMESPACE::string &name,
 
596
      OCCI_STD_NAMESPACE::string roles[], unsigned int numRoles,
 
597
      const OCCI_STD_NAMESPACE::string &tag = "",
 
598
      Connection::ProxyType proxyType = Connection::PROXY_DEFAULT) =0;
 
599
    virtual Connection* getAnyTaggedProxyConnection(
 
600
      const OCCI_STD_NAMESPACE::string &name,
 
601
      const OCCI_STD_NAMESPACE::string &tag="",
 
602
      Connection::ProxyType proxyType = Connection::PROXY_DEFAULT ) =0;
 
603
    virtual void releaseConnection (Connection *connection,
 
604
      const OCCI_STD_NAMESPACE::string &tag = "") =0;
 
605
    virtual void terminateConnection (Connection *connection) =0;
 
606
    virtual void setStmtCacheSize(unsigned int cacheSize) =0;
 
607
    virtual unsigned int getStmtCacheSize() const =0;
 
608
 
 
609
    virtual Connection* getConnection(const UString &tag)=0;
 
610
    virtual Connection* getConnection(const UString &userName,
 
611
      const UString &password,
 
612
      const UString &tag)=0;
 
613
    virtual Connection* getAnyTaggedConnection(const UString &tag)=0;
 
614
    virtual Connection* getAnyTaggedConnection( const UString &userName,
 
615
      const UString &Password, const UString &tag)=0 ;
 
616
    virtual Connection* getProxyConnection(const UString &name,
 
617
      OCCI_STD_NAMESPACE::string roles[], unsigned int numRoles,
 
618
      const UString &tag,
 
619
      Connection::ProxyType proxyType = Connection::PROXY_DEFAULT)=0;
 
620
    virtual Connection* getProxyConnection(const UString &name,
 
621
      const UString &tag, Connection::ProxyType
 
622
      proxyType = Connection::PROXY_DEFAULT)=0;
 
623
    virtual Connection* getAnyTaggedProxyConnection(const UString &name,
 
624
      OCCI_STD_NAMESPACE::string roles[], unsigned int numRoles,
 
625
      const UString &tag,
 
626
      Connection::ProxyType proxyType = Connection::PROXY_DEFAULT)=0;
 
627
    virtual Connection* getAnyTaggedProxyConnection(const UString &name,
 
628
      const UString &tag,
 
629
      Connection::ProxyType proxyType = Connection::PROXY_DEFAULT )=0;
 
630
    virtual void releaseConnection(Connection *connection,
 
631
      const UString  &tag)=0;
 
632
 
 
633
};
 
634
 
 
635
 
 
636
class ConnectionPool
 
637
{
 
638
  public :
 
639
 
 
640
    virtual ~ConnectionPool() {}
 
641
    virtual unsigned int getBusyConnections() const 
 
642
       =0; 
 
643
    virtual unsigned int getOpenConnections() const 
 
644
       =0; 
 
645
    virtual unsigned int getMinConnections() const 
 
646
       =0; 
 
647
    virtual unsigned int getMaxConnections() const 
 
648
       =0; 
 
649
    virtual unsigned int getIncrConnections() const 
 
650
       =0; 
 
651
    virtual OCCI_STD_NAMESPACE::string getPoolName() const 
 
652
       =0; 
 
653
    virtual unsigned int getTimeOut() const 
 
654
       =0; 
 
655
    virtual void setErrorOnBusy() 
 
656
       =0; 
 
657
    virtual void setTimeOut(unsigned int connTimeOut =0) 
 
658
       =0; 
 
659
    virtual void setPoolSize(unsigned int minConn =0,
 
660
      unsigned int maxConn =1, unsigned int incrConn =1) 
 
661
       =0; 
 
662
    virtual Connection* createConnection(
 
663
      const OCCI_STD_NAMESPACE::string &userName,
 
664
      const OCCI_STD_NAMESPACE::string &password)  =0; 
 
665
 
 
666
    virtual Connection* createProxyConnection(
 
667
      const OCCI_STD_NAMESPACE::string &name,
 
668
      OCCI_STD_NAMESPACE::string roles[], unsigned int numRoles,
 
669
      Connection::ProxyType proxyType = 
 
670
      Connection::PROXY_DEFAULT)  =0; 
 
671
 
 
672
    virtual Connection* createProxyConnection(
 
673
      const OCCI_STD_NAMESPACE::string &name,
 
674
      Connection::ProxyType proxyType =
 
675
      Connection::PROXY_DEFAULT)  =0;
 
676
 
 
677
    virtual void terminateConnection
 
678
      (Connection *connection) =0;
 
679
 
 
680
    //new interfaces
 
681
 
 
682
    virtual Connection* createConnection(
 
683
      const UString &userName,
 
684
      const UString &password)  =0; 
 
685
    
 
686
    virtual Connection* createProxyConnection(const UString &name,
 
687
      OCCI_STD_NAMESPACE::string roles[], unsigned int numRoles,
 
688
      Connection::ProxyType proxyType = 
 
689
      Connection::PROXY_DEFAULT)  =0; 
 
690
    
 
691
    virtual Connection* createProxyConnection(const UString &name,
 
692
      Connection::ProxyType proxyType =
 
693
      Connection::PROXY_DEFAULT)  =0;
 
694
    
 
695
    virtual void setStmtCacheSize(unsigned int cacheSize) =0;
 
696
    virtual unsigned int getStmtCacheSize() const =0;
 
697
 
 
698
    virtual UString getPoolNameUString() const 
 
699
       =0; 
 
700
};
 
701
 
 
702
class   Environment     
 
703
{
 
704
 public:
 
705
                    // class constants
 
706
 
 
707
  enum Mode
 
708
  {
 
709
    DEFAULT = OCI_DEFAULT,
 
710
    OBJECT = OCI_OBJECT,
 
711
    SHARED = OCI_SHARED,
 
712
    NO_USERCALLBACKS = OCI_NO_UCB,
 
713
    THREADED_MUTEXED = OCI_THREADED,
 
714
    THREADED_UNMUTEXED = OCI_THREADED | OCI_ENV_NO_MUTEX,
 
715
    EVENTS = OCI_EVENTS,
 
716
    USE_LDAP = OCI_USE_LDAP
 
717
  };
 
718
 
 
719
  virtual ~Environment(){}
 
720
 
 
721
                    // public methods
 
722
 
 
723
  static Environment * createEnvironment(
 
724
                              Mode mode = DEFAULT,
 
725
                              void *ctxp = 0,
 
726
                              void *(*malocfp)(void *ctxp, size_t size) = 0,
 
727
                              void *(*ralocfp)(void *ctxp, void *memptr,
 
728
                                               size_t newsize) = 0,
 
729
                              void (*mfreefp)(void *ctxp, void *memptr) = 0);
 
730
  
 
731
  static Environment * createEnvironment(
 
732
                              const OCCI_STD_NAMESPACE::string &charset,
 
733
                              const OCCI_STD_NAMESPACE::string &ncharset,
 
734
                              Mode mode = DEFAULT,
 
735
                              void *ctxp = 0,
 
736
                              void *(*malocfp)(void *ctxp, size_t size) = 0,
 
737
                              void *(*ralocfp)(void *ctxp, void *memptr,
 
738
                                               size_t newsize) = 0,
 
739
                              void (*mfreefp)(void *ctxp, void *memptr) = 0);
 
740
 
 
741
  static void terminateEnvironment(Environment *env);
 
742
  
 
743
  static Environment* getXAEnvironment(const 
 
744
                           OCCI_STD_NAMESPACE::string& dbname);
 
745
 
 
746
  static void releaseXAEnvironment(Environment *env);
 
747
  
 
748
  virtual Connection * createConnection(
 
749
    const OCCI_STD_NAMESPACE::string &userName,
 
750
    const OCCI_STD_NAMESPACE::string &password, 
 
751
    const OCCI_STD_NAMESPACE::string &connectString = "") = 0;
 
752
 
 
753
  virtual void terminateConnection(Connection *connection) = 0;
 
754
 
 
755
  virtual ConnectionPool* createConnectionPool(
 
756
    const OCCI_STD_NAMESPACE::string &poolUserName,
 
757
    const OCCI_STD_NAMESPACE::string &poolPassword, 
 
758
    const OCCI_STD_NAMESPACE::string &connectString ="", 
 
759
    unsigned int minConn =0,
 
760
    unsigned int maxConn =1, unsigned int incrConn =1) = 0;
 
761
 
 
762
  virtual void terminateConnectionPool(ConnectionPool *poolp) = 0;
 
763
 
 
764
  virtual unsigned int getCurrentHeapSize() const = 0;
 
765
 
 
766
  virtual OCIEnv * getOCIEnvironment() const = 0;
 
767
 
 
768
  virtual Map *getMap() const = 0;
 
769
 
 
770
  virtual void setCacheMaxSize(unsigned int maxSize) = 0; 
 
771
  
 
772
  virtual unsigned int getCacheMaxSize() const = 0; 
 
773
  
 
774
  virtual void setCacheOptSize(unsigned int OptSize) = 0; 
 
775
  
 
776
  virtual unsigned int getCacheOptSize() const = 0; 
 
777
 
 
778
 
 
779
  //new interfaces
 
780
 
 
781
  virtual Connection * createConnection(const UString &userName,
 
782
    const UString &password, const UString &connectString) = 0;
 
783
  
 
784
  virtual ConnectionPool* createConnectionPool(
 
785
    const UString &poolUserName,
 
786
    const UString &poolPassword, const UString &connectString, 
 
787
    unsigned int minConn =0,
 
788
    unsigned int maxConn =1, unsigned int incrConn =1) = 0;
 
789
 
 
790
  virtual Connection* getXAConnection(const 
 
791
                           OCCI_STD_NAMESPACE::string& dbname) = 0;
 
792
 
 
793
  virtual void releaseXAConnection(Connection* conn) =0;
 
794
  
 
795
  virtual StatelessConnectionPool* createStatelessConnectionPool(
 
796
    const OCCI_STD_NAMESPACE::string &poolUserName,
 
797
    const OCCI_STD_NAMESPACE::string &poolPassword,
 
798
    const OCCI_STD_NAMESPACE::string &connectString = "",
 
799
    unsigned int maxConn = 1, unsigned int minConn = 0,
 
800
    unsigned int incrConn = 1,
 
801
    StatelessConnectionPool::PoolType pType 
 
802
                                 = StatelessConnectionPool::HETEROGENEOUS) = 0;
 
803
  
 
804
  virtual StatelessConnectionPool* createStatelessConnectionPool(
 
805
    const UString &poolUserName,
 
806
    const UString &poolPassword,
 
807
    const UString &connectString,
 
808
    unsigned int maxConn = 1, unsigned int minConn = 0,
 
809
    unsigned int incrConn = 1,
 
810
    StatelessConnectionPool::PoolType pType 
 
811
                                 = StatelessConnectionPool::HETEROGENEOUS) = 0;
 
812
 
 
813
  virtual void terminateStatelessConnectionPool(StatelessConnectionPool *poolp,
 
814
  StatelessConnectionPool::DestroyMode mode = StatelessConnectionPool::DEFAULT)
 
815
      = 0;
 
816
  virtual void setLDAPAuthentication(unsigned int mode) =0;
 
817
 
 
818
  virtual unsigned int getLDAPAuthentication() const =0;
 
819
  
 
820
  virtual void setLDAPLoginNameAndPassword(
 
821
     const OCCI_STD_NAMESPACE::string &login,
 
822
     const OCCI_STD_NAMESPACE::string &passwd) =0;
 
823
 
 
824
  virtual void setLDAPAdminContext(const OCCI_STD_NAMESPACE::string &ctx)=0;
 
825
 
 
826
  virtual OCCI_STD_NAMESPACE::string getLDAPAdminContext() const =0;
 
827
 
 
828
  virtual void setLDAPHostAndPort(const OCCI_STD_NAMESPACE::string &host,
 
829
     unsigned int port) =0;
 
830
 
 
831
  virtual OCCI_STD_NAMESPACE::string getLDAPHost() const =0;
 
832
 
 
833
  virtual unsigned int getLDAPPort() const =0;  
 
834
 
 
835
  virtual void registerSubscriptions(
 
836
     const OCCI_STD_NAMESPACE::vector<aq::Subscription>& sub) =0;
 
837
 
 
838
  virtual void unregisterSubscription(const aq::Subscription& sub) =0; 
 
839
 
 
840
  virtual void enableSubscription(const aq::Subscription& sub) =0;
 
841
  
 
842
  virtual void disableSubscription(const aq::Subscription& sub) =0;
 
843
  
 
844
  virtual bool getCacheSortedFlush() const = 0;
 
845
 
 
846
  virtual void setCacheSortedFlush(bool flag) = 0;
 
847
 
 
848
  private:
 
849
 
 
850
};
 
851
 
 
852
 
 
853
 
 
854
class Map
 
855
{
 
856
 public:
 
857
 
 
858
  virtual ~Map(){}
 
859
  virtual void put(const OCCI_STD_NAMESPACE::string&, void *(*)(void *), 
 
860
                void (*)(void *, void *)) = 0;
 
861
  virtual void getReadSQL(
 
862
    void *, unsigned int, void *, unsigned int, void **) const = 0;
 
863
  virtual void getWriteSQL(
 
864
    void *, unsigned int, void *, unsigned int, void **) const = 0;
 
865
  virtual void put(const OCCI_STD_NAMESPACE::string&, 
 
866
                const OCCI_STD_NAMESPACE::string&, void *(*)(void *), 
 
867
                void (*)(void *, void *)) = 0;
 
868
  virtual void putUTF16(const OCCI_STD_NAMESPACE::string&, 
 
869
                const OCCI_STD_NAMESPACE::string&, void *(*)(void *), 
 
870
                void (*)(void *, void *)) = 0;
 
871
 
 
872
 private:
 
873
};
 
874
 
 
875
 
 
876
   
 
877
class SQLException : public OCCI_STD_NAMESPACE::exception
 
878
{
 
879
 public:
 
880
 
 
881
  virtual int getErrorCode() const;
 
882
  
 
883
  virtual OCCI_STD_NAMESPACE::string getMessage() const;
 
884
 
 
885
  const char *what() const throw();
 
886
 
 
887
  virtual void setErrorCtx(void *ctx);
 
888
  
 
889
  SQLException();
 
890
 
 
891
  SQLException(const SQLException &e);
 
892
 
 
893
  void operator=(const SQLException &other);
 
894
 
 
895
  virtual ~SQLException() throw();
 
896
 
 
897
  virtual int getXAErrorCode(const OCCI_STD_NAMESPACE::string& dbname) const;
 
898
  
 
899
  virtual UString getUStringMessage() const;
 
900
 
 
901
  virtual OCCI_STD_NAMESPACE::string getNLSMessage(Environment *env) const;
 
902
  
 
903
  virtual UString getNLSUStringMessage(Environment *env) const;
 
904
 
 
905
 private:
 
906
 
 
907
  Ptr<SQLExceptionImpl> ptr_;
 
908
  SQLException(SQLExceptionImpl *ptr);
 
909
  friend SQLException SQLExceptionCreate(int errorCode);
 
910
  friend SQLException SQLExceptionCreate(dvoid *handle,
 
911
  int handleType);
 
912
 
 
913
};
 
914
 
 
915
 
 
916
class Statement 
 
917
{
 
918
 public:
 
919
                                // class constants
 
920
 
 
921
  virtual ~Statement() {}
 
922
  
 
923
  enum Status                                   
 
924
  {
 
925
    UNPREPARED,
 
926
    PREPARED,
 
927
    RESULT_SET_AVAILABLE,
 
928
    UPDATE_COUNT_AVAILABLE,
 
929
    NEEDS_STREAM_DATA,
 
930
    STREAM_DATA_AVAILABLE
 
931
  };
 
932
  
 
933
                                // common methods
 
934
  
 
935
  virtual void setSQL(const OCCI_STD_NAMESPACE::string &sql) = 0; 
 
936
 
 
937
  virtual OCCI_STD_NAMESPACE::string getSQL() const = 0;
 
938
 
 
939
  virtual Status execute(const OCCI_STD_NAMESPACE::string &sql = "") = 0;
 
940
  
 
941
  virtual ResultSet * getResultSet() = 0;
 
942
  
 
943
  virtual unsigned int getUpdateCount() const = 0; 
 
944
  
 
945
  virtual ResultSet * executeQuery(
 
946
    const OCCI_STD_NAMESPACE::string &sql = "") = 0;
 
947
  
 
948
  virtual unsigned int executeUpdate(
 
949
    const OCCI_STD_NAMESPACE::string &sql = "") = 0; 
 
950
  
 
951
  virtual Status status() const = 0;  
 
952
                                        
 
953
  virtual void closeResultSet(ResultSet *resultSet) = 0;
 
954
  
 
955
  virtual void setPrefetchRowCount(unsigned int rowCount) = 0; 
 
956
  
 
957
  virtual void setPrefetchMemorySize(unsigned int bytes) = 0;
 
958
  
 
959
  virtual void setAutoCommit(bool autoCommit) = 0;
 
960
  
 
961
  virtual bool getAutoCommit() const = 0;
 
962
  
 
963
  virtual OCIStmt * getOCIStatement() const = 0;
 
964
 
 
965
 
 
966
                    // methods for prepared statements with IN
 
967
                    // parameters  
 
968
 
 
969
  virtual void setMaxParamSize(unsigned int paramIndex,unsigned int maxSize)=0;
 
970
  
 
971
  virtual unsigned int getMaxParamSize(unsigned int paramIndex) const = 0;
 
972
 
 
973
  virtual void setNull(unsigned int paramIndex, Type type) = 0;
 
974
 
 
975
  virtual void setInt(unsigned int paramIndex, int x) = 0; 
 
976
  
 
977
  virtual void setUInt(unsigned int paramIndex, unsigned int x) = 0; 
 
978
  
 
979
  virtual void setFloat(unsigned int paramIndex, float x) = 0; 
 
980
 
 
981
  virtual void setDouble(unsigned int paramIndex, double x) = 0; 
 
982
 
 
983
  virtual void setNumber(unsigned int paramIndex, const Number &x) = 0; 
 
984
  
 
985
  virtual void setString(unsigned int paramIndex, 
 
986
    const OCCI_STD_NAMESPACE::string &x) = 0; 
 
987
 
 
988
  virtual void setBytes(unsigned int paramIndex, const Bytes &x) = 0; 
 
989
 
 
990
  virtual void setDate(unsigned int paramIndex, const Date &x) = 0; 
 
991
  
 
992
  virtual void setTimestamp(unsigned int paramIndex, const Timestamp &x) = 0; 
 
993
 
 
994
  virtual void setBlob(unsigned int paramIndex, const Blob &x) = 0;
 
995
 
 
996
  virtual void setClob(unsigned int paramIndex, const Clob &x) = 0;
 
997
 
 
998
  virtual void setBfile(unsigned int paramIndex, const Bfile &x) = 0;
 
999
 
 
1000
  virtual void setIntervalYM(unsigned int paramIndex, const IntervalYM &x) = 0;
 
1001
 
 
1002
  virtual void setIntervalDS(unsigned int paramIndex, const IntervalDS &x) = 0;
 
1003
 
 
1004
  virtual void setRowid(unsigned int paramIndex, const Bytes &x) = 0; 
 
1005
  
 
1006
  virtual void setRef(unsigned int paramIndex, const RefAny &x) = 0; 
 
1007
 
 
1008
  virtual void setObject(unsigned int paramIndex, PObject * x) = 0; 
 
1009
  
 
1010
  virtual void setDataBuffer(unsigned int paramIndex, void *buffer, 
 
1011
                             Type type,
 
1012
                             sb4 size, ub2 *length, sb2 *ind = NULL,
 
1013
                             ub2 *rc = NULL) = 0; 
 
1014
 
 
1015
  virtual void setDataBufferArray(unsigned int paramIndex, void *buffer, 
 
1016
                                  Type type,
 
1017
                                  ub4 arraySize, ub4 *arrayLength,
 
1018
                                  sb4 elementSize,
 
1019
                                  ub2 *elementLength, sb2 *ind = NULL,
 
1020
                                  ub2 *rc = NULL) = 0;
 
1021
 
 
1022
  virtual void setCharSet(unsigned int paramIndex, 
 
1023
  const OCCI_STD_NAMESPACE::string & charSet) = 0; 
 
1024
  
 
1025
  virtual OCCI_STD_NAMESPACE::string getCharSet(unsigned int paramIndex) 
 
1026
  const = 0; 
 
1027
  
 
1028
  virtual void setDatabaseNCHARParam(
 
1029
    unsigned int paramIndex, bool isNCHAR) = 0;
 
1030
                                         
 
1031
  virtual bool getDatabaseNCHARParam(unsigned int paramIndex) const = 0;       
 
1032
 
 
1033
  virtual void closeStream(Stream *stream) =0;
 
1034
 
 
1035
  virtual Stream * getStream(unsigned int paramIndex) = 0; 
 
1036
  
 
1037
  virtual unsigned int getCurrentStreamParam() const = 0; 
 
1038
  
 
1039
  virtual unsigned int getCurrentStreamIteration() const = 0;
 
1040
 
 
1041
  virtual void setBinaryStreamMode(unsigned int colIndex, 
 
1042
    unsigned int size) =0;
 
1043
 
 
1044
  virtual void setCharacterStreamMode(unsigned int colIndex, 
 
1045
    unsigned int size) =0;
 
1046
  
 
1047
  virtual void setMaxIterations(unsigned int maxIterations) = 0;
 
1048
  
 
1049
  virtual unsigned int getMaxIterations() const = 0; 
 
1050
 
 
1051
  virtual void addIteration() = 0; 
 
1052
  
 
1053
  virtual unsigned int getCurrentIteration() const = 0; 
 
1054
 
 
1055
  virtual Status executeArrayUpdate(unsigned int arrayLength) = 0;
 
1056
  
 
1057
 
 
1058
                    // methods for Callable Statements
 
1059
 
 
1060
  virtual void registerOutParam(unsigned int paramIndex, Type type, 
 
1061
  unsigned int maxSize=0, const OCCI_STD_NAMESPACE::string &sqltype="") = 0;
 
1062
  
 
1063
  virtual bool isNull(unsigned int paramIndex) const = 0;
 
1064
 
 
1065
  virtual bool isTruncated(unsigned int paramIndex) const
 
1066
   =0;
 
1067
 
 
1068
  
 
1069
  virtual void setErrorOnNull(unsigned int paramIndex, 
 
1070
    bool causeException) = 0;
 
1071
                               
 
1072
  virtual void setErrorOnTruncate(unsigned int paramIndex,
 
1073
  bool causeException)  = 0;
 
1074
 
 
1075
  virtual int preTruncationLength(unsigned int paramIndex) const
 
1076
   =0;
 
1077
 
 
1078
 
 
1079
  virtual int getInt(unsigned int paramIndex)  = 0; 
 
1080
  
 
1081
  virtual unsigned int getUInt(unsigned int paramIndex)  = 0; 
 
1082
  
 
1083
  virtual float getFloat(unsigned int paramIndex)  = 0; 
 
1084
 
 
1085
  virtual double getDouble(unsigned int paramIndex)  = 0; 
 
1086
  
 
1087
  virtual Number getNumber(unsigned int paramIndex)  = 0; 
 
1088
  
 
1089
  virtual OCCI_STD_NAMESPACE::string getString(unsigned int paramIndex)  = 0; 
 
1090
  
 
1091
  virtual Bytes getBytes(unsigned int paramIndex)  = 0; 
 
1092
 
 
1093
  virtual Date getDate(unsigned int paramIndex)  = 0; 
 
1094
  
 
1095
  virtual Timestamp getTimestamp(unsigned int paramIndex)  = 0; 
 
1096
 
 
1097
  virtual Bytes getRowid(unsigned int paramIndex)  = 0; 
 
1098
  
 
1099
  virtual PObject * getObject(unsigned int paramIndex)  = 0; 
 
1100
  
 
1101
  virtual Blob getBlob(unsigned int paramIndex)  = 0; 
 
1102
  
 
1103
  virtual Clob getClob(unsigned int paramIndex)  = 0; 
 
1104
  
 
1105
  virtual Bfile getBfile(unsigned int paramIndex)  = 0; 
 
1106
 
 
1107
  virtual IntervalYM getIntervalYM(unsigned int paramIndex)  = 0; 
 
1108
 
 
1109
  virtual IntervalDS getIntervalDS(unsigned int paramIndex)  = 0; 
 
1110
 
 
1111
  virtual RefAny getRef(unsigned int paramIndex)  = 0;  
 
1112
 
 
1113
  virtual ResultSet * getCursor(unsigned int paramIndex)   = 0;
 
1114
 
 
1115
  virtual Connection* getConnection() const =0; 
 
1116
 
 
1117
  //new interfaces
 
1118
 
 
1119
  virtual void setRef(unsigned int paramIndex, const RefAny &x, 
 
1120
                      const OCCI_STD_NAMESPACE::string &typName, 
 
1121
                      const OCCI_STD_NAMESPACE::string &schName = "") = 0; 
 
1122
  
 
1123
  virtual void setSQLUString(const UString &sql) = 0;
 
1124
  
 
1125
  virtual UString getSQLUString() const = 0;
 
1126
  
 
1127
  virtual Status execute(const UString &sql) = 0;
 
1128
                                
 
1129
  virtual ResultSet * executeQuery(
 
1130
    const UString &sql) = 0;
 
1131
  
 
1132
  virtual unsigned int executeUpdate(
 
1133
    const UString &sql) = 0; 
 
1134
  
 
1135
  virtual void setBFloat(unsigned int paramIndex, const BFloat &fval) = 0;
 
1136
  
 
1137
  virtual void setBDouble(unsigned int paramIndex, const BDouble &dval) = 0;
 
1138
  
 
1139
  virtual void setUString(unsigned int paramIndex,
 
1140
    const UString &x) = 0;
 
1141
  
 
1142
  virtual void setCharSetUString(unsigned int paramIndex, 
 
1143
  const UString & charSet) = 0; 
 
1144
  
 
1145
  virtual UString getCharSetUString(unsigned int paramIndex) 
 
1146
  const = 0; 
 
1147
  
 
1148
  virtual void registerOutParam(unsigned int paramIndex, Type type, 
 
1149
  unsigned int maxSize, const OCCI_STD_NAMESPACE::string &typName,
 
1150
  const OCCI_STD_NAMESPACE::string &schName) = 0;
 
1151
  
 
1152
  virtual void registerOutParam(unsigned int paramIndex, Type type, 
 
1153
  unsigned int maxSize, const UString &typName, 
 
1154
  const UString &schName) = 0;
 
1155
  
 
1156
  virtual BFloat getBFloat(unsigned int paramIndex)  = 0;
 
1157
  
 
1158
  virtual BDouble getBDouble(unsigned int paramIndex)  = 0;
 
1159
 
 
1160
  virtual UString getUString(unsigned int paramIndex)  = 0; 
 
1161
  
 
1162
  virtual void disableCaching() =0;
 
1163
  
 
1164
  virtual void setRef(unsigned int paramIndex, const RefAny &x, 
 
1165
                      const UString &typName, 
 
1166
                      const UString &schName) = 0; 
 
1167
 
 
1168
  virtual void setBinaryStreamMode(unsigned int colIndex, 
 
1169
    unsigned int size, bool INArg) =0;
 
1170
 
 
1171
  virtual void setCharacterStreamMode(unsigned int colIndex, 
 
1172
    unsigned int size, bool INArg) =0;
 
1173
 
 
1174
};
 
1175
 
 
1176
 
 
1177
 
 
1178
class ResultSet 
 
1179
{
 
1180
 public:
 
1181
                                // class constants
 
1182
  
 
1183
  enum Status                                   
 
1184
  {
 
1185
    END_OF_FETCH = 0,
 
1186
    DATA_AVAILABLE,
 
1187
    STREAM_DATA_AVAILABLE
 
1188
  };
 
1189
  virtual ~ResultSet(){}
 
1190
 
 
1191
                                // public methods
 
1192
 
 
1193
  virtual Status next(unsigned int numRows = 1) = 0;
 
1194
  
 
1195
  virtual Status status() const = 0;            
 
1196
  
 
1197
  virtual unsigned int getNumArrayRows()  const = 0;
 
1198
  
 
1199
  virtual void cancel() = 0;
 
1200
 
 
1201
  virtual void setMaxColumnSize(unsigned int colIndex, unsigned int max) = 0;
 
1202
  
 
1203
  virtual unsigned int getMaxColumnSize(unsigned int colIndex) const = 0;
 
1204
  
 
1205
  virtual bool isNull(unsigned int colIndex) const = 0;
 
1206
  
 
1207
  virtual bool isTruncated(unsigned int paramIndex) const
 
1208
   =0;
 
1209
 
 
1210
  virtual void setErrorOnNull(unsigned int colIndex, bool causeException) = 0;
 
1211
  virtual void setErrorOnTruncate(unsigned int paramIndex,
 
1212
  bool causeException)   =0;
 
1213
 
 
1214
  virtual int preTruncationLength(unsigned int paramIndex) const
 
1215
   =0;
 
1216
 
 
1217
  virtual int getInt(unsigned int colIndex)   = 0; 
 
1218
  
 
1219
  virtual unsigned int getUInt(unsigned int colIndex)   = 0; 
 
1220
  
 
1221
  virtual float getFloat(unsigned int colIndex)  = 0; 
 
1222
 
 
1223
  virtual double getDouble(unsigned int colIndex)  = 0; 
 
1224
 
 
1225
  virtual Number getNumber(unsigned int colIndex)  = 0; 
 
1226
  
 
1227
  virtual OCCI_STD_NAMESPACE::string getString(unsigned int colIndex)  = 0; 
 
1228
  
 
1229
  virtual Bytes getBytes(unsigned int colIndex)  = 0; 
 
1230
 
 
1231
  virtual Date getDate(unsigned int colIndex)  = 0; 
 
1232
  
 
1233
  virtual Timestamp getTimestamp(unsigned int colIndex)  = 0; 
 
1234
  
 
1235
  virtual Bytes getRowid(unsigned int colIndex)  = 0; 
 
1236
  
 
1237
  virtual PObject * getObject(unsigned int colIndex)  = 0; 
 
1238
  
 
1239
  virtual Blob getBlob(unsigned int colIndex)  = 0; 
 
1240
  
 
1241
  virtual Clob getClob(unsigned int colIndex)  =0; 
 
1242
  
 
1243
  virtual Bfile getBfile(unsigned int colIndex)  = 0; 
 
1244
 
 
1245
  virtual  IntervalYM getIntervalYM(unsigned int colIndex)  =0;
 
1246
   
 
1247
  virtual  IntervalDS getIntervalDS(unsigned int colIndex)  =0;
 
1248
   
 
1249
  virtual RefAny getRef(unsigned int colIndex)  = 0; 
 
1250
 
 
1251
  virtual Bytes getRowPosition() const = 0; 
 
1252
 
 
1253
  virtual ResultSet * getCursor(unsigned int colIndex)  = 0; 
 
1254
  
 
1255
  virtual void setDataBuffer(unsigned int colIndex, void *buffer, Type type,
 
1256
                             sb4 size = 0, ub2 *length = NULL,
 
1257
                             sb2 *ind = NULL, ub2 *rc = NULL) = 0;
 
1258
 
 
1259
  virtual void setCharSet(unsigned int colIndex, 
 
1260
  const OCCI_STD_NAMESPACE::string & charSet) = 0; 
 
1261
  
 
1262
  virtual OCCI_STD_NAMESPACE::string getCharSet(unsigned int colIndex) 
 
1263
  const = 0; 
 
1264
  
 
1265
  virtual void setBinaryStreamMode(unsigned int colIndex, unsigned int size)
 
1266
    = 0;
 
1267
 
 
1268
  virtual void setCharacterStreamMode(unsigned int colIndex, unsigned int size)
 
1269
    = 0;
 
1270
  
 
1271
  virtual void setDatabaseNCHARParam(unsigned int paramIndex, 
 
1272
    bool isNCHAR) = 0;
 
1273
  
 
1274
  virtual bool getDatabaseNCHARParam(unsigned int paramIndex) const = 0;       
 
1275
                                         
 
1276
  virtual Stream * getStream(unsigned int colIndex)  = 0; 
 
1277
 
 
1278
  virtual void closeStream(Stream *stream) =0;
 
1279
  
 
1280
  virtual unsigned int getCurrentStreamColumn() const= 0; 
 
1281
  
 
1282
  virtual unsigned int getCurrentStreamRow() const= 0;       
 
1283
  
 
1284
  virtual OCCI_STD_NAMESPACE::vector<MetaData> getColumnListMetaData() const 
 
1285
    = 0;
 
1286
 
 
1287
  virtual Statement* getStatement() const=0;
 
1288
 
 
1289
  //new interfaces
 
1290
 
 
1291
  virtual BFloat getBFloat(unsigned int colIndex)  = 0;
 
1292
  
 
1293
  virtual BDouble getBDouble(unsigned int colIndex)  = 0;
 
1294
  
 
1295
  virtual UString getUString(unsigned int colIndex)  = 0; 
 
1296
  
 
1297
  virtual void setCharSetUString(unsigned int colIndex, 
 
1298
  const UString & charSet) = 0; 
 
1299
  
 
1300
  virtual UString getCharSetUString(unsigned int colIndex) 
 
1301
  const = 0; 
 
1302
 
 
1303
};
 
1304
 
 
1305
 
 
1306
class Stream
 
1307
{
 
1308
  public : 
 
1309
 
 
1310
    enum Status {READY_FOR_READ, READY_FOR_WRITE, INACTIVE};
 
1311
 
 
1312
    virtual ~Stream(){}
 
1313
    virtual int readBuffer(char *buffer, unsigned int size)
 
1314
       =0;
 
1315
    virtual int readLastBuffer(char *buffer, unsigned int size)
 
1316
       =0;
 
1317
    virtual void writeBuffer(char *buffer, unsigned int size)
 
1318
       =0;
 
1319
    virtual void writeLastBuffer(char *buffer, unsigned int size)
 
1320
       =0;
 
1321
    virtual Status status() const  =0;
 
1322
 
 
1323
};
 
1324
 
 
1325
/*---------------------------------------------------------------------------
 
1326
                PROTOTYPES USED BY FUNCTION TEMPLATES
 
1327
 -------------------------------------------------------------------------*/
 
1328
  void getVectorOfPObjects( ResultSet *rs, unsigned int index,
 
1329
  OCCI_STD_NAMESPACE::vector<PObject *> &vect) ;
 
1330
  void getVectorOfOCIRefs(ResultSet  *rs, unsigned int index,
 
1331
  OCCI_STD_NAMESPACE::vector<void *> &vect) ;
 
1332
  void getVectorOfPObjects( Statement *rs, unsigned int index,
 
1333
  OCCI_STD_NAMESPACE::vector<PObject *> &vect) ;
 
1334
  void getVectorOfOCIRefs(Statement  *rs, unsigned int index,
 
1335
  OCCI_STD_NAMESPACE::vector<void *> &vect) ;
 
1336
  void setVectorOfPObjects( Statement *stmt, unsigned int paramIndex,
 
1337
  const OCCI_STD_NAMESPACE::vector<PObject *> &vect, 
 
1338
  const OCCI_STD_NAMESPACE::string &sqltype) ;
 
1339
  void setVectorOfPObjects( Statement *stmt, unsigned int paramIndex,
 
1340
  const OCCI_STD_NAMESPACE::vector<PObject *> &vect, 
 
1341
  const OCCI_STD_NAMESPACE::string &schemaName,
 
1342
  const OCCI_STD_NAMESPACE::string &typeName) ;
 
1343
  void setVectorOfPObjects( Statement *stmt, unsigned int paramIndex,
 
1344
  const OCCI_STD_NAMESPACE::vector<PObject *> &vect, 
 
1345
  const UString &schemaName,
 
1346
  const UString &typeName) ;
 
1347
  void setVectorOfOCIRefs(Statement *stmt, unsigned int paramIndex,
 
1348
  const  OCCI_STD_NAMESPACE::vector<void *> &vect,
 
1349
  const OCCI_STD_NAMESPACE::vector<OCIInd> &vecind,
 
1350
  const OCCI_STD_NAMESPACE::string &sqltype) ;
 
1351
  void setVectorOfOCIRefs(Statement *stmt, unsigned int paramIndex,
 
1352
  const  OCCI_STD_NAMESPACE::vector<void *> &vect,
 
1353
  const OCCI_STD_NAMESPACE::vector<OCIInd> &vecind,
 
1354
  const OCCI_STD_NAMESPACE::string &schemaName,
 
1355
  const OCCI_STD_NAMESPACE::string &typeName) ;
 
1356
  void setVectorOfOCIRefs(Statement *stmt, unsigned int paramIndex,
 
1357
  const  OCCI_STD_NAMESPACE::vector<void *> &vect,
 
1358
  const OCCI_STD_NAMESPACE::vector<OCIInd> &vecind,
 
1359
  const UString &schemaName,
 
1360
  const UString &typeName) ;
 
1361
  void pinVectorOfOCIRefs(const Connection *conn, 
 
1362
  OCCI_STD_NAMESPACE::vector<void *> & vecRef,
 
1363
  OCCI_STD_NAMESPACE::vector<void *> & vecCor,
 
1364
  OCCI_STD_NAMESPACE::vector<PObject *> &vecPObj,LockOptions &lockOpt );
 
1365
 
 
1366
 
 
1367
/*---------------------------------------------------------------------------
 
1368
                           EXPORT FUNCTIONS
 
1369
  ---------------------------------------------------------------------------*/
 
1370
 
 
1371
/*------------------------ getVector for objects ---------------------------*/
 
1372
/*
 
1373
   NAME
 
1374
      getVector - overloaded function. Retrieves the attribute in the current
 
1375
position as a vector of objects
 
1376
 
 
1377
   PARAMETERS
 
1378
      rs - ResultSet
 
1379
      vect- reference to vector of objects(OUT parameter).
 
1380
 
 
1381
   DESCRIPTION
 
1382
     Retrieves the column in the specified position as a vector of RefAny.
 
1383
   The attribute at the current position should be a collection type (varray or
 
1384
   nested table). The SQL type of the elements in the collection should be
 
1385
   compatible with objects.
 
1386
 
 
1387
   RETURNS
 
1388
     nothing
 
1389
 
 
1390
   NOTES
 
1391
        compatible SQL types : NTY
 
1392
 
 
1393
        will call getVector(..., vector<PObject*>)
 
1394
*/
 
1395
#ifdef WIN32COMMON
 
1396
// and other platforms that do not support
 
1397
// partial function template specialization
 
1398
 
 
1399
template <class T>
 
1400
void getVector( ResultSet *rs, unsigned int index,OCCI_STD_NAMESPACE::vector<T>
 
1401
& vect) 
 
1402
{
 
1403
  OCCI_STD_NAMESPACE::vector<PObject *> vec_pobj;
 
1404
  getVectorOfPObjects(rs, index, vec_pobj);
 
1405
 
 
1406
  vect.clear();
 
1407
  unsigned int size = vec_pobj.size();
 
1408
  vect.reserve( size );
 
1409
  for ( unsigned int i=0; i< size; i++)
 
1410
    vect.push_back((T)vec_pobj[i]);
 
1411
}
 
1412
 
 
1413
#else
 
1414
template <class T>
 
1415
void getVector( ResultSet *rs, unsigned int index, OCCI_STD_NAMESPACE::vector<T
 
1416
 *> &vect)
 
1417
{
 
1418
  OCCI_STD_NAMESPACE::vector<PObject *> vec_pobj;
 
1419
  getVectorOfPObjects(rs, index, vec_pobj);
 
1420
 
 
1421
  vect.clear();
 
1422
  unsigned int size = vec_pobj.size();
 
1423
  vect.reserve( size );
 
1424
  for (unsigned int i=0; i< size; i++)
 
1425
    vect.push_back((T *)vec_pobj[i]);
 
1426
}
 
1427
#endif
 
1428
 
 
1429
/*------------------------ getVector for objects ---------------------------*/
 
1430
/*
 
1431
   NAME
 
1432
      getVector - overloaded function. Retrieves the attribute in the current
 
1433
position as a vector of objects
 
1434
 
 
1435
   PARAMETERS
 
1436
      stmt - Statement
 
1437
      vect- reference to vector of objects(OUT parameter).
 
1438
 
 
1439
   DESCRIPTION
 
1440
     Retrieves the column in the specified position as a vector of RefAny.
 
1441
   The attribute at the current position should be a collection type (varray or
 
1442
   nested table). The SQL type of the elements in the collection should be
 
1443
   compatible with objects.
 
1444
 
 
1445
   RETURNS
 
1446
     nothing
 
1447
 
 
1448
   NOTES
 
1449
        compatible SQL types : NTY
 
1450
 
 
1451
        will call getVector(..., vector<PObject*>)
 
1452
*/
 
1453
#ifdef WIN32COMMON
 
1454
// and other platforms that do not support
 
1455
// partial function template specialization
 
1456
 
 
1457
template <class T>
 
1458
void getVector( Statement *stmt, unsigned int index, 
 
1459
OCCI_STD_NAMESPACE::vector<T> &vect) 
 
1460
{
 
1461
  OCCI_STD_NAMESPACE::vector<PObject *> vec_pobj;
 
1462
  getVectorOfPObjects(stmt, index, vec_pobj);
 
1463
  vect.clear();
 
1464
  unsigned int size = vec_pobj.size();
 
1465
  vect.reserve( size );
 
1466
  for (unsigned int i=0; i< size; i++)
 
1467
    vect.push_back((T)vec_pobj[i]);
 
1468
}
 
1469
#else
 
1470
template <class T>
 
1471
void getVector( Statement *stmt, unsigned int index,
 
1472
OCCI_STD_NAMESPACE::vector<T *> &vect)
 
1473
{
 
1474
  OCCI_STD_NAMESPACE::vector<PObject *> vec_pobj;
 
1475
  getVectorOfPObjects(stmt, index, vec_pobj);
 
1476
  vect.clear();
 
1477
  unsigned int size = vec_pobj.size();
 
1478
  vect.reserve( size );
 
1479
  for (unsigned int i=0; i< size; i++)
 
1480
    vect.push_back((T *)vec_pobj[i]);
 
1481
}
 
1482
#endif
 
1483
 
 
1484
/*------------------------ getVector for Ref<T> ---------------------------*/
 
1485
/*
 
1486
   NAME
 
1487
      getVector - overloaded function. Retrieves the attribute in the current
 
1488
position as a vector of Ref<T>
 
1489
 
 
1490
   PARAMETERS
 
1491
      rs - ResultSet
 
1492
      vect- reference to vector of Ref<T>(OUT parameter).
 
1493
 
 
1494
   DESCRIPTION
 
1495
     Retrieves the column in the specified position as a vector of Ref<T>.
 
1496
   The attribute at the current position should be a collection type (varray or
 
1497
   nested table). The SQL type of the elements in the collection should be
 
1498
   compatible with Ref<T>.
 
1499
 
 
1500
   RETURNS
 
1501
     nothing
 
1502
 
 
1503
   NOTES
 
1504
        compatible SQL types : REF
 
1505
*/
 
1506
#ifndef WIN32COMMON
 
1507
template <class T>
 
1508
void getVector( ResultSet *rs, unsigned int index, 
 
1509
                OCCI_STD_NAMESPACE::vector<Ref<T> > &vect) 
 
1510
{
 
1511
  OCCI_STD_NAMESPACE::vector<void *> vec_ref;
 
1512
  getVectorOfOCIRefs(rs, index, vec_ref);
 
1513
 
 
1514
  const Connection *sess = rs->getStatement()->getConnection();
 
1515
 
 
1516
  vect.clear();
 
1517
  unsigned int size = vec_ref.size();
 
1518
  vect.reserve( size );
 
1519
  for (unsigned int i=0; i< size; i++)
 
1520
  {
 
1521
    if (vec_ref[i] == (OCIRef *)0)
 
1522
       vect.push_back(Ref<T>());     // pushing a default-constructed Ref
 
1523
     else
 
1524
       vect.push_back(Ref<T>(sess, (OCIRef *)vec_ref[i], FALSE));
 
1525
  }
 
1526
}
 
1527
#endif
 
1528
 
 
1529
/*------------------------ setVector for PObject*---------------------------*/
 
1530
/*
 
1531
   NAME
 
1532
      SetVector - overloaded function. Binds the attribute in the current
 
1533
      position with a vector of objects.
 
1534
 
 
1535
   PARAMETERS
 
1536
      rs - ResultSet
 
1537
      vect- reference to vector of objects(OUT parameter).
 
1538
 
 
1539
   DESCRIPTION
 
1540
     Binds the column in the specified position with a vector of signed int .
 
1541
   The column at the current position should be a collection type (varray or
 
1542
   nested table). The SQL type of the elements in the collection should be
 
1543
   compatible with objects .
 
1544
 
 
1545
   RETURNS
 
1546
     nothing
 
1547
 
 
1548
   NOTES
 
1549
     compatible SQL types : SQLT_NTY
 
1550
 
 
1551
     This will be calling setVector(..., vector<PObject*>,..)
 
1552
 
 
1553
*/
 
1554
#ifdef WIN32COMMON
 
1555
// and other platforms that do not support
 
1556
// partial function template specialization
 
1557
 
 
1558
template <class T>
 
1559
void setVector( Statement *stmt, unsigned int index, 
 
1560
                const OCCI_STD_NAMESPACE::vector<T> &vect, 
 
1561
                const OCCI_STD_NAMESPACE::string &sqltype) 
 
1562
{
 
1563
  OCCI_STD_NAMESPACE::vector<PObject *> vec_pobj;
 
1564
  unsigned int size = vect.size();
 
1565
  vec_pobj.reserve( size );
 
1566
  
 
1567
  for (unsigned int i = 0; i < size; i++)
 
1568
    vec_pobj.push_back((PObject *)vect[i]);
 
1569
 
 
1570
  setVectorOfPObjects(stmt, index, vec_pobj, sqltype);
 
1571
}
 
1572
 
 
1573
template <class T>
 
1574
void setVector( Statement *stmt, unsigned int index, const OCCI_STD_NAMESPACE::
 
1575
vector<T> &vect, const OCCI_STD_NAMESPACE::string &schemaName,
 
1576
const OCCI_STD_NAMESPACE::string &typeName)
 
1577
{
 
1578
  OCCI_STD_NAMESPACE::vector<PObject *> vec_pobj;
 
1579
  unsigned int size = vect.size();
 
1580
  vec_pobj.reserve( size );
 
1581
 
 
1582
  for (unsigned int i = 0; i < size; i++)
 
1583
    vec_pobj.push_back((PObject *)vect[i]);
 
1584
 
 
1585
  setVectorOfPObjects(stmt, index, vec_pobj, schemaName, typeName);
 
1586
}
 
1587
 
 
1588
template <class T>
 
1589
void setVector( Statement *stmt, unsigned int index, const OCCI_STD_NAMESPACE::
 
1590
vector<T> &vect, const UString &schemaName,
 
1591
const UString &typeName)
 
1592
{
 
1593
  OCCI_STD_NAMESPACE::vector<PObject *> vec_pobj;
 
1594
  unsigned int size = vect.size();
 
1595
  vec_pobj.reserve( size );
 
1596
 
 
1597
  for (unsigned int i = 0; i < size; i++)
 
1598
    vec_pobj.push_back((PObject *)vect[i]);
 
1599
 
 
1600
  setVectorOfPObjects(stmt, index, vec_pobj, schemaName, typeName);
 
1601
}
 
1602
#else
 
1603
template <class T>
 
1604
void setVector( Statement *stmt, unsigned int index, const OCCI_STD_NAMESPACE::
 
1605
vector<T *> &vect, const OCCI_STD_NAMESPACE::string &sqltype)
 
1606
{
 
1607
  OCCI_STD_NAMESPACE::vector<PObject *> vec_pobj;
 
1608
  unsigned int size = vect.size();
 
1609
  vec_pobj.reserve( size );
 
1610
 
 
1611
  for (unsigned int i = 0; i < size; i++)
 
1612
    vec_pobj.push_back((PObject *)vect[i]);
 
1613
 
 
1614
  setVectorOfPObjects(stmt, index, vec_pobj, sqltype);
 
1615
}
 
1616
 
 
1617
template <class T>
 
1618
void setVector( Statement *stmt, unsigned int index, const OCCI_STD_NAMESPACE::
 
1619
vector<T *> &vect, const OCCI_STD_NAMESPACE::string &schemaName,
 
1620
const OCCI_STD_NAMESPACE::string &typeName)
 
1621
{
 
1622
  OCCI_STD_NAMESPACE::vector<PObject *> vec_pobj;
 
1623
  unsigned int size = vect.size();
 
1624
  vec_pobj.reserve( size );
 
1625
 
 
1626
  for (unsigned int i = 0; i < size; i++)
 
1627
    vec_pobj.push_back((PObject *)vect[i]);
 
1628
 
 
1629
  setVectorOfPObjects(stmt, index, vec_pobj, schemaName, typeName);
 
1630
}
 
1631
 
 
1632
template <class T>
 
1633
void setVector( Statement *stmt, unsigned int index, const OCCI_STD_NAMESPACE::
 
1634
vector<T *> &vect, const UString &schemaName,
 
1635
const UString &typeName)
 
1636
{
 
1637
  OCCI_STD_NAMESPACE::vector<PObject *> vec_pobj;
 
1638
  unsigned int size = vect.size();
 
1639
  vec_pobj.reserve( size );
 
1640
 
 
1641
  for (unsigned int i = 0; i < size; i++)
 
1642
    vec_pobj.push_back((PObject *)vect[i]);
 
1643
 
 
1644
  setVectorOfPObjects(stmt, index, vec_pobj, schemaName, typeName);
 
1645
}
 
1646
#endif
 
1647
 
 
1648
/*------------------------ setVector for Ref<T>---------------------------*/
 
1649
/*
 
1650
   NAME
 
1651
      setVector - overloaded function. Binds the attribute in the current
 
1652
      position with a vector of Ref<T>.
 
1653
 
 
1654
   PARAMETERS
 
1655
      rs - ResultSet
 
1656
      vect- reference to vector of REF
 
1657
 
 
1658
   DESCRIPTION
 
1659
     Binds the column in the specified position with a vector of signed int .
 
1660
   The column at the current position should be a collection type (varray or
 
1661
   nested table). The SQL type of the elements in the collection should be
 
1662
   compatible with OCIRef* .
 
1663
 
 
1664
   RETURNS
 
1665
     nothing
 
1666
 
 
1667
   NOTES
 
1668
     compatible SQL types : REF 
 
1669
 
 
1670
     This will just call setVector(..., vector<OCIRef*>,..)
 
1671
 
 
1672
 
 
1673
*/
 
1674
#ifndef WIN32COMMON
 
1675
template <class T>
 
1676
void setVector( Statement *stmt, unsigned int index, 
 
1677
                const OCCI_STD_NAMESPACE::vector<Ref<T> > &vect, 
 
1678
                const OCCI_STD_NAMESPACE::string &sqltype)
 
1679
{
 
1680
  OCCI_STD_NAMESPACE::vector<void *> vec_ref;
 
1681
  OCCI_STD_NAMESPACE::vector<OCIInd> vec_ind;
 
1682
  unsigned int size = vect.size();
 
1683
  vec_ref.reserve( size );
 
1684
  vec_ind.reserve( size );
 
1685
 
 
1686
  for (unsigned int i = 0; i < size; i++)
 
1687
  {
 
1688
    vec_ref.push_back((void *)vect[i].getRef());
 
1689
    vec_ind.push_back( vect[i].isNull() ? OCI_IND_NULL : OCI_IND_NOTNULL);
 
1690
  }
 
1691
 
 
1692
  setVectorOfOCIRefs(stmt, index, vec_ref, vec_ind, sqltype);
 
1693
}
 
1694
 
 
1695
template <class T>
 
1696
void setVector( Statement *stmt, unsigned int index, 
 
1697
                const OCCI_STD_NAMESPACE::vector<Ref<T> > &vect, 
 
1698
                const OCCI_STD_NAMESPACE::string &schemaName,
 
1699
                const OCCI_STD_NAMESPACE::string &typeName)
 
1700
{
 
1701
  OCCI_STD_NAMESPACE::vector<void *> vec_ref;
 
1702
  OCCI_STD_NAMESPACE::vector<OCIInd> vec_ind;
 
1703
  unsigned int size = vect.size();
 
1704
  vec_ref.reserve( size );
 
1705
  vec_ind.reserve( size );
 
1706
 
 
1707
  for (unsigned int i = 0; i < size; i++)
 
1708
  {
 
1709
    vec_ref.push_back((void *)vect[i].getRef());
 
1710
    vec_ind.push_back( vect[i].isNull() ? OCI_IND_NULL : OCI_IND_NOTNULL);
 
1711
  }
 
1712
 
 
1713
  setVectorOfOCIRefs(stmt, index, vec_ref, vec_ind, schemaName, typeName);
 
1714
}
 
1715
 
 
1716
template <class T>
 
1717
void setVector( Statement *stmt, unsigned int index, 
 
1718
                const OCCI_STD_NAMESPACE::vector<Ref<T> > &vect, 
 
1719
                const UString &schemaName,
 
1720
                const UString &typeName)
 
1721
{
 
1722
  OCCI_STD_NAMESPACE::vector<void *> vec_ref;
 
1723
  OCCI_STD_NAMESPACE::vector<OCIInd> vec_ind;
 
1724
  unsigned int size = vect.size();
 
1725
  vec_ref.reserve( size );
 
1726
  vec_ind.reserve( size );
 
1727
 
 
1728
  for (unsigned int i = 0; i < size; i++)
 
1729
  {
 
1730
    vec_ref.push_back((void *)vect[i].getRef());
 
1731
    vec_ind.push_back( vect[i].isNull() ? OCI_IND_NULL : OCI_IND_NOTNULL);
 
1732
  }
 
1733
 
 
1734
  setVectorOfOCIRefs(stmt, index, vec_ref, vec_ind, schemaName, typeName);
 
1735
}
 
1736
#endif
 
1737
 
 
1738
/*------------------------ getVector for Ref<T> ---------------------------*/
 
1739
/*
 
1740
   NAME
 
1741
      getVector - overloaded function. Retrieves the attribute in the current
 
1742
position as a vector of Ref<T>
 
1743
 
 
1744
   PARAMETERS
 
1745
      stmt - Statement
 
1746
      vect- reference to vector of Ref<T>(OUT parameter).
 
1747
 
 
1748
   DESCRIPTION
 
1749
     Retrieves the column in the specified position as a vector of Ref<T>.
 
1750
   The attribute at the current position should be a collection type (varray or
 
1751
   nested table). The SQL type of the elements in the collection should be
 
1752
   compatible with Ref<T>.
 
1753
 
 
1754
   RETURNS
 
1755
     nothing
 
1756
 
 
1757
   NOTES
 
1758
        compatible SQL types : REF
 
1759
*/
 
1760
#ifndef WIN32COMMON
 
1761
template <class T>
 
1762
void getVector( Statement *stmt, unsigned int index, 
 
1763
                OCCI_STD_NAMESPACE::vector<Ref<T> > &vect) 
 
1764
{
 
1765
  OCCI_STD_NAMESPACE::vector<void *> vec_ref;
 
1766
  getVectorOfOCIRefs(stmt, index, vec_ref);
 
1767
 
 
1768
  const Connection *sess = stmt->getConnection();
 
1769
 
 
1770
  vect.clear();
 
1771
  unsigned int size = vec_ref.size();
 
1772
  vect.reserve( size );
 
1773
  for (unsigned int i=0; i< size; i++)
 
1774
  {
 
1775
    if (vec_ref[i] == (OCIRef *)0)
 
1776
       vect.push_back(Ref <T>());     // pushing a default-constructed Ref
 
1777
     else
 
1778
       vect.push_back(Ref<T> (sess, (OCIRef *)vec_ref[i], FALSE));
 
1779
  }
 
1780
 
 
1781
}
 
1782
#endif
 
1783
 
 
1784
// Platform independent get/setVectorOfRefs method added
 
1785
// get(set)Vector of Ref<T> and get(set)VectorOfRefs are identical 
 
1786
// in functionality. 
 
1787
 
 
1788
/*------------------------ getVectorOfRefs for Ref<T> ----------------------*/
 
1789
/*
 
1790
   NAME
 
1791
      getVectorOfRefs - overloaded function. Retrieves the attribute in the
 
1792
      current position as a vector of Ref<T>
 
1793
 
 
1794
   PARAMETERS
 
1795
      rs - ResultSet
 
1796
      vect- reference to vector of Ref<T>(OUT parameter).
 
1797
 
 
1798
   DESCRIPTION
 
1799
     Retrieves the column in the specified position as a vector of Ref<T>.
 
1800
   The attribute at the current position should be a collection type (varray or
 
1801
   nested table). The SQL type of the elements in the collection should be
 
1802
   compatible with Ref<T>.
 
1803
 
 
1804
   RETURNS
 
1805
     nothing
 
1806
 
 
1807
   NOTES
 
1808
        compatible SQL types : REF
 
1809
*/
 
1810
 
 
1811
template <class T>
 
1812
void getVectorOfRefs( ResultSet *rs, unsigned int index, 
 
1813
OCCI_STD_NAMESPACE::vector<Ref<T> > &vect)
 
1814
{
 
1815
  OCCI_STD_NAMESPACE::vector<void *> vec_ref;
 
1816
  getVectorOfOCIRefs(rs, index, vec_ref);
 
1817
 
 
1818
  const Connection *sess = rs->getStatement()->getConnection();
 
1819
 
 
1820
  vect.clear();
 
1821
  unsigned int size = vec_ref.size();
 
1822
  vect.reserve( size );
 
1823
  for (unsigned int i=0; i< size; i++)
 
1824
  {
 
1825
    if (vec_ref[i] == (OCIRef *)0)
 
1826
       vect.push_back(Ref<T>());     // pushing a default-constructed Ref
 
1827
     else
 
1828
       vect.push_back(Ref<T>(sess, (OCIRef *)vec_ref[i], FALSE));
 
1829
  }
 
1830
}
 
1831
 
 
1832
/*------------------------ setVectorOfRefs for Ref<T>-----------------------*/
 
1833
/*
 
1834
   NAME
 
1835
      setVectorOfRefs - overloaded function. Binds the attribute in the current
 
1836
      position with a vector of Ref<T>.
 
1837
 
 
1838
   PARAMETERS
 
1839
      rs - ResultSet
 
1840
      vect- reference to vector of REF
 
1841
 
 
1842
   DESCRIPTION
 
1843
     Binds the column in the specified position with a vector of signed int .
 
1844
   The column at the current position should be a collection type (varray or
 
1845
   nested table). The SQL type of the elements in the collection should be
 
1846
   compatible with OCIRef* .
 
1847
 
 
1848
   RETURNS
 
1849
     nothing
 
1850
 
 
1851
   NOTES
 
1852
     compatible SQL types : REF
 
1853
 
 
1854
     This will just call setVector(..., vector<OCIRef*>,..)
 
1855
 
 
1856
 
 
1857
*/
 
1858
 
 
1859
template <class T>
 
1860
void setVectorOfRefs( Statement *stmt, unsigned int index, 
 
1861
const OCCI_STD_NAMESPACE::vector<Ref<T> > &vect, 
 
1862
const OCCI_STD_NAMESPACE::string &sqltype)
 
1863
{
 
1864
  OCCI_STD_NAMESPACE::vector<void *> vec_ref;
 
1865
  OCCI_STD_NAMESPACE::vector<OCIInd> vec_ind;
 
1866
  unsigned int size = vect.size();
 
1867
  vec_ref.reserve( size );
 
1868
  vec_ind.reserve( size );
 
1869
 
 
1870
  for (unsigned int i = 0; i < size; i++)
 
1871
  {
 
1872
    vec_ref.push_back((void *)vect[i].getRef());
 
1873
    vec_ind.push_back( vect[i].isNull() ? OCI_IND_NULL : OCI_IND_NOTNULL);
 
1874
  }
 
1875
 
 
1876
  setVectorOfOCIRefs(stmt, index, vec_ref, vec_ind, sqltype);
 
1877
}
 
1878
 
 
1879
template <class T>
 
1880
void setVectorOfRefs( Statement *stmt, unsigned int index, 
 
1881
const OCCI_STD_NAMESPACE::vector<Ref<T> > &vect, 
 
1882
const OCCI_STD_NAMESPACE::string &schemaName,
 
1883
const OCCI_STD_NAMESPACE::string &typeName)
 
1884
{
 
1885
  OCCI_STD_NAMESPACE::vector<void *> vec_ref;
 
1886
  OCCI_STD_NAMESPACE::vector<OCIInd> vec_ind;
 
1887
  unsigned int size = vect.size();
 
1888
  vec_ref.reserve( size );
 
1889
  vec_ind.reserve( size );
 
1890
 
 
1891
  for (unsigned int i = 0; i < size; i++)
 
1892
  {
 
1893
    vec_ref.push_back((void *)vect[i].getRef());
 
1894
    vec_ind.push_back( vect[i].isNull() ? OCI_IND_NULL : OCI_IND_NOTNULL);
 
1895
  }
 
1896
 
 
1897
  setVectorOfOCIRefs(stmt, index, vec_ref, vec_ind, schemaName, typeName);
 
1898
}
 
1899
 
 
1900
template <class T>
 
1901
void setVectorOfRefs( Statement *stmt, unsigned int index, 
 
1902
const OCCI_STD_NAMESPACE::vector<Ref<T> > &vect, 
 
1903
const UString &schemaName,
 
1904
const UString &typeName)
 
1905
{
 
1906
  OCCI_STD_NAMESPACE::vector<void *> vec_ref;
 
1907
  OCCI_STD_NAMESPACE::vector<OCIInd> vec_ind;
 
1908
  unsigned int size = vect.size();
 
1909
  vec_ref.reserve( size );
 
1910
  vec_ind.reserve( size );
 
1911
 
 
1912
  for (unsigned int i = 0; i < size; i++)
 
1913
  {
 
1914
    vec_ref.push_back((void *)vect[i].getRef());
 
1915
    vec_ind.push_back( vect[i].isNull() ? OCI_IND_NULL : OCI_IND_NOTNULL);
 
1916
  }
 
1917
 
 
1918
  setVectorOfOCIRefs(stmt, index, vec_ref, vec_ind, schemaName, typeName);
 
1919
}
 
1920
 
 
1921
/*------------------------ getVectorOfRefs for Ref<T> ----------------------*/
 
1922
/*
 
1923
   NAME
 
1924
      getVectorOfRefs - overloaded function. Retrieves the attribute in the
 
1925
      current position as a vector of Ref<T>
 
1926
 
 
1927
   PARAMETERS
 
1928
      stmt - Statement
 
1929
      vect- reference to vector of Ref<T>(OUT parameter).
 
1930
 
 
1931
   DESCRIPTION
 
1932
     Retrieves the column in the specified position as a vector of Ref<T>.
 
1933
   The attribute at the current position should be a collection type (varray or
 
1934
   nested table). The SQL type of the elements in the collection should be
 
1935
   compatible with Ref<T>.
 
1936
 
 
1937
   RETURNS
 
1938
     nothing
 
1939
 
 
1940
   NOTES
 
1941
        compatible SQL types : REF
 
1942
*/
 
1943
 
 
1944
template <class T>
 
1945
void getVectorOfRefs( Statement *stmt, unsigned int index, 
 
1946
OCCI_STD_NAMESPACE::vector <Ref<T> > &vect)
 
1947
{
 
1948
  OCCI_STD_NAMESPACE::vector<void *> vec_ref;
 
1949
  getVectorOfOCIRefs(stmt, index, vec_ref);
 
1950
 
 
1951
  const Connection *sess = stmt->getConnection();
 
1952
 
 
1953
  vect.clear();
 
1954
  unsigned int size = vec_ref.size();
 
1955
  vect.reserve( size );
 
1956
  for (unsigned int i=0; i< size; i++)
 
1957
  {
 
1958
    if (vec_ref[i] == (OCIRef *)0)
 
1959
       vect.push_back(Ref <T>());     // pushing a default-constructed Ref
 
1960
     else
 
1961
       vect.push_back(Ref<T> (sess, (OCIRef *)vec_ref[i], FALSE));
 
1962
  }
 
1963
}
 
1964
/*----------------------------- pinVectorOfRefs---------------------*/
 
1965
/*
 
1966
   NAME
 
1967
    pinVectorOfRefs - array pin implementation
 
1968
 
 
1969
   PARAMETERS
 
1970
     conn- Connection object
 
1971
     vecRef - vector of OCIRefs *
 
1972
     vecCor - vector of OCIComplexObject *
 
1973
     vecPOBj - vector of PObject * ( OUT )
 
1974
 
 
1975
   DESCRIPTION
 
1976
    implements the array pin of refs passed and returns the corresponding
 
1977
    PObject s
 
1978
 
 
1979
   RETURNS
 
1980
 
 
1981
   NOTES
 
1982
*/
 
1983
template <class T>
 
1984
void pinVectorOfRefs( const Connection *conn,
 
1985
OCCI_STD_NAMESPACE::vector<Ref<T> > &vect, 
 
1986
OCCI_STD_NAMESPACE::vector<T* > &vectObj, LockOptions lockOpt) 
 
1987
{
 
1988
   
 
1989
 OCCI_STD_NAMESPACE::vector<void *> vecRef;
 
1990
 OCCI_STD_NAMESPACE::vector<void *> vecCor;
 
1991
 OCCI_STD_NAMESPACE::vector<PObject *> vecPObj;
 
1992
 unsigned int sz = vect.size();
 
1993
 vecRef.reserve( sz );
 
1994
 vecCor.reserve( sz );
 
1995
 
 
1996
 for ( unsigned int  i=0; i < sz; i++)
 
1997
 {
 
1998
   vecRef.push_back((void *)vect[i].getRef());
 
1999
   vecCor.push_back((void *)vect[i].getCor());
 
2000
 }
 
2001
 pinVectorOfOCIRefs(conn, vecRef, vecCor, vecPObj, lockOpt);
 
2002
 for ( unsigned int  k=0; k < sz; k++)
 
2003
 {
 
2004
   vectObj.push_back((T *)vecPObj[k]);
 
2005
   vect[k].setPinnedObject(vecPObj[k]);
 
2006
 }
 
2007
}
 
2008
 
 
2009
/*----------------------------- pinVectorOfRefs---------------------*/
 
2010
/*
 
2011
   NAME
 
2012
    pinVectorOfRefs - array pin implementation
 
2013
 
 
2014
   PARAMETERS
 
2015
     conn- Connection object
 
2016
     vecRef - vector of OCIRefs *
 
2017
     vecCor - vector of OCIComplexObject *
 
2018
 
 
2019
   DESCRIPTION
 
2020
    implements the array pin of refs passed 
 
2021
 
 
2022
   RETURNS
 
2023
 
 
2024
   NOTES
 
2025
*/
 
2026
template <class T>
 
2027
void pinVectorOfRefs( const Connection *conn,
 
2028
OCCI_STD_NAMESPACE::vector<Ref<T> > &vect,
 
2029
LockOptions lockOpt)
 
2030
{
 
2031
  
 
2032
 OCCI_STD_NAMESPACE::vector<void *> vecRef;
 
2033
 OCCI_STD_NAMESPACE::vector<void *> vecCor;
 
2034
 OCCI_STD_NAMESPACE::vector<PObject *> vecPObj;
 
2035
 unsigned int sz = vect.size();
 
2036
 vecRef.reserve( sz );
 
2037
 vecCor.reserve( sz );
 
2038
 
 
2039
 for ( unsigned int  i=0; i < sz; i++)
 
2040
 {
 
2041
   vecRef.push_back((void *)vect[i].getRef());
 
2042
   vecCor.push_back((void *)vect[i].getCor());
 
2043
 }
 
2044
 pinVectorOfOCIRefs(conn, vecRef, vecCor,vecPObj, lockOpt);
 
2045
 for ( unsigned int  k=0; k < sz; k++)
 
2046
   vect[k].setPinnedObject(vecPObj[k]);
 
2047
}
 
2048
 
 
2049
 
 
2050
 
 
2051
/*---------------------------------------------------------------------------
 
2052
                          INTERNAL FUNCTIONS
 
2053
  ---------------------------------------------------------------------------*/
 
2054
 
 
2055
 
 
2056
} /* end of namespace occi */
 
2057
} /* end of namespace oracle */
 
2058
#endif                                              /* OCCICONTROL_ORACLE */
 
2059
 
 
2060
#endif                                              /* _olint */