Tang Cheng | 31b9525 | 2014-10-23 09:22:35 +0800 | [diff] [blame^] | 1 | /* Copyright (c) 1994, 2006, Oracle. All rights reserved. */ |
| 2 | |
| 3 | /* |
| 4 | NAME |
| 5 | ORI - OCI navigational interface |
| 6 | |
| 7 | DESCRIPTION |
| 8 | |
| 9 | This section is intended to give a brief introduction to the navigational |
| 10 | interfaces. Readers can refer to the documents listed in the section |
| 11 | 'RELATED DOCUMENTS' for more information. |
| 12 | |
| 13 | PURPOSE |
| 14 | The Oracle Call Interface (OCI) supports navigational access of objects. |
| 15 | In the navigational paradigm, data is represented as a graph of objects |
| 16 | connected by references. Objects in the graph are reached by following |
| 17 | the references. |
| 18 | |
| 19 | OBJECT ENVIRONMENT |
| 20 | |
| 21 | The object environment is initialized when the OCI environment handle is |
| 22 | initialized with the object option. An object environment contains a |
| 23 | heap which buffers type instances in memory. The object environment also |
| 24 | contains an object cache which keeps track of the objects in the object |
| 25 | environment. Readers can refer to the "Functional Specification for |
| 26 | Programmatic Interface" for more information about the object |
| 27 | environment. |
| 28 | |
| 29 | INSTANCE, OBJECT AND VALUE |
| 30 | |
| 31 | An OTS instance is an occurence of a type specified by the Oracle Type |
| 32 | System (OTS). This section describes how an OTS instance can be |
| 33 | represented in OCI. In OCI, an OTS instance can be classified based on |
| 34 | the type, the lifetime and referencability (see the figure below): |
| 35 | |
| 36 | 1) A persistent object is an instance of an object type. A persistent |
| 37 | object resides in a row of a table in the server and can exist longer |
| 38 | than the duration of a session (connection). Persistent objects can be |
| 39 | identified by object references which contain the object identifiers. |
| 40 | A persistent object is obtained by pinning its object reference. |
| 41 | |
| 42 | 2) A transient object is an instance of an object type. A transient |
| 43 | object cannot exist longer than the duration of a session, and it is |
| 44 | used to contain temporary computing results. Transient objects can |
| 45 | also be identified by references which contain transient object |
| 46 | identifiers. |
| 47 | |
| 48 | 3) A value is an instance of an user-defined type (object type or |
| 49 | collection type) or any built-in OTS type. Unlike objects, values of |
| 50 | object types are identified by memory pointers, rather than by |
| 51 | references. |
| 52 | |
| 53 | A value can be standalone or embbeded. A standalone value is usually |
| 54 | obtained by issuing a select statement. OCI also allows the client |
| 55 | program to select a row of object table into a value by issuing a SQL |
| 56 | statement. Thus, a referenceable object (in the database) can be |
| 57 | represented as a value (which cannot be identified by a reference). |
| 58 | A standalone value can also be an out-of-line attribute in an object |
| 59 | (e.g varchar, raw) or an out-of-line element in a collection (e.g. |
| 60 | varchar, raw, object). |
| 61 | |
| 62 | An embedded value is phyiscally included in a containing instance. |
| 63 | An embedded value can be an in-line attribute in an object (e.g. |
| 64 | number, nested object) or an in-line element in a collection. |
| 65 | |
| 66 | All values are considered to be transient by OCI, e.g. OCI does not |
| 67 | support automatic flushing a value to the database, and the client has |
| 68 | to explicitly execute a SQL statement to store a value into the |
| 69 | database. For embedded values, they are flushed when their containing |
| 70 | instance are flushed. |
| 71 | |
| 72 | |
| 73 | OTS instance |
| 74 | | | |
| 75 | v v |
| 76 | object value (type) |
| 77 | | | |
| 78 | v v |
| 79 | persistent transient (lifetime) |
| 80 | |
| 81 | |
| 82 | persistent obj transient obj value |
| 83 | --------------------------------------------------------------- |
| 84 | | | | | object type, | |
| 85 | | type | object type | object type | built-in, | |
| 86 | | | | | collection | |
| 87 | --------------------------------------------------------------- |
| 88 | | maximum | until object | session | session | |
| 89 | | lifetime | is deleted | | | |
| 90 | --------------------------------------------------------------- |
| 91 | | referencable | yes | yes | no | |
| 92 | --------------------------------------------------------------- |
| 93 | | embeddable | no | no | yes | |
| 94 | --------------------------------------------------------------- |
| 95 | |
| 96 | REFERENCEABLE OBJECT, STANDALONE OBJECT, EMBEDDED OBJECT |
| 97 | |
| 98 | In the reminding of this include file, the following term will be used: |
| 99 | 1) The term 'object' can be generally referred to a persistent object, |
| 100 | a transient object, a standalone value of object type, or an embedded |
| 101 | value of object type. |
| 102 | 2) The term 'referenceable object' refers to a persistent object or a |
| 103 | transient object. |
| 104 | 3) The term 'standalone object' refers to a persistent object, a |
| 105 | transient object or a standalone value of object type. |
| 106 | 4) The term 'embedded object' referes to a embbeded value of object |
| 107 | type. |
| 108 | |
| 109 | META ATTRIBUTES |
| 110 | |
| 111 | There is a set of meta-attributes that are defined for standalone |
| 112 | objects. A meta-attribute can be transient or persistent. A |
| 113 | transient meta-attribute is applicable to an instance only when it is |
| 114 | in memory. A persistent meta-attribute can be applicable to an instance |
| 115 | that is in the disk. |
| 116 | |
| 117 | The set of user visible meta-attributes for persistent objects are: |
| 118 | 1) existent (persistent) : Does the object exist? |
| 119 | 2) nullness (persistent) : Null information of the instance |
| 120 | 3) locked (persistent) : Is the object locked? |
| 121 | 4) pinned (transient) : Is the object being accessed by the client? |
| 122 | 5) dirty (transient) : Has the object been modified? |
| 123 | 6) allocation duration (transient) : see below |
| 124 | 7) pin duration (transient) : see below |
| 125 | |
| 126 | The set of user visible meta-attributes for transient objects are: |
| 127 | 1) existent (transient) : Does the object exist? |
| 128 | 2) nullness (transient) : Null information of the instance |
| 129 | 3) pinned (transient) : Is the object being accessed by the client? |
| 130 | 4) dirty (transient) : Has the object been modified? |
| 131 | 4) allocation duration (transient) : see below |
| 132 | 5) pin duration (transient) : see below |
| 133 | |
| 134 | The set of user visible meta-attributes for standalone values of object |
| 135 | type or collections are: |
| 136 | 1) allocation duration (transient) : see below |
| 137 | 2) nullness (transient) : Null information of the instance |
| 138 | (of an object type) |
| 139 | |
| 140 | NULLNESS OF AN INSTANCE |
| 141 | |
| 142 | Each standalone object is associated with a null structure which keeps |
| 143 | the null information about the object. A null indicates the absence of |
| 144 | data. The null structure itself contains null indicators that represent: |
| 145 | 1) atomic nullness : a null value that pertains to the whole object |
| 146 | 2) null status of the individual attribute in the object |
| 147 | |
| 148 | The layout of a null structure in memory resembles that of the object, |
| 149 | except that the null structure has additional indicators to represent |
| 150 | the atomic nullness for each object. |
| 151 | |
| 152 | An non-existent object is different than an object that is atomically |
| 153 | null. A atomically null object is an existing object that has no data. |
| 154 | |
| 155 | MEMORY LAYOUT OF AN OBJECT |
| 156 | |
| 157 | A standalone object in memory is composed of a top level memory chunk, |
| 158 | a null structure and optionally, a number of secondary memory chunks. |
| 159 | For a DEPARTMENT object type, |
| 160 | |
| 161 | OBJECT TYPE department |
| 162 | { |
| 163 | dep_name varchar2(20), |
| 164 | budget number, |
| 165 | manager person, /o person is an object type o/ |
| 166 | employees collection of person |
| 167 | } |
| 168 | |
| 169 | Each instance of DEPARTMENT will has a top level memory chunk which |
| 170 | contains the top level attributes such as dep_name, budget, manager and |
| 171 | employees. The attributes dep_name and employees are themselves pointers |
| 172 | to the additional memory (the secondary memory chunks). The secondary |
| 173 | memory is for the out-of-line attribute (e.g. varray). |
| 174 | |
| 175 | CONSISTENCY MODEL |
| 176 | |
| 177 | Each pin operation behaves like a distinct SQL select. Thus, the object |
| 178 | cache does not guarantee consistency for a graph of objects. In order to |
| 179 | retrieve a consistent graph of objects, the user has to explicitly start |
| 180 | a serializable transaction or a read-only transaction. |
| 181 | |
| 182 | DURATION |
| 183 | In OCI, a duration is used to specify |
| 184 | |
| 185 | 1) the length of memory allocation of an instance |
| 186 | When each instance is allocated, it is associate with an allocation |
| 187 | duration. The memory occupied by the object is freed automatically |
| 188 | at the end of its allocation duration. The allocation duration of an |
| 189 | instance cannot be changed. |
| 190 | |
| 191 | 2) the length of pinning of an object |
| 192 | When each object is pinned, the client has to give a pin duration |
| 193 | which specify the length of time that the object is intended to be |
| 194 | used. It is an user error to specify a pin duration longer than an |
| 195 | allocation duration of the object. An object is completely unpinned |
| 196 | at the end of its pin duration (see OCIObjectUnpin()). |
| 197 | |
| 198 | An OCI program can use the allocation duration and the pin duration to |
| 199 | automatically free the memory of the instances: |
| 200 | 1) Transient objects and values are freed at the end of the allocation |
| 201 | duration. |
| 202 | 2) Persistent objects ARE freed at the end of the allocation duration. |
| 203 | Persistent objects CAN be freed at the end of the pin duration when |
| 204 | the objects are completely unpinned. The persistent objects are said |
| 205 | to be aged out. See OCIObjectUnpin() for more details. |
| 206 | |
| 207 | There are 3 predefined duration: session, transaction, call. The time |
| 208 | spans of these durations are defined based on the programming model |
| 209 | presented by OCI. The call duration is mapped to the transaction |
| 210 | duration in the client-side environment. See oro.h for the macros defined |
| 211 | for these 3 durations. |
| 212 | |
| 213 | A pin duration can be promoted. For example, if an object is pinned with |
| 214 | duration 1, and the object is later pinned with duration 2, the pin |
| 215 | routine will try to find a duration that is longer or equal to the |
| 216 | length of both duration 1 and duration 2. The pin duration of the object |
| 217 | is set to the that duration. The object is automatically unpinned only |
| 218 | after both duration 1 and duration 2 are terminated. |
| 219 | |
| 220 | RELATED DOCUMENTS |
| 221 | "Functional Specification for Oracle Object RDBMS" |
| 222 | "Functional Specification for Programmatic Interfaces" |
| 223 | "Functional Specification for the Oracle Type System (OTS)" |
| 224 | |
| 225 | INSPECTION STATUS |
| 226 | Inspection date: |
| 227 | Inspection status: |
| 228 | Estimated increasing cost defects per page: |
| 229 | Rule sets: |
| 230 | |
| 231 | ACCEPTANCE REVIEW STATUS |
| 232 | Review date: |
| 233 | Review status: |
| 234 | Reviewers: |
| 235 | |
| 236 | PUBLIC FUNCTIONS |
| 237 | OCIObjectNew - OCI new a standalone instance |
| 238 | OCIObjectPin - OCI pin an object by reference |
| 239 | OCIObjectUnpin - OCI unpin a referenceable object |
| 240 | OCIObjectPinCountReset - OCI reset the pin count of a referenceable object |
| 241 | OCIObjectLock - OCI lock a persistent object |
| 242 | OCIObjectLockNoWait - OCI lock a persistent object |
| 243 | OCIObjectMarkUpdate - OCI mark a referenceable object as updated |
| 244 | OCIObjectUnmark - OCI unmark a dirtied referenceable object |
| 245 | OCIObjectUnmarkByRef - OCI unmark a dirtied object by reference |
| 246 | OCIObjectFree - OCI free a standalone instance |
| 247 | OCIObjectMarkDelete - OCI mark a referenceable object as deleted |
| 248 | OCIObjectMarkDeleteByRef - OCI mark a referenceable object as deleted by |
| 249 | giving a reference |
| 250 | OCIObjectFlush - OCI flush a persistent object |
| 251 | OCIObjectRefresh - OCI refresh a persistent object |
| 252 | OCIObjectCopy - OCI CoPy one object to another |
| 253 | OCIObjectGetTypeRef - OCI get the Type Reference of a standalone object |
| 254 | OCIObjectGetObjectRef - OCI get the Object's Reference |
| 255 | OCIObjectGetInd - OCI get Null Structure of an standalone object |
| 256 | OCIObjectExists - OCI get the existence of a referenceable object |
| 257 | OCIObjectGetProperty - get object property |
| 258 | OCIObjectIsLocked - OCI get the lock status of a referenceable object |
| 259 | OCIObjectIsDirty - OCI get the dirty status of a referenceable object |
| 260 | OCIObjectPinTable - OCI get Table object |
| 261 | OCIObjectArrayPin - OCI pin array of objects |
| 262 | OCIObjectGetPrimayKeyTypeRef - OCI get the Ref for the primary key OID's |
| 263 | type |
| 264 | OCIObjectMakeObjectRef - OCI Create a pk or sys generated REF |
| 265 | |
| 266 | OCIObjectGetNewOID - OCI Create a new Object ID |
| 267 | |
| 268 | OCICacheFlush - OCI flsuh the modified persistent objects in the cache |
| 269 | OCICacheRefresh - OCI refresh persistent objects in the cache |
| 270 | OCICacheUnpin - OCI unpin referenceable objects in the cache |
| 271 | OCICacheFree - OCI free all instances in the environment |
| 272 | OCICacheUnmark - OCI unmark all dirty referenceable objects in the cache |
| 273 | |
| 274 | PRIVATE FUNCTIONS |
| 275 | None |
| 276 | |
| 277 | EXAMPLES |
| 278 | |
| 279 | The following types will be used in the examples in this section: |
| 280 | |
| 281 | OBJECT TYPE professor |
| 282 | ( |
| 283 | varchar2 name; |
| 284 | number department; |
| 285 | number num_of_students; |
| 286 | ); |
| 287 | |
| 288 | OBJECT TYPE course |
| 289 | ( |
| 290 | varchar2 name; |
| 291 | number grade; |
| 292 | ); |
| 293 | |
| 294 | OBJECT TYPE student |
| 295 | ( |
| 296 | vstring name; |
| 297 | number department; |
| 298 | ref advisor; /o advisor is a professor o/ |
| 299 | collection courses; |
| 300 | ); |
| 301 | |
| 302 | EXAMPLE 1 |
| 303 | |
| 304 | Here is a set of examples to illustrate the usages of some of the |
| 305 | orio and oric functions. |
| 306 | |
| 307 | OCIenv *env; /o OCI environment handle o/ |
| 308 | OCIError *err; /o OCI error handle o/ |
| 309 | OCISvcCtx *svc; /o OCI service handle o/ |
| 310 | |
| 311 | void *stu_tbl; /o pointer to the student table o/ |
| 312 | OCIType *stu_tdo; /o student type tdo o/ |
| 313 | |
| 314 | OCIRef *stu2_ref; /o object reference to student object o/ |
| 315 | student *stu1; /o pointer to the student object o/ |
| 316 | student *stu2; /o pointer to the student object o/ |
| 317 | professor *pro; /o pointer to the professor object o/ |
| 318 | |
| 319 | /o Initialize the OCI environment handle, error handle and service |
| 320 | handle and login to the database o/ |
| 321 | ... |
| 322 | |
| 323 | /o CREATE A PERSISTENT OBJECT o/ |
| 324 | |
| 325 | /o get the table object of student o/ |
| 326 | if (OCIObjectPinTable(env, err, svc, "ORACLEU", sizeof("ORACLEU"), |
| 327 | "STUDENT_TABLE", sizeof("STUDENT_TABLE"), (OCIRef *)0, |
| 328 | OCI_DURATION_NULL, &stu_tbl) != OCI_SUCCESS) |
| 329 | /o error handling code o/ |
| 330 | |
| 331 | /o get type object of student o/ |
| 332 | if (OCITypeByName(env, err, svc, "ORACLEU", sizeof("ORACLEU"), |
| 333 | "STUDENT", sizeof("STUDENT"), OCI_DURATION_NULL, OCI_TYPEGET_HEADER, |
| 334 | &stu_tdo) != OCI_SUCCESS) |
| 335 | /o error handling code o/ |
| 336 | |
| 337 | /o create a persistent object 'mark' (of type student) o/ |
| 338 | if (OCIObjectNew(env, err, svc, OCI_TYPECODE_ADT, stu_tdo, stu_tbl, |
| 339 | OCI_DURATION_TRANS, (ub1)FALSE, (void **)&stu1) != OCI_SUCCESS) |
| 340 | /o error handling code o/ |
| 341 | |
| 342 | /o RETRIEVE OBJECTS IN PERSISTENT STORES o/ |
| 343 | |
| 344 | /o Use OCI to retrieve a reference to student object 'joe'. |
| 345 | o The retrieved reference is bound to the variable stu2_ref. |
| 346 | o/ |
| 347 | |
| 348 | /o pin/retrieve the student "joe" by reference o/ |
| 349 | if (OCIObjectPin(env, err, &stu2_ref, (OCIComplexObject *)0, OCI_PIN_ANY, |
| 350 | OCI_DURATION_TRANS, OCI_LOCK_X, &stu2) != OCI_SUCCESS) |
| 351 | /o error handling code o/ |
| 352 | |
| 353 | /o pin/retrieve the advisor of student "joe" by reference o/ |
| 354 | if (OCIObjectPin(env, err, &stu2->advisor, (OCIComplexObject *)0, |
| 355 | OCI_PIN_ANY, OCI_DURATION_TRANS, OCI_LOCK_X, &pro) != OCI_SUCCESS) |
| 356 | /o error handling code o/ |
| 357 | |
| 358 | /o MODIFY OBJECTS o/ |
| 359 | |
| 360 | /o initialize the newly created object "mark" o/ |
| 361 | DISCARD OCIStringAssignText(env, err, "mark", sizeof("mark"), |
| 362 | &stu1->name); |
| 363 | department = 522; |
| 364 | DISCARD OCINumberFromInt(err, &department, sizeof(department), |
| 365 | OCI_NUMBER_UNSIGNED, &stu1->department); |
| 366 | |
| 367 | /o assign advisor to student "mark" o/ |
| 368 | DISCARD OCIRefAssign(env, err, &stu2->advisor, &stu1->advisor); |
| 369 | |
| 370 | /o update student "joe". o/ |
| 371 | department = 533; |
| 372 | DISCARD OCINumberFromInt(err, &department, sizeof(department), |
| 373 | OCI_NUMBER_UNSIGNED, &stu2->department); |
| 374 | DISCARD OCIObjectMarkUpdate(env, err, stu2); |
| 375 | |
| 376 | /o UNPIN OBJECTS AFTER FINSIHED PROCESSING THEM o/ |
| 377 | |
| 378 | /o unpin the student object "mark" o/ |
| 379 | if (OCIObjectUnpin(env, err, stu1) != OCI_SUCCESS) |
| 380 | /o error handling code o/ |
| 381 | |
| 382 | /o unpin the student object "joe" o/ |
| 383 | if (OCIObjectUnpin(env, err, stu2) != OCI_SUCCESS) |
| 384 | /o error handling code o/ |
| 385 | |
| 386 | /o unpin the professor object o/ |
| 387 | if (OCIObjectUnpin(env, err, pro) != OCI_SUCCESS) |
| 388 | /o error handling code o/ |
| 389 | |
| 390 | /o unpin the type object o/ |
| 391 | if (OCIObjectUnpin(env, err, stu_tdo) != OCI_SUCCESS) |
| 392 | /o error handling code o/ |
| 393 | |
| 394 | /o unpin the table object o/ |
| 395 | if (OCIObjectUnpin(env, err, stu_tbl) != OCI_SUCCESS) |
| 396 | /o error handling code o/ |
| 397 | |
| 398 | /o FLUSH MODIFIED OBJECTS BACK TO PERSISTENT STORE o/ |
| 399 | |
| 400 | if (OCICacheFlush(env, err, svc, (void *)0, ((OCIRef*)(*)())0, |
| 401 | (OCIRef *)0) != OCI_SUCCESS) |
| 402 | /o error handling code o/ |
| 403 | |
| 404 | /o commit transaction o/ |
| 405 | |
| 406 | END OF EXAMPLE 1 |
| 407 | |
| 408 | NOTES |
| 409 | This file has been subsetted to contain only the routines that will |
| 410 | be in the first release. |
| 411 | |
| 412 | MODIFIED |
| 413 | dmukhin 06/29/05 - ANSI prototypes; miscellaneous cleanup |
| 414 | srseshad 03/12/03 - convert oci public api to ansi |
| 415 | aahluwal 06/03/02 - bug 2360115 |
| 416 | bpalaval 02/09/01 - Change text to oratext. |
| 417 | rkasamse 06/21/00 - add ociobjectgetnewoid |
| 418 | rkasamse 05/24/00 - add OCIObjectSetData |
| 419 | whe 09/01/99 - 976457:check __cplusplus for C++ code |
| 420 | smuralid 10/29/98 - add comments for OCIObjectMakeObjectRef |
| 421 | mkrishna 08/19/98 - change OCIGetPkTypeRef to OCIObjectGetPrimaryKeyTypeR |
| 422 | mkrishna 08/10/98 - add OCIObjectMakeObjectRef & OCIObjectGetPkTypeRef |
| 423 | rkasamse 06/22/98 - add comments for OCIDurationBegin(End) |
| 424 | pmitra 04/01/98 - OCIObjectLockNoWait added |
| 425 | pmitra 11/05/97 - [573769] OCIObjectArrayPin pos parameter cannot be NU |
| 426 | cxcheng 07/29/97 - fix compile for short names |
| 427 | skrishna 07/14/97 - add OCIObjectGetProperty |
| 428 | skrishna 04/30/97 - OCIObjectFlushRefresh: remove duplicate declaration |
| 429 | skrishna 04/24/97 - flag unsupported functions |
| 430 | sthakur 03/20/97 - modify flag argument to OCIObjectFree |
| 431 | skrishna 03/18/97 - fix ifdef for supporting ansi and k&r proto-types |
| 432 | cxcheng 02/19/97 - remove short names support |
| 433 | cxcheng 02/06/97 - take out short name support except with SLSHORTNAME |
| 434 | sthakur 12/20/96 - fix a typepo in OCIOBjectArrayPin |
| 435 | jboonleu 11/07/96 - modify comments |
| 436 | cxcheng 10/28/96 - more beautification changes |
| 437 | jboonleu 10/24/96 - add flag to OCIObjectFree |
| 438 | jboonleu 10/22/96 - change interface of OCICacheFlush |
| 439 | cxcheng 10/18/96 - rename OCIObjectPinArray to OCIObjectArrayPin |
| 440 | cxcheng 10/14/96 - more renaming of types |
| 441 | jboonleu 10/09/96 - add new interfaces |
| 442 | cxcheng 10/09/96 - more lint fixes |
| 443 | cxcheng 10/08/96 - more lint fixes |
| 444 | jboonleu 09/27/96 - fix lint errors |
| 445 | jboonleu 10/07/96 - beautify ori.h after conversion to long names |
| 446 | cxcheng 10/04/96 - replace short names with long names |
| 447 | sthakur 08/20/96 - add COR context to OCIObjectPin |
| 448 | mluong 07/17/96 - add back orioglk, oriogdr, oriogiv, and oriocur. |
| 449 | jboonleu 07/17/96 - rename refresh option to conherency option |
| 450 | jboonleu 07/16/96 - change comment for cache consistency |
| 451 | jwijaya 07/03/96 - add ANSI prototypes |
| 452 | jboonleu 06/12/96 - update comment |
| 453 | jboonleu 05/08/96 - change description of OCIDurationGetParent |
| 454 | jboonleu 05/01/96 - add OROOCOSFN |
| 455 | skrishna 04/08/96 - change ori*() to take OCIEnv* and OCIError* instead |
| 456 | of oroenv* |
| 457 | jboonleu 01/04/96 - interface change |
| 458 | jboonleu 10/24/95 - support of variable ref |
| 459 | jboonleu 02/15/95 - new interface |
| 460 | sthakur 01/05/95 - pass username to origrgc |
| 461 | skotsovo 12/07/94 - update example |
| 462 | jwijaya 11/15/94 - rename ORONSPTAB to ORONSPEXT |
| 463 | jwijaya 10/06/94 - add namespace to oriopnm() |
| 464 | jwijaya 10/02/94 - connection handle -> connection number |
| 465 | jboonleu 08/16/94 - fix lint errors |
| 466 | jboonleu 07/20/94 - change interface of OCICacheFlush |
| 467 | tanguyen 07/18/94 - add oriocpe, change OCIObjectCopy to oriocps |
| 468 | tcheng 07/15/94 - add init param maximum_sga_heap_size |
| 469 | tcheng 07/13/94 - change origini to get param string |
| 470 | jboonleu 07/05/94 - change sccs string from sccid to a comment |
| 471 | jboonleu 07/01/94 - Add examples to ORIO* and ORIC* functions |
| 472 | tanguyen 06/30/94 - Fix the ORI_ORACLE ifdef |
| 473 | skotsovo 06/27/94 - include all public functions in public functions |
| 474 | list at top of header file |
| 475 | tcheng 06/27/94 - modify comments according to new template |
| 476 | tanguyen 06/24/94 - fix comments for OCIObjectCopy |
| 477 | tcheng 06/24/94 - fix comments in origrgc() |
| 478 | tanguyen 06/21/94 - fix comments and format |
| 479 | tcheng 06/20/94 - commenting origini/trm/err/rgc/urg() functions |
| 480 | tanguyen 06/16/94 - fix descriptions of ref operations |
| 481 | tanguyen 06/16/94 - clarifies refs comparison |
| 482 | tanguyen 05/12/94 - adds more interfaces (OCIObjectMarkUpdate) |
| 483 | jwijaya 05/10/94 - fix examples, add origurg, change origcon to origrgc |
| 484 | tanguyen 05/03/94 - remove unnecessary 'type' argument from |
| 485 | 'OCIObjectCopy' |
| 486 | tanguyen 03/08/94 - clarifies comments |
| 487 | jwijaya 02/16/94 - more questions |
| 488 | jwijaya 02/11/94 - more comments |
| 489 | jwijaya 02/10/94 - identify optional arguments |
| 490 | jwijaya 02/07/94 - Creation |
| 491 | */ |
| 492 | |
| 493 | |
| 494 | #ifndef ORATYPES |
| 495 | #include <oratypes.h> |
| 496 | #endif |
| 497 | #ifndef ORO_ORACLE |
| 498 | #include <oro.h> |
| 499 | #endif |
| 500 | #ifndef OCI_ORACLE |
| 501 | #include <oci.h> |
| 502 | #endif |
| 503 | #ifndef ORT_ORACLE |
| 504 | #include <ort.h> |
| 505 | #endif |
| 506 | |
| 507 | #ifndef ORI_ORACLE |
| 508 | #define ORI_ORACLE |
| 509 | |
| 510 | /*---------------------------------------------------------------------------*/ |
| 511 | /* SHORT NAMES SUPPORT SECTION */ |
| 512 | /*---------------------------------------------------------------------------*/ |
| 513 | |
| 514 | #ifdef SLSHORTNAME |
| 515 | |
| 516 | /* the following are short names that are only supported on IBM mainframes |
| 517 | with the SLSHORTNAME defined. |
| 518 | With this all subsequent long names will actually be substituted with |
| 519 | the short names here */ |
| 520 | |
| 521 | #define OCIDurationBegin origbgu |
| 522 | #define OCIDurationEnd origedu |
| 523 | #define OCIDurationGetParent origpdr |
| 524 | #define OCICacheFlushRefresh oricfrh |
| 525 | #define OCICacheUnpin oricunp |
| 526 | #define OCICacheFree oricfre |
| 527 | #define OCICacheUnmark oricumk |
| 528 | #define OCICacheGetObjects oricgpr |
| 529 | #define OCICacheRegister oricscb |
| 530 | #define OCIObjectUnpin oriounp |
| 531 | #define OCIObjectPinCountReset orioupz |
| 532 | #define OCIObjectLock oriolck |
| 533 | #define OCIObjectLockNoWait oriolnw |
| 534 | #define OCIObjectMarkUpdate orioupd |
| 535 | #define OCIObjectUnmark orioumk |
| 536 | #define OCIObjectUnmarkByRef orioumr |
| 537 | #define OCIObjectAlwaysLatest oriomkl |
| 538 | #define OCIObjectNotAlwaysLatest oriouml |
| 539 | #define OCIObjectMarkDeleteByRef oriordl |
| 540 | #define OCIObjectMarkDelete oriopdl |
| 541 | #define OCIObjectFlush oriofls |
| 542 | #define OCIObjectFlushRefresh oriofrh |
| 543 | #define OCIObjectCopy oriocpy |
| 544 | #define OCIObjectGetTypeRef oriogtr |
| 545 | #define OCIObjectGetObjectRef oriogor |
| 546 | #define OCIObjectGetInd oriogns |
| 547 | #define OCIObjectExists oriogex |
| 548 | #define OCIObjectGetProperty oriogpr |
| 549 | #define OCIObjectRefresh oriorfs |
| 550 | #define OCIObjectPinTable oriogtb |
| 551 | #define OCIObjectGetPrimaryKeyTypeRef oriogpf |
| 552 | #define OCIObjectMakeObjectRef oriomrf |
| 553 | |
| 554 | #define OCIObjectNew orionew |
| 555 | #define OCIObjectPin oriopin |
| 556 | #define OCIObjectFree oriofre |
| 557 | #define OCIObjectArrayPin orioapn |
| 558 | #define OCIObjectIsDirty oriodrt |
| 559 | #define OCIObjectIsDirtied oriodrd |
| 560 | #define OCIObjectIsLoaded orioldd |
| 561 | #define OCICacheFlush oricfls |
| 562 | #define OCICacheRefresh oricrfs |
| 563 | |
| 564 | #endif /* SLSHORTNAME */ |
| 565 | |
| 566 | /*---------------------------------------------------------------------------*/ |
| 567 | /* PUBLIC TYPES AND CONSTANTS */ |
| 568 | /*---------------------------------------------------------------------------*/ |
| 569 | |
| 570 | /* Also see oro.h. */ |
| 571 | |
| 572 | /*---------------------------------------------------------------------------*/ |
| 573 | /* PUBLIC FUNCTIONS */ |
| 574 | /*---------------------------------------------------------------------------*/ |
| 575 | /*---------------------------------------------------------------------------*/ |
| 576 | /* OBJECT/INSTANCE OPERATIONS */ |
| 577 | /*---------------------------------------------------------------------------*/ |
| 578 | |
| 579 | /*--------------------------- OCIObjectNew ----------------------------------*/ |
| 580 | sword OCIObjectNew( OCIEnv *env, OCIError *err, const OCISvcCtx *svc, |
| 581 | OCITypeCode typecode, OCIType *tdo, void *table, |
| 582 | OCIDuration duration, boolean value, |
| 583 | void **instance ); |
| 584 | /* |
| 585 | NAME: OCIObjectNew - OCI new (create) a standalone instance |
| 586 | PARAMETERS: |
| 587 | env (IN/OUT) - OCI environment handle initialized in object mode |
| 588 | err (IN/OUT) - error handle. If there is an error, it is |
| 589 | recorded in 'err' and this function returns OCI_ERROR. |
| 590 | The error recorded in 'err' can be retrieved by calling |
| 591 | OCIErrorGet(). |
| 592 | svc (IN) - OCI service handle. |
| 593 | typecode (IN) - the typecode of the type of the instance. |
| 594 | tdo (IN, optional) - pointer to the type descriptor object. The |
| 595 | TDO describes the type of the instance that is to be |
| 596 | created. Refer to OCITypeByName() for obtaining a TDO. |
| 597 | The TDO is required for creating a named type (e.g. an |
| 598 | object or a collection). |
| 599 | table (IN, optional) - pointer to a table object which specifies a |
| 600 | table in the server. This parameter can be set to NULL |
| 601 | if no table is given. See the description below to find |
| 602 | out how the table object and the TDO are used together |
| 603 | to determine the kind of instances (persistent, |
| 604 | transient, value) to be created. Also see |
| 605 | OCIObjectPinTable() for retrieving a table object. |
| 606 | duration (IN) - this is an overloaded parameter. The use of this |
| 607 | parameter is based on the kind of the instance that is |
| 608 | to be created. |
| 609 | a) persistent object. This parameter specifies the |
| 610 | pin duration. |
| 611 | b) transient object. This parameter specififes the |
| 612 | allocation duration and pin duration. |
| 613 | c) value. This parameter specifies the allocation |
| 614 | duration. |
| 615 | value (IN) - specifies whether the created object is a value. |
| 616 | If TRUE, then a value is created. Otherwise, a |
| 617 | referenceable object is created. If the instance is |
| 618 | not an object, then this parameter is ignored. |
| 619 | instance (OUT) - address of the newly created instance |
| 620 | |
| 621 | REQUIRES: |
| 622 | - a valid OCI environment handle must be given. |
| 623 | DESCRIPTION: |
| 624 | This function creates a new instance of the type specified by the |
| 625 | typecode or the TDO. Based on the parameters 'typecode' (or 'tdo'), |
| 626 | 'value' and 'table', different kinds of instances can be created: |
| 627 | |
| 628 | The parameter 'table' is not NULL? |
| 629 | |
| 630 | yes no |
| 631 | ---------------------------------------------------------------- |
| 632 | | object type (value=TRUE) | value | value | |
| 633 | ---------------------------------------------------------------- |
| 634 | | object type (value=FALSE) | persistent obj | transient obj | |
| 635 | type ---------------------------------------------------------------- |
| 636 | | built-in type | value | value | |
| 637 | ---------------------------------------------------------------- |
| 638 | | collection type | value | value | |
| 639 | ---------------------------------------------------------------- |
| 640 | |
| 641 | This function allocates the top level memory chunk of an OTS instance. |
| 642 | The attributes in the top level memory are initialized (e.g. an |
| 643 | attribute of varchar2 is initialized to a vstring of 0 length). |
| 644 | |
| 645 | If the instance is an object, the object is marked existed but is |
| 646 | atomically null. |
| 647 | |
| 648 | FOR PERSISTENT OBJECTS: |
| 649 | The object is marked dirty and existed. The allocation duration for |
| 650 | the object is session. The object is pinned and the pin duration is |
| 651 | specified by the given parameter 'duration'. |
| 652 | |
| 653 | FOR TRANSIENT OBJECTS: |
| 654 | The object is pinned. The allocation duration and the pin duration are |
| 655 | specified by the given parameter 'duration'. |
| 656 | |
| 657 | FOR VALUES: |
| 658 | The allocation duration is specified by the given parameter 'duration'. |
| 659 | |
| 660 | RETURNS: |
| 661 | if environment handle or error handle is null, return |
| 662 | OCI_INVALID_HANDLE. |
| 663 | if operation suceeds, return OCI_SUCCESS. |
| 664 | if operation fails, return OCI_ERROR. |
| 665 | */ |
| 666 | |
| 667 | /*--------------------------- OCIObjectPin ----------------------------------*/ |
| 668 | sword OCIObjectPin( OCIEnv *env, OCIError *err, OCIRef *object_ref, |
| 669 | OCIComplexObject *corhdl, OCIPinOpt pin_option, |
| 670 | OCIDuration pin_duration, |
| 671 | OCILockOpt lock_option, void **object ); |
| 672 | /* |
| 673 | NAME: OCIObjectPin - OCI pin a referenceable object |
| 674 | PARAMETERS: |
| 675 | env (IN/OUT) - OCI environment handle initialized in object mode |
| 676 | err (IN/OUT) - error handle. If there is an error, it is |
| 677 | recorded in 'err' and this function returns |
| 678 | OCI_ERROR. The error recorded in 'err' can be |
| 679 | retrieved by calling OCIErrorGet(). |
| 680 | object_ref (IN) - the reference to the object. |
| 681 | corhdl (IN) - handle for complex object retrieval. |
| 682 | pin_option (IN) - See description below. |
| 683 | pin_duration (IN) - The duration of which the object is being accesed |
| 684 | by a client. The object is implicitly unpinned at |
| 685 | the end of the pin duration. |
| 686 | If OCI_DURATION_NULL is passed, there is no pin |
| 687 | promotion if the object is already loaded into |
| 688 | the cache. If the object is not yet loaded, then |
| 689 | the pin duration is set to OCI_DURATION_DEFAULT. |
| 690 | lock_option (IN) - lock option (e.g., exclusive). If a lock option |
| 691 | is specified, the object is locked in the server. |
| 692 | See 'oro.h' for description about lock option. |
| 693 | object (OUT) - the pointer to the pinned object. |
| 694 | |
| 695 | REQUIRES: |
| 696 | - a valid OCI environment handle must be given. |
| 697 | DESCRIPTION: |
| 698 | |
| 699 | This function pins a referenceable object instance given the object |
| 700 | reference. The process of pinning serves three purposes: |
| 701 | |
| 702 | 1) locate an object given its reference. This is done by the object |
| 703 | cache which keeps track of the objects in the object heap. |
| 704 | |
| 705 | 2) notify the object cache that an object is being in use. An object |
| 706 | can be pinned many times. A pinned object will remain in memory |
| 707 | until it is completely unpinned (see OCIObjectUnpin()). |
| 708 | |
| 709 | 3) notify the object cache that a persistent object is being in use |
| 710 | such that the persistent object cannot be aged out. Since a |
| 711 | persistent object can be loaded from the server whenever is needed, |
| 712 | the memory utilization can be increased if a completely unpinned |
| 713 | persistent object can be freed (aged out), even before the |
| 714 | allocation duration is expired. |
| 715 | |
| 716 | Also see OCIObjectUnpin() for more information about unpinning. |
| 717 | |
| 718 | FOR PERSISTENT OBJECTS: |
| 719 | |
| 720 | When pinning a persistent object, if it is not in the cache, the object |
| 721 | will be fetched from the persistent store. The allocation duration of |
| 722 | the object is session. If the object is already in the cache, it is |
| 723 | returned to the client. The object will be locked in the server if a |
| 724 | lock option is specified. |
| 725 | |
| 726 | This function will return an error for a non-existent object. |
| 727 | |
| 728 | A pin option is used to specify the copy of the object that is to be |
| 729 | retrieved: |
| 730 | |
| 731 | 1) If option is OCI_PIN_ANY (pin any), if the object is already |
| 732 | in the environment heap, return this object. Otherwise, the object |
| 733 | is retrieved from the database. This option is useful when the |
| 734 | client knows that he has the exclusive access to the data in a |
| 735 | session. |
| 736 | |
| 737 | 2) If option is OCI_PIN_LATEST (pin latest), if the object is |
| 738 | not cached, it is retrieved from the database. If the object is |
| 739 | cached, it is refreshed with the latest version. See |
| 740 | OCIObjectRefresh() for more information about refreshing. |
| 741 | |
| 742 | 3) If option is OCI_PIN_RECENT (pin recent), if the object is loaded |
| 743 | into the cache in the current transaction, the object is returned. |
| 744 | If the object is not loaded in the current transaction, the object |
| 745 | is refreshed from the server. |
| 746 | |
| 747 | FOR TRANSIENT OBJECTS: |
| 748 | |
| 749 | This function will return an error if the transient object has already |
| 750 | been freed. This function does not return an error if an exclusive |
| 751 | lock is specified in the lock option. |
| 752 | |
| 753 | RETURNS: |
| 754 | if environment handle or error handle is null, return |
| 755 | OCI_INVALID_HANDLE. |
| 756 | if operation suceeds, return OCI_SUCCESS. |
| 757 | if operation fails, return OCI_ERROR. |
| 758 | */ |
| 759 | |
| 760 | /*------------------------------ OCIObjectUnpin -----------------------------*/ |
| 761 | sword OCIObjectUnpin( OCIEnv *env, OCIError *err, void *object ); |
| 762 | /* |
| 763 | NAME: OCIObjectUnpin - OCI unpin a referenceable object |
| 764 | PARAMETERS: |
| 765 | env (IN/OUT) - OCI environment handle initialized in object mode |
| 766 | err (IN/OUT) - error handle. If there is an error, it is |
| 767 | recorded in 'err' and this function returns OCI_ERROR. |
| 768 | The error recorded in 'err' can be retrieved by |
| 769 | calling OCIErrorGet(). |
| 770 | object (IN) - pointer to an object |
| 771 | REQUIRES: |
| 772 | - a valid OCI environment handle must be given. |
| 773 | - The specified object must be pinned. |
| 774 | DESCRIPTION: |
| 775 | This function unpins an object. An object is completely unpinned when |
| 776 | 1) the object was unpinned N times after it has been pinned N times |
| 777 | (by calling OCIObjectPin()). |
| 778 | 2) it is the end of the pin duration |
| 779 | 3) the function OCIObjectPinCountReset() is called |
| 780 | |
| 781 | There is a pin count associated with each object which is incremented |
| 782 | whenever an object is pinned. When the pin count of the object is zero, |
| 783 | the object is said to be completely unpinned. An unpinned object can |
| 784 | be freed without error. |
| 785 | |
| 786 | FOR PERSISTENT OBJECTS: |
| 787 | When a persistent object is completely unpinned, it becomes a candidate |
| 788 | for aging. The memory of an object is freed when it is aged out. Aging |
| 789 | is used to maximize the utilization of memory. An dirty object cannot |
| 790 | be aged out unless it is flushed. |
| 791 | |
| 792 | FOR TRANSIENT OBJECTS: |
| 793 | The pin count of the object is decremented. A transient can be freed |
| 794 | only at the end of its allocation duration or when it is explicitly |
| 795 | deleted by calling OCIObjectFree(). |
| 796 | |
| 797 | FOR VALUE: |
| 798 | This function will return an error for value. |
| 799 | |
| 800 | RETURNS: |
| 801 | if environment handle or error handle is null, return |
| 802 | OCI_INVALID_HANDLE. |
| 803 | if operation suceeds, return OCI_SUCCESS. |
| 804 | if operation fails, return OCI_ERROR. |
| 805 | */ |
| 806 | |
| 807 | /*---------------------------- OCIObjectPinCountReset -----------------------*/ |
| 808 | sword OCIObjectPinCountReset( OCIEnv *env, OCIError *err, void *object ); |
| 809 | /* |
| 810 | NAME: OCIObjectPinCountReset - OCI resets the pin count of a referenceable |
| 811 | object |
| 812 | PARAMETERS: |
| 813 | env (IN/OUT) - OCI environment handle initialized in object mode |
| 814 | err (IN/OUT) - error handle. If there is an error, it is |
| 815 | recorded in 'err' and this function returns OCI_ERROR. |
| 816 | The error recorded in 'err' can be retrieved by |
| 817 | calling OCIErrorGet(). |
| 818 | object (IN) - pointer to an object |
| 819 | REQUIRES: |
| 820 | - a valid OCI environment handle must be given. |
| 821 | - The specified object must be pinned. |
| 822 | DESCRIPTION: |
| 823 | This function completely unpins an object. When an object is |
| 824 | completely unpinned, it can be freed without error. |
| 825 | |
| 826 | FOR PERSISTENT OBJECTS: |
| 827 | When a persistent object is completely unpinned, it becomes a candidate |
| 828 | for aging. The memory of an object is freed when it is aged out. Aging |
| 829 | is used to maximize the utilization of memory. An dirty object cannot |
| 830 | be aged out unless it is flushed. |
| 831 | |
| 832 | FOR TRANSIENT OBJECTS: |
| 833 | The pin count of the object is decremented. A transient can be freed |
| 834 | only at the end of its allocation duration or when it is explicitly |
| 835 | freed by calling OCIObjectFree(). |
| 836 | |
| 837 | FOR VALUE: |
| 838 | This function will return an error for value. |
| 839 | |
| 840 | RETURNS: |
| 841 | if environment handle or error handle is null, return |
| 842 | OCI_INVALID_HANDLE. |
| 843 | if operation suceeds, return OCI_SUCCESS. |
| 844 | if operation fails, return OCI_ERROR. |
| 845 | */ |
| 846 | |
| 847 | /*--------------------------- OCIObjectLock ---------------------------------*/ |
| 848 | sword OCIObjectLock( OCIEnv *env, OCIError *err, void *object ); |
| 849 | /* |
| 850 | NAME: OCIObjectLock - OCI lock a persistent object |
| 851 | PARAMETERS: |
| 852 | env (IN/OUT) - OCI environment handle initialized in object mode |
| 853 | err (IN/OUT) - error handle. If there is an error, it is |
| 854 | recorded in 'err' and this function returns OCI_ERROR. |
| 855 | The error recorded in 'err' can be retrieved by |
| 856 | calling OCIErrorGet(). |
| 857 | object (IN) - pointer to the persistent object |
| 858 | REQUIRES: |
| 859 | - a valid OCI environment handle must be given. |
| 860 | - The specified object must be pinned. |
| 861 | DESCRIPTION: |
| 862 | This function locks a persistent object at the server. Unlike |
| 863 | OCIObjectLockNoWait() this function waits if another user currently |
| 864 | holds a lock on the desired object. This function |
| 865 | returns an error if: |
| 866 | 1) the object is non-existent. |
| 867 | |
| 868 | This function will return an error for transient objects and values. |
| 869 | The lock of an object is released at the end of a transaction. |
| 870 | |
| 871 | RETURNS: |
| 872 | if environment handle or error handle is null, return |
| 873 | OCI_INVALID_HANDLE. |
| 874 | if operation suceeds, return OCI_SUCCESS. |
| 875 | if operation fails, return OCI_ERROR. |
| 876 | */ |
| 877 | |
| 878 | /*------------------------ OCIObjectLockNoWait ------------------------------*/ |
| 879 | sword OCIObjectLockNoWait( OCIEnv *env, OCIError *err, void *object ); |
| 880 | /* |
| 881 | NAME: OCIObjectLockNoWait - OCI lock a persistent object, do not wait for |
| 882 | the lock, return error if lock not available |
| 883 | PARAMETERS: |
| 884 | env (IN/OUT) - OCI environment handle initialized in object mode |
| 885 | err (IN/OUT) - error handle. If there is an error, it is |
| 886 | recorded in 'err' and this function returns OCI_ERROR. |
| 887 | The error recorded in 'err' can be retrieved by |
| 888 | calling OCIErrorGet(). |
| 889 | object (IN) - pointer to the persistent object |
| 890 | REQUIRES: |
| 891 | - a valid OCI environment handle must be given. |
| 892 | - The specified object must be pinned. |
| 893 | DESCRIPTION: |
| 894 | This function locks a persistent object at the server. Unlike |
| 895 | OCIObjectLock() this function will not wait if another user holds |
| 896 | the lock on the desired object. This function returns an error if: |
| 897 | 1) the object is non-existent. |
| 898 | 2) the object is currently locked by another user in which |
| 899 | case this function returns with an error. |
| 900 | |
| 901 | This function will return an error for transient objects and values. |
| 902 | The lock of an object is released at the end of a transaction. |
| 903 | |
| 904 | RETURNS: |
| 905 | if environment handle or error handle is null, return |
| 906 | OCI_INVALID_HANDLE. |
| 907 | if operation suceeds, return OCI_SUCCESS. |
| 908 | if operation fails, return OCI_ERROR. |
| 909 | */ |
| 910 | |
| 911 | /*--------------------------- OCIObjectMarkUpdate ---------------------------*/ |
| 912 | sword OCIObjectMarkUpdate( OCIEnv *env, OCIError *err, void *object ); |
| 913 | /* |
| 914 | NAME: OCIObjectMarkUpdate - OCI marks an object as updated |
| 915 | PARAMETERS: |
| 916 | env (IN/OUT) - OCI environment handle initialized in object mode |
| 917 | err (IN/OUT) - error handle. If there is an error, it is |
| 918 | recorded in 'err' and this function returns OCI_ERROR. |
| 919 | The error recorded in 'err' can be retrieved by |
| 920 | calling OCIErrorGet(). |
| 921 | object (IN) - pointer to the persistent object |
| 922 | REQUIRES: |
| 923 | - a valid OCI environment handle must be given. |
| 924 | - The specified object must be pinned. |
| 925 | DESCRIPTION: |
| 926 | FOR PERSISTENT OBJECTS: |
| 927 | This function marks the specified persistent object as updated. The |
| 928 | persistent objects will be written to the server when the object cache |
| 929 | is flushed. The object is not locked or flushed by this function. It |
| 930 | is an error to update a deleted object. |
| 931 | |
| 932 | After an object is marked updated and flushed, this function must be |
| 933 | called again to mark the object as updated if it has been dirtied |
| 934 | after it is being flushed. |
| 935 | |
| 936 | FOR TRANSIENT OBJECTS: |
| 937 | This function marks the specified transient object as updated. The |
| 938 | transient objects will NOT be written to the server. It is an error |
| 939 | to update a deleted object. |
| 940 | |
| 941 | FOR VALUES: |
| 942 | It is an no-op for values. |
| 943 | |
| 944 | RETURNS: |
| 945 | if environment handle or error handle is null, return |
| 946 | OCI_INVALID_HANDLE. |
| 947 | if operation suceeds, return OCI_SUCCESS. |
| 948 | if operation fails, return OCI_ERROR. |
| 949 | */ |
| 950 | |
| 951 | /*----------------------------- OCIObjectUnmark -----------------------------*/ |
| 952 | sword OCIObjectUnmark( OCIEnv *env, OCIError *err, void *object ); |
| 953 | /* |
| 954 | NAME: OCIObjectUnmark - OCI unmarks an object |
| 955 | PARAMETERS: |
| 956 | env (IN/OUT) - OCI environment handle initialized in object mode |
| 957 | err (IN/OUT) - error handle. If there is an error, it is |
| 958 | recorded in 'err' and this function returns OCI_ERROR. |
| 959 | The error recorded in 'err' can be retrieved by |
| 960 | calling OCIErrorGet(). |
| 961 | object (IN) - pointer to the persistent object |
| 962 | REQUIRES: |
| 963 | - a valid OCI environment handle must be given. |
| 964 | - The specified object must be pinned. |
| 965 | DESCRIPTION: |
| 966 | FOR PERSISTENT OBJECTS AND TRANSIENT OBJECTS: |
| 967 | This function unmarks the specified persistent object as dirty. Changes |
| 968 | that are made to the object will not be written to the server. If the |
| 969 | object is marked locked, it remains marked locked. The changes that |
| 970 | have already made to the object will not be undone implicitly. |
| 971 | |
| 972 | FOR VALUES: |
| 973 | It is an no-op for values. |
| 974 | |
| 975 | RETURNS: |
| 976 | if environment handle or error handle is null, return |
| 977 | OCI_INVALID_HANDLE. |
| 978 | if operation suceeds, return OCI_SUCCESS. |
| 979 | if operation fails, return OCI_ERROR. |
| 980 | */ |
| 981 | |
| 982 | /*----------------------------- OCIObjectUnmarkByRef ------------------------*/ |
| 983 | sword OCIObjectUnmarkByRef( OCIEnv *env, OCIError *err, OCIRef *ref ); |
| 984 | /* |
| 985 | NAME: OCIObjectUnmarkByRef - OCI unmarks an object by Ref |
| 986 | PARAMETERS: |
| 987 | env (IN/OUT) - OCI environment handle initialized in object mode |
| 988 | err (IN/OUT) - error handle. If there is an error, it is |
| 989 | recorded in 'err' and this function returns OCI_ERROR. |
| 990 | The error recorded in 'err' can be retrieved by |
| 991 | calling OCIErrorGet(). |
| 992 | ref (IN) - reference of the object |
| 993 | REQUIRES: |
| 994 | - a valid OCI environment handle must be given. |
| 995 | - The specified object must be pinned. |
| 996 | DESCRIPTION: |
| 997 | FOR PERSISTENT OBJECTS AND TRANSIENT OBJECTS: |
| 998 | This function unmarks the specified persistent object as dirty. Changes |
| 999 | that are made to the object will not be written to the server. If the |
| 1000 | object is marked locked, it remains marked locked. The changes that |
| 1001 | have already made to the object will not be undone implicitly. |
| 1002 | |
| 1003 | FOR VALUES: |
| 1004 | It is an no-op for values. |
| 1005 | |
| 1006 | RETURNS: |
| 1007 | if environment handle or error handle is null, return |
| 1008 | OCI_INVALID_HANDLE. |
| 1009 | if operation suceeds, return OCI_SUCCESS. |
| 1010 | if operation fails, return OCI_ERROR. |
| 1011 | */ |
| 1012 | |
| 1013 | /*--------------------------- OCIObjectFree ---------------------------------*/ |
| 1014 | sword OCIObjectFree( OCIEnv *env, OCIError *err, void *instance, |
| 1015 | ub2 flags ); |
| 1016 | /* |
| 1017 | NAME: OCIObjectFree - OCI free (and unpin) an standalone instance |
| 1018 | PARAMETERS: |
| 1019 | env (IN/OUT) - OCI environment handle initialized in object mode |
| 1020 | err (IN/OUT) - error handle. If there is an error, it is |
| 1021 | recorded in 'err' and this function returns |
| 1022 | OCI_ERROR. The error recorded in 'err' can be |
| 1023 | retrieved by calling OCIErrorGet(). |
| 1024 | instance (IN) - pointer to a standalone instance. |
| 1025 | flags (IN) - If OCI_OBJECT_FREE_FORCE is set, free the object |
| 1026 | even if it is pinned or dirty. |
| 1027 | If OCI_OBJECT_FREE_NONULL is set, the null |
| 1028 | structure will not be freed. |
| 1029 | REQUIRES: |
| 1030 | - a valid OCI environment handle must be given. |
| 1031 | - The instance to be freed must be standalone. |
| 1032 | - If the instance is a referenceable object, the object must be pinned. |
| 1033 | DESCRIPTION: |
| 1034 | This function deallocates all the memory allocated for an OTS instance, |
| 1035 | including the null structure. |
| 1036 | |
| 1037 | FOR PERSISTENT OBJECTS: |
| 1038 | This function will return an error if the client is attempting to free |
| 1039 | a dirty persistent object that has not been flushed. The client should |
| 1040 | either flush the persistent object or set the parameter 'flag' to |
| 1041 | OCI_OBJECT_FREE_FORCE. |
| 1042 | |
| 1043 | This function will call OCIObjectUnpin() once to check if the object |
| 1044 | can be completely unpin. If it succeeds, the rest of the function will |
| 1045 | proceed to free the object. If it fails, then an error is returned |
| 1046 | unless the parameter 'flag' is set to OCI_OBJECT_FREE_FORCE. |
| 1047 | |
| 1048 | Freeing a persistent object in memory will not change the persistent |
| 1049 | state of that object at the server. For example, the object will |
| 1050 | remain locked after the object is freed. |
| 1051 | |
| 1052 | FOR TRANSIENT OBJECTS: |
| 1053 | |
| 1054 | This function will call OCIObjectUnpin() once to check if the object |
| 1055 | can be completely unpin. If it succeeds, the rest of the function will |
| 1056 | proceed to free the object. If it fails, then an error is returned |
| 1057 | unless the parameter 'flag' is set to OCI_OBJECT_FREE_FORCE. |
| 1058 | |
| 1059 | FOR VALUES: |
| 1060 | The memory of the object is freed immediately. |
| 1061 | |
| 1062 | RETURNS: |
| 1063 | if environment handle or error handle is null, return |
| 1064 | OCI_INVALID_HANDLE. |
| 1065 | if operation suceeds, return OCI_SUCCESS. |
| 1066 | if operation fails, return OCI_ERROR. |
| 1067 | */ |
| 1068 | |
| 1069 | /*----------------------- OCIObjectMarkDeleteByRef --------------------------*/ |
| 1070 | sword OCIObjectMarkDeleteByRef( OCIEnv *env, OCIError *err, |
| 1071 | OCIRef *object_ref); |
| 1072 | /* |
| 1073 | NAME: OCIObjectMarkDeleteByRef - OCI "delete" (and unpin) an object given |
| 1074 | a reference |
| 1075 | PARAMETERS: |
| 1076 | env (IN/OUT) - OCI environment handle initialized in object mode |
| 1077 | err (IN/OUT) - error handle. If there is an error, it is |
| 1078 | recorded in 'err' and this function returns |
| 1079 | OCI_ERROR. The error recorded in 'err' can be |
| 1080 | retrieved by calling OCIErrorGet(). |
| 1081 | object_ref (IN) - ref of the object to be deleted |
| 1082 | |
| 1083 | REQUIRES: |
| 1084 | - a valid OCI environment handle must be given. |
| 1085 | DESCRIPTION: |
| 1086 | This function marks the object designated by 'object_ref' as deleted. |
| 1087 | |
| 1088 | FOR PERSISTENT OBJECTS: |
| 1089 | If the object is not loaded, then a temporary object is created and is |
| 1090 | marked deleted. Otherwise, the object is marked deleted. |
| 1091 | |
| 1092 | The object is deleted in the server when the object is flushed. |
| 1093 | |
| 1094 | FOR TRANSIENT OBJECTS: |
| 1095 | The object is marked deleted. The object is not freed until it is |
| 1096 | unpinned. |
| 1097 | |
| 1098 | RETURNS: |
| 1099 | if environment handle or error handle is null, return |
| 1100 | OCI_INVALID_HANDLE. |
| 1101 | if operation suceeds, return OCI_SUCCESS. |
| 1102 | if operation fails, return OCI_ERROR. |
| 1103 | */ |
| 1104 | |
| 1105 | /*--------------------------- OCIObjectMarkDelete ---------------------------*/ |
| 1106 | sword OCIObjectMarkDelete( OCIEnv *env, OCIError *err, void *instance ); |
| 1107 | /* |
| 1108 | NAME: OCIObjectMarkDelete - OCI "delete" an instance given a Pointer |
| 1109 | PARAMETERS: |
| 1110 | env (IN/OUT) - OCI environment handle initialized in object mode |
| 1111 | err (IN/OUT) - error handle. If there is an error, it is |
| 1112 | recorded in 'err' and this function returns |
| 1113 | OCI_ERROR. The error recorded in 'err' can be |
| 1114 | retrieved by calling OCIErrorGet(). |
| 1115 | instance (IN) - pointer to the instance |
| 1116 | REQUIRES: |
| 1117 | - a valid OCI environment handle must be given. |
| 1118 | - The instance must be standalone. |
| 1119 | - If the instance is a referenceable object, then it must be pinned. |
| 1120 | DESCRIPTION: |
| 1121 | |
| 1122 | FOR PERSISTENT OBJECTS: |
| 1123 | The object is marked deleted. The memory of the object is not freed. |
| 1124 | The object is deleted in the server when the object is flushed. |
| 1125 | |
| 1126 | FOR TRANSIENT OBJECTS: |
| 1127 | The object is marked deleted. The memory of the object is not freed. |
| 1128 | |
| 1129 | FOR VALUES: |
| 1130 | This function frees a value immediately. |
| 1131 | |
| 1132 | RETURNS: |
| 1133 | if environment handle or error handle is null, return |
| 1134 | OCI_INVALID_HANDLE. |
| 1135 | if operation suceeds, return OCI_SUCCESS. |
| 1136 | if operation fails, return OCI_ERROR. |
| 1137 | */ |
| 1138 | |
| 1139 | /*---------------------------- OCIObjectFlush -------------------------------*/ |
| 1140 | sword OCIObjectFlush( OCIEnv *env, OCIError *err, void *object ); |
| 1141 | /* |
| 1142 | NAME: OCIObjectFlush - OCI flush a persistent object |
| 1143 | PARAMETERS: |
| 1144 | env (IN/OUT) - OCI environment handle initialized in object mode |
| 1145 | err (IN/OUT) - error handle. If there is an error, it is |
| 1146 | recorded in 'err' and this function returns |
| 1147 | OCI_ERROR. The error recorded in 'err' can be |
| 1148 | retrieved by calling OCIErrorGet(). |
| 1149 | object (IN) - pointer to the persistent object |
| 1150 | REQUIRES: |
| 1151 | - a valid OCI environment handle must be given. |
| 1152 | - The specified object must be pinned. |
| 1153 | DESCRIPTION: |
| 1154 | This function flushes a modified persistent object to the server. |
| 1155 | An exclusive lock is obtained implicitly for the object when flushed. |
| 1156 | |
| 1157 | When the object is written to the server, triggers may be fired. |
| 1158 | Objects can be modified by the triggers at the server. To keep the |
| 1159 | objects in the object cache being coherent with the database, the |
| 1160 | clients can free or refresh the objects in the cache. |
| 1161 | |
| 1162 | This function will return an error for transient objects and values. |
| 1163 | |
| 1164 | RETURNS: |
| 1165 | if environment handle or error handle is null, return |
| 1166 | OCI_INVALID_HANDLE. |
| 1167 | if operation suceeds, return OCI_SUCCESS. |
| 1168 | if operation fails, return OCI_ERROR. |
| 1169 | */ |
| 1170 | |
| 1171 | /*------------------------ OCIObjectRefresh ---------------------------------*/ |
| 1172 | sword OCIObjectRefresh( OCIEnv *env, OCIError *err, void *object ); |
| 1173 | /* |
| 1174 | NAME: OCIObjectRefresh - OCI refresh a persistent object |
| 1175 | PARAMETERS: |
| 1176 | env (IN/OUT) - OCI environment handle initialized in object mode |
| 1177 | err (IN/OUT) - error handle. If there is an error, it is |
| 1178 | recorded in 'err' and this function returns |
| 1179 | OCI_ERROR. The error recorded in 'err' can be |
| 1180 | retrieved by calling OCIErrorGet(). |
| 1181 | object (IN) - pointer to the persistent object |
| 1182 | REQUIRES: |
| 1183 | - a valid OCI environment handle must be given. |
| 1184 | - The specified object must be pinned. |
| 1185 | DESCRIPTION: |
| 1186 | This function refreshes an unmarked object with data retrieved from the |
| 1187 | latest snapshot in the server. An object should be refreshed when the |
| 1188 | objects in the cache are inconsistent with the objects at |
| 1189 | the server: |
| 1190 | 1) When an object is flushed to the server, triggers can be fired to |
| 1191 | modify more objects in the server. The same objects (modified by |
| 1192 | the triggers) in the object cache become obsolete. |
| 1193 | 2) When the user issues a SQL or executes a PL/SQL procedure to modify |
| 1194 | any object in the server, the same object in the cache becomes |
| 1195 | obsolete. |
| 1196 | |
| 1197 | The object that is refreshed will be 'replaced-in-place'. When an |
| 1198 | object is 'replaced-in-place', the top level memory of the object will |
| 1199 | be reused so that new data can be loaded into the same memory address. |
| 1200 | The top level memory of the null structre is also reused. Unlike the |
| 1201 | top level memory chunk, the secondary memory chunks may be resized and |
| 1202 | reallocated. The client should be careful when holding onto a pointer |
| 1203 | to the secondary memory chunk (e.g. assigning the address of a |
| 1204 | secondary memory to a local variable), since this pointer can become |
| 1205 | invalid after the object is refreshed. |
| 1206 | |
| 1207 | The object state will be modified as followed after being refreshed: |
| 1208 | - existent : set to appropriate value |
| 1209 | - pinned : unchanged |
| 1210 | - allocation duration : unchanged |
| 1211 | - pin duration : unchanged |
| 1212 | |
| 1213 | This function is an no-op for transient objects or values. |
| 1214 | |
| 1215 | RETURNS: |
| 1216 | if environment handle or error handle is null, return |
| 1217 | OCI_INVALID_HANDLE. |
| 1218 | if operation suceeds, return OCI_SUCCESS. |
| 1219 | if operation fails, return OCI_ERROR. |
| 1220 | */ |
| 1221 | |
| 1222 | /*---------------------------- OCIObjectCopy --------------------------------*/ |
| 1223 | sword OCIObjectCopy( OCIEnv *env, OCIError *err, const OCISvcCtx *svc, |
| 1224 | void *source, void *null_source, |
| 1225 | void *target, void *null_target, OCIType *tdo, |
| 1226 | OCIDuration duration, ub1 option ); |
| 1227 | /* |
| 1228 | NAME: OCIObjectCopy - OCI copy one instance to another |
| 1229 | PARAMETERS: |
| 1230 | env (IN/OUT) - OCI environment handle initialized in object mode |
| 1231 | err (IN/OUT) - error handle. If there is an error, it is |
| 1232 | recorded in 'err' and this function returns |
| 1233 | OCI_ERROR. The error recorded in 'err' can be |
| 1234 | retrieved by calling OCIErrorGet(). |
| 1235 | svc (IN) - OCI service context handle |
| 1236 | source (IN) - pointer to the source instance |
| 1237 | null_source (IN) - pointer to the null structure of the source |
| 1238 | target (IN) - pointer to the target instance |
| 1239 | null_target (IN) - pointer to the null structure of the target |
| 1240 | tdo (IN) - the TDO for both source and target |
| 1241 | duration (IN) - allocation duration of the target memory |
| 1242 | option (IN) - specify the copy option: |
| 1243 | OROOCOSFN - Set Reference to Null. All references |
| 1244 | in the source will not be copied to the target. The |
| 1245 | references in the target are set to null. |
| 1246 | REQUIRES: |
| 1247 | - a valid OCI environment handle must be given. |
| 1248 | - If source or target is referenceable, it must be pinned. |
| 1249 | - The target or the containing instance of the target must be already |
| 1250 | be instantiated (e.g. created by OCIObjectNew()). |
| 1251 | - The source and target instances must be of the same type. If the |
| 1252 | source and target are located in a different databases, then the |
| 1253 | same type must exist in both databases. |
| 1254 | DESCRIPTION: |
| 1255 | This function copies the contents of the 'source' instance to the |
| 1256 | 'target' instance. This function performs a deep-copy such that the |
| 1257 | data that is copied/duplicated include: |
| 1258 | a) all the top level attributes (see the exceptions below) |
| 1259 | b) all the secondary memory (of the source) that is reachable from the |
| 1260 | top level attributes. |
| 1261 | c) the null structure of the instance |
| 1262 | |
| 1263 | Memory is allocated with the specified allocation duration. |
| 1264 | |
| 1265 | Certain data items are not copied: |
| 1266 | a) If the option OCI_OBJECTCOPY_NOREF is specified, then all references |
| 1267 | in the source are not copied. Instead, the references in the target |
| 1268 | are set to null. |
| 1269 | b) If the attribute is a LOB, then it is set to null. |
| 1270 | |
| 1271 | RETURNS: |
| 1272 | if environment handle or error handle is null, return |
| 1273 | OCI_INVALID_HANDLE. |
| 1274 | if operation suceeds, return OCI_SUCCESS. |
| 1275 | if operation fails, return OCI_ERROR. |
| 1276 | */ |
| 1277 | |
| 1278 | /*---------------------------- OCIObjectGetTypeRef --------------------------*/ |
| 1279 | sword OCIObjectGetTypeRef( OCIEnv *env, OCIError *err, void *instance, |
| 1280 | OCIRef *type_ref ); |
| 1281 | /* |
| 1282 | NAME: OCIObjectGetTypeRef - get the type reference of a standalone object |
| 1283 | PARAMETERS: |
| 1284 | env (IN/OUT) - OCI environment handle initialized in object mode |
| 1285 | err (IN/OUT) - error handle. If there is an error, it is |
| 1286 | recorded in 'err' and this function returns |
| 1287 | OCI_ERROR. The error recorded in 'err' can be |
| 1288 | retrieved by calling OCIErrorGet(). |
| 1289 | instance (IN) - pointer to an standalone instance |
| 1290 | type_ref (OUT) - reference to the type of the object. The reference |
| 1291 | must already be allocated. |
| 1292 | REQUIRES: |
| 1293 | - a valid OCI environment handle must be given. |
| 1294 | - The instance must be standalone. |
| 1295 | - If the object is referenceable, the specified object must be pinned. |
| 1296 | - The reference must already be allocated. |
| 1297 | DESCRIPTION: |
| 1298 | This function returns a reference to the TDO of a standalone instance. |
| 1299 | RETURNS: |
| 1300 | if environment handle or error handle is null, return |
| 1301 | OCI_INVALID_HANDLE. |
| 1302 | if operation suceeds, return OCI_SUCCESS. |
| 1303 | if operation fails, return OCI_ERROR. |
| 1304 | */ |
| 1305 | |
| 1306 | /*--------------------------- OCIObjectGetObjectRef -------------------------*/ |
| 1307 | sword OCIObjectGetObjectRef( OCIEnv *env, OCIError *err, void *object, |
| 1308 | OCIRef *object_ref ); |
| 1309 | /* |
| 1310 | NAME: OCIObjectGetObjectRef - OCI get the object reference of an |
| 1311 | referenceable object |
| 1312 | PARAMETERS: |
| 1313 | env (IN/OUT) - OCI environment handle initialized in object mode |
| 1314 | err (IN/OUT) - error handle. If there is an error, it is |
| 1315 | recorded in 'err' and this function returns |
| 1316 | OCI_ERROR. The error recorded in 'err' can be |
| 1317 | retrieved by calling OCIErrorGet(). |
| 1318 | object (IN) - pointer to a persistent object |
| 1319 | object_ref (OUT) - reference of the given object. The reference must |
| 1320 | already be allocated. |
| 1321 | REQUIRES: |
| 1322 | - a valid OCI environment handle must be given. |
| 1323 | - The specified object must be pinned. |
| 1324 | - The reference must already be allocated. |
| 1325 | DESCRIPTION: |
| 1326 | This function returns a reference to the given object. It returns an |
| 1327 | error for values. |
| 1328 | RETURNS: |
| 1329 | if environment handle or error handle is null, return |
| 1330 | OCI_INVALID_HANDLE. |
| 1331 | if operation suceeds, return OCI_SUCCESS. |
| 1332 | if operation fails, return OCI_ERROR. |
| 1333 | */ |
| 1334 | |
| 1335 | /*--------------------------- OCIObjectMakeObjectRef -----------------------*/ |
| 1336 | sword OCIObjectMakeObjectRef( OCIEnv *env, OCIError *err, |
| 1337 | const OCISvcCtx *svc, void * table, |
| 1338 | void **values, ub4 array_len, |
| 1339 | OCIRef *object_ref ); |
| 1340 | /* |
| 1341 | NAME: OCIObjectMakeObjectRef - OCI Create an object reference to a |
| 1342 | referenceable object. |
| 1343 | PARAMETERS: |
| 1344 | env (IN/OUT) - OCI environment handle initialized in object mode |
| 1345 | err (IN/OUT) - error handle. If there is an error, it is |
| 1346 | recorded in 'err' and this function returns |
| 1347 | OCI_ERROR. The error recorded in 'err' can be |
| 1348 | retrieved by calling OCIErrorGet(). |
| 1349 | svc (IN) - the service context |
| 1350 | table (IN) - A pointer to the table object (must be pinned) |
| 1351 | attrlist (IN) - A list of values (OCI type values) from which |
| 1352 | the ref is to be created. |
| 1353 | attrcnt (IN) - The length of the attrlist array. |
| 1354 | object_ref (OUT) - reference of the given object. The reference must |
| 1355 | already be allocated. |
| 1356 | REQUIRES: |
| 1357 | - a valid OCI environment handle must be given. |
| 1358 | - The specified table object must be pinned. |
| 1359 | - The reference must already be allocated. |
| 1360 | DESCRIPTION: |
| 1361 | This function creates a reference given the values that make up the |
| 1362 | reference and also a pointer to the table object. |
| 1363 | Based on the table's OID property, whether it is a pk based OID or |
| 1364 | a system generated OID, the function creates a sys-generated REF or |
| 1365 | a pk based REF. |
| 1366 | In case of system generated REFs pass in a OCIRaw which is 16 bytes |
| 1367 | long contatining the sys generated OID. |
| 1368 | In case of PK refs pass in the OCI equivalent for numbers, chars etc.. |
| 1369 | RETURNS: |
| 1370 | if environment handle or error handle is null, return |
| 1371 | OCI_INVALID_HANDLE. |
| 1372 | if operation suceeds, return OCI_SUCCESS. |
| 1373 | if operation fails, return OCI_ERROR. |
| 1374 | */ |
| 1375 | |
| 1376 | /*--------------------------- OCIObjectGetPrimaryKeyTypeRef --------------- */ |
| 1377 | sword OCIObjectGetPrimaryKeyTypeRef( OCIEnv *env, OCIError *err, |
| 1378 | const OCISvcCtx *svc, void *table, |
| 1379 | OCIRef *type_ref ); |
| 1380 | /* |
| 1381 | NAME: OCIObjectGetPrimaryKeyTypeRef - OCI get the REF to the pk OID type |
| 1382 | PARAMETERS: |
| 1383 | env (IN/OUT) - OCI environment handle initialized in object mode |
| 1384 | err (IN/OUT) - error handle. If there is an error, it is |
| 1385 | recorded in 'err' and this function returns |
| 1386 | OCI_ERROR. The error recorded in 'err' can be |
| 1387 | retrieved by calling OCIErrorGet(). |
| 1388 | svc (IN) - the service context |
| 1389 | table (IN) - pointer to the table object |
| 1390 | type_ref (OUT) - reference of the pk type. The reference must |
| 1391 | already be allocated. |
| 1392 | REQUIRES: |
| 1393 | - a valid OCI environment handle must be given. |
| 1394 | - The specified table object must be pinned. |
| 1395 | - The reference must already be allocated. |
| 1396 | DESCRIPTION: |
| 1397 | This function returns a reference to the pk type. It returns an |
| 1398 | error for values. If the table is not a Pk oid table/view, then |
| 1399 | it returns error. |
| 1400 | RETURNS: |
| 1401 | if environment handle or error handle is null, return |
| 1402 | OCI_INVALID_HANDLE. |
| 1403 | if operation suceeds, return OCI_SUCCESS. |
| 1404 | if operation fails, return OCI_ERROR. |
| 1405 | */ |
| 1406 | |
| 1407 | /*-------------------------- OCIObjectGetInd --------------------------------*/ |
| 1408 | sword OCIObjectGetInd( OCIEnv *env, OCIError *err, void *instance, |
| 1409 | void **null_struct ); |
| 1410 | /* |
| 1411 | NAME: OCIObjectGetInd - OCI get the null structure of a standalone object |
| 1412 | PARAMETERS: |
| 1413 | env (IN/OUT) - OCI environment handle initialized in object mode |
| 1414 | err (IN/OUT) - error handle. If there is an error, it is |
| 1415 | recorded in 'err' and this function returns |
| 1416 | OCI_ERROR. The error recorded in 'err' can be |
| 1417 | retrieved by calling OCIErrorGet(). |
| 1418 | instance (IN) - pointer to the instance |
| 1419 | null_struct (OUT) - null structure |
| 1420 | REQUIRES: |
| 1421 | - a valid OCI environment handle must be given. |
| 1422 | - The object must be standalone. |
| 1423 | - If the object is referenceable, the specified object must be pinned. |
| 1424 | DESCRIPTION: |
| 1425 | This function returns the null structure of an instance. This function |
| 1426 | will allocate the top level memory of the null structure if it is not |
| 1427 | already allocated. If an null structure cannot be allocated for the |
| 1428 | instance, then an error is returned. This function only works for |
| 1429 | ADT or row type instance. |
| 1430 | RETURNS: |
| 1431 | if environment handle or error handle is null, return |
| 1432 | OCI_INVALID_HANDLE. |
| 1433 | if operation suceeds, return OCI_SUCCESS. |
| 1434 | if operation fails, return OCI_ERROR. |
| 1435 | */ |
| 1436 | |
| 1437 | /*------------------------- OCIObjectExists --------------------------------*/ |
| 1438 | sword OCIObjectExists(OCIEnv *env, OCIError *err, void *ins, boolean *exist); |
| 1439 | /* |
| 1440 | NAME: OCIObjectExist - OCI checks if the object exists |
| 1441 | PARAMETERS: |
| 1442 | env (IN/OUT) - OCI environment handle initialized in object mode |
| 1443 | err (IN/OUT) - error handle. If there is an error, it is |
| 1444 | recorded in 'err' and this function returns |
| 1445 | OCI_ERROR. The error recorded in 'err' can be |
| 1446 | retrieved by calling OCIErrorGet(). |
| 1447 | ins (IN) - pointer to an instance |
| 1448 | exist (OUT) - return TRUE if the object exists |
| 1449 | REQUIRES: |
| 1450 | - a valid OCI environment handle must be given. |
| 1451 | - The object must be standalone. |
| 1452 | - if object is a referenceable, it must be pinned. |
| 1453 | DESCRIPTION: |
| 1454 | This function returns the existence of an instance. If the instance |
| 1455 | is a value, this function always returns TRUE. |
| 1456 | RETURNS: |
| 1457 | if environment handle or error handle is null, return |
| 1458 | OCI_INVALID_HANDLE. |
| 1459 | if operation suceeds, return OCI_SUCCESS. |
| 1460 | if operation fails, return OCI_ERROR. |
| 1461 | */ |
| 1462 | |
| 1463 | /*------------------------- OCIObjectGetProperty ---------------------------*/ |
| 1464 | sword OCIObjectGetProperty(OCIEnv *envh, OCIError *errh, const void *obj, |
| 1465 | OCIObjectPropId propertyId, |
| 1466 | void *property, ub4 *size ); |
| 1467 | /* |
| 1468 | NAME: OCIObjectGetProperty - OCIObject Get Property of given object |
| 1469 | PARAMETERS: |
| 1470 | env (IN/OUT) - OCI environment handle initialized in object mode |
| 1471 | err (IN/OUT) - error handle. If there is an error, it is |
| 1472 | recorded in 'err' and this function returns |
| 1473 | OCI_ERROR. The error recorded in 'err' can be |
| 1474 | retrieved by calling OCIErrorGet(). |
| 1475 | obj (IN) - object whose property is returned |
| 1476 | propertyId (IN) - id which identifies the desired property |
| 1477 | property (OUT) - buffer into which the desired property is |
| 1478 | copied |
| 1479 | size (IN/OUT) - on input specifies the size of the property buffer |
| 1480 | passed by caller, on output will contain the |
| 1481 | size in bytes of the property returned. |
| 1482 | This parameter is required for string type |
| 1483 | properties only (e.g OCI_OBJECTPROP_SCHEMA, |
| 1484 | OCI_OBJECTPROP_TABLE). For non-string |
| 1485 | properties this parameter is ignored since |
| 1486 | the size is fixed. |
| 1487 | DESCRIPTION: |
| 1488 | This function returns the specified property of the object. |
| 1489 | The desired property is identified by 'propertyId'. The property |
| 1490 | value is copied into 'property' and for string typed properties |
| 1491 | the string size is returned via 'size'. |
| 1492 | |
| 1493 | Objects are classified as persistent, transient and value |
| 1494 | depending upon the lifetime and referenceability of the object. |
| 1495 | Some of the properties are applicable only to persistent |
| 1496 | objects and some others only apply to persistent and |
| 1497 | transient objects. An error is returned if the user tries to |
| 1498 | get a property which in not applicable to the given object. |
| 1499 | To avoid such an error, the user should first check whether |
| 1500 | the object is persistent or transient or value |
| 1501 | (OCI_OBJECTPROP_LIFETIME property) and then appropriately |
| 1502 | query for other properties. |
| 1503 | |
| 1504 | The different property ids and the corresponding type of |
| 1505 | 'property' argument is given below. |
| 1506 | |
| 1507 | OCI_OBJECTPROP_LIFETIME |
| 1508 | This identifies whether the given object is a persistent |
| 1509 | object (OCI_OBJECT_PERSISTENT) or a |
| 1510 | transient object (OCI_OBJECT_TRANSIENT) or a |
| 1511 | value instance (OCI_OBJECT_VALUE). |
| 1512 | 'property' argument must be a pointer to a variable of |
| 1513 | type OCIObjectLifetime. |
| 1514 | |
| 1515 | OCI_OBJECTPROP_SCHEMA |
| 1516 | This returns the schema name of the table in which the |
| 1517 | object exists. An error is returned if the given object |
| 1518 | points to a transient instance or a value. If the input |
| 1519 | buffer is not big enough to hold the schema name an error |
| 1520 | is returned, the error message will communicate the |
| 1521 | required size. Upon success, the size of the returned |
| 1522 | schema name in bytes is returned via 'size'. |
| 1523 | 'property' argument must be an array of type text and 'size' |
| 1524 | should be set to size of array in bytes by the caller. |
| 1525 | |
| 1526 | OCI_OBJECTPROP_TABLE |
| 1527 | This returns the table name in which the object exists. An |
| 1528 | error is returned if the given object points to a |
| 1529 | transient instance or a value. If the input buffer is not |
| 1530 | big enough to hold the table name an error is returned, |
| 1531 | the error message will communicate the required size. Upon |
| 1532 | success, the size of the returned table name in bytes is |
| 1533 | returned via 'size'. 'property' argument must be an array |
| 1534 | of type text and 'size' should be set to size of array in |
| 1535 | bytes by the caller. |
| 1536 | |
| 1537 | OCI_OBJECTPROP_PIN_DURATION |
| 1538 | This returns the pin duration of the object. |
| 1539 | An error is returned if the given object points to a value |
| 1540 | instance. Valid pin durations are: OCI_DURATION_SESSION and |
| 1541 | OCI_DURATION_TRANS. |
| 1542 | 'property' argument must be a pointer to a variable of type |
| 1543 | OCIDuration. |
| 1544 | |
| 1545 | OCI_OBJECTPROP_ALLOC_DURATION |
| 1546 | This returns the allocation duration of the object. |
| 1547 | Valid allocation durations are: OCI_DURATION_SESSION and |
| 1548 | OCI_DURATION_TRANS. |
| 1549 | 'property' argument must be a pointer to a variable of type |
| 1550 | OCIDuration. |
| 1551 | |
| 1552 | OCI_OBJECTPROP_LOCK |
| 1553 | This returns the lock status of the |
| 1554 | object. The possible lock status is enumerated by OCILockOpt. |
| 1555 | An error is returned if the given object points to a transient |
| 1556 | or value instance. |
| 1557 | 'property' argument must be a pointer to a variable of |
| 1558 | type OCILockOpt. |
| 1559 | Note, the lock status of an object can also be retrieved by |
| 1560 | calling OCIObjectIsLocked(). |
| 1561 | |
| 1562 | OCI_OBJECTPROP_MARKSTATUS |
| 1563 | This returns the status flag which indicates whether the |
| 1564 | object is a new object, updated object and/or deleted object. |
| 1565 | The following macros can be used to test the mark status |
| 1566 | flag: |
| 1567 | |
| 1568 | OCI_OBJECT_IS_UPDATED(flag) |
| 1569 | OCI_OBJECT_IS_DELETED(flag) |
| 1570 | OCI_OBJECT_IS_NEW(flag) |
| 1571 | OCI_OBJECT_IS_DIRTY(flag) |
| 1572 | |
| 1573 | An object is dirty if it is a new object or marked deleted or |
| 1574 | marked updated. |
| 1575 | An error is returned if the given object points to a transient |
| 1576 | or value instance. 'property' argument must be of type |
| 1577 | OCIObjectMarkStatus. |
| 1578 | |
| 1579 | OCI_OBJECTPROP_VIEW |
| 1580 | This identifies whether the specified object is a view object |
| 1581 | or not. If property value returned is TRUE, it indicates the |
| 1582 | object is a view otherwise it is not. |
| 1583 | 'property' argument must be of type boolean. |
| 1584 | |
| 1585 | RETURNS: |
| 1586 | if environment handle or error handle is null, return |
| 1587 | OCI_INVALID_HANDLE. |
| 1588 | if operation suceeds, return OCI_SUCCESS. |
| 1589 | if operation fails, return OCI_ERROR. Possible errors are TBD |
| 1590 | */ |
| 1591 | |
| 1592 | /*---------------------------- OCIObjectIsLocked --------------------------*/ |
| 1593 | sword OCIObjectIsLocked( OCIEnv *env, OCIError *err, void *ins, |
| 1594 | boolean *lock); |
| 1595 | /* |
| 1596 | NAME: OCIObjectIsLocked - OCI get the lock status of a standalone object |
| 1597 | PARAMETERS: |
| 1598 | env (IN/OUT) - OCI environment handle initialized in object mode |
| 1599 | err (IN/OUT) - error handle. If there is an error, it is |
| 1600 | recorded in 'err' and this function returns |
| 1601 | OCI_ERROR. The error recorded in 'err' can be |
| 1602 | retrieved by calling OCIErrorGet(). |
| 1603 | ins (IN) - pointer to an instance |
| 1604 | lock (OUT) - return value for the lock status. |
| 1605 | REQUIRES: |
| 1606 | - a valid OCI environment handle must be given. |
| 1607 | - The instance must be standalone. |
| 1608 | - If the object is referenceable, the specified object must be pinned. |
| 1609 | DESCRIPTION: |
| 1610 | This function returns the lock status of an instance. If the instance |
| 1611 | is a value, this function always returns FALSE. |
| 1612 | RETURNS: |
| 1613 | if environment handle or error handle is null, return |
| 1614 | OCI_INVALID_HANDLE. |
| 1615 | if operation suceeds, return OCI_SUCCESS. |
| 1616 | if operation fails, return OCI_ERROR. |
| 1617 | */ |
| 1618 | |
| 1619 | /*------------------------- OCIObjectIsDirty ------------------------------*/ |
| 1620 | sword OCIObjectIsDirty( OCIEnv *env, OCIError *err, void *ins, |
| 1621 | boolean *dirty); |
| 1622 | /* |
| 1623 | NAME: OCIObjectIsDirty - OCI get the dirty status of a standalone object |
| 1624 | PARAMETERS: |
| 1625 | env (IN/OUT) - OCI environment handle initialized in object mode |
| 1626 | err (IN/OUT) - error handle. If there is an error, it is |
| 1627 | recorded in 'err' and this function returns |
| 1628 | OCI_ERROR. The error recorded in 'err' can be |
| 1629 | retrieved by calling OCIErrorGet(). |
| 1630 | ins (IN) - pointer to an instance |
| 1631 | dirty (OUT) - return value for the dirty status. |
| 1632 | REQUIRES: |
| 1633 | - a valid OCI environment handle must be given. |
| 1634 | - The instance must be standalone. |
| 1635 | - if instance is an object, the instance must be pinned. |
| 1636 | DESCRIPTION: |
| 1637 | This function returns the dirty status of an instance. If the instance |
| 1638 | is a value, this function always returns FALSE. |
| 1639 | RETURNS: |
| 1640 | if environment handle or error handle is null, return |
| 1641 | OCI_INVALID_HANDLE. |
| 1642 | if operation suceeds, return OCI_SUCCESS. |
| 1643 | if operation fails, return OCI_ERROR. |
| 1644 | */ |
| 1645 | |
| 1646 | /*--------------------------- OCIObjectPinTable -----------------------------*/ |
| 1647 | sword OCIObjectPinTable( OCIEnv *env, OCIError *err, const OCISvcCtx *svc, |
| 1648 | const oratext *schema_name, |
| 1649 | ub4 s_n_length, const oratext *object_name, ub4 o_n_length, |
| 1650 | const OCIRef *scope_obj_ref, OCIDuration pin_duration, |
| 1651 | void ** object ); |
| 1652 | /* |
| 1653 | NAME: OCIObjectPinTable - OCI get table object |
| 1654 | PARAMETERS: |
| 1655 | env (IN/OUT) - OCI environment handle initialized in object mode |
| 1656 | err (IN/OUT) - error handle. If there is an error, it is |
| 1657 | recorded in 'err' and this function returns |
| 1658 | OCI_ERROR. The error recorded in 'err' can be |
| 1659 | retrieved by calling OCIErrorGet(). |
| 1660 | svc (IN) - OCI service context handle |
| 1661 | schema_name (IN, optional) - schema name of the table |
| 1662 | s_n_length (IN, optional) - length of the schema name |
| 1663 | object_name (IN) - name of the table |
| 1664 | o_n_length (IN) - length of the table name |
| 1665 | scope_obj_ref (IN, optional) - reference of the scoping object |
| 1666 | pin_duration (IN) - pin duration. See description in OCIObjectPin(). |
| 1667 | object (OUT) - the pinned table object |
| 1668 | REQUIRES: |
| 1669 | - a valid OCI environment handle must be given. |
| 1670 | DESCRIPTION: |
| 1671 | This function pin a table object with the specified pin duration. |
| 1672 | The client can unpin the object by calling OCIObjectUnpin(). See |
| 1673 | OCIObjectPin() and OCIObjectUnpin() for more information about pinning |
| 1674 | and unpinning. |
| 1675 | RETURNS: |
| 1676 | if environment handle or error handle is null, return |
| 1677 | OCI_INVALID_HANDLE. |
| 1678 | if operation suceeds, return OCI_SUCCESS. |
| 1679 | if operation fails, return OCI_ERROR. |
| 1680 | */ |
| 1681 | |
| 1682 | /*------------------------- OCIObjectArrayPin -------------------------------*/ |
| 1683 | sword OCIObjectArrayPin(OCIEnv *env, OCIError *err, OCIRef **ref_array, |
| 1684 | ub4 array_size, OCIComplexObject **cor_array, |
| 1685 | ub4 cor_array_size, OCIPinOpt pin_option, |
| 1686 | OCIDuration pin_duration, OCILockOpt lock, |
| 1687 | void **obj_array, ub4 *pos ); |
| 1688 | /* |
| 1689 | NAME: OCIObjectArrayPin - ORIO array pin |
| 1690 | PARAMETERS: |
| 1691 | env (IN/OUT) - OCI environment handle initialized in object mode |
| 1692 | err (IN/OUT) - error handle. If there is an error, it is |
| 1693 | recorded in 'err' and this function returns |
| 1694 | OCI_ERROR. The error recorded in 'err' can be |
| 1695 | retrieved by calling OCIErrorGet(). |
| 1696 | ref_array (IN) - array of references to be pinned |
| 1697 | array_size (IN) - number of elements in the array of references |
| 1698 | pin_option (IN) - pin option. See OCIObjectPin(). |
| 1699 | pin_duration (IN) - pin duration. See OCIObjectPin(). |
| 1700 | lock_option (IN) - lock option. See OCIObjectPin(). |
| 1701 | obj_array (OUT) - If this argument is not NULL, the pinned objects |
| 1702 | will be returned in the array. The user must |
| 1703 | allocate this array with element type being |
| 1704 | 'void *'. The size of this array is identical to |
| 1705 | 'array'. |
| 1706 | pos (OUT) - If there is an error, this argument will contain |
| 1707 | the element that is causing the error. Note that |
| 1708 | this argument is set to 1 for the first element in |
| 1709 | the ref_array. |
| 1710 | REQUIRE: |
| 1711 | - a valid OCI environment handle must be given. |
| 1712 | - If 'obj_array' is not NULL, then it must already be allocated and |
| 1713 | the size of 'obj_array' is 'array_size'. |
| 1714 | DESCRIPTION: |
| 1715 | This function pin an array of references. All the pinned objects are |
| 1716 | retrieved from the database in one network roundtrip. If the user |
| 1717 | specifies an output array ('obj_array'), then the address of the |
| 1718 | pinned objects will be assigned to the elements in the array. See |
| 1719 | OCIObjectPin() for more information about pinning. |
| 1720 | RETURNS: |
| 1721 | if environment handle or error handle is null, return |
| 1722 | OCI_INVALID_HANDLE. |
| 1723 | if operation suceeds, return OCI_SUCCESS. |
| 1724 | if operation fails, return OCI_ERROR. |
| 1725 | */ |
| 1726 | |
| 1727 | /*---------------------------------------------------------------------------*/ |
| 1728 | /* HEAP/CACHE OPERATIONS */ |
| 1729 | /*---------------------------------------------------------------------------*/ |
| 1730 | |
| 1731 | /*--------------------------- OCICacheFlush ---------------------------------*/ |
| 1732 | sword OCICacheFlush( OCIEnv *env, OCIError *err, const OCISvcCtx *svc, |
| 1733 | void *context, OCIRef *(*get)(void *context, ub1 *last), |
| 1734 | OCIRef **ref ); |
| 1735 | /* |
| 1736 | NAME: OCICacheFlush - OCI flush persistent objects |
| 1737 | PARAMETERS: |
| 1738 | env (IN/OUT) - OCI environment handle initialized in object mode |
| 1739 | err (IN/OUT) - error handle. If there is an error, it is |
| 1740 | recorded in 'err' and this function returns |
| 1741 | OCI_ERROR. The error recorded in 'err' can be |
| 1742 | retrieved by calling OCIErrorGet(). |
| 1743 | svc (IN) [optional] - OCI service context. If null pointer is |
| 1744 | specified, then the dirty objects in all connections |
| 1745 | will be flushed. |
| 1746 | context (IN) [optional] - specifies an user context that is an |
| 1747 | argument to the client callback function 'get'. This |
| 1748 | parameter is set to NULL if there is no user context. |
| 1749 | get (IN) [optional] - an client-defined function which acts an |
| 1750 | iterator to retrieve a batch of dirty objects that need |
| 1751 | to be flushed. If the function is not NULL, this function |
| 1752 | will be called to get a reference of a dirty object. |
| 1753 | This is repeated until a null reference is returned by |
| 1754 | the client function or the parameter 'last' is set to |
| 1755 | TRUE. The parameter 'context' is passed to get() |
| 1756 | for each invocation of the client function. This |
| 1757 | parameter should be NULL if user callback is not given. |
| 1758 | If the object that is returned by the client function is |
| 1759 | not a dirtied persistent object, the object is ignored. |
| 1760 | All the objects that are returned from the client |
| 1761 | function must be from newed or pinned the same service |
| 1762 | context, otherwise, an error is signalled. Note that the |
| 1763 | returned objects are flushed in the order in which they |
| 1764 | are marked dirty. |
| 1765 | ref (OUT) [optional] - if there is an error in flushing the |
| 1766 | objects, (*ref) will point to the object that |
| 1767 | is causing the error. If 'ref' is NULL, then the object |
| 1768 | will not be returned. If '*ref' is NULL, then a |
| 1769 | reference will be allocated and set to point to the |
| 1770 | object. If '*ref' is not NULL, then the reference of |
| 1771 | the object is copied into the given space. If the |
| 1772 | error is not caused by any of the dirtied object, |
| 1773 | the given ref is initalized to be a NULL reference |
| 1774 | (OCIRefIsNull(*ref) is TRUE). |
| 1775 | REQUIRES: |
| 1776 | - a valid OCI environment handle must be given. |
| 1777 | DESCRIPTION: |
| 1778 | This function flushes the modified persistent objects from the |
| 1779 | environment heap to the server. The objects are flushed in the order |
| 1780 | that they are marked updated or deleted. |
| 1781 | |
| 1782 | See OCIObjectFlush() for more information about flushing. |
| 1783 | |
| 1784 | RETURNS: |
| 1785 | if environment handle or error handle is null, return |
| 1786 | OCI_INVALID_HANDLE. |
| 1787 | if operation suceeds, return OCI_SUCCESS. |
| 1788 | if operation fails, return OCI_ERROR. |
| 1789 | */ |
| 1790 | |
| 1791 | /*--------------------------- OCICacheRefresh -------------------------------*/ |
| 1792 | sword OCICacheRefresh(OCIEnv *env, OCIError *err, const OCISvcCtx *svc, |
| 1793 | OCIRefreshOpt option, void *context, |
| 1794 | OCIRef *(*get)(void *context), OCIRef **ref); |
| 1795 | /* |
| 1796 | NAME: OCICacheRefresh - OCI ReFreSh persistent objects |
| 1797 | PARAMETERS: |
| 1798 | env (IN/OUT) - OCI environment handle initialized in object mode |
| 1799 | err (IN/OUT) - error handle. If there is an error, it is |
| 1800 | recorded in 'err' and this function returns |
| 1801 | OCI_ERROR. The error recorded in 'err' can be |
| 1802 | retrieved by calling OCIErrorGet(). |
| 1803 | svc (IN) [optional] - OCI service context. If null pointer is |
| 1804 | specified, then the persistent objects in all connections |
| 1805 | will be refreshed. |
| 1806 | option (IN) [optional] - if OCI_REFRESH_LOAD is specified, all |
| 1807 | objects that is loaded within the transaction are |
| 1808 | refreshed. If the option is OCI_REFERSH_LOAD and the |
| 1809 | parameter 'get' is not NULL, this function will ignore |
| 1810 | the parameter. |
| 1811 | context (IN) [optional] - specifies an user context that is an |
| 1812 | argument to the client callback function 'get'. This |
| 1813 | parameter is set to NULL if there is no user context. |
| 1814 | get (IN) [optional] - an client-defined function which acts an |
| 1815 | iterator to retrieve a batch of objects that need to be |
| 1816 | refreshed. If the function is not NULL, this function |
| 1817 | will be called to get a reference of an object. If |
| 1818 | the reference is not NULL, then the object will be |
| 1819 | refreshed. These steps are repeated until a null |
| 1820 | reference is returned by this function. The parameter |
| 1821 | 'context' is passed to get() for each invocation of the |
| 1822 | client function. This parameter should be NULL if user |
| 1823 | callback is not given. |
| 1824 | ref (OUT) [optional] - if there is an error in refreshing the |
| 1825 | objects, (*ref) will point to the object that |
| 1826 | is causing the error. If 'ref' is NULL, then the object |
| 1827 | will not be returned. If '*ref' is NULL, then a |
| 1828 | reference will be allocated and set to point to the |
| 1829 | object. If '*ref' is not NULL, then the reference of |
| 1830 | the object is copied into the given space. If the |
| 1831 | error is not caused by any of the object, |
| 1832 | the given ref is initalized to be a NULL reference |
| 1833 | (OCIRefIsNull(*ref) is TRUE). |
| 1834 | REQUIRES: |
| 1835 | - a valid OCI environment handle must be given. |
| 1836 | DESCRIPTION: |
| 1837 | This function refreshes all pinned persistent objects. All unpinned |
| 1838 | persistent objects are freed. See OCIObjectRefresh() for more |
| 1839 | information about refreshing. |
| 1840 | RETURNS: |
| 1841 | if environment handle or error handle is null, return |
| 1842 | OCI_INVALID_HANDLE. |
| 1843 | if operation suceeds, return OCI_SUCCESS. |
| 1844 | if operation fails, return OCI_ERROR. |
| 1845 | */ |
| 1846 | |
| 1847 | /*---------------------------- OCICacheUnpin --------------------------------*/ |
| 1848 | sword OCICacheUnpin( OCIEnv *env, OCIError *err, const OCISvcCtx *svc ); |
| 1849 | /* |
| 1850 | NAME: OCICacheUnpin - OCI UNPin objects |
| 1851 | PARAMETERS: |
| 1852 | env (IN/OUT) - OCI environment handle initialized in object mode |
| 1853 | err (IN/OUT) - error handle. If there is an error, it is |
| 1854 | recorded in 'err' and this function returns |
| 1855 | OCI_ERROR. The error recorded in 'err' can be |
| 1856 | retrieved by calling OCIErrorGet(). |
| 1857 | svc (IN) [optional] - OCI service context. If null pointer is |
| 1858 | specified, then the objects in all connections |
| 1859 | will be unpinned. |
| 1860 | REQUIRES: |
| 1861 | - a valid OCI environment handle must be given. |
| 1862 | DESCRIPTION: |
| 1863 | If a connection is specified, this function completely unpins the |
| 1864 | persistent objects in that connection. Otherwise, all persistent |
| 1865 | objects in the heap are completely unpinned. All transient objects in |
| 1866 | the heap are also completely unpinned. See OCIObjectUnpin() for more |
| 1867 | information about unpinning. |
| 1868 | RETURNS: |
| 1869 | if environment handle or error handle is null, return |
| 1870 | OCI_INVALID_HANDLE. |
| 1871 | if operation suceeds, return OCI_SUCCESS. |
| 1872 | if operation fails, return OCI_ERROR. |
| 1873 | */ |
| 1874 | |
| 1875 | /*----------------------------- OCICacheFree --------------------------------*/ |
| 1876 | sword OCICacheFree( OCIEnv *env, OCIError *err, const OCISvcCtx *svc ); |
| 1877 | /* |
| 1878 | NAME: OCICacheFree - OCI FREe instances |
| 1879 | PARAMETERS: |
| 1880 | env (IN/OUT) - OCI environment handle initialized in object mode |
| 1881 | err (IN/OUT) - error handle. If there is an error, it is |
| 1882 | recorded in 'err' and this function returns |
| 1883 | OCI_ERROR. The error recorded in 'err' can be |
| 1884 | retrieved by calling OCIErrorGet(). |
| 1885 | svc (IN) [optional] - OCI service context. If null pointer is |
| 1886 | specified, then the objects in all connections |
| 1887 | will be freed. |
| 1888 | REQUIRES: |
| 1889 | - a valid OCI environment handle must be given. |
| 1890 | DESCRIPTION: |
| 1891 | If a connection is specified, this function frees the persistent |
| 1892 | objects, transient objects and values allocated for that connection. |
| 1893 | Otherwise, all persistent objects, transient objects and values in the |
| 1894 | heap are freed. Objects are freed regardless of their pin count. See |
| 1895 | OCIObjectFree() for more information about freeing an instance. |
| 1896 | RETURNS: |
| 1897 | if environment handle or error handle is null, return |
| 1898 | OCI_INVALID_HANDLE. |
| 1899 | if operation suceeds, return OCI_SUCCESS. |
| 1900 | if operation fails, return OCI_ERROR. |
| 1901 | */ |
| 1902 | |
| 1903 | /*---------------------------- OCICacheUnmark -------------------------------*/ |
| 1904 | sword OCICacheUnmark( OCIEnv *env, OCIError *err, const OCISvcCtx *svc ); |
| 1905 | /* |
| 1906 | NAME: OCICacheUnmark - OCI Unmark all dirty objects |
| 1907 | PARAMETERS: |
| 1908 | env (IN/OUT) - OCI environment handle initialized in object mode |
| 1909 | err (IN/OUT) - error handle. If there is an error, it is |
| 1910 | recorded in 'err' and this function returns |
| 1911 | OCI_ERROR. The error recorded in 'err' can be |
| 1912 | retrieved by calling OCIErrorGet(). |
| 1913 | svc (IN) [optional] - OCI service context. If null pointer is |
| 1914 | specified, then the objects in all connections |
| 1915 | will be unmarked. |
| 1916 | REQUIRES: |
| 1917 | - a valid OCI environment handle must be given. |
| 1918 | DESCRIPTION: |
| 1919 | If a connection is specified, this function unmarks all dirty objects |
| 1920 | in that connection. Otherwise, all dirty objects in the cache are |
| 1921 | unmarked. See OCIObjectUnmark() for more information about unmarking |
| 1922 | an object. |
| 1923 | RETURNS: |
| 1924 | if environment handle or error handle is null, return |
| 1925 | OCI_INVALID_HANDLE. |
| 1926 | if operation suceeds, return OCI_SUCCESS. |
| 1927 | if operation fails, return OCI_ERROR. |
| 1928 | */ |
| 1929 | |
| 1930 | |
| 1931 | sword OCIDurationBegin( OCIEnv *env, OCIError *err, const OCISvcCtx *svc, |
| 1932 | OCIDuration parent, OCIDuration *dur ); |
| 1933 | /* |
| 1934 | NAME: OCIDurationBegin - OCI DURATION BEGIN |
| 1935 | PARAMETERS: |
| 1936 | env (IN/OUT) - OCI environment handle initialized in object mode |
| 1937 | This should be passed NULL, when cartridge services |
| 1938 | are to be used. |
| 1939 | err (IN/OUT) - error handle. If there is an error, it is |
| 1940 | recorded in 'err' and this function returns OCI_ERROR. |
| 1941 | The error recorded in 'err' can be retrieved by calling |
| 1942 | OCIErrorGet(). |
| 1943 | svc (IN/OUT) - OCI service handle. |
| 1944 | parent (IN) - parent for the duration to be started. |
| 1945 | dur (OUT) - newly created user duration |
| 1946 | REQUIRES: |
| 1947 | - a valid OCI environment handle must be given for non-cartridge |
| 1948 | services. |
| 1949 | - For cartridge services, NULL should be given for environment handle |
| 1950 | - A valid service handle must be given in all cases. |
| 1951 | DESCRIPTION: |
| 1952 | This function starts a new user duration. A user can have multiple |
| 1953 | active user durations simultaneously. The user durations do not have |
| 1954 | to be nested. |
| 1955 | |
| 1956 | The object subsystem predefines 3 durations : |
| 1957 | 1) session - memory allocated with session duration comes from |
| 1958 | the UGA heap (OCI_DURATION_SESSION). A session |
| 1959 | duration terminates at the end of the user session. |
| 1960 | 2) transaction - memory allocated with transaction duration comes |
| 1961 | from the UGA heap (OCI_DURATION_TRANS). A trans- |
| 1962 | action duration terminates at the end of the user |
| 1963 | transaction. |
| 1964 | 3) call - memory allocated with call duration comes from PGA |
| 1965 | heap (OCI_DURATION_CALL). A call duration terminates |
| 1966 | at the end of the user call. |
| 1967 | |
| 1968 | Each user duration has a parent duration. A parent duration can be a |
| 1969 | predefined duration or another user duration. The relationship between |
| 1970 | a user duration and its parent duration (child duration) are: |
| 1971 | |
| 1972 | 1) An user duration is nested within the parent duration. When its |
| 1973 | parent duration terminates, the user duration will also terminate. |
| 1974 | 2) The memory allocated with an user duration comes from the heap of |
| 1975 | its parent duration. For example, if the parent duration of an |
| 1976 | user duration is call, then the memory allocated with the user |
| 1977 | duration will also come from the PGA heap. |
| 1978 | |
| 1979 | This function can be used as both part of cartridge services as well |
| 1980 | as without cartridge services. |
| 1981 | The difference in the function in the case of cartridge and |
| 1982 | non-cartridge services is: |
| 1983 | In case of cartridge services, as descibed above a new user |
| 1984 | duration is created as a child of the "parent" duration. |
| 1985 | But when used for non-cartridge purposes, when a pre-defined |
| 1986 | duration is passed in as parent, it is mapped to the cache duration |
| 1987 | for that connection (which is created if not already present) and |
| 1988 | the new user duration will be child of the cache duration. |
| 1989 | |
| 1990 | RETURNS: |
| 1991 | if environment handle and service handle is null or if error |
| 1992 | handle is null return OCI_INVALID_HANDLE. |
| 1993 | if operation suceeds, return OCI_SUCCESS. |
| 1994 | if operation fails, return OCI_ERROR. |
| 1995 | */ |
| 1996 | |
| 1997 | |
| 1998 | sword OCIDurationEnd( OCIEnv *env, OCIError *err, const OCISvcCtx *svc, |
| 1999 | OCIDuration duration ); |
| 2000 | /* |
| 2001 | NAME: OCIDurationEnd - OCI DURATION END |
| 2002 | PARAMETERS: |
| 2003 | env (IN/OUT) - OCI environment handle initialized in object mode |
| 2004 | This should be passed NULL, when cartridge services |
| 2005 | are to be used. |
| 2006 | err (IN/OUT) - error handle. If there is an error, it is |
| 2007 | recorded in 'err' and this function returns OCI_ERROR. |
| 2008 | The error recorded in 'err' can be retrieved by calling |
| 2009 | OCIErrorGet(). |
| 2010 | svc (IN/OUT) - OCI service handle. |
| 2011 | dur (OUT) - a previously created user duration using |
| 2012 | OCIDurationBegin() |
| 2013 | REQUIRES: |
| 2014 | - a valid OCI environment handle must be given for non-cartridge |
| 2015 | services. |
| 2016 | - For cartridge services, NULL should be given for environment handle |
| 2017 | - A valid service handle must be given in all cases. |
| 2018 | DESCRIPTION: |
| 2019 | This function terminates a user duration. All memory allocated for |
| 2020 | this duration is freed. |
| 2021 | |
| 2022 | This function can be used as both part of cartridge services as well |
| 2023 | as without cartridge services. In both cased, the heap duration |
| 2024 | is freed and all the allocated memory for that duration is freed. |
| 2025 | The difference in the function in the case of cartridge and |
| 2026 | non-cartridge services is: |
| 2027 | In case of non-cartridge services, if the duration is pre- |
| 2028 | defined, the associated cache duration (see OCIDurationBegin()) |
| 2029 | is also terminated and the following is done. |
| 2030 | 1) The child durations are terminated. |
| 2031 | 2) All objects pinned for this duration are unpinned. |
| 2032 | 3) All instances allocated for this duration are freed. |
| 2033 | |
| 2034 | In case of cartridge services, only the heap duration is |
| 2035 | freed. All the context entries allocated for that duration are |
| 2036 | freed from the context hash table.. |
| 2037 | |
| 2038 | RETURNS: |
| 2039 | if environment handle and service handle is null or if error |
| 2040 | handle is null return OCI_INVALID_HANDLE. |
| 2041 | if operation suceeds, return OCI_SUCCESS. |
| 2042 | if operation fails, return OCI_ERROR. |
| 2043 | */ |
| 2044 | |
| 2045 | /****************************************************************************** |
| 2046 | ** DO NOT USE THE FUNCTIONS BELOW! ** |
| 2047 | ** UNSUPPORTED INTERFACE ** |
| 2048 | ** WILL BE REMOVED/CHANGED IN A FUTURE RELEASE ** |
| 2049 | ******************************************************************************/ |
| 2050 | |
| 2051 | sword OCIDurationGetParent( OCIEnv *env, OCIError *err, |
| 2052 | OCIDuration duration, OCIDuration *parent ); |
| 2053 | |
| 2054 | sword OCIObjectAlwaysLatest( OCIEnv *env, OCIError *err, void *object ); |
| 2055 | |
| 2056 | sword OCIObjectNotAlwaysLatest( OCIEnv *env, OCIError *err, |
| 2057 | void *object ); |
| 2058 | |
| 2059 | sword OCIObjectFlushRefresh( OCIEnv *env, OCIError *err, void *object); |
| 2060 | |
| 2061 | sword OCIObjectIsLoaded( OCIEnv *env, OCIError *err, void *ins, |
| 2062 | boolean *load); |
| 2063 | |
| 2064 | sword OCIObjectIsDirtied( OCIEnv *env, OCIError *err, void *ins, |
| 2065 | boolean *dirty); |
| 2066 | |
| 2067 | sword OCICacheGetObjects( OCIEnv *env, OCIError *err, |
| 2068 | const OCISvcCtx *svc, |
| 2069 | OCIObjectProperty property, |
| 2070 | void *client_context, |
| 2071 | void (*client_callback)( |
| 2072 | void *client_context, |
| 2073 | void *object )); |
| 2074 | |
| 2075 | sword OCICacheRegister( OCIEnv *env, OCIError *err, |
| 2076 | OCIObjectEvent event, |
| 2077 | void *client_context, |
| 2078 | void (*client_callback)( |
| 2079 | void *client_context, |
| 2080 | OCIObjectEvent event, |
| 2081 | void *object)); |
| 2082 | |
| 2083 | sword OCICacheFlushRefresh( OCIEnv *env, OCIError *err, |
| 2084 | const OCISvcCtx *svc, void *context, |
| 2085 | OCIRef *(*get)(void *context, ub1 *last), |
| 2086 | OCIRef **ref ); |
| 2087 | |
| 2088 | sword OCIObjectSetData(OCIEnv *env, OCIError *err, void *obj_hdr, |
| 2089 | void *data); |
| 2090 | |
| 2091 | sword OCIObjectGetNewOID(OCIEnv *env, OCIError *err, OCISvcCtx *svc, |
| 2092 | ub1 *oid); |
| 2093 | |
| 2094 | |
| 2095 | #endif /* ORI_ORACLE */ |