mg-dbx 2.3.25-a → 2.4.27-a

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.
package/README.md CHANGED
@@ -3,9 +3,9 @@
3
3
  High speed Synchronous and Asynchronous access to InterSystems Cache/IRIS and YottaDB from Node.js.
4
4
 
5
5
  Chris Munt <cmunt@mgateway.com>
6
- 22 April 2021, M/Gateway Developments Ltd [http://www.mgateway.com](http://www.mgateway.com)
6
+ 25 April 2022, M/Gateway Developments Ltd [http://www.mgateway.com](http://www.mgateway.com)
7
7
 
8
- * Verified to work with Node.js v8 to v16.
8
+ * Verified to work with Node.js v8 to v18.
9
9
  * Two connectivity models to the InterSystems or YottaDB database are provided: High performance via the local database API or network based.
10
10
  * [Release Notes](#RelNotes) can be found at the end of this document.
11
11
 
@@ -83,7 +83,7 @@ Change to your development UCI and check the installation:
83
83
  do ^%zmgsi
84
84
 
85
85
  M/Gateway Developments Ltd - Service Integration Gateway
86
- Version: 4.2; Revision 20 (20 April 2021)
86
+ Version: 4.4; Revision 25 (2 September 2021)
87
87
 
88
88
 
89
89
  #### Installation for YottaDB
@@ -112,7 +112,7 @@ Link all the **zmgsi** routines and check the installation:
112
112
  do ^%zmgsi
113
113
 
114
114
  M/Gateway Developments Ltd - Service Integration Gateway
115
- Version: 4.2; Revision 20 (20 April 2021)
115
+ Version: 4.4; Revision 25 (2 September 2021)
116
116
 
117
117
  Note that the version of **zmgsi** is successfully displayed.
118
118
 
@@ -255,7 +255,7 @@ Assuming YottaDB is accessed via **localhost** listening on TCP port **7041**
255
255
 
256
256
  * **timeout**: The timeout (in seconds) to be applied to database operations invoked via network based connections. The default value is 10 seconds.
257
257
 
258
- * **dberror_exceptions**: A boolean value to be set to 'true' or 'false' (default: **dberror_exceptions: false**). Set this property to 'true' to instruct **mg\-dbx** to throw Node.js exceptions if synchronous invocation of database operations result in an error condition. If this property is not set, any error condition resulting from the previous database operation can be retrieved using the **db.geterrormessage()** method.
258
+ * **dberror\_exceptions**: A boolean value to be set to 'true' or 'false' (default: **dberror_exceptions: false**). Set this property to 'true' to instruct **mg\-dbx** to throw Node.js exceptions if synchronous invocation of database operations result in an error condition. If this property is not set, any error condition resulting from the previous database operation can be retrieved using the **db.geterrormessage()** method.
259
259
 
260
260
 
261
261
  ### Return the version of mg-dbx
@@ -286,7 +286,7 @@ Example 2 (Change the current Namespace):
286
286
 
287
287
  ### Returning (and optionally changing) the current character set
288
288
 
289
- UTF-8 is the default character encoding for **mg-dbx**. The other option is the 8-bit ASCII character set (characters of the range ASCII 0 to ASCII 255). The ASCII character set is a better option when exchanging single-byte binary data with the database.
289
+ UTF-8 is the default character encoding for **mg-dbx**. The other option is the 8-bit ASCII character set (characters of the range ASCII 0 to ASCII 255). Native Unicode (as UTF-16) is supported for InterSystems DB Servers. The ASCII character set is a better option when exchanging single-byte binary data with the database.
290
290
 
291
291
  current_charset = db.charset([<new_charset>]);
292
292
 
@@ -298,8 +298,12 @@ Example 2 (Change the current character set):
298
298
 
299
299
  var new_charset = db.charset('ascii');
300
300
 
301
+ Example 3 (Native Unicode support for InterSystems DB Servers):
302
+
303
+ var new_charset = db.charset('utf-16');
304
+
301
305
  * If the operation is successful this method will echo back the new character set name. If not successful, the method will return the name of the current (unchanged) character set.
302
- * Currently supported character sets and encoding schemes: 'ascii' and 'utf-8'.
306
+ * Currently supported character sets and encoding schemes: 'ascii', 'utf-8' and 'utf-16' for InterSystems DB Servers.
303
307
 
304
308
 
305
309
  ### Setting (or resetting) the timeout for the connection
@@ -1017,7 +1021,7 @@ Logging can be switched off by calling the **setloglevel** function without spec
1017
1021
 
1018
1022
  ## <a name="License"></a> License
1019
1023
 
1020
- Copyright (c) 2018-2021 M/Gateway Developments Ltd,
1024
+ Copyright (c) 2018-2022 M/Gateway Developments Ltd,
1021
1025
  Surrey UK.
1022
1026
  All rights reserved.
1023
1027
 
@@ -1186,4 +1190,20 @@ Unless required by applicable law or agreed to in writing, software distributed
1186
1190
 
1187
1191
  ### v2.3.25a (22 April 2021)
1188
1192
 
1189
- * Verify that **mg-dbx** will build and work with Node.js v16.x.x.
1193
+ * Verify that **mg-dbx** will build and work with Node.js v16.x.x.
1194
+
1195
+ ### v2.4.26 (2 September 2021)
1196
+
1197
+ * Introduce native Unicode support for InterSystems DB Servers - as character set/encoding UTF-16.
1198
+ * db.charset('utf-16')
1199
+ * For network-based connectivity, DB Superserver version 4.4.25 (or later) should be used.
1200
+ * This update should be regarded as a beta-release. It is recommended that only those who need native support for Unicode on InterSystems DB Servers should upgrade to this release at this time.
1201
+
1202
+ ### v2.4.27 (20 October 2021)
1203
+
1204
+ * Verify that **mg-dbx** will build and work with Node.js v17.x.x.
1205
+
1206
+ ### v2.4.27a (25 April 2022)
1207
+
1208
+ * Verify that **mg-dbx** will build and work with Node.js v18.x.x.
1209
+
Binary file
Binary file
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "author": "Chris Munt <cmunt@mgateway.com> (http://www.gateway.com/)",
3
3
  "name": "mg-dbx",
4
4
  "description": "High speed Synchronous and Asynchronous access to InterSystems Cache/IRIS and YottaDB from Node.js.",
5
- "version": "2.3.25a",
5
+ "version": "2.4.27a",
6
6
  "maintainers": "Chris Munt <cmunt@mgateway.com>",
7
7
  "homepage": "https://github.com/chrisemunt/mg-dbx",
8
8
  "repository": {
package/src/mg-class.cpp CHANGED
@@ -3,7 +3,7 @@
3
3
  | mg-dbx.node |
4
4
  | Author: Chris Munt cmunt@mgateway.com |
5
5
  | chris.e.munt@gmail.com |
6
- | Copyright (c) 2016-2021 M/Gateway Developments Ltd, |
6
+ | Copyright (c) 2016-2022 M/Gateway Developments Ltd, |
7
7
  | Surrey UK. |
8
8
  | All rights reserved. |
9
9
  | |
@@ -19,7 +19,7 @@
19
19
  | distributed under the License is distributed on an "AS IS" BASIS, |
20
20
  | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
21
21
  | See the License for the specific language governing permissions and |
22
- | limitations under the License. |
22
+ | limitations under the License. |
23
23
  | |
24
24
  ----------------------------------------------------------------------------
25
25
  */
@@ -99,6 +99,7 @@ void mclass::New(const FunctionCallbackInfo<Value>& args)
99
99
  DBXCON *pcon = NULL;
100
100
  DBXMETH *pmeth = NULL;
101
101
  Local<Object> obj;
102
+ Local<String> cname;
102
103
 
103
104
  /* 1.4.10 */
104
105
  argc = args.Length();
@@ -128,10 +129,20 @@ void mclass::New(const FunctionCallbackInfo<Value>& args)
128
129
  }
129
130
  obj->c = c;
130
131
  pcon = c->pcon;
131
- pmeth = dbx_request_memory(pcon, 1);
132
+ pmeth = dbx_request_memory(pcon, 1, 1);
132
133
  pmeth->argc = argc;
133
134
  if (argc > 1) {
134
- dbx_write_char8(isolate, DBX_TO_STRING(args[1]), obj->class_name, obj->c->pcon->utf8);
135
+ cname = DBX_TO_STRING(args[1]);
136
+ dbx_write_char8(isolate, cname, obj->class_name, obj->c->pcon->utf8);
137
+ obj->class_name_len = (int) strlen(obj->class_name);
138
+ if (pcon->utf16) {
139
+ dbx_write_char16(isolate, cname, obj->class_name16);
140
+ obj->class_name16_len = (int) dbx_string16_length(isolate, cname);
141
+ }
142
+ else {
143
+ obj->class_name16[0] = 0;
144
+ obj->class_name16_len = 0;
145
+ }
135
146
  if (argc > 2) {
136
147
  DBX_DBFUN_START(c, c->pcon, pmeth);
137
148
  pmeth->ibuffer_used = 0;
@@ -244,10 +255,13 @@ void mclass::ClassMethodEx(const FunctionCallbackInfo<Value>& args, int binary)
244
255
  if (pcon->log_functions) {
245
256
  c->LogFunction(c, args, (void *) clx, (char *) "mclass::classmethod");
246
257
  }
247
- pmeth = dbx_request_memory(pcon, 0);
258
+ pmeth = dbx_request_memory(pcon, 1, 0);
248
259
 
249
260
  pmeth->binary = binary;
250
261
  cref.class_name = clx->class_name;
262
+ cref.class_name_len = clx->class_name_len;
263
+ cref.class_name16 = clx->class_name16;
264
+ cref.class_name16_len = clx->class_name16_len;
251
265
  cref.oref = clx->oref;
252
266
 
253
267
  DBX_CALLBACK_FUN(pmeth->argc, async);
@@ -316,7 +330,7 @@ void mclass::ClassMethodEx(const FunctionCallbackInfo<Value>& args, int binary)
316
330
  args.GetReturnValue().Set(bx);
317
331
  }
318
332
  else {
319
- str = dbx_new_string8n(isolate, pmeth->output_val.svalue.buf_addr, pmeth->output_val.svalue.len_used, pcon->utf8);
333
+ str = pcon->utf16 ? dbx_new_string16n(isolate, pmeth->output_val.cvalue.buf16_addr, pmeth->output_val.cvalue.len_used) : dbx_new_string8n(isolate, pmeth->output_val.svalue.buf_addr, pmeth->output_val.svalue.len_used, pcon->utf8);
320
334
  args.GetReturnValue().Set(str);
321
335
  }
322
336
  dbx_request_memory_free(pcon, pmeth, 0);
@@ -329,7 +343,11 @@ void mclass::ClassMethodEx(const FunctionCallbackInfo<Value>& args, int binary)
329
343
 
330
344
  clx1->c = c;
331
345
  clx1->oref = pmeth->output_val.num.oref;
332
- strcpy(clx1->class_name, "");
346
+ clx1->class_name[0] = '\0';
347
+ clx1->class_name_len = 0;
348
+ clx1->class_name16[0] = 0;
349
+ clx1->class_name16_len = 0;
350
+
333
351
  dbx_request_memory_free(pcon, pmeth, 0);
334
352
  return;
335
353
  }
@@ -365,10 +383,13 @@ void mclass::MethodEx(const FunctionCallbackInfo<Value>& args, int binary)
365
383
  if (pcon->log_functions) {
366
384
  c->LogFunction(c, args, (void *) clx, (char *) "mclass::method");
367
385
  }
368
- pmeth = dbx_request_memory(pcon, 0);
386
+ pmeth = dbx_request_memory(pcon, 1, 0);
369
387
 
370
388
  pmeth->binary = binary;
371
389
  cref.class_name = clx->class_name;
390
+ cref.class_name_len = clx->class_name_len;
391
+ cref.class_name16 = clx->class_name16;
392
+ cref.class_name16_len = clx->class_name16_len;
372
393
  cref.oref = clx->oref;
373
394
 
374
395
  DBX_CALLBACK_FUN(pmeth->argc, async);
@@ -437,7 +458,7 @@ void mclass::MethodEx(const FunctionCallbackInfo<Value>& args, int binary)
437
458
  args.GetReturnValue().Set(bx);
438
459
  }
439
460
  else {
440
- str = dbx_new_string8n(isolate, pmeth->output_val.svalue.buf_addr, pmeth->output_val.svalue.len_used, pcon->utf8);
461
+ str = pcon->utf16 ? dbx_new_string16n(isolate, pmeth->output_val.cvalue.buf16_addr, pmeth->output_val.cvalue.len_used) : dbx_new_string8n(isolate, pmeth->output_val.svalue.buf_addr, pmeth->output_val.svalue.len_used, pcon->utf8);
441
462
  args.GetReturnValue().Set(str);
442
463
  }
443
464
  dbx_request_memory_free(pcon, pmeth, 0);
@@ -450,7 +471,11 @@ void mclass::MethodEx(const FunctionCallbackInfo<Value>& args, int binary)
450
471
 
451
472
  clx1->c = c;
452
473
  clx1->oref = pmeth->output_val.num.oref;
453
- strcpy(clx1->class_name, "");
474
+ clx1->class_name[0] = '\0';
475
+ clx1->class_name_len = 0;
476
+ clx1->class_name16[0] = 0;
477
+ clx1->class_name16_len = 0;
478
+
454
479
  dbx_request_memory_free(pcon, pmeth, 0);
455
480
  return;
456
481
  }
@@ -474,9 +499,12 @@ void mclass::SetProperty(const FunctionCallbackInfo<Value>& args)
474
499
  if (pcon->log_functions) {
475
500
  c->LogFunction(c, args, (void *) clx, (char *) "mclass::setproperty");
476
501
  }
477
- pmeth = dbx_request_memory(pcon, 0);
502
+ pmeth = dbx_request_memory(pcon, 1, 0);
478
503
 
479
504
  cref.class_name = clx->class_name;
505
+ cref.class_name_len = clx->class_name_len;
506
+ cref.class_name16 = clx->class_name16;
507
+ cref.class_name16_len = clx->class_name16_len;
480
508
  cref.oref = clx->oref;
481
509
 
482
510
  DBX_CALLBACK_FUN(pmeth->argc, async);
@@ -576,10 +604,13 @@ void mclass::GetPropertyEx(const FunctionCallbackInfo<Value>& args, int binary)
576
604
  if (pcon->log_functions) {
577
605
  c->LogFunction(c, args, (void *) clx, (char *) "mclass::getproperty");
578
606
  }
579
- pmeth = dbx_request_memory(pcon, 0);
607
+ pmeth = dbx_request_memory(pcon, 1, 0);
580
608
 
581
609
  pmeth->binary = binary;
582
610
  cref.class_name = clx->class_name;
611
+ cref.class_name_len = clx->class_name_len;
612
+ cref.class_name16 = clx->class_name16;
613
+ cref.class_name16_len = clx->class_name16_len;
583
614
  cref.oref = clx->oref;
584
615
 
585
616
  DBX_CALLBACK_FUN(pmeth->argc, async);
@@ -648,7 +679,7 @@ void mclass::GetPropertyEx(const FunctionCallbackInfo<Value>& args, int binary)
648
679
  args.GetReturnValue().Set(bx);
649
680
  }
650
681
  else {
651
- str = dbx_new_string8n(isolate, pmeth->output_val.svalue.buf_addr, pmeth->output_val.svalue.len_used, pcon->utf8);
682
+ str = pcon->utf16 ? dbx_new_string16n(isolate, pmeth->output_val.cvalue.buf16_addr, pmeth->output_val.cvalue.len_used) : dbx_new_string8n(isolate, pmeth->output_val.svalue.buf_addr, pmeth->output_val.svalue.len_used, pcon->utf8);
652
683
  args.GetReturnValue().Set(str);
653
684
  }
654
685
  dbx_request_memory_free(pcon, pmeth, 0);
@@ -663,7 +694,11 @@ void mclass::GetPropertyEx(const FunctionCallbackInfo<Value>& args, int binary)
663
694
 
664
695
  clx1->c = c;
665
696
  clx1->oref = pmeth->output_val.num.oref;
666
- strcpy(clx1->class_name, "");
697
+ clx1->class_name[0] = '\0';
698
+ clx1->class_name_len = 0;
699
+ clx1->class_name16[0] = 0;
700
+ clx1->class_name16_len = 0;
701
+
667
702
  dbx_request_memory_free(pcon, pmeth, 0);
668
703
  return;
669
704
  }
@@ -678,6 +713,7 @@ void mclass::Reset(const FunctionCallbackInfo<Value>& args)
678
713
  DBXMETH *pmeth;
679
714
  Local<Object> obj;
680
715
  Local<String> str;
716
+ Local<String> cname;
681
717
  mclass *clx = ObjectWrap::Unwrap<mclass>(args.This());
682
718
  MG_CLASS_CHECK_CLASS(clx);
683
719
  DBX_DBNAME *c = clx->c;
@@ -688,7 +724,7 @@ void mclass::Reset(const FunctionCallbackInfo<Value>& args)
688
724
  if (pcon->log_functions) {
689
725
  c->LogFunction(c, args, (void *) clx, (char *) "mclass::reset");
690
726
  }
691
- pmeth = dbx_request_memory(pcon, 0);
727
+ pmeth = dbx_request_memory(pcon, 1, 0);
692
728
 
693
729
  DBX_CALLBACK_FUN(pmeth->argc, async);
694
730
 
@@ -700,7 +736,8 @@ void mclass::Reset(const FunctionCallbackInfo<Value>& args)
700
736
  return;
701
737
  }
702
738
 
703
- dbx_write_char8(isolate, DBX_TO_STRING(args[0]), class_name, pcon->utf8);
739
+ cname = DBX_TO_STRING(args[0]);
740
+ dbx_write_char8(isolate, cname, class_name, pcon->utf8);
704
741
  if (class_name[0] == '\0') {
705
742
  isolate->ThrowException(Exception::Error(dbx_new_string8(isolate, (char *) "The class:reset method takes at least one argument (the class name)", 1)));
706
743
  dbx_request_memory_free(pcon, pmeth, 0);
@@ -740,6 +777,15 @@ void mclass::Reset(const FunctionCallbackInfo<Value>& args)
740
777
 
741
778
  clx->oref = pmeth->output_val.num.oref;
742
779
  strcpy(clx->class_name, class_name);
780
+ clx->class_name_len = (int) strlen(clx->class_name);
781
+ if (pcon->utf16) {
782
+ dbx_write_char16(isolate, cname, clx->class_name16);
783
+ clx->class_name16_len = dbx_string16_length(isolate, cname);
784
+ }
785
+ else {
786
+ clx->class_name16[0] = 0;
787
+ clx->class_name16_len = 0;
788
+ }
743
789
 
744
790
  dbx_request_memory_free(pcon, pmeth, 0);
745
791
  return;
package/src/mg-class.h CHANGED
@@ -3,7 +3,7 @@
3
3
  | mg-dbx.node |
4
4
  | Author: Chris Munt cmunt@mgateway.com |
5
5
  | chris.e.munt@gmail.com |
6
- | Copyright (c) 2016-2021 M/Gateway Developments Ltd, |
6
+ | Copyright (c) 2016-2022 M/Gateway Developments Ltd, |
7
7
  | Surrey UK. |
8
8
  | All rights reserved. |
9
9
  | |
@@ -19,7 +19,7 @@
19
19
  | distributed under the License is distributed on an "AS IS" BASIS, |
20
20
  | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
21
21
  | See the License for the specific language governing permissions and |
22
- | limitations under the License. |
22
+ | limitations under the License. |
23
23
  | |
24
24
  ----------------------------------------------------------------------------
25
25
  */
@@ -42,6 +42,9 @@ class mclass : public node::ObjectWrap
42
42
  int dbx_count;
43
43
  int oref;
44
44
  char class_name[256];
45
+ int class_name_len;
46
+ unsigned short class_name16[256];
47
+ int class_name16_len;
45
48
  DBX_DBNAME *c;
46
49
 
47
50