oracledb 2.2.0 → 2.3.0

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.
@@ -26,7 +26,8 @@ REM ****************************************************************************
26
26
 
27
27
  REM
28
28
  REM usage: MAKEPKG.BAT [<cmd>]
29
- REM : Possible values for <cmd> are: CLEANUP and CREATEBINARY
29
+ REM : Possible values for <cmd> are: CLEANUP, CREATEBINARY
30
+ REM and CREATESTAGEBINARY
30
31
  REM
31
32
  REM expected to run this batch file from package sub-directory,
32
33
  REM where a fresh clone is created.
@@ -38,6 +39,7 @@ if "%1" == "" GOTO usage
38
39
  REM jump to appropriate sections based on <cmd>
39
40
  if "%1" == "CLEANUP" GOTO cleanup
40
41
  if "%1" == "CREATEBINARY" GOTO createbinary
42
+ if "%1" == "CREATESTAGEBINARY" GOTO createstagebinary
41
43
  goto usage
42
44
 
43
45
  REM cleanup section, remove file(s) created by this batch file
@@ -47,6 +49,67 @@ del ..\package-lock.json
47
49
  del SHASUMS256.txt oracledb-v*-node-*.gz
48
50
  goto exit
49
51
 
52
+
53
+ REM compile, package to gz file
54
+ :createstagebinary
55
+ echo "createstagebinary section"
56
+
57
+ REM Append SHA to LICENSE.MD
58
+ git checkout ..\LICENSE.md
59
+ setlocal enabledelayedexpansion
60
+ REM compose a string with commands to execute one by one
61
+
62
+ REM start with empty string
63
+ set CONCAT_STR=
64
+ REM capture SHA
65
+ FOR /F "tokens=* USEBACKQ" %%F IN (`git --git-dir=..\.git rev-parse HEAD`) DO (
66
+ SET CONCAT_STR=%%F
67
+ )
68
+
69
+ set DATE_STR=
70
+ FOR /F "tokens=* USEBACKQ" %%F IN (`DATE /T`) DO ( SET DATE_STR=%%F )
71
+
72
+ REM append output of other commands
73
+ set CMD_STR="git --git-dir=..\odpi\.git rev-parse HEAD && node --version"
74
+ for /f %%i in ('%CMD_STR%') do set "CONCAT_STR=!CONCAT_STR! %%i"
75
+ set CONCAT_STR=!CONCAT_STR! !DATE_STR!
76
+ echo !CONCAT_STR! >> ..\LICENSE.MD
77
+
78
+ REM Compile node-oracledb
79
+ cd ..
80
+ CALL npm install
81
+ echo "NODE oracledb compiled"
82
+ cd package
83
+ echo "==> Staging Binary package created for Node.js "
84
+
85
+ Set "hostname=%NODE_ORACLEDB_PACKAGE_HOSTNAME%"
86
+ Set "pathname=%NODE_ORACLEDB_PACKAGE_URL_PATH%"
87
+ Set "newname=%NODE_PKG_HOSTNAME%"
88
+ echo ON
89
+ echo %hostname%
90
+ echo %pathname%
91
+ echo %newname%
92
+
93
+ sed "s/github.com/%hostname%/g" oracledbinstall.js
94
+ sed "s/oracle\/node-oracledb\/releases\/download\//%pathname%/g" oracledbinstall.js
95
+
96
+ del /S *.gz
97
+
98
+ node createpackage.js
99
+ xcopy /Y "package.json" "../package.json"
100
+ npm pack
101
+ Setlocal enabledelayedexpansion
102
+
103
+ Set "Pattern=oracledb"
104
+ Set "Replace=oracledb-staging"
105
+
106
+ For %%a in (*.gz) Do (
107
+ Set "File=%%~a"
108
+ Ren "%%a" "!File:%Pattern%=%Replace%!"
109
+ )
110
+
111
+ goto exit
112
+
50
113
  REM compile, package to gz file
51
114
  :createbinary
52
115
  echo "createbinary section"
package/package/README.md CHANGED
@@ -76,7 +76,7 @@ Installation is described in [INSTALL](https://oracle.github.io/node-oracledb/IN
76
76
  before running `make`.
77
77
 
78
78
  - `oracledb-src-X.Y.Z.tgz` which is the complete source code, mainly
79
- created because older npm's (e.g. with Node 4) do not download the
79
+ created because older npm's (e.g. with Node.js 4) do not download the
80
80
  opdi submodule code when installing from a GitHub tag or branch.
81
81
 
82
82
  - The`staging-oracledb-X.Y.Z.tgz` package can be used to host binaries
@@ -98,6 +98,9 @@ Installation is described in [INSTALL](https://oracle.github.io/node-oracledb/IN
98
98
  Remember to do `npm config delete strict-ssl` and unset the
99
99
  environment variable when not testing.
100
100
 
101
+ - On Windows, MAKEPKG.BAT has command options to create binaries, and
102
+ also to create staged binaries and the main packages.
103
+
101
104
  - At install time, setting the environment variable
102
105
  `NODE_ORACLEDB_TRACE_INSTALL` to `TRUE` will cause `npm install` to
103
106
  display more tracing information.
@@ -108,4 +111,5 @@ Installation is described in [INSTALL](https://oracle.github.io/node-oracledb/IN
108
111
  - TODO
109
112
 
110
113
  - oracledbinstall.js should cache SHASUMS256.txt so it doesn't have to be fetched twice.
114
+ - Add support for proxies that require authentication
111
115
  - Improve oracledbinstall.js `no_proxy` support for domain names and wildcards.
@@ -343,7 +343,7 @@ function done(err, alreadyInstalled) {
343
343
  packageUtil.error('Pre-built binary packages are not available for platform="' + process.platform + '"');
344
344
  } else if (process.arch !== 'x64') {
345
345
  packageUtil.error('Pre-built binary packages are not available for architecture="' + process.arch + '"');
346
- } else if (['46', '48', '57', '59'].indexOf(process.versions.modules) < 0) {
346
+ } else if (['48', '57', '64'].indexOf(process.versions.modules) < 0) {
347
347
  packageUtil.error('Pre-built binary packages are not available for this version of Node.js (NODE_MODULE_VERSION="' + process.versions.modules + '")');
348
348
  }
349
349
  packageUtil.error('Failed to install binary package ' + packageUtil.dynamicProps.PACKAGE_FILE_NAME);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "oracledb",
3
- "version": "2.2.0",
4
- "description": "Oracle Database driver by Oracle Corp.",
3
+ "version": "2.3.0",
4
+ "description": "A Node.js module for Oracle Database access",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "http://oracle.github.io/node-oracledb/",
7
7
  "keywords": [
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "oracledb",
3
- "version": "2.2.0",
4
- "description": "Oracle Database driver by Oracle Corp.",
3
+ "version": "2.3.0",
4
+ "description": "A Node.js module for Oracle Database access",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "http://oracle.github.io/node-oracledb/",
7
7
  "keywords": [
package/src/njsCommon.cpp CHANGED
@@ -52,6 +52,7 @@
52
52
  #include "njsCommon.h"
53
53
  #include "njsOracle.h"
54
54
  #include "njsIntLob.h"
55
+ #include "njsSubscription.h"
55
56
 
56
57
  using namespace node;
57
58
  using namespace std;
@@ -193,6 +194,7 @@ njsBaton::~njsBaton()
193
194
  jsCallback.Reset();
194
195
  jsCallingObj.Reset();
195
196
  jsOracledb.Reset();
197
+ jsSubscription.Reset();
196
198
  jsBuffer.Reset();
197
199
  ClearAsyncData();
198
200
  }
@@ -209,7 +211,7 @@ void njsBaton::CheckJSException(Nan::TryCatch *tryCatch)
209
211
  {
210
212
  if (tryCatch->HasCaught()) {
211
213
  Local<String> message = tryCatch->Message()->Get();
212
- v8::String::Utf8Value v8str(message->ToString());
214
+ Nan::Utf8String v8str(message->ToString());
213
215
  error = std::string(*v8str, static_cast<size_t>(v8str.length()));
214
216
  tryCatch->Reset();
215
217
  }
@@ -239,6 +241,10 @@ void njsBaton::ClearAsyncData()
239
241
  dpiLob_release(dpiLobHandle);
240
242
  dpiLobHandle = NULL;
241
243
  }
244
+ if (dpiSubscrHandle) {
245
+ dpiSubscr_release(dpiSubscrHandle);
246
+ dpiSubscrHandle = NULL;
247
+ }
242
248
  if (bindVars) {
243
249
  delete [] bindVars;
244
250
  bindVars = NULL;
@@ -357,8 +363,11 @@ void njsBaton::AsyncAfterWorkCallback(uv_work_t *req, int status)
357
363
  delete baton;
358
364
 
359
365
  // make JS callback
360
- Nan::MakeCallback(Nan::GetCurrentContext()->Global(), callback,
361
- static_cast<int>(numCallbackArgs), callbackArgs);
366
+ Nan::AsyncResource *asyncResource =
367
+ new Nan::AsyncResource("node-oracledb");
368
+ asyncResource->runInAsyncScope(Nan::GetCurrentContext()->Global(),
369
+ callback, static_cast<int>(numCallbackArgs), callbackArgs);
370
+ delete asyncResource;
362
371
 
363
372
  // we no longer need the callback args
364
373
  delete [] callbackArgs;
@@ -440,6 +449,19 @@ void njsBaton::SetDPILobHandle(dpiLob *handle)
440
449
  }
441
450
 
442
451
 
452
+ //-----------------------------------------------------------------------------
453
+ // njsBaton::SetDPISubscrHandle()
454
+ // Set the DPI subscription handle. This adds a reference to the DPI
455
+ // subscription which will be released in the destructor.
456
+ //-----------------------------------------------------------------------------
457
+ void njsBaton::SetDPISubscrHandle(dpiSubscr *handle)
458
+ {
459
+ if (dpiSubscr_addRef(handle) < 0)
460
+ GetDPIError();
461
+ else dpiSubscrHandle = handle;
462
+ }
463
+
464
+
443
465
  //-----------------------------------------------------------------------------
444
466
  // njsBaton::GetBoolFromJSON()
445
467
  // Gets a boolean value from the JSON object for the given key, if possible.
@@ -479,6 +501,34 @@ bool njsBaton::GetBoolFromJSON(Local<Object> obj, const char *key, int index,
479
501
  }
480
502
 
481
503
 
504
+ //-----------------------------------------------------------------------------
505
+ // njsBaton::GetFunctionFromJSON()
506
+ // Gets a function from the JSON object for the given key, if possible. If
507
+ // undefined, leave value alone and do not set error; otherwise, set error.
508
+ // Index is the argument index in the caller.
509
+ //-----------------------------------------------------------------------------
510
+ bool njsBaton::GetFunctionFromJSON(Local<Object> obj, const char *key,
511
+ int index, Local<Function> *value)
512
+ {
513
+ Nan::EscapableHandleScope scope;
514
+ Local<Value> jsValue;
515
+
516
+ if (!error.empty())
517
+ return false;
518
+ MaybeLocal<Value> mval = Nan::Get(obj, Nan::New(key).ToLocalChecked());
519
+ if (!mval.ToLocal(&jsValue))
520
+ return false;
521
+ if (jsValue->IsFunction()) {
522
+ *value = scope.Escape(jsValue.As<Function>());
523
+ return true;
524
+ } else if (jsValue->IsUndefined()) {
525
+ return true;
526
+ }
527
+ error = njsMessages::Get(errInvalidPropertyTypeInParam, key, index + 1);
528
+ return false;
529
+ }
530
+
531
+
482
532
  //-----------------------------------------------------------------------------
483
533
  // njsBaton::GetIntFromJSON()
484
534
  // Gets a signed integer value from the JSON object for the given key, if
@@ -557,7 +607,7 @@ bool njsBaton::GetStringFromJSON(Local<Object> obj, const char *key, int index,
557
607
  return false;
558
608
 
559
609
  if (jsValue->IsString()) {
560
- v8::String::Utf8Value utf8str(jsValue->ToString());
610
+ Nan::Utf8String utf8str(jsValue->ToString());
561
611
  value = std::string(*utf8str, static_cast<size_t>(utf8str.length()));
562
612
  return true;
563
613
  } else if (jsValue->IsUndefined()) {
@@ -711,7 +761,7 @@ bool njsCommon::GetStringArg(Nan::NAN_METHOD_ARGS_TYPE args,
711
761
  Nan::ThrowError(errMsg.c_str());
712
762
  return false;
713
763
  }
714
- v8::String::Utf8Value utf8str(args[index]->ToString());
764
+ Nan::Utf8String utf8str(args[index]->ToString());
715
765
  value = std::string(*utf8str, static_cast<size_t>(utf8str.length()));
716
766
  return true;
717
767
  }
@@ -806,7 +856,7 @@ bool njsCommon::SetPropString(Local<Value> value, std::string *valuePtr,
806
856
  Nan::ThrowError(errMsg.c_str());
807
857
  return false;
808
858
  }
809
- v8::String::Utf8Value utfstr(value->ToString());
859
+ Nan::Utf8String utfstr(value->ToString());
810
860
  *valuePtr = std::string(*utfstr, static_cast<size_t>(utfstr.length()));
811
861
  return true;
812
862
  }
package/src/njsCommon.h CHANGED
@@ -72,6 +72,7 @@ using namespace node;
72
72
  class njsBaton;
73
73
  class njsOracledb;
74
74
  class njsProtoILob;
75
+ class njsSubscription;
75
76
 
76
77
  //-----------------------------------------------------------------------------
77
78
  // njsBindDir
@@ -267,6 +268,8 @@ public:
267
268
  std::string connectString;
268
269
  std::string connClass;
269
270
  std::string edition;
271
+ std::string ipAddress;
272
+ std::string name;
270
273
  uint32_t poolMin;
271
274
  uint32_t poolMax;
272
275
  uint32_t poolIncrement;
@@ -276,6 +279,7 @@ public:
276
279
  dpiConn *dpiConnHandle;
277
280
  dpiStmt *dpiStmtHandle;
278
281
  dpiLob *dpiLobHandle;
282
+ dpiSubscr *dpiSubscrHandle;
279
283
  dpiStmtInfo stmtInfo;
280
284
  uint32_t stmtCacheSize;
281
285
  uint32_t lobPrefetchSize;
@@ -299,6 +303,7 @@ public:
299
303
  njsDataType *fetchAsBufferTypes;
300
304
  njsProtoILob *protoILob;
301
305
  bool externalAuth;
306
+ bool homogeneous; // True: one user, false: multiple user
302
307
  bool getRS;
303
308
  bool autoCommit;
304
309
  bool extendedMetaData;
@@ -313,32 +318,44 @@ public:
313
318
  uint64_t lobAmount;
314
319
  uint32_t numRowCounts;
315
320
  uint64_t *rowCounts;
321
+ uint32_t timeout;
322
+ uint32_t qos;
323
+ uint32_t operations;
316
324
  uint32_t numBatchErrorInfos;
317
325
  dpiErrorInfo *batchErrorInfos;
318
326
  dpiErrorInfo errorInfo;
319
327
  bool dpiError;
328
+ uint32_t portNumber;
329
+ uint32_t subscrGroupingClass;
330
+ uint32_t subscrGroupingValue;
331
+ uint32_t subscrGroupingType;
332
+ njsSubscription *subscription;
320
333
  njsCommon *callingObj;
321
334
  Nan::Persistent<Object> jsCallingObj;
322
335
  Nan::Persistent<Object> jsOracledb;
323
336
  Nan::Persistent<Object> jsBuffer;
337
+ Nan::Persistent<Object> jsSubscription;
324
338
  Nan::Persistent<Function> jsCallback;
325
339
 
326
340
  njsBaton(Local<Function> callback, Local<Object> callingObj) :
327
341
  poolMin(0), poolMax(0), poolIncrement(0), poolTimeout(0),
328
342
  poolPingInterval(0), dpiPoolHandle(NULL), dpiConnHandle(NULL),
329
- dpiStmtHandle(NULL), dpiLobHandle(NULL), stmtCacheSize(0),
330
- lobPrefetchSize(0), maxRows(0), bindArraySize(1),
343
+ dpiStmtHandle(NULL), dpiLobHandle(NULL), dpiSubscrHandle(NULL),
344
+ stmtCacheSize(0), lobPrefetchSize(0), maxRows(0), bindArraySize(1),
331
345
  fetchArraySize(0), privilege(0), rowsFetched(0), bufferRowIndex(0),
332
346
  rowsAffected(0), outFormat(0), numQueryVars(0), queryVars(NULL),
333
347
  numBindVars(0), bindVars(NULL), numFetchInfo(0), fetchInfo(NULL),
334
348
  numFetchAsStringTypes(0), fetchAsStringTypes(NULL),
335
349
  numFetchAsBufferTypes(0), fetchAsBufferTypes(NULL),
336
- protoILob(NULL), externalAuth(false), getRS(false),
337
- autoCommit(false), extendedMetaData(false), isReturning(false),
338
- isPLSQL(false), events(false), batchErrors(false),
339
- dmlRowCounts(false), bufferSize(0), bufferPtr(NULL), lobOffset(0),
340
- lobAmount(0), numRowCounts(0), rowCounts(NULL),
341
- numBatchErrorInfos(0), batchErrorInfos(NULL), dpiError(false) {
350
+ protoILob(NULL), externalAuth(false), homogeneous(true),
351
+ getRS(false), autoCommit(false), extendedMetaData(false),
352
+ isReturning(false), isPLSQL(false), events(false),
353
+ batchErrors(false), dmlRowCounts(false), bufferSize(0),
354
+ bufferPtr(NULL), lobOffset(0), lobAmount(0), numRowCounts(0),
355
+ rowCounts(NULL), timeout(0), qos(0), operations(0),
356
+ numBatchErrorInfos(0), batchErrorInfos(NULL), dpiError(false),
357
+ portNumber(0), subscrGroupingClass(0), subscrGroupingValue(0),
358
+ subscrGroupingType(0), subscription(NULL) {
342
359
  this->jsCallback.Reset(callback);
343
360
  this->jsCallingObj.Reset(callingObj);
344
361
  this->callingObj = Nan::ObjectWrap::Unwrap<njsCommon>(callingObj);
@@ -363,10 +380,13 @@ public:
363
380
  void SetDPIPoolHandle(dpiPool *handle);
364
381
  void SetDPIStmtHandle(dpiStmt *handle);
365
382
  void SetDPILobHandle(dpiLob *handle);
383
+ void SetDPISubscrHandle(dpiSubscr *handle);
366
384
 
367
385
  // methods for getting values from JSON
368
386
  bool GetBoolFromJSON(Local<Object> obj, const char *key, int index,
369
387
  bool *value);
388
+ bool GetFunctionFromJSON(Local<Object> obj, const char *key, int index,
389
+ Local<Function> *value);
370
390
  bool GetStringFromJSON(Local<Object> obj, const char *key, int index,
371
391
  string &value);
372
392
  bool GetPositiveIntFromJSON(Local<Object> obj, const char *key, int index,