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
@@ -1,549 +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
- // dpiPool.c
14
- // Implementation of session pools.
15
- //-----------------------------------------------------------------------------
16
-
17
- #include "dpiImpl.h"
18
-
19
- //-----------------------------------------------------------------------------
20
- // dpiPool__acquireConnection() [INTERNAL]
21
- // Internal method used for acquiring a connection from a pool.
22
- //-----------------------------------------------------------------------------
23
- int dpiPool__acquireConnection(dpiPool *pool, const char *userName,
24
- uint32_t userNameLength, const char *password, uint32_t passwordLength,
25
- dpiConnCreateParams *params, dpiConn **conn, dpiError *error)
26
- {
27
- dpiConn *tempConn;
28
-
29
- // allocate new connection
30
- if (dpiGen__allocate(DPI_HTYPE_CONN, pool->env, (void**) &tempConn,
31
- error) < 0)
32
- return DPI_FAILURE;
33
-
34
- // create the connection
35
- if (dpiConn__create(tempConn, pool->env->context, userName, userNameLength,
36
- password, passwordLength, pool->name, pool->nameLength, pool,
37
- NULL, params, error) < 0) {
38
- dpiConn__free(tempConn, error);
39
- return DPI_FAILURE;
40
- }
41
-
42
- *conn = tempConn;
43
- return DPI_SUCCESS;
44
- }
45
-
46
-
47
- //-----------------------------------------------------------------------------
48
- // dpiPool__checkConnected() [INTERNAL]
49
- // Determine if the session pool is connected to the database. If not, an
50
- // error is raised.
51
- //-----------------------------------------------------------------------------
52
- static int dpiPool__checkConnected(dpiPool *pool, const char *fnName,
53
- dpiError *error)
54
- {
55
- if (dpiGen__startPublicFn(pool, DPI_HTYPE_POOL, fnName, 1, error) < 0)
56
- return DPI_FAILURE;
57
- if (!pool->handle)
58
- return dpiError__set(error, "check pool", DPI_ERR_NOT_CONNECTED);
59
- return DPI_SUCCESS;
60
- }
61
-
62
-
63
- //-----------------------------------------------------------------------------
64
- // dpiPool__create() [INTERNAL]
65
- // Internal method for creating a session pool.
66
- //-----------------------------------------------------------------------------
67
- static int dpiPool__create(dpiPool *pool, const char *userName,
68
- uint32_t userNameLength, const char *password, uint32_t passwordLength,
69
- const char *connectString, uint32_t connectStringLength,
70
- const dpiCommonCreateParams *commonParams,
71
- dpiPoolCreateParams *createParams, dpiError *error)
72
- {
73
- uint32_t poolMode;
74
- uint8_t getMode;
75
- void *authInfo;
76
-
77
- // validate parameters
78
- if (createParams->externalAuth &&
79
- ((userName && userNameLength > 0) ||
80
- (password && passwordLength > 0)))
81
- return dpiError__set(error, "check mixed credentials",
82
- DPI_ERR_EXT_AUTH_WITH_CREDENTIALS);
83
-
84
- // create the session pool handle
85
- if (dpiOci__handleAlloc(pool->env->handle, &pool->handle,
86
- DPI_OCI_HTYPE_SPOOL, "allocate pool handle", error) < 0)
87
- return DPI_FAILURE;
88
-
89
- // prepare pool mode
90
- poolMode = DPI_OCI_SPC_STMTCACHE;
91
- if (createParams->homogeneous)
92
- poolMode |= DPI_OCI_SPC_HOMOGENEOUS;
93
-
94
- // create authorization handle
95
- if (dpiOci__handleAlloc(pool->env->handle, &authInfo,
96
- DPI_OCI_HTYPE_AUTHINFO, "allocate authinfo handle", error) < 0)
97
- return DPI_FAILURE;
98
-
99
- // set context attributes
100
- if (dpiUtils__setAttributesFromCommonCreateParams(authInfo,
101
- DPI_OCI_HTYPE_AUTHINFO, commonParams, error) < 0)
102
- return DPI_FAILURE;
103
-
104
- // set authorization info on session pool
105
- if (dpiOci__attrSet(pool->handle, DPI_OCI_HTYPE_SPOOL, (void*) authInfo, 0,
106
- DPI_OCI_ATTR_SPOOL_AUTH, "set auth info", error) < 0)
107
- return DPI_FAILURE;
108
-
109
- // create pool
110
- if (dpiOci__sessionPoolCreate(pool, connectString, connectStringLength,
111
- createParams->minSessions, createParams->maxSessions,
112
- createParams->sessionIncrement, userName, userNameLength, password,
113
- passwordLength, poolMode, error) < 0)
114
- return DPI_FAILURE;
115
-
116
- // set the get mode on the pool
117
- getMode = (uint8_t) createParams->getMode;
118
- if (dpiOci__attrSet(pool->handle, DPI_OCI_HTYPE_SPOOL, (void*) &getMode, 0,
119
- DPI_OCI_ATTR_SPOOL_GETMODE, "set get mode", error) < 0)
120
- return DPI_FAILURE;
121
-
122
- // set the session timeout on the pool
123
- if (dpiOci__attrSet(pool->handle, DPI_OCI_HTYPE_SPOOL, (void*)
124
- &createParams->timeout, 0, DPI_OCI_ATTR_SPOOL_TIMEOUT,
125
- "set timeout", error) < 0)
126
- return DPI_FAILURE;
127
-
128
- // set the wait timeout on the pool (valid in 12.2 and higher)
129
- if (pool->env->versionInfo->versionNum > 12 ||
130
- (pool->env->versionInfo->versionNum == 12 &&
131
- pool->env->versionInfo->releaseNum >= 2)) {
132
- if (dpiOci__attrSet(pool->handle, DPI_OCI_HTYPE_SPOOL, (void*)
133
- &createParams->waitTimeout, 0, DPI_OCI_ATTR_SPOOL_WAIT_TIMEOUT,
134
- "set wait timeout", error) < 0)
135
- return DPI_FAILURE;
136
- }
137
-
138
- // set the maximum lifetime session on the pool (valid in 12.1 and higher)
139
- if (pool->env->versionInfo->versionNum >= 12) {
140
- if (dpiOci__attrSet(pool->handle, DPI_OCI_HTYPE_SPOOL, (void*)
141
- &createParams->maxLifetimeSession, 0,
142
- DPI_OCI_ATTR_SPOOL_MAX_LIFETIME_SESSION,
143
- "set max lifetime session", error) < 0)
144
- return DPI_FAILURE;
145
- }
146
-
147
- // set reamining attributes directly
148
- pool->homogeneous = createParams->homogeneous;
149
- pool->externalAuth = createParams->externalAuth;
150
- pool->pingInterval = createParams->pingInterval;
151
- pool->pingTimeout = createParams->pingTimeout;
152
- return DPI_SUCCESS;
153
- }
154
-
155
-
156
- //-----------------------------------------------------------------------------
157
- // dpiPool__free() [INTERNAL]
158
- // Free any memory associated with the pool.
159
- //-----------------------------------------------------------------------------
160
- void dpiPool__free(dpiPool *pool, dpiError *error)
161
- {
162
- if (pool->handle) {
163
- dpiOci__sessionPoolDestroy(pool, DPI_OCI_SPD_FORCE, 0, error);
164
- dpiOci__handleFree(pool->handle, DPI_OCI_HTYPE_SPOOL);
165
- pool->handle = NULL;
166
- }
167
- if (pool->env) {
168
- dpiEnv__free(pool->env, error);
169
- pool->env = NULL;
170
- }
171
- dpiUtils__freeMemory(pool);
172
- }
173
-
174
-
175
- //-----------------------------------------------------------------------------
176
- // dpiPool__getAttributeUint() [INTERNAL]
177
- // Return the value of the attribute as an unsigned integer.
178
- //-----------------------------------------------------------------------------
179
- static int dpiPool__getAttributeUint(dpiPool *pool, uint32_t attribute,
180
- uint32_t *value, const char *fnName)
181
- {
182
- int status, supported = 1;
183
- dpiError error;
184
-
185
- if (dpiPool__checkConnected(pool, fnName, &error) < 0)
186
- return dpiGen__endPublicFn(pool, DPI_FAILURE, &error);
187
- DPI_CHECK_PTR_NOT_NULL(pool, value)
188
- switch (attribute) {
189
- case DPI_OCI_ATTR_SPOOL_MAX_LIFETIME_SESSION:
190
- if (pool->env->versionInfo->versionNum < 12)
191
- supported = 0;
192
- break;
193
- case DPI_OCI_ATTR_SPOOL_WAIT_TIMEOUT:
194
- if (pool->env->versionInfo->versionNum < 12 ||
195
- (pool->env->versionInfo->versionNum == 12 &&
196
- pool->env->versionInfo->releaseNum < 2))
197
- supported = 0;
198
- break;
199
- case DPI_OCI_ATTR_SPOOL_BUSY_COUNT:
200
- case DPI_OCI_ATTR_SPOOL_OPEN_COUNT:
201
- case DPI_OCI_ATTR_SPOOL_STMTCACHESIZE:
202
- case DPI_OCI_ATTR_SPOOL_TIMEOUT:
203
- break;
204
- default:
205
- supported = 0;
206
- break;
207
- }
208
- if (supported)
209
- status = dpiOci__attrGet(pool->handle, DPI_OCI_HTYPE_SPOOL, value,
210
- NULL, attribute, "get attribute value", &error);
211
- else status = dpiError__set(&error, "get attribute value",
212
- DPI_ERR_NOT_SUPPORTED);
213
- return dpiGen__endPublicFn(pool, status, &error);
214
- }
215
-
216
-
217
- //-----------------------------------------------------------------------------
218
- // dpiPool__setAttributeUint() [INTERNAL]
219
- // Set the value of the OCI attribute as an unsigned integer.
220
- //-----------------------------------------------------------------------------
221
- static int dpiPool__setAttributeUint(dpiPool *pool, uint32_t attribute,
222
- uint32_t value, const char *fnName)
223
- {
224
- int status, supported = 1;
225
- void *ociValue = &value;
226
- uint8_t shortValue;
227
- dpiError error;
228
-
229
- // make sure session pool is connected
230
- if (dpiPool__checkConnected(pool, fnName, &error) < 0)
231
- return dpiGen__endPublicFn(pool, DPI_FAILURE, &error);
232
-
233
- // determine pointer to pass (OCI uses different sizes)
234
- switch (attribute) {
235
- case DPI_OCI_ATTR_SPOOL_GETMODE:
236
- shortValue = (uint8_t) value;
237
- ociValue = &shortValue;
238
- break;
239
- case DPI_OCI_ATTR_SPOOL_MAX_LIFETIME_SESSION:
240
- if (pool->env->versionInfo->versionNum < 12)
241
- supported = 0;
242
- break;
243
- case DPI_OCI_ATTR_SPOOL_WAIT_TIMEOUT:
244
- if (pool->env->versionInfo->versionNum < 12 ||
245
- (pool->env->versionInfo->versionNum == 12 &&
246
- pool->env->versionInfo->releaseNum < 2))
247
- supported = 0;
248
- break;
249
- case DPI_OCI_ATTR_SPOOL_STMTCACHESIZE:
250
- case DPI_OCI_ATTR_SPOOL_TIMEOUT:
251
- break;
252
- default:
253
- supported = 0;
254
- break;
255
- }
256
-
257
- // set value in the OCI
258
- if (supported)
259
- status = dpiOci__attrSet(pool->handle, DPI_OCI_HTYPE_SPOOL, ociValue,
260
- 0, attribute, "set attribute value", &error);
261
- else status = dpiError__set(&error, "set attribute value",
262
- DPI_ERR_NOT_SUPPORTED);
263
- return dpiGen__endPublicFn(pool, status, &error);
264
- }
265
-
266
-
267
- //-----------------------------------------------------------------------------
268
- // dpiPool_acquireConnection() [PUBLIC]
269
- // Acquire a connection from the pool.
270
- //-----------------------------------------------------------------------------
271
- int dpiPool_acquireConnection(dpiPool *pool, const char *userName,
272
- uint32_t userNameLength, const char *password, uint32_t passwordLength,
273
- dpiConnCreateParams *params, dpiConn **conn)
274
- {
275
- dpiConnCreateParams localParams;
276
- dpiError error;
277
- int status;
278
-
279
- // validate parameters
280
- if (dpiPool__checkConnected(pool, __func__, &error) < 0)
281
- return dpiGen__endPublicFn(pool, DPI_FAILURE, &error);
282
- DPI_CHECK_PTR_AND_LENGTH(pool, userName)
283
- DPI_CHECK_PTR_AND_LENGTH(pool, password)
284
- DPI_CHECK_PTR_NOT_NULL(pool, conn)
285
-
286
- // use default parameters if none provided
287
- if (!params) {
288
- dpiContext__initConnCreateParams(&localParams);
289
- params = &localParams;
290
- }
291
-
292
- status = dpiPool__acquireConnection(pool, userName, userNameLength,
293
- password, passwordLength, params, conn, &error);
294
- return dpiGen__endPublicFn(pool, status, &error);
295
- }
296
-
297
-
298
- //-----------------------------------------------------------------------------
299
- // dpiPool_addRef() [PUBLIC]
300
- // Add a reference to the pool.
301
- //-----------------------------------------------------------------------------
302
- int dpiPool_addRef(dpiPool *pool)
303
- {
304
- return dpiGen__addRef(pool, DPI_HTYPE_POOL, __func__);
305
- }
306
-
307
-
308
- //-----------------------------------------------------------------------------
309
- // dpiPool_close() [PUBLIC]
310
- // Destroy the pool now, not when the reference count reaches zero.
311
- //-----------------------------------------------------------------------------
312
- int dpiPool_close(dpiPool *pool, dpiPoolCloseMode mode)
313
- {
314
- dpiError error;
315
-
316
- if (dpiPool__checkConnected(pool, __func__, &error) < 0)
317
- return dpiGen__endPublicFn(pool, DPI_FAILURE, &error);
318
- if (dpiOci__sessionPoolDestroy(pool, mode, 1, &error) < 0)
319
- return dpiGen__endPublicFn(pool, DPI_FAILURE, &error);
320
- return dpiGen__endPublicFn(pool, DPI_SUCCESS, &error);
321
- }
322
-
323
-
324
- //-----------------------------------------------------------------------------
325
- // dpiPool_create() [PUBLIC]
326
- // Create a new session pool and return it.
327
- //-----------------------------------------------------------------------------
328
- int dpiPool_create(const dpiContext *context, const char *userName,
329
- uint32_t userNameLength, const char *password, uint32_t passwordLength,
330
- const char *connectString, uint32_t connectStringLength,
331
- const dpiCommonCreateParams *commonParams,
332
- dpiPoolCreateParams *createParams, dpiPool **pool)
333
- {
334
- dpiCommonCreateParams localCommonParams;
335
- dpiPoolCreateParams localCreateParams;
336
- dpiPool *tempPool;
337
- dpiError error;
338
-
339
- // validate parameters
340
- if (dpiGen__startPublicFn(context, DPI_HTYPE_CONTEXT, __func__, 0,
341
- &error) < 0)
342
- return dpiGen__endPublicFn(context, DPI_FAILURE, &error);
343
- DPI_CHECK_PTR_AND_LENGTH(context, userName)
344
- DPI_CHECK_PTR_AND_LENGTH(context, password)
345
- DPI_CHECK_PTR_AND_LENGTH(context, connectString)
346
- DPI_CHECK_PTR_NOT_NULL(context, pool)
347
-
348
- // use default parameters if none provided
349
- if (!commonParams) {
350
- dpiContext__initCommonCreateParams(&localCommonParams);
351
- commonParams = &localCommonParams;
352
- }
353
- if (!createParams) {
354
- dpiContext__initPoolCreateParams(&localCreateParams);
355
- createParams = &localCreateParams;
356
- }
357
-
358
- // allocate memory for pool
359
- if (dpiGen__allocate(DPI_HTYPE_POOL, NULL, (void**) &tempPool, &error) < 0)
360
- return dpiGen__endPublicFn(context, DPI_FAILURE, &error);
361
-
362
- // initialize environment
363
- if (dpiEnv__init(tempPool->env, context, commonParams, &error) < 0) {
364
- dpiPool__free(tempPool, &error);
365
- return dpiGen__endPublicFn(context, DPI_FAILURE, &error);
366
- }
367
-
368
- // perform remaining steps required to create pool
369
- if (dpiPool__create(tempPool, userName, userNameLength, password,
370
- passwordLength, connectString, connectStringLength, commonParams,
371
- createParams, &error) < 0) {
372
- dpiPool__free(tempPool, &error);
373
- return dpiGen__endPublicFn(context, DPI_FAILURE, &error);
374
- }
375
-
376
- createParams->outPoolName = tempPool->name;
377
- createParams->outPoolNameLength = tempPool->nameLength;
378
- *pool = tempPool;
379
- dpiHandlePool__release(tempPool->env->errorHandles, error.handle, &error);
380
- error.handle = NULL;
381
- return dpiGen__endPublicFn(context, DPI_SUCCESS, &error);
382
- }
383
-
384
-
385
- //-----------------------------------------------------------------------------
386
- // dpiPool_getBusyCount() [PUBLIC]
387
- // Return the pool's busy count.
388
- //-----------------------------------------------------------------------------
389
- int dpiPool_getBusyCount(dpiPool *pool, uint32_t *value)
390
- {
391
- return dpiPool__getAttributeUint(pool, DPI_OCI_ATTR_SPOOL_BUSY_COUNT,
392
- value, __func__);
393
- }
394
-
395
-
396
- //-----------------------------------------------------------------------------
397
- // dpiPool_getEncodingInfo() [PUBLIC]
398
- // Get the encoding information from the pool.
399
- //-----------------------------------------------------------------------------
400
- int dpiPool_getEncodingInfo(dpiPool *pool, dpiEncodingInfo *info)
401
- {
402
- dpiError error;
403
- int status;
404
-
405
- if (dpiPool__checkConnected(pool, __func__, &error) < 0)
406
- return dpiGen__endPublicFn(pool, DPI_FAILURE, &error);
407
- DPI_CHECK_PTR_NOT_NULL(pool, info)
408
- status = dpiEnv__getEncodingInfo(pool->env, info);
409
- return dpiGen__endPublicFn(pool, status, &error);
410
- }
411
-
412
-
413
- //-----------------------------------------------------------------------------
414
- // dpiPool_getGetMode() [PUBLIC]
415
- // Return the pool's "get" mode.
416
- //-----------------------------------------------------------------------------
417
- int dpiPool_getGetMode(dpiPool *pool, dpiPoolGetMode *value)
418
- {
419
- dpiError error;
420
-
421
- if (dpiPool__checkConnected(pool, __func__, &error) < 0)
422
- return dpiGen__endPublicFn(pool, DPI_FAILURE, &error);
423
- DPI_CHECK_PTR_NOT_NULL(pool, value)
424
- if (dpiOci__attrGet(pool->handle, DPI_OCI_HTYPE_SPOOL, value, NULL,
425
- DPI_OCI_ATTR_SPOOL_GETMODE, "get attribute value", &error) < 0)
426
- return dpiGen__endPublicFn(pool, DPI_FAILURE, &error);
427
- return dpiGen__endPublicFn(pool, DPI_SUCCESS, &error);
428
- }
429
-
430
-
431
- //-----------------------------------------------------------------------------
432
- // dpiPool_getMaxLifetimeSession() [PUBLIC]
433
- // Return the pool's maximum lifetime session.
434
- //-----------------------------------------------------------------------------
435
- int dpiPool_getMaxLifetimeSession(dpiPool *pool, uint32_t *value)
436
- {
437
- return dpiPool__getAttributeUint(pool,
438
- DPI_OCI_ATTR_SPOOL_MAX_LIFETIME_SESSION, value, __func__);
439
- }
440
-
441
-
442
- //-----------------------------------------------------------------------------
443
- // dpiPool_getOpenCount() [PUBLIC]
444
- // Return the pool's open count.
445
- //-----------------------------------------------------------------------------
446
- int dpiPool_getOpenCount(dpiPool *pool, uint32_t *value)
447
- {
448
- return dpiPool__getAttributeUint(pool, DPI_OCI_ATTR_SPOOL_OPEN_COUNT,
449
- value, __func__);
450
- }
451
-
452
-
453
- //-----------------------------------------------------------------------------
454
- // dpiPool_getStmtCacheSize() [PUBLIC]
455
- // Return the pool's default statement cache size.
456
- //-----------------------------------------------------------------------------
457
- int dpiPool_getStmtCacheSize(dpiPool *pool, uint32_t *value)
458
- {
459
- return dpiPool__getAttributeUint(pool, DPI_OCI_ATTR_SPOOL_STMTCACHESIZE,
460
- value, __func__);
461
- }
462
-
463
-
464
- //-----------------------------------------------------------------------------
465
- // dpiPool_getTimeout() [PUBLIC]
466
- // Return the pool's timeout value.
467
- //-----------------------------------------------------------------------------
468
- int dpiPool_getTimeout(dpiPool *pool, uint32_t *value)
469
- {
470
- return dpiPool__getAttributeUint(pool, DPI_OCI_ATTR_SPOOL_TIMEOUT, value,
471
- __func__);
472
- }
473
-
474
-
475
- //-----------------------------------------------------------------------------
476
- // dpiPool_getWaitTimeout() [PUBLIC]
477
- // Return the pool's wait timeout value.
478
- //-----------------------------------------------------------------------------
479
- int dpiPool_getWaitTimeout(dpiPool *pool, uint32_t *value)
480
- {
481
- return dpiPool__getAttributeUint(pool, DPI_OCI_ATTR_SPOOL_WAIT_TIMEOUT,
482
- value, __func__);
483
- }
484
-
485
-
486
- //-----------------------------------------------------------------------------
487
- // dpiPool_release() [PUBLIC]
488
- // Release a reference to the pool.
489
- //-----------------------------------------------------------------------------
490
- int dpiPool_release(dpiPool *pool)
491
- {
492
- return dpiGen__release(pool, DPI_HTYPE_POOL, __func__);
493
- }
494
-
495
-
496
- //-----------------------------------------------------------------------------
497
- // dpiPool_setGetMode() [PUBLIC]
498
- // Set the pool's "get" mode.
499
- //-----------------------------------------------------------------------------
500
- int dpiPool_setGetMode(dpiPool *pool, dpiPoolGetMode value)
501
- {
502
- return dpiPool__setAttributeUint(pool, DPI_OCI_ATTR_SPOOL_GETMODE, value,
503
- __func__);
504
- }
505
-
506
-
507
- //-----------------------------------------------------------------------------
508
- // dpiPool_setMaxLifetimeSession() [PUBLIC]
509
- // Set the pool's maximum lifetime session.
510
- //-----------------------------------------------------------------------------
511
- int dpiPool_setMaxLifetimeSession(dpiPool *pool, uint32_t value)
512
- {
513
- return dpiPool__setAttributeUint(pool,
514
- DPI_OCI_ATTR_SPOOL_MAX_LIFETIME_SESSION, value, __func__);
515
- }
516
-
517
-
518
- //-----------------------------------------------------------------------------
519
- // dpiPool_setStmtCacheSize() [PUBLIC]
520
- // Set the pool's default statement cache size.
521
- //-----------------------------------------------------------------------------
522
- int dpiPool_setStmtCacheSize(dpiPool *pool, uint32_t value)
523
- {
524
- return dpiPool__setAttributeUint(pool, DPI_OCI_ATTR_SPOOL_STMTCACHESIZE,
525
- value, __func__);
526
- }
527
-
528
-
529
- //-----------------------------------------------------------------------------
530
- // dpiPool_setTimeout() [PUBLIC]
531
- // Set the pool's timeout value.
532
- //-----------------------------------------------------------------------------
533
- int dpiPool_setTimeout(dpiPool *pool, uint32_t value)
534
- {
535
- return dpiPool__setAttributeUint(pool, DPI_OCI_ATTR_SPOOL_TIMEOUT, value,
536
- __func__);
537
- }
538
-
539
-
540
- //-----------------------------------------------------------------------------
541
- // dpiPool_setWaitTimeout() [PUBLIC]
542
- // Set the pool's wait timeout value.
543
- //-----------------------------------------------------------------------------
544
- int dpiPool_setWaitTimeout(dpiPool *pool, uint32_t value)
545
- {
546
- return dpiPool__setAttributeUint(pool, DPI_OCI_ATTR_SPOOL_WAIT_TIMEOUT,
547
- value, __func__);
548
- }
549
-
@@ -1,136 +0,0 @@
1
- //-----------------------------------------------------------------------------
2
- // Copyright (c) 2016, 2017, 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
- // dpiRowid.c
14
- // Implementation of rowids.
15
- //-----------------------------------------------------------------------------
16
-
17
- #include "dpiImpl.h"
18
-
19
- //-----------------------------------------------------------------------------
20
- // dpiRowid__allocate() [INTERNAL]
21
- // Allocate and initialize a rowid object.
22
- //-----------------------------------------------------------------------------
23
- int dpiRowid__allocate(dpiConn *conn, dpiRowid **rowid, dpiError *error)
24
- {
25
- dpiRowid *tempRowid;
26
-
27
- if (dpiGen__allocate(DPI_HTYPE_ROWID, conn->env, (void**) &tempRowid,
28
- error) < 0)
29
- return DPI_FAILURE;
30
- if (dpiOci__descriptorAlloc(conn->env->handle, &tempRowid->handle,
31
- DPI_OCI_DTYPE_ROWID, "allocate descriptor", error) < 0) {
32
- dpiRowid__free(tempRowid, error);
33
- return DPI_FAILURE;
34
- }
35
-
36
- *rowid = tempRowid;
37
- return DPI_SUCCESS;
38
- }
39
-
40
-
41
- //-----------------------------------------------------------------------------
42
- // dpiRowid__free() [INTERNAL]
43
- // Free the memory for a rowid.
44
- //-----------------------------------------------------------------------------
45
- void dpiRowid__free(dpiRowid *rowid, UNUSED dpiError *error)
46
- {
47
- if (rowid->handle) {
48
- dpiOci__descriptorFree(rowid->handle, DPI_OCI_DTYPE_ROWID);
49
- rowid->handle = NULL;
50
- }
51
- if (rowid->buffer) {
52
- dpiUtils__freeMemory(rowid->buffer);
53
- rowid->buffer = NULL;
54
- }
55
- dpiUtils__freeMemory(rowid);
56
- }
57
-
58
-
59
- //-----------------------------------------------------------------------------
60
- // dpiRowid_addRef() [PUBLIC]
61
- // Add a reference to the rowid.
62
- //-----------------------------------------------------------------------------
63
- int dpiRowid_addRef(dpiRowid *rowid)
64
- {
65
- return dpiGen__addRef(rowid, DPI_HTYPE_ROWID, __func__);
66
- }
67
-
68
-
69
- //-----------------------------------------------------------------------------
70
- // dpiRowid_getStringValue() [PUBLIC]
71
- // Get the string representation of the rowid.
72
- //-----------------------------------------------------------------------------
73
- int dpiRowid_getStringValue(dpiRowid *rowid, const char **value,
74
- uint32_t *valueLength)
75
- {
76
- char temp, *adjustedBuffer, *sourcePtr;
77
- uint16_t *targetPtr;
78
- dpiError error;
79
- uint16_t i;
80
-
81
- if (dpiGen__startPublicFn(rowid, DPI_HTYPE_ROWID, __func__, 1,
82
- &error) < 0)
83
- return dpiGen__endPublicFn(rowid, DPI_FAILURE, &error);
84
- DPI_CHECK_PTR_NOT_NULL(rowid, value)
85
- DPI_CHECK_PTR_NOT_NULL(rowid, valueLength)
86
- if (!rowid->buffer) {
87
-
88
- // determine length of rowid
89
- rowid->bufferLength = 0;
90
- dpiOci__rowidToChar(rowid, &temp, &rowid->bufferLength, &error);
91
-
92
- // allocate and populate buffer containing string representation
93
- if (dpiUtils__allocateMemory(1, rowid->bufferLength, 0,
94
- "allocate rowid buffer", (void**) &rowid->buffer, &error) < 0)
95
- return dpiGen__endPublicFn(rowid, DPI_FAILURE, &error);
96
- if (dpiOci__rowidToChar(rowid, rowid->buffer, &rowid->bufferLength,
97
- &error) < 0)
98
- return dpiGen__endPublicFn(rowid, DPI_FAILURE, &error);
99
-
100
- // UTF-16 is not handled properly (data is returned as ASCII instead)
101
- // adjust the buffer to use the correct encoding
102
- if (rowid->env->charsetId == DPI_CHARSET_ID_UTF16) {
103
- if (dpiUtils__allocateMemory(2, rowid->bufferLength, 0,
104
- "allocate rowid buffer", (void**) &adjustedBuffer,
105
- &error) < 0) {
106
- dpiUtils__freeMemory(rowid->buffer);
107
- rowid->bufferLength = 0;
108
- rowid->buffer = NULL;
109
- return dpiGen__endPublicFn(rowid, DPI_FAILURE, &error);
110
- }
111
- sourcePtr = rowid->buffer;
112
- targetPtr = (uint16_t*) adjustedBuffer;
113
- for (i = 0; i < rowid->bufferLength; i++)
114
- *targetPtr++ = (uint16_t) *sourcePtr++;
115
- dpiUtils__freeMemory(rowid->buffer);
116
- rowid->buffer = adjustedBuffer;
117
- rowid->bufferLength *= 2;
118
- }
119
-
120
- }
121
-
122
- *value = rowid->buffer;
123
- *valueLength = rowid->bufferLength;
124
- return dpiGen__endPublicFn(rowid, DPI_SUCCESS, &error);
125
- }
126
-
127
-
128
- //-----------------------------------------------------------------------------
129
- // dpiRowid_release() [PUBLIC]
130
- // Release a reference to the rowid.
131
- //-----------------------------------------------------------------------------
132
- int dpiRowid_release(dpiRowid *rowid)
133
- {
134
- return dpiGen__release(rowid, DPI_HTYPE_ROWID, __func__);
135
- }
136
-