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/src/njsPool.cpp DELETED
@@ -1,482 +0,0 @@
1
- /* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. */
2
-
3
- /******************************************************************************
4
- *
5
- * You may not use the identified files except in compliance with the Apache
6
- * License, Version 2.0 (the "License.")
7
- *
8
- * You may obtain a copy of the License at
9
- * http://www.apache.org/licenses/LICENSE-2.0.
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- *
15
- * See the License for the specific language governing permissions and
16
- * limitations under the License.
17
- *
18
- * This file uses NAN:
19
- *
20
- * Copyright (c) 2015 NAN contributors
21
- *
22
- * NAN contributors listed at https://github.com/rvagg/nan#contributors
23
- *
24
- * Permission is hereby granted, free of charge, to any person obtaining
25
- * a copy of this software and associated documentation files (the
26
- * "Software"), to deal in the Software without restriction, including
27
- * without limitation the rights to use, copy, modify, merge, publish,
28
- * distribute, sublicense, and/or sell copies of the Software, and to
29
- * permit persons to whom the Software is furnished to do so, subject to
30
- * the following conditions:
31
- *
32
- * The above copyright notice and this permission notice shall be
33
- * included in all copies or substantial portions of the Software.
34
- *
35
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
36
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
37
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
38
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
39
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
40
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
41
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
42
- *
43
- * NAME
44
- * njsPool.cpp
45
- *
46
- * DESCRIPTION
47
- * Pool class implementation.
48
- *
49
- *****************************************************************************/
50
-
51
- #include "node.h"
52
-
53
- #include <string>
54
-
55
- #include "njsOracle.h"
56
- #include "njsPool.h"
57
- #include "njsConnection.h"
58
-
59
- using namespace std;
60
- using namespace node;
61
- using namespace v8;
62
-
63
- // peristent Pool class handle
64
- Nan::Persistent<FunctionTemplate> njsPool::poolTemplate_s;
65
-
66
-
67
- //-----------------------------------------------------------------------------
68
- // njsPool::Init()
69
- // Initialization function of Pool class. Maps functions and properties
70
- // from JS to C++.
71
- //-----------------------------------------------------------------------------
72
- void njsPool::Init(Local<Object> target)
73
- {
74
- Nan::HandleScope scope;
75
-
76
- Local<FunctionTemplate> temp = Nan::New<FunctionTemplate>(New);
77
- temp->InstanceTemplate()->SetInternalFieldCount(1);
78
- temp->SetClassName(Nan::New<v8::String>("Pool").ToLocalChecked());
79
-
80
- Nan::SetPrototypeMethod(temp, "close", Close);
81
- Nan::SetPrototypeMethod(temp, "getConnection", GetConnection);
82
-
83
- Nan::SetAccessor(temp->InstanceTemplate(),
84
- Nan::New<v8::String>("poolMax").ToLocalChecked(),
85
- njsPool::GetPoolMax, njsPool::SetPoolMax);
86
- Nan::SetAccessor(temp->InstanceTemplate(),
87
- Nan::New<v8::String>("poolMin").ToLocalChecked(),
88
- njsPool::GetPoolMin, njsPool::SetPoolMin);
89
- Nan::SetAccessor(temp->InstanceTemplate(),
90
- Nan::New<v8::String>("poolIncrement").ToLocalChecked(),
91
- njsPool::GetPoolIncrement, njsPool::SetPoolIncrement);
92
- Nan::SetAccessor(temp->InstanceTemplate(),
93
- Nan::New<v8::String>("poolTimeout").ToLocalChecked(),
94
- njsPool::GetPoolTimeout, njsPool::SetPoolTimeout);
95
- Nan::SetAccessor(temp->InstanceTemplate(),
96
- Nan::New<v8::String>("connectionsOpen").ToLocalChecked(),
97
- njsPool::GetConnectionsOpen, njsPool::SetConnectionsOpen);
98
- Nan::SetAccessor(temp->InstanceTemplate(),
99
- Nan::New<v8::String>("connectionsInUse").ToLocalChecked(),
100
- njsPool::GetConnectionsInUse, njsPool::SetConnectionsInUse);
101
- Nan::SetAccessor(temp->InstanceTemplate(),
102
- Nan::New<v8::String>("stmtCacheSize").ToLocalChecked(),
103
- njsPool::GetStmtCacheSize, njsPool::SetStmtCacheSize);
104
- Nan::SetAccessor(temp->InstanceTemplate(),
105
- Nan::New<v8::String>("poolPingInterval").ToLocalChecked(),
106
- njsPool::GetPoolPingInterval, njsPool::SetPoolPingInterval);
107
-
108
- poolTemplate_s.Reset(temp);
109
- Nan::Set(target, Nan::New<v8::String>("Pool").ToLocalChecked(),
110
- temp->GetFunction());
111
- }
112
-
113
-
114
- //-----------------------------------------------------------------------------
115
- // njsPool::CreateFromBaton()
116
- // Create a new pool from the baton.
117
- //-----------------------------------------------------------------------------
118
- Local<Object> njsPool::CreateFromBaton(njsBaton *baton)
119
- {
120
- Nan::EscapableHandleScope scope;
121
- Local<Function> func;
122
- Local<Object> obj;
123
- njsPool *pool;
124
-
125
- func = Nan::GetFunction(
126
- Nan::New<FunctionTemplate>(poolTemplate_s)).ToLocalChecked();
127
- obj = Nan::NewInstance(func).ToLocalChecked();
128
- pool = Nan::ObjectWrap::Unwrap<njsPool>(obj);
129
- pool->dpiPoolHandle = baton->dpiPoolHandle;
130
- baton->dpiPoolHandle = NULL;
131
- pool->jsOracledb.Reset(baton->jsOracledb);
132
- pool->poolMax = baton->poolMax;
133
- pool->poolMin = baton->poolMin;
134
- pool->poolIncrement = baton->poolIncrement;
135
- pool->poolTimeout = baton->poolTimeout;
136
- pool->poolPingInterval = baton->poolPingInterval;
137
- pool->stmtCacheSize = baton->stmtCacheSize;
138
- pool->lobPrefetchSize = baton->lobPrefetchSize;
139
- return scope.Escape(obj);
140
- }
141
-
142
-
143
- //-----------------------------------------------------------------------------
144
- // njsPool::New()
145
- // Create new object accesible from JS. This is always called from within
146
- // njsPool::CreateFromBaton() and never from any external JS.
147
- //-----------------------------------------------------------------------------
148
- NAN_METHOD(njsPool::New)
149
- {
150
- njsPool *pool = new njsPool();
151
- pool->Wrap(info.Holder());
152
- info.GetReturnValue().Set(info.Holder());
153
- }
154
-
155
-
156
- //-----------------------------------------------------------------------------
157
- // njsPool::GetPoolMin()
158
- // Get accessor of "poolMin" property.
159
- //-----------------------------------------------------------------------------
160
- NAN_GETTER(njsPool::GetPoolMin)
161
- {
162
- njsPool *pool = (njsPool*) ValidateGetter(info);
163
- if (pool)
164
- info.GetReturnValue().Set(pool->poolMin);
165
- }
166
-
167
-
168
- //-----------------------------------------------------------------------------
169
- // njsPool::GetPoolMax()
170
- // Get accessor of "poolMax" property.
171
- //-----------------------------------------------------------------------------
172
- NAN_GETTER(njsPool::GetPoolMax)
173
- {
174
- njsPool *pool = (njsPool*) ValidateGetter(info);
175
- if (pool)
176
- info.GetReturnValue().Set(pool->poolMax);
177
- }
178
-
179
-
180
- //-----------------------------------------------------------------------------
181
- // njsPool::GetPoolIncrement()
182
- // Get accessor of "poolIncrement" property.
183
- //-----------------------------------------------------------------------------
184
- NAN_GETTER(njsPool::GetPoolIncrement)
185
- {
186
- njsPool *pool = (njsPool*) ValidateGetter(info);
187
- if (pool)
188
- info.GetReturnValue().Set(pool->poolIncrement);
189
- }
190
-
191
-
192
- //-----------------------------------------------------------------------------
193
- // njsPool::GetPoolTimeout()
194
- // Get accessor of "poolTimeout" property.
195
- //-----------------------------------------------------------------------------
196
- NAN_GETTER(njsPool::GetPoolTimeout)
197
- {
198
- njsPool *pool = (njsPool*) ValidateGetter(info);
199
- if (pool)
200
- info.GetReturnValue().Set(pool->poolTimeout);
201
- }
202
-
203
-
204
- //-----------------------------------------------------------------------------
205
- // njsPool::GetConnectionsOpen()
206
- // Get accessor of "connectionsOpen" property.
207
- //-----------------------------------------------------------------------------
208
- NAN_GETTER(njsPool::GetConnectionsOpen)
209
- {
210
- njsPool *pool = (njsPool*) ValidateGetter(info);
211
- if (!pool)
212
- return;
213
- if (!pool->IsValid()) {
214
- info.GetReturnValue().Set(Nan::Undefined());
215
- return;
216
- }
217
- uint32_t value;
218
- if (dpiPool_getOpenCount(pool->dpiPoolHandle, &value) < 0) {
219
- njsOracledb::ThrowDPIError();
220
- return;
221
- }
222
- info.GetReturnValue().Set(value);
223
- }
224
-
225
-
226
- //-----------------------------------------------------------------------------
227
- // njsPool::GetConnectionsInUse()
228
- // Get accessor of "connectionsInUse" property.
229
- //-----------------------------------------------------------------------------
230
- NAN_GETTER(njsPool::GetConnectionsInUse)
231
- {
232
- njsPool *pool = (njsPool*) ValidateGetter(info);
233
- if (!pool)
234
- return;
235
- if (!pool->IsValid()) {
236
- info.GetReturnValue().Set(Nan::Undefined());
237
- return;
238
- }
239
- uint32_t value;
240
- if (dpiPool_getBusyCount(pool->dpiPoolHandle, &value) < 0) {
241
- njsOracledb::ThrowDPIError();
242
- return;
243
- }
244
- info.GetReturnValue().Set(value);
245
- }
246
-
247
-
248
- //-----------------------------------------------------------------------------
249
- // njsPool::GetPoolPingInterval()
250
- // Get accessor of "poolPingInterval" property.
251
- //-----------------------------------------------------------------------------
252
- NAN_GETTER(njsPool::GetPoolPingInterval)
253
- {
254
- njsPool *pool = (njsPool*) ValidateGetter(info);
255
- if (pool)
256
- info.GetReturnValue().Set(pool->poolPingInterval);
257
- }
258
-
259
-
260
- //-----------------------------------------------------------------------------
261
- // njsPool::GetStmtCacheSize()
262
- // Get accessor of "stmtCacheSize" property.
263
- //-----------------------------------------------------------------------------
264
- NAN_GETTER(njsPool::GetStmtCacheSize)
265
- {
266
- njsPool *pool = (njsPool*) ValidateGetter(info);
267
- if (pool)
268
- info.GetReturnValue().Set(pool->stmtCacheSize);
269
- }
270
-
271
-
272
- //-----------------------------------------------------------------------------
273
- // njsPool::SetPoolMin()
274
- // Set accessor of "poolMin" property.
275
- //-----------------------------------------------------------------------------
276
- NAN_SETTER(njsPool::SetPoolMin)
277
- {
278
- PropertyIsReadOnly("poolMin");
279
- }
280
-
281
-
282
- //-----------------------------------------------------------------------------
283
- // njsPool::SetPoolMax()
284
- // Set accessor of "poolMax" property.
285
- //-----------------------------------------------------------------------------
286
- NAN_SETTER(njsPool::SetPoolMax)
287
- {
288
- PropertyIsReadOnly("poolMax");
289
- }
290
-
291
-
292
- //-----------------------------------------------------------------------------
293
- // njsPool::SetPoolIncrement()
294
- // Set accessor of "poolIncrement" property.
295
- //-----------------------------------------------------------------------------
296
- NAN_SETTER(njsPool::SetPoolIncrement)
297
- {
298
- PropertyIsReadOnly("poolIncrement");
299
- }
300
-
301
-
302
- //-----------------------------------------------------------------------------
303
- // njsPool::SetPoolTimeout()
304
- // Set accessor of "poolTimeout" property.
305
- //-----------------------------------------------------------------------------
306
- NAN_SETTER(njsPool::SetPoolTimeout)
307
- {
308
- PropertyIsReadOnly("poolTimeout");
309
- }
310
-
311
-
312
- //-----------------------------------------------------------------------------
313
- // njsPool::SetConnectionsOpen()
314
- // Set accessor of "connectionsOpen" property.
315
- //-----------------------------------------------------------------------------
316
- NAN_SETTER(njsPool::SetConnectionsOpen)
317
- {
318
- PropertyIsReadOnly("connectionsOpen");
319
- }
320
-
321
-
322
- //-----------------------------------------------------------------------------
323
- // njsPool::SetConnectionsInUse()
324
- // Set accessor of "connectionsInUse" property.
325
- //-----------------------------------------------------------------------------
326
- NAN_SETTER(njsPool::SetConnectionsInUse)
327
- {
328
- PropertyIsReadOnly("connectionsInUse");
329
- }
330
-
331
-
332
- //-----------------------------------------------------------------------------
333
- // njsPool::SetPoolPingInterval()
334
- // Set accessor of "stmtCacheSize" property.
335
- //-----------------------------------------------------------------------------
336
- NAN_SETTER(njsPool::SetPoolPingInterval)
337
- {
338
- PropertyIsReadOnly("poolPingInterval");
339
- }
340
-
341
-
342
- //-----------------------------------------------------------------------------
343
- // njsPool::SetStmtCacheSize()
344
- // Set accessor of "stmtCacheSize" property.
345
- //-----------------------------------------------------------------------------
346
- NAN_SETTER(njsPool::SetStmtCacheSize)
347
- {
348
- PropertyIsReadOnly("stmtCacheSize");
349
- }
350
-
351
-
352
- //-----------------------------------------------------------------------------
353
- // njsPool::GetConnection()
354
- // Get a connection from the pool and return it.
355
- //
356
- // PARAMETERS
357
- // - JS callback which will receive (error, connection)
358
- //-----------------------------------------------------------------------------
359
- NAN_METHOD(njsPool::GetConnection)
360
- {
361
- njsBaton *baton;
362
- njsPool *pool;
363
- Local<Object> connProps;
364
-
365
- pool = (njsPool*) ValidateArgs(info, 2, 2);
366
- if (!pool)
367
- return;
368
-
369
- /* Get optional connection properties: argument may have empty json */
370
- if (!pool->GetObjectArg(info, 0, connProps))
371
- return;
372
-
373
- baton = pool->CreateBaton(info);
374
- if (!baton)
375
- return;
376
- if (baton->error.empty()) {
377
- /* Connection Properties: If empty json, values will be empty */
378
- baton->GetStringFromJSON(connProps, "user", 0, baton->user);
379
- baton->GetStringFromJSON(connProps, "password", 0, baton->password);
380
-
381
- baton->jsOracledb.Reset(pool->jsOracledb);
382
- njsOracledb *oracledb = baton->GetOracledb();
383
- baton->connClass = oracledb->getConnectionClass();
384
- baton->lobPrefetchSize = pool->lobPrefetchSize;
385
- baton->SetDPIPoolHandle(pool->dpiPoolHandle);
386
- }
387
- baton->QueueWork("GetConnection", Async_GetConnection,
388
- Async_AfterGetConnection, 2);
389
- }
390
-
391
-
392
- //-----------------------------------------------------------------------------
393
- // njsPool::Async_GetConnection()
394
- // Worker function for njsPool::GetConnection() method.
395
- //-----------------------------------------------------------------------------
396
- void njsPool::Async_GetConnection(njsBaton *baton)
397
- {
398
- dpiConnCreateParams params;
399
- dpiContext *context;
400
-
401
- context = njsOracledb::GetDPIContext();
402
- if (dpiContext_initConnCreateParams(context, &params) < 0) {
403
- baton->GetDPIError();
404
- return;
405
- }
406
- if (!baton->connClass.empty()) {
407
- params.connectionClass = baton->connClass.c_str();
408
- params.connectionClassLength = baton->connClass.length();
409
- }
410
- if (dpiPool_acquireConnection(baton->dpiPoolHandle,
411
- baton->user.empty() ?
412
- NULL : baton->user.c_str(),
413
- baton->user.empty() ?
414
- 0 : baton->user.length(),
415
- baton->password.empty () ?
416
- NULL : baton->password.c_str(),
417
- baton->password.empty () ?
418
- 0 : baton->password.length(),
419
- &params, &baton->dpiConnHandle) < 0)
420
- baton->GetDPIError();
421
- }
422
-
423
-
424
- //-----------------------------------------------------------------------------
425
- // njsPool::Async_AfterGetConnection()
426
- // Sets up the arguments for the callback to JS. The connection object is
427
- // created and passed as the second argument. The first argument is the error
428
- // and at this point it is known that no error has taken place.
429
- //-----------------------------------------------------------------------------
430
- void njsPool::Async_AfterGetConnection(njsBaton *baton, Local<Value> argv[])
431
- {
432
- argv[1] = njsConnection::CreateFromBaton(baton);
433
- }
434
-
435
-
436
- //-----------------------------------------------------------------------------
437
- // njsPool::Close()
438
- // Close the pool. The reference to the DPI handle is transferred to the
439
- // baton so that it will cleared automatically upon success and so that the
440
- // pool is marked as invalid immediately.
441
- //
442
- // PARAMETERS
443
- // - JS callback which will receive (error)
444
- //-----------------------------------------------------------------------------
445
- NAN_METHOD(njsPool::Close)
446
- {
447
- njsBaton *baton;
448
- njsPool *pool;
449
-
450
- pool = (njsPool*) ValidateArgs(info, 2, 2);
451
- if (!pool)
452
- return;
453
- baton = pool->CreateBaton(info);
454
- if (!baton)
455
- return;
456
- baton->GetBoolFromJSON(info[0].As<Object>(), "forceClose", 0,
457
- &baton->force);
458
-
459
- baton->dpiPoolHandle = pool->dpiPoolHandle;
460
- pool->dpiPoolHandle = NULL;
461
- baton->QueueWork("Close", Async_Close, NULL, 1);
462
- }
463
-
464
-
465
- //-----------------------------------------------------------------------------
466
- // njsPool::Async_Close()
467
- // Worker function for njsPool::Close() method. If the attempt to
468
- // close the pool fails, the reference to the DPI handle is transferred back
469
- // from the baton to the pool.
470
- //-----------------------------------------------------------------------------
471
- void njsPool::Async_Close(njsBaton *baton)
472
- {
473
- dpiPoolCloseMode mode = (baton->force) ? DPI_MODE_POOL_CLOSE_FORCE :
474
- DPI_MODE_POOL_CLOSE_DEFAULT;
475
- if (dpiPool_close(baton->dpiPoolHandle, mode) < 0) {
476
- njsPool *pool = (njsPool*) baton->callingObj;
477
- pool->dpiPoolHandle = baton->dpiPoolHandle;
478
- baton->dpiPoolHandle = NULL;
479
- baton->GetDPIError();
480
- }
481
- }
482
-
package/src/njsPool.h DELETED
@@ -1,132 +0,0 @@
1
- /* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. */
2
-
3
- /******************************************************************************
4
- *
5
- * You may not use the identified files except in compliance with the Apache
6
- * License, Version 2.0 (the "License.")
7
- *
8
- * You may obtain a copy of the License at
9
- * http://www.apache.org/licenses/LICENSE-2.0.
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- *
15
- * See the License for the specific language governing permissions and
16
- * limitations under the License.
17
- *
18
- * This file uses NAN:
19
- *
20
- * Copyright (c) 2015 NAN contributors
21
- *
22
- * NAN contributors listed at https://github.com/rvagg/nan#contributors
23
- *
24
- * Permission is hereby granted, free of charge, to any person obtaining
25
- * a copy of this software and associated documentation files (the
26
- * "Software"), to deal in the Software without restriction, including
27
- * without limitation the rights to use, copy, modify, merge, publish,
28
- * distribute, sublicense, and/or sell copies of the Software, and to
29
- * permit persons to whom the Software is furnished to do so, subject to
30
- * the following conditions:
31
- *
32
- * The above copyright notice and this permission notice shall be
33
- * included in all copies or substantial portions of the Software.
34
- *
35
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
36
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
37
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
38
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
39
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
40
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
41
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
42
- *
43
- * NAME
44
- * njsPool.h
45
- *
46
- * DESCRIPTION
47
- * Pool class
48
- *
49
- *****************************************************************************/
50
-
51
- #ifndef __NJSPOOL_H__
52
- #define __NJSPOOL_H__
53
-
54
- #include "njsOracle.h"
55
- #include <node.h>
56
- #include "nan.h"
57
- #include <string>
58
-
59
- using namespace v8;
60
- using namespace node;
61
-
62
-
63
- //-----------------------------------------------------------------------------
64
- // njsPool
65
- // Class exposed to JS for handling session pools.
66
- //-----------------------------------------------------------------------------
67
- class njsPool: public njsCommon {
68
- public:
69
-
70
- static void Init(Local<Object> target);
71
- static Local<Object> CreateFromBaton(njsBaton *baton);
72
- bool IsValid() const { return (dpiPoolHandle) ? true : false; }
73
- njsErrorType GetInvalidErrorType() const { return errInvalidPool; }
74
-
75
- private:
76
-
77
- static NAN_METHOD(New);
78
-
79
- // Get Connection Methods
80
- static NAN_METHOD(GetConnection);
81
- static void Async_GetConnection(njsBaton *baton);
82
- static void Async_AfterGetConnection(njsBaton *baton, Local<Value> argv[]);
83
-
84
- // Close Methods
85
- static NAN_METHOD(Close);
86
- static void Async_Close(njsBaton *baton);
87
-
88
- // Define Getter Accessors to properties
89
- static NAN_GETTER(GetPoolMax);
90
- static NAN_GETTER(GetPoolMin);
91
- static NAN_GETTER(GetPoolIncrement);
92
- static NAN_GETTER(GetPoolPingInterval);
93
- static NAN_GETTER(GetPoolTimeout);
94
- static NAN_GETTER(GetConnectionsOpen);
95
- static NAN_GETTER(GetConnectionsInUse);
96
- static NAN_GETTER(GetStmtCacheSize);
97
-
98
- // Define Setter Accessors to properties
99
- static NAN_SETTER(SetPoolMax);
100
- static NAN_SETTER(SetPoolMin);
101
- static NAN_SETTER(SetPoolIncrement);
102
- static NAN_SETTER(SetPoolPingInterval);
103
- static NAN_SETTER(SetPoolTimeout);
104
- static NAN_SETTER(SetConnectionsOpen);
105
- static NAN_SETTER(SetConnectionsInUse);
106
- static NAN_SETTER(SetStmtCacheSize);
107
-
108
- njsPool() : dpiPoolHandle(NULL), poolMin(0), poolMax(0), poolIncrement(0),
109
- poolTimeout(0), stmtCacheSize(0), lobPrefetchSize(0),
110
- poolPingInterval(0) {}
111
- ~njsPool() {
112
- jsOracledb.Reset();
113
- if (dpiPoolHandle) {
114
- dpiPool_release(dpiPoolHandle);
115
- dpiPoolHandle = NULL;
116
- }
117
- }
118
-
119
- dpiPool *dpiPoolHandle;
120
- Nan::Persistent<Object> jsOracledb;
121
- uint32_t poolMin;
122
- uint32_t poolMax;
123
- uint32_t poolIncrement;
124
- uint32_t poolTimeout;
125
- uint32_t stmtCacheSize;
126
- uint32_t lobPrefetchSize;
127
- int32_t poolPingInterval;
128
-
129
- static Nan::Persistent<FunctionTemplate> poolTemplate_s ;
130
- };
131
-
132
- #endif /* __NJSPOOL_H__ */