oracledb 3.0.0 → 3.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. package/CHANGELOG.md +135 -8
  2. package/README.md +6 -4
  3. package/build/Release/oracledb-abi48-darwin-x64.node +0 -0
  4. package/build/Release/oracledb-abi48-darwin-x64.node-buildinfo.txt +1 -0
  5. package/build/Release/oracledb-abi48-linux-x64.node +0 -0
  6. package/build/Release/oracledb-abi48-linux-x64.node-buildinfo.txt +1 -0
  7. package/build/Release/oracledb-abi48-win32-x64.node +0 -0
  8. package/build/Release/oracledb-abi48-win32-x64.node-buildinfo.txt +1 -0
  9. package/build/Release/oracledb-abi57-darwin-x64.node +0 -0
  10. package/build/Release/oracledb-abi57-darwin-x64.node-buildinfo.txt +1 -0
  11. package/build/Release/oracledb-abi57-linux-x64.node +0 -0
  12. package/build/Release/oracledb-abi57-linux-x64.node-buildinfo.txt +1 -0
  13. package/build/Release/oracledb-abi57-win32-x64.node +0 -0
  14. package/build/Release/oracledb-abi57-win32-x64.node-buildinfo.txt +1 -0
  15. package/build/Release/oracledb-abi64-darwin-x64.node +0 -0
  16. package/build/Release/oracledb-abi64-darwin-x64.node-buildinfo.txt +1 -0
  17. package/build/Release/oracledb-abi64-linux-x64.node +0 -0
  18. package/build/Release/oracledb-abi64-linux-x64.node-buildinfo.txt +1 -0
  19. package/build/Release/oracledb-abi64-win32-x64.node +0 -0
  20. package/build/Release/oracledb-abi64-win32-x64.node-buildinfo.txt +1 -0
  21. package/build/Release/oracledb-abi67-darwin-x64.node +0 -0
  22. package/build/Release/oracledb-abi67-darwin-x64.node-buildinfo.txt +1 -0
  23. package/build/Release/oracledb-abi67-linux-x64.node +0 -0
  24. package/build/Release/oracledb-abi67-linux-x64.node-buildinfo.txt +1 -0
  25. package/build/Release/oracledb-abi67-win32-x64.node +0 -0
  26. package/build/Release/oracledb-abi67-win32-x64.node-buildinfo.txt +1 -0
  27. package/lib/connection.js +18 -4
  28. package/lib/oracledb.js +44 -92
  29. package/lib/pool.js +36 -2
  30. package/lib/sodaCollection.js +1 -1
  31. package/lib/sodaDatabase.js +1 -1
  32. package/lib/util.js +82 -5
  33. package/package/README.md +32 -101
  34. package/package/install.js +139 -0
  35. package/package/prunebinaries.js +51 -0
  36. package/package.json +4 -11
  37. package/binding.gyp +0 -162
  38. package/lib/rel.txt +0 -1
  39. package/odpi/.npmignore +0 -4
  40. package/odpi/LICENSE.md +0 -218
  41. package/odpi/README.md +0 -61
  42. package/odpi/embed/README.md +0 -4
  43. package/odpi/embed/dpi.c +0 -50
  44. package/odpi/include/dpi.h +0 -1748
  45. package/odpi/src/dpiConn.c +0 -2089
  46. package/odpi/src/dpiContext.c +0 -296
  47. package/odpi/src/dpiData.c +0 -797
  48. package/odpi/src/dpiDebug.c +0 -184
  49. package/odpi/src/dpiDeqOptions.c +0 -370
  50. package/odpi/src/dpiEnqOptions.c +0 -174
  51. package/odpi/src/dpiEnv.c +0 -189
  52. package/odpi/src/dpiError.c +0 -204
  53. package/odpi/src/dpiErrorMessages.h +0 -86
  54. package/odpi/src/dpiGen.c +0 -303
  55. package/odpi/src/dpiGlobal.c +0 -292
  56. package/odpi/src/dpiHandleList.c +0 -117
  57. package/odpi/src/dpiHandlePool.c +0 -118
  58. package/odpi/src/dpiImpl.h +0 -1707
  59. package/odpi/src/dpiLob.c +0 -506
  60. package/odpi/src/dpiMsgProps.c +0 -386
  61. package/odpi/src/dpiObject.c +0 -897
  62. package/odpi/src/dpiObjectAttr.c +0 -115
  63. package/odpi/src/dpiObjectType.c +0 -326
  64. package/odpi/src/dpiOci.c +0 -3527
  65. package/odpi/src/dpiOracleType.c +0 -492
  66. package/odpi/src/dpiPool.c +0 -549
  67. package/odpi/src/dpiRowid.c +0 -136
  68. package/odpi/src/dpiSodaColl.c +0 -685
  69. package/odpi/src/dpiSodaCollCursor.c +0 -143
  70. package/odpi/src/dpiSodaDb.c +0 -432
  71. package/odpi/src/dpiSodaDoc.c +0 -230
  72. package/odpi/src/dpiSodaDocCursor.c +0 -143
  73. package/odpi/src/dpiStmt.c +0 -1797
  74. package/odpi/src/dpiSubscr.c +0 -674
  75. package/odpi/src/dpiUtils.c +0 -410
  76. package/odpi/src/dpiVar.c +0 -1794
  77. package/package/MAKEPKG.BAT +0 -156
  78. package/package/Makefile +0 -85
  79. package/package/createpackage.js +0 -186
  80. package/package/extractpackage.js +0 -76
  81. package/package/getversion.js +0 -37
  82. package/package/oracledbinstall.js +0 -497
  83. package/package/package.json +0 -54
  84. package/package/util.js +0 -286
  85. package/src/njsCommon.cpp +0 -1055
  86. package/src/njsCommon.h +0 -484
  87. package/src/njsConnection.cpp +0 -2926
  88. package/src/njsConnection.h +0 -227
  89. package/src/njsIntLob.cpp +0 -618
  90. package/src/njsIntLob.h +0 -179
  91. package/src/njsMessages.cpp +0 -122
  92. package/src/njsMessages.h +0 -118
  93. package/src/njsOracle.cpp +0 -1274
  94. package/src/njsOracle.h +0 -237
  95. package/src/njsPool.cpp +0 -482
  96. package/src/njsPool.h +0 -132
  97. package/src/njsResultSet.cpp +0 -478
  98. package/src/njsResultSet.h +0 -120
  99. package/src/njsSodaCollection.cpp +0 -507
  100. package/src/njsSodaCollection.h +0 -128
  101. package/src/njsSodaDatabase.cpp +0 -335
  102. package/src/njsSodaDatabase.h +0 -108
  103. package/src/njsSodaDocCursor.cpp +0 -203
  104. package/src/njsSodaDocCursor.h +0 -94
  105. package/src/njsSodaDocument.cpp +0 -412
  106. package/src/njsSodaDocument.h +0 -105
  107. package/src/njsSodaOperation.cpp +0 -557
  108. package/src/njsSodaOperation.h +0 -123
  109. package/src/njsSubscription.cpp +0 -388
  110. package/src/njsSubscription.h +0 -111
  111. package/src/njsUtils.cpp +0 -158
  112. package/src/njsUtils.h +0 -68
package/odpi/src/dpiLob.c DELETED
@@ -1,506 +0,0 @@
1
- //-----------------------------------------------------------------------------
2
- // Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
3
- // This program is free software: you can modify it and/or redistribute it
4
- // under the terms of:
5
- //
6
- // (i) the Universal Permissive License v 1.0 or at your option, any
7
- // later version (http://oss.oracle.com/licenses/upl); and/or
8
- //
9
- // (ii) the Apache License v 2.0. (http://www.apache.org/licenses/LICENSE-2.0)
10
- //-----------------------------------------------------------------------------
11
-
12
- //-----------------------------------------------------------------------------
13
- // dpiLob.c
14
- // Implementation of LOB data.
15
- //-----------------------------------------------------------------------------
16
-
17
- #include "dpiImpl.h"
18
-
19
- //-----------------------------------------------------------------------------
20
- // dpiLob__allocate() [INTERNAL]
21
- // Allocate and initialize LOB object.
22
- //-----------------------------------------------------------------------------
23
- int dpiLob__allocate(dpiConn *conn, const dpiOracleType *type, dpiLob **lob,
24
- dpiError *error)
25
- {
26
- dpiLob *tempLob;
27
-
28
- if (dpiGen__allocate(DPI_HTYPE_LOB, conn->env, (void**) &tempLob,
29
- error) < 0)
30
- return DPI_FAILURE;
31
- dpiGen__setRefCount(conn, error, 1);
32
- tempLob->conn = conn;
33
- tempLob->type = type;
34
- if (dpiOci__descriptorAlloc(conn->env->handle, &tempLob->locator,
35
- DPI_OCI_DTYPE_LOB, "allocate descriptor", error) < 0) {
36
- dpiLob__free(tempLob, error);
37
- return DPI_FAILURE;
38
- }
39
- if (dpiHandleList__addHandle(conn->openLobs, tempLob,
40
- &tempLob->openSlotNum, error) < 0) {
41
- dpiOci__descriptorFree(tempLob->locator, DPI_OCI_DTYPE_LOB);
42
- tempLob->locator = NULL;
43
- dpiLob__free(tempLob, error);
44
- return DPI_FAILURE;
45
- }
46
-
47
- *lob = tempLob;
48
- return DPI_SUCCESS;
49
- }
50
-
51
-
52
- //-----------------------------------------------------------------------------
53
- // dpiLob__check() [INTERNAL]
54
- // Check that the LOB is valid and get an error handle for subsequent calls.
55
- //-----------------------------------------------------------------------------
56
- static int dpiLob__check(dpiLob *lob, const char *fnName, int needErrorHandle,
57
- dpiError *error)
58
- {
59
- if (dpiGen__startPublicFn(lob, DPI_HTYPE_LOB, fnName, 1, error) < 0)
60
- return DPI_FAILURE;
61
- if (!lob->locator)
62
- return dpiError__set(error, "check closed", DPI_ERR_LOB_CLOSED);
63
- return dpiConn__checkConnected(lob->conn, error);
64
- }
65
-
66
-
67
- //-----------------------------------------------------------------------------
68
- // dpiLob__close() [INTERNAL]
69
- // Internal method used for closing the LOB.
70
- //-----------------------------------------------------------------------------
71
- int dpiLob__close(dpiLob *lob, int propagateErrors, dpiError *error)
72
- {
73
- int isTemporary, closing, status = DPI_SUCCESS;
74
-
75
- // determine whether LOB is already being closed and if not, mark LOB as
76
- // being closed; this MUST be done while holding the lock (if in threaded
77
- // mode) to avoid race conditions!
78
- if (lob->env->threaded)
79
- dpiMutex__acquire(lob->env->mutex);
80
- closing = lob->closing;
81
- lob->closing = 1;
82
- if (lob->env->threaded)
83
- dpiMutex__release(lob->env->mutex);
84
-
85
- // if LOB is already being closed, nothing needs to be done
86
- if (closing)
87
- return DPI_SUCCESS;
88
-
89
- // perform actual work of closing LOB
90
- if (lob->locator) {
91
- if (!lob->conn->deadSession && lob->conn->handle) {
92
- status = dpiOci__lobIsTemporary(lob, &isTemporary, propagateErrors,
93
- error);
94
- if (isTemporary && status == DPI_SUCCESS)
95
- status = dpiOci__lobFreeTemporary(lob->conn,
96
- lob->locator, propagateErrors, error);
97
- }
98
- dpiOci__descriptorFree(lob->locator, DPI_OCI_DTYPE_LOB);
99
- if (!lob->conn->closing)
100
- dpiHandleList__removeHandle(lob->conn->openLobs, lob->openSlotNum);
101
- lob->locator = NULL;
102
- }
103
- if (lob->buffer) {
104
- dpiUtils__freeMemory(lob->buffer);
105
- lob->buffer = NULL;
106
- }
107
-
108
- // if actual close fails, reset closing flag; again, this must be done
109
- // while holding the lock (if in threaded mode) in order to avoid race
110
- // conditions!
111
- if (status < 0) {
112
- if (lob->env->threaded)
113
- dpiMutex__acquire(lob->env->mutex);
114
- lob->closing = 0;
115
- if (lob->env->threaded)
116
- dpiMutex__release(lob->env->mutex);
117
- }
118
-
119
- return status;
120
- }
121
-
122
-
123
- //-----------------------------------------------------------------------------
124
- // dpiLob__free() [INTERNAL]
125
- // Free the memory for a LOB.
126
- //-----------------------------------------------------------------------------
127
- void dpiLob__free(dpiLob *lob, dpiError *error)
128
- {
129
- dpiLob__close(lob, 0, error);
130
- if (lob->conn) {
131
- dpiGen__setRefCount(lob->conn, error, -1);
132
- lob->conn = NULL;
133
- }
134
- dpiUtils__freeMemory(lob);
135
- }
136
-
137
-
138
- //-----------------------------------------------------------------------------
139
- // dpiLob__readBytes() [INTERNAL]
140
- // Return a portion (or all) of the data in the LOB.
141
- //-----------------------------------------------------------------------------
142
- int dpiLob__readBytes(dpiLob *lob, uint64_t offset, uint64_t amount,
143
- char *value, uint64_t *valueLength, dpiError *error)
144
- {
145
- uint64_t lengthInBytes = 0, lengthInChars = 0;
146
- int isOpen = 0;
147
-
148
- // amount is in characters for character LOBs and bytes for binary LOBs
149
- if (lob->type->isCharacterData)
150
- lengthInChars = amount;
151
- else lengthInBytes = amount;
152
-
153
- // for files, open the file if needed
154
- if (lob->type->oracleTypeNum == DPI_ORACLE_TYPE_BFILE) {
155
- if (dpiOci__lobIsOpen(lob, &isOpen, error) < 0)
156
- return DPI_FAILURE;
157
- if (!isOpen) {
158
- if (dpiOci__lobOpen(lob, error) < 0)
159
- return DPI_FAILURE;
160
- }
161
- }
162
-
163
- // read the bytes from the LOB
164
- if (dpiOci__lobRead2(lob, offset, &lengthInBytes, &lengthInChars,
165
- value, *valueLength, error) < 0)
166
- return DPI_FAILURE;
167
- *valueLength = lengthInBytes;
168
-
169
- // if file was opened in this routine, close it again
170
- if (lob->type->oracleTypeNum == DPI_ORACLE_TYPE_BFILE && !isOpen) {
171
- if (dpiOci__lobClose(lob, error) < 0)
172
- return DPI_FAILURE;
173
- }
174
-
175
- return DPI_SUCCESS;
176
- }
177
-
178
-
179
- //-----------------------------------------------------------------------------
180
- // dpiLob__setFromBytes() [INTERNAL]
181
- // Clear the LOB completely and then write the specified bytes to it.
182
- //-----------------------------------------------------------------------------
183
- int dpiLob__setFromBytes(dpiLob *lob, const char *value, uint64_t valueLength,
184
- dpiError *error)
185
- {
186
- if (dpiOci__lobTrim2(lob, 0, error) < 0)
187
- return DPI_FAILURE;
188
- if (valueLength == 0)
189
- return DPI_SUCCESS;
190
- return dpiOci__lobWrite2(lob, 1, value, valueLength, error);
191
- }
192
-
193
-
194
- //-----------------------------------------------------------------------------
195
- // dpiLob_addRef() [PUBLIC]
196
- // Add a reference to the LOB.
197
- //-----------------------------------------------------------------------------
198
- int dpiLob_addRef(dpiLob *lob)
199
- {
200
- return dpiGen__addRef(lob, DPI_HTYPE_LOB, __func__);
201
- }
202
-
203
-
204
- //-----------------------------------------------------------------------------
205
- // dpiLob_close() [PUBLIC]
206
- // Close the LOB and make it unusable for further operations.
207
- //-----------------------------------------------------------------------------
208
- int dpiLob_close(dpiLob *lob)
209
- {
210
- dpiError error;
211
- int status;
212
-
213
- if (dpiLob__check(lob, __func__, 1, &error) < 0)
214
- return dpiGen__endPublicFn(lob, DPI_FAILURE, &error);
215
- status = dpiLob__close(lob, 1, &error);
216
- return dpiGen__endPublicFn(lob, status, &error);
217
- }
218
-
219
-
220
- //-----------------------------------------------------------------------------
221
- // dpiLob_closeResource() [PUBLIC]
222
- // Close the LOB's resources.
223
- //-----------------------------------------------------------------------------
224
- int dpiLob_closeResource(dpiLob *lob)
225
- {
226
- dpiError error;
227
- int status;
228
-
229
- if (dpiLob__check(lob, __func__, 1, &error) < 0)
230
- return dpiGen__endPublicFn(lob, DPI_FAILURE, &error);
231
- status = dpiOci__lobClose(lob, &error);
232
- return dpiGen__endPublicFn(lob, status, &error);
233
- }
234
-
235
-
236
- //-----------------------------------------------------------------------------
237
- // dpiLob_copy() [PUBLIC]
238
- // Create a copy of the LOB and return it.
239
- //-----------------------------------------------------------------------------
240
- int dpiLob_copy(dpiLob *lob, dpiLob **copiedLob)
241
- {
242
- dpiLob *tempLob;
243
- dpiError error;
244
-
245
- if (dpiLob__check(lob, __func__, 1, &error) < 0)
246
- return dpiGen__endPublicFn(lob, DPI_FAILURE, &error);
247
- DPI_CHECK_PTR_NOT_NULL(lob, copiedLob)
248
- if (dpiLob__allocate(lob->conn, lob->type, &tempLob, &error) < 0)
249
- return dpiGen__endPublicFn(lob, DPI_FAILURE, &error);
250
- if (dpiOci__lobLocatorAssign(lob, &tempLob->locator, &error) < 0) {
251
- dpiLob__free(tempLob, &error);
252
- return dpiGen__endPublicFn(lob, DPI_FAILURE, &error);
253
- }
254
- *copiedLob = tempLob;
255
- return dpiGen__endPublicFn(lob, DPI_SUCCESS, &error);
256
- }
257
-
258
-
259
- //-----------------------------------------------------------------------------
260
- // dpiLob_getBufferSize() [PUBLIC]
261
- // Get the required size of a buffer given the number of characters. If the
262
- // LOB does not refer to a character LOB the value is returned unchanged.
263
- //-----------------------------------------------------------------------------
264
- int dpiLob_getBufferSize(dpiLob *lob, uint64_t sizeInChars,
265
- uint64_t *sizeInBytes)
266
- {
267
- dpiError error;
268
-
269
- if (dpiLob__check(lob, __func__, 0, &error) < 0)
270
- return dpiGen__endPublicFn(lob, DPI_FAILURE, &error);
271
- DPI_CHECK_PTR_NOT_NULL(lob, sizeInBytes)
272
- if (lob->type->oracleTypeNum == DPI_ORACLE_TYPE_CLOB)
273
- *sizeInBytes = sizeInChars * lob->env->maxBytesPerCharacter;
274
- else if (lob->type->oracleTypeNum == DPI_ORACLE_TYPE_NCLOB)
275
- *sizeInBytes = sizeInChars * lob->env->nmaxBytesPerCharacter;
276
- else *sizeInBytes = sizeInChars;
277
- return dpiGen__endPublicFn(lob, DPI_SUCCESS, &error);
278
- }
279
-
280
-
281
- //-----------------------------------------------------------------------------
282
- // dpiLob_getChunkSize() [PUBLIC]
283
- // Return the chunk size associated with the LOB.
284
- //-----------------------------------------------------------------------------
285
- int dpiLob_getChunkSize(dpiLob *lob, uint32_t *size)
286
- {
287
- dpiError error;
288
- int status;
289
-
290
- if (dpiLob__check(lob, __func__, 0, &error) < 0)
291
- return dpiGen__endPublicFn(lob, DPI_FAILURE, &error);
292
- DPI_CHECK_PTR_NOT_NULL(lob, size)
293
- status = dpiOci__lobGetChunkSize(lob, size, &error);
294
- return dpiGen__endPublicFn(lob, status, &error);
295
- }
296
-
297
-
298
- //-----------------------------------------------------------------------------
299
- // dpiLob_getDirectoryAndFileName() [PUBLIC]
300
- // Return the directory alias and file name for the BFILE lob.
301
- //-----------------------------------------------------------------------------
302
- int dpiLob_getDirectoryAndFileName(dpiLob *lob, const char **directoryAlias,
303
- uint32_t *directoryAliasLength, const char **fileName,
304
- uint32_t *fileNameLength)
305
- {
306
- uint16_t ociDirectoryAliasLength, ociFileNameLength;
307
- dpiError error;
308
-
309
- // validate parameters
310
- if (dpiLob__check(lob, __func__, 1, &error) < 0)
311
- return dpiGen__endPublicFn(lob, DPI_FAILURE, &error);
312
- DPI_CHECK_PTR_NOT_NULL(lob, directoryAlias)
313
- DPI_CHECK_PTR_NOT_NULL(lob, directoryAliasLength)
314
- DPI_CHECK_PTR_NOT_NULL(lob, fileName)
315
- DPI_CHECK_PTR_NOT_NULL(lob, fileNameLength)
316
-
317
- // get directory and file name
318
- ociDirectoryAliasLength = 30;
319
- ociFileNameLength = 255;
320
- if (!lob->buffer) {
321
- if (dpiUtils__allocateMemory(1,
322
- ociDirectoryAliasLength + ociFileNameLength, 0,
323
- "allocate name buffer", (void**) &lob->buffer, &error) < 0)
324
- return dpiGen__endPublicFn(lob, DPI_FAILURE, &error);
325
- }
326
- *directoryAlias = lob->buffer;
327
- *fileName = lob->buffer + ociDirectoryAliasLength;
328
- if (dpiOci__lobFileGetName(lob, (char*) *directoryAlias,
329
- &ociDirectoryAliasLength, (char*) *fileName, &ociFileNameLength,
330
- &error) < 0)
331
- return dpiGen__endPublicFn(lob, DPI_FAILURE, &error);
332
- *directoryAliasLength = ociDirectoryAliasLength;
333
- *fileNameLength = ociFileNameLength;
334
- return dpiGen__endPublicFn(lob, DPI_SUCCESS, &error);
335
- }
336
-
337
-
338
- //-----------------------------------------------------------------------------
339
- // dpiLob_getFileExists() [PUBLIC]
340
- // Return whether or not the file pointed to by the locator exists.
341
- //-----------------------------------------------------------------------------
342
- int dpiLob_getFileExists(dpiLob *lob, int *exists)
343
- {
344
- dpiError error;
345
- int status;
346
-
347
- if (dpiLob__check(lob, __func__, 1, &error) < 0)
348
- return dpiGen__endPublicFn(lob, DPI_FAILURE, &error);
349
- DPI_CHECK_PTR_NOT_NULL(lob, exists)
350
- status = dpiOci__lobFileExists(lob, exists, &error);
351
- return dpiGen__endPublicFn(lob, status, &error);
352
- }
353
-
354
-
355
- //-----------------------------------------------------------------------------
356
- // dpiLob_getIsResourceOpen() [PUBLIC]
357
- // Return whether or not the LOB' resources are open.
358
- //-----------------------------------------------------------------------------
359
- int dpiLob_getIsResourceOpen(dpiLob *lob, int *isOpen)
360
- {
361
- dpiError error;
362
- int status;
363
-
364
- if (dpiLob__check(lob, __func__, 1, &error) < 0)
365
- return dpiGen__endPublicFn(lob, DPI_FAILURE, &error);
366
- DPI_CHECK_PTR_NOT_NULL(lob, isOpen)
367
- status = dpiOci__lobIsOpen(lob, isOpen, &error);
368
- return dpiGen__endPublicFn(lob, status, &error);
369
- }
370
-
371
-
372
- //-----------------------------------------------------------------------------
373
- // dpiLob_getSize() [PUBLIC]
374
- // Returns the size of the LOB.
375
- //-----------------------------------------------------------------------------
376
- int dpiLob_getSize(dpiLob *lob, uint64_t *size)
377
- {
378
- dpiError error;
379
- int status;
380
-
381
- if (dpiLob__check(lob, __func__, 1, &error) < 0)
382
- return dpiGen__endPublicFn(lob, DPI_FAILURE, &error);
383
- DPI_CHECK_PTR_NOT_NULL(lob, size)
384
- status = dpiOci__lobGetLength2(lob, size, &error);
385
- return dpiGen__endPublicFn(lob, status, &error);
386
- }
387
-
388
-
389
- //-----------------------------------------------------------------------------
390
- // dpiLob_openResource() [PUBLIC]
391
- // Open the LOB's resources to speed further accesses.
392
- //-----------------------------------------------------------------------------
393
- int dpiLob_openResource(dpiLob *lob)
394
- {
395
- dpiError error;
396
- int status;
397
-
398
- if (dpiLob__check(lob, __func__, 1, &error) < 0)
399
- return dpiGen__endPublicFn(lob, DPI_FAILURE, &error);
400
- status = dpiOci__lobOpen(lob, &error);
401
- return dpiGen__endPublicFn(lob, status, &error);
402
- }
403
-
404
-
405
- //-----------------------------------------------------------------------------
406
- // dpiLob_readBytes() [PUBLIC]
407
- // Return a portion (or all) of the data in the LOB.
408
- //-----------------------------------------------------------------------------
409
- int dpiLob_readBytes(dpiLob *lob, uint64_t offset, uint64_t amount,
410
- char *value, uint64_t *valueLength)
411
- {
412
- dpiError error;
413
- int status;
414
-
415
- if (dpiLob__check(lob, __func__, 1, &error) < 0)
416
- return dpiGen__endPublicFn(lob, DPI_FAILURE, &error);
417
- DPI_CHECK_PTR_NOT_NULL(lob, value)
418
- DPI_CHECK_PTR_NOT_NULL(lob, valueLength)
419
- status = dpiLob__readBytes(lob, offset, amount, value, valueLength,
420
- &error);
421
- return dpiGen__endPublicFn(lob, status, &error);
422
- }
423
-
424
-
425
- //-----------------------------------------------------------------------------
426
- // dpiLob_release() [PUBLIC]
427
- // Release a reference to the LOB.
428
- //-----------------------------------------------------------------------------
429
- int dpiLob_release(dpiLob *lob)
430
- {
431
- return dpiGen__release(lob, DPI_HTYPE_LOB, __func__);
432
- }
433
-
434
-
435
- //-----------------------------------------------------------------------------
436
- // dpiLob_setDirectoryAndFileName() [PUBLIC]
437
- // Set the directory alias and file name for the BFILE LOB.
438
- //-----------------------------------------------------------------------------
439
- int dpiLob_setDirectoryAndFileName(dpiLob *lob, const char *directoryAlias,
440
- uint32_t directoryAliasLength, const char *fileName,
441
- uint32_t fileNameLength)
442
- {
443
- dpiError error;
444
- int status;
445
-
446
- if (dpiLob__check(lob, __func__, 1, &error) < 0)
447
- return dpiGen__endPublicFn(lob, DPI_FAILURE, &error);
448
- DPI_CHECK_PTR_NOT_NULL(lob, directoryAlias)
449
- DPI_CHECK_PTR_NOT_NULL(lob, fileName)
450
- status = dpiOci__lobFileSetName(lob, directoryAlias,
451
- (uint16_t) directoryAliasLength, fileName,
452
- (uint16_t) fileNameLength, &error);
453
- return dpiGen__endPublicFn(lob, status, &error);
454
- }
455
-
456
-
457
- //-----------------------------------------------------------------------------
458
- // dpiLob_setFromBytes() [PUBLIC]
459
- // Clear the LOB completely and then write the specified bytes to it.
460
- //-----------------------------------------------------------------------------
461
- int dpiLob_setFromBytes(dpiLob *lob, const char *value, uint64_t valueLength)
462
- {
463
- dpiError error;
464
- int status;
465
-
466
- if (dpiLob__check(lob, __func__, 1, &error) < 0)
467
- return dpiGen__endPublicFn(lob, DPI_FAILURE, &error);
468
- DPI_CHECK_PTR_NOT_NULL(lob, value)
469
- status = dpiLob__setFromBytes(lob, value, valueLength, &error);
470
- return dpiGen__endPublicFn(lob, status, &error);
471
- }
472
-
473
-
474
- //-----------------------------------------------------------------------------
475
- // dpiLob_trim() [PUBLIC]
476
- // Trim the LOB to the specified length.
477
- //-----------------------------------------------------------------------------
478
- int dpiLob_trim(dpiLob *lob, uint64_t newSize)
479
- {
480
- dpiError error;
481
- int status;
482
-
483
- if (dpiLob__check(lob, __func__, 1, &error) < 0)
484
- return dpiGen__endPublicFn(lob, DPI_FAILURE, &error);
485
- status = dpiOci__lobTrim2(lob, newSize, &error);
486
- return dpiGen__endPublicFn(lob, status, &error);
487
- }
488
-
489
-
490
- //-----------------------------------------------------------------------------
491
- // dpiLob_writeBytes() [PUBLIC]
492
- // Write the data to the LOB at the offset specified.
493
- //-----------------------------------------------------------------------------
494
- int dpiLob_writeBytes(dpiLob *lob, uint64_t offset, const char *value,
495
- uint64_t valueLength)
496
- {
497
- dpiError error;
498
- int status;
499
-
500
- if (dpiLob__check(lob, __func__, 1, &error) < 0)
501
- return dpiGen__endPublicFn(lob, DPI_FAILURE, &error);
502
- DPI_CHECK_PTR_NOT_NULL(lob, value)
503
- status = dpiOci__lobWrite2(lob, offset, value, valueLength, &error);
504
- return dpiGen__endPublicFn(lob, status, &error);
505
- }
506
-