oracledb 2.1.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.
Files changed (52) hide show
  1. package/CHANGELOG.md +174 -54
  2. package/LICENSE.md +52 -18
  3. package/README.md +35 -68
  4. package/binding.gyp +5 -4
  5. package/lib/connection.js +164 -14
  6. package/lib/oracledb.js +160 -11
  7. package/lib/pool.js +33 -22
  8. package/lib/querystream.js +3 -2
  9. package/lib/rel.txt +1 -1
  10. package/odpi/LICENSE.md +1 -1
  11. package/odpi/README.md +25 -84
  12. package/odpi/embed/README.md +1 -1
  13. package/odpi/include/dpi.h +51 -7
  14. package/odpi/src/dpiConn.c +78 -9
  15. package/odpi/src/dpiContext.c +24 -10
  16. package/odpi/src/dpiEnv.c +5 -1
  17. package/odpi/src/dpiError.c +4 -0
  18. package/odpi/src/dpiErrorMessages.h +6 -4
  19. package/odpi/src/dpiImpl.h +125 -68
  20. package/odpi/src/dpiMsgProps.c +33 -0
  21. package/odpi/src/dpiObject.c +17 -10
  22. package/odpi/src/dpiObjectType.c +1 -1
  23. package/odpi/src/dpiOci.c +55 -40
  24. package/odpi/src/dpiOracleType.c +2 -2
  25. package/odpi/src/dpiPool.c +88 -18
  26. package/odpi/src/dpiStmt.c +57 -36
  27. package/odpi/src/dpiSubscr.c +117 -9
  28. package/odpi/src/dpiUtils.c +20 -9
  29. package/odpi/src/dpiVar.c +504 -430
  30. package/package/MAKEPKG.BAT +64 -1
  31. package/package/README.md +9 -5
  32. package/package/createpackage.js +2 -2
  33. package/package/extractpackage.js +2 -1
  34. package/package/oracledbinstall.js +19 -19
  35. package/package/package.json +4 -4
  36. package/package.json +4 -4
  37. package/src/njsCommon.cpp +94 -10
  38. package/src/njsCommon.h +73 -21
  39. package/src/njsConnection.cpp +1425 -458
  40. package/src/njsConnection.h +68 -19
  41. package/src/njsIntLob.cpp +5 -1
  42. package/src/njsIntLob.h +1 -1
  43. package/src/njsMessages.cpp +9 -2
  44. package/src/njsMessages.h +9 -2
  45. package/src/njsOracle.cpp +213 -23
  46. package/src/njsOracle.h +18 -2
  47. package/src/njsPool.cpp +32 -14
  48. package/src/njsPool.h +4 -4
  49. package/src/njsResultSet.cpp +4 -3
  50. package/src/njsResultSet.h +1 -1
  51. package/src/njsSubscription.cpp +388 -0
  52. package/src/njsSubscription.h +111 -0
package/src/njsCommon.h CHANGED
@@ -72,17 +72,17 @@ using namespace node;
72
72
  class njsBaton;
73
73
  class njsOracledb;
74
74
  class njsProtoILob;
75
+ class njsSubscription;
75
76
 
76
77
  //-----------------------------------------------------------------------------
77
- // njsBindType
78
- // User defined bind types.
78
+ // njsBindDir
79
+ // User defined bind directions.
79
80
  //-----------------------------------------------------------------------------
80
81
  typedef enum {
81
- NJS_BIND_UNKNOWN = -1,
82
82
  NJS_BIND_IN = 3001,
83
83
  NJS_BIND_INOUT = 3002,
84
84
  NJS_BIND_OUT = 3003
85
- } njsBindType;
85
+ } njsBindDir;
86
86
 
87
87
 
88
88
  //-----------------------------------------------------------------------------
@@ -90,7 +90,6 @@ typedef enum {
90
90
  // Values used for "outFormat".
91
91
  //-----------------------------------------------------------------------------
92
92
  typedef enum {
93
- NJS_ROWS_UNKNOWN = -1,
94
93
  NJS_ROWS_ARRAY = 4001,
95
94
  NJS_ROWS_OBJECT = 4002
96
95
  } njsRowsType;
@@ -144,9 +143,24 @@ typedef enum {
144
143
  } njsDBType;
145
144
 
146
145
 
146
+ //-----------------------------------------------------------------------------
147
+ // njsVariableBuffer
148
+ // Class used for keeping track of ODPI-C buffers and proto ILob objects.
149
+ //-----------------------------------------------------------------------------
150
+ class njsVariableBuffer {
151
+ public:
152
+ uint32_t numElements;
153
+ dpiData *dpiVarData;
154
+ njsProtoILob *lobs;
155
+
156
+ njsVariableBuffer() : numElements(0), dpiVarData(NULL), lobs(NULL) {}
157
+ ~njsVariableBuffer();
158
+ };
159
+
160
+
147
161
  //-----------------------------------------------------------------------------
148
162
  // njsVariable
149
- // Class used for keeping track of variables used for fetching data.
163
+ // Class used for keeping track of variables used for binding/fetching data.
150
164
  //-----------------------------------------------------------------------------
151
165
  class njsVariable {
152
166
  public:
@@ -156,8 +170,8 @@ public:
156
170
  dpiOracleTypeNum varTypeNum;
157
171
  dpiNativeTypeNum nativeTypeNum;
158
172
  dpiVar *dpiVarHandle;
159
- dpiData *dpiVarData;
160
- uint32_t bindDir;
173
+ njsBindDir bindDir;
174
+ njsDataType bindDataType;
161
175
  uint32_t maxArraySize;
162
176
  uint32_t maxSize;
163
177
  uint32_t dbSizeInBytes;
@@ -165,16 +179,18 @@ public:
165
179
  int8_t scale;
166
180
  bool isArray;
167
181
  bool isNullable;
168
- njsProtoILob *lobs;
182
+ njsVariableBuffer buffer;
183
+ njsVariableBuffer* dmlReturningBuffers;
169
184
  uint32_t numQueryVars;
170
185
  njsVariable *queryVars;
171
186
 
172
187
  njsVariable() : pos(0), dbTypeNum(DPI_ORACLE_TYPE_VARCHAR),
173
188
  varTypeNum(DPI_ORACLE_TYPE_VARCHAR),
174
189
  nativeTypeNum(DPI_NATIVE_TYPE_BYTES), dpiVarHandle(NULL),
175
- dpiVarData(NULL), bindDir(0), maxArraySize(0), maxSize(0),
176
- dbSizeInBytes(0), precision(0), scale(0), isArray(false),
177
- isNullable(false), lobs(NULL), numQueryVars(0), queryVars(NULL) {}
190
+ bindDir(NJS_BIND_IN), bindDataType(NJS_DATATYPE_DEFAULT),
191
+ maxArraySize(0), maxSize(0), dbSizeInBytes(0), precision(0),
192
+ scale(0), isArray(false), isNullable(false),
193
+ dmlReturningBuffers(NULL), numQueryVars(0), queryVars(NULL) {}
178
194
  ~njsVariable();
179
195
  njsDataType DataType();
180
196
  njsDBType DBType();
@@ -248,8 +264,12 @@ public:
248
264
  std::string sql;
249
265
  std::string user;
250
266
  std::string password;
267
+ std::string newPassword;
251
268
  std::string connectString;
252
269
  std::string connClass;
270
+ std::string edition;
271
+ std::string ipAddress;
272
+ std::string name;
253
273
  uint32_t poolMin;
254
274
  uint32_t poolMax;
255
275
  uint32_t poolIncrement;
@@ -259,9 +279,12 @@ public:
259
279
  dpiConn *dpiConnHandle;
260
280
  dpiStmt *dpiStmtHandle;
261
281
  dpiLob *dpiLobHandle;
282
+ dpiSubscr *dpiSubscrHandle;
283
+ dpiStmtInfo stmtInfo;
262
284
  uint32_t stmtCacheSize;
263
285
  uint32_t lobPrefetchSize;
264
286
  uint32_t maxRows;
287
+ uint32_t bindArraySize;
265
288
  uint32_t fetchArraySize;
266
289
  uint32_t privilege;
267
290
  uint32_t rowsFetched;
@@ -280,36 +303,59 @@ public:
280
303
  njsDataType *fetchAsBufferTypes;
281
304
  njsProtoILob *protoILob;
282
305
  bool externalAuth;
306
+ bool homogeneous; // True: one user, false: multiple user
283
307
  bool getRS;
284
308
  bool autoCommit;
285
309
  bool extendedMetaData;
286
310
  bool isReturning;
287
311
  bool isPLSQL;
312
+ bool events;
313
+ bool batchErrors;
314
+ bool dmlRowCounts;
288
315
  uint64_t bufferSize;
289
316
  char *bufferPtr;
290
317
  uint64_t lobOffset;
291
318
  uint64_t lobAmount;
319
+ uint32_t numRowCounts;
320
+ uint64_t *rowCounts;
321
+ uint32_t timeout;
322
+ uint32_t qos;
323
+ uint32_t operations;
324
+ uint32_t numBatchErrorInfos;
325
+ dpiErrorInfo *batchErrorInfos;
292
326
  dpiErrorInfo errorInfo;
293
327
  bool dpiError;
328
+ uint32_t portNumber;
329
+ uint32_t subscrGroupingClass;
330
+ uint32_t subscrGroupingValue;
331
+ uint32_t subscrGroupingType;
332
+ njsSubscription *subscription;
294
333
  njsCommon *callingObj;
295
334
  Nan::Persistent<Object> jsCallingObj;
296
335
  Nan::Persistent<Object> jsOracledb;
297
336
  Nan::Persistent<Object> jsBuffer;
337
+ Nan::Persistent<Object> jsSubscription;
298
338
  Nan::Persistent<Function> jsCallback;
299
339
 
300
340
  njsBaton(Local<Function> callback, Local<Object> callingObj) :
301
341
  poolMin(0), poolMax(0), poolIncrement(0), poolTimeout(0),
302
342
  poolPingInterval(0), dpiPoolHandle(NULL), dpiConnHandle(NULL),
303
- dpiStmtHandle(NULL), dpiLobHandle(NULL), stmtCacheSize(0),
304
- lobPrefetchSize(0), maxRows(0), fetchArraySize(0), privilege(0),
305
- rowsFetched(0), bufferRowIndex(0), rowsAffected(0), outFormat(0),
306
- numQueryVars(0), queryVars(NULL), numBindVars(0), bindVars(NULL),
307
- numFetchInfo(0), fetchInfo(NULL), numFetchAsStringTypes(0),
308
- fetchAsStringTypes(NULL), numFetchAsBufferTypes(0),
309
- fetchAsBufferTypes(NULL), protoILob(NULL), externalAuth(false),
343
+ dpiStmtHandle(NULL), dpiLobHandle(NULL), dpiSubscrHandle(NULL),
344
+ stmtCacheSize(0), lobPrefetchSize(0), maxRows(0), bindArraySize(1),
345
+ fetchArraySize(0), privilege(0), rowsFetched(0), bufferRowIndex(0),
346
+ rowsAffected(0), outFormat(0), numQueryVars(0), queryVars(NULL),
347
+ numBindVars(0), bindVars(NULL), numFetchInfo(0), fetchInfo(NULL),
348
+ numFetchAsStringTypes(0), fetchAsStringTypes(NULL),
349
+ numFetchAsBufferTypes(0), fetchAsBufferTypes(NULL),
350
+ protoILob(NULL), externalAuth(false), homogeneous(true),
310
351
  getRS(false), autoCommit(false), extendedMetaData(false),
311
- isReturning(false), isPLSQL(false), bufferSize(0), bufferPtr(NULL),
312
- lobOffset(0), lobAmount(0), dpiError(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) {
313
359
  this->jsCallback.Reset(callback);
314
360
  this->jsCallingObj.Reset(callingObj);
315
361
  this->callingObj = Nan::ObjectWrap::Unwrap<njsCommon>(callingObj);
@@ -334,10 +380,13 @@ public:
334
380
  void SetDPIPoolHandle(dpiPool *handle);
335
381
  void SetDPIStmtHandle(dpiStmt *handle);
336
382
  void SetDPILobHandle(dpiLob *handle);
383
+ void SetDPISubscrHandle(dpiSubscr *handle);
337
384
 
338
385
  // methods for getting values from JSON
339
386
  bool GetBoolFromJSON(Local<Object> obj, const char *key, int index,
340
387
  bool *value);
388
+ bool GetFunctionFromJSON(Local<Object> obj, const char *key, int index,
389
+ Local<Function> *value);
341
390
  bool GetStringFromJSON(Local<Object> obj, const char *key, int index,
342
391
  string &value);
343
392
  bool GetPositiveIntFromJSON(Local<Object> obj, const char *key, int index,
@@ -347,6 +396,9 @@ public:
347
396
  bool GetUnsignedIntFromJSON(Local<Object> obj, const char *key, int index,
348
397
  uint32_t *value);
349
398
 
399
+ // convenience methods
400
+ uint32_t GetNumOutBinds();
401
+
350
402
  // methods for queuing work on the thread queue
351
403
  void QueueWork(const char *methodName, void (*workCallback)(njsBaton*),
352
404
  void (*afterWorkCallback)(njsBaton*, Local<Value>[]),