mg-dbx 2.4.31 → 2.5.32

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,7 +3,7 @@
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
- 9 December 2025, MGateway Ltd [http://www.mgateway.com](http://www.mgateway.com)
6
+ 8 February 2026, MGateway Ltd [http://www.mgateway.com](http://www.mgateway.com)
7
7
 
8
8
  * Verified to work with Node.js v8 to v24.
9
9
  * Two connectivity models to the InterSystems or YottaDB database are provided: High performance via the local database API or network based.
@@ -1243,3 +1243,11 @@ Unless required by applicable law or agreed to in writing, software distributed
1243
1243
  * Correct a potential memory access violation in the **dbx.setloglevel()** method.
1244
1244
  * Correct a potential memory access violation in the **mclass.reset()** method.
1245
1245
 
1246
+ ### v2.5.32 (8 February 2025)
1247
+
1248
+ * Introduce a basic sanity check for M global names. Check that non-printable characters are not included in the name.
1249
+ * Correct a fault in setting extra long string values in M Globals.
1250
+ * The fault occurred for strings longer than 32,767 Bytes (The old default limit for Cache databases).
1251
+ * Newer Cache configurations and IRIS can accept strings of up to 3,641,144 Bytes in length.
1252
+
1253
+
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.4.31",
5
+ "version": "2.5.32",
6
6
  "maintainers": "Chris Munt <cmunt@mgateway.com>",
7
7
  "homepage": "https://github.com/chrisemunt/mg-dbx",
8
8
  "repository": {
package/src/mg-dbx.cpp CHANGED
@@ -188,6 +188,12 @@ Version 2.4.31 9 December 2025:
188
188
  Correct a potential memory access violation in the dbx.setloglevel() method.
189
189
  Correct a potential memory access violation in the mclass.reset() method.
190
190
 
191
+ Version 2.5.32 8 February 2026:
192
+ Introduce a basic sanity check for M global names. Check that non-printable characters are not included in the name.
193
+ Correct a fault in setting extra long string values in M Globals.
194
+ The fault occurred for strings longer than 32,767 Bytes (The old default limit for Cache databases).
195
+ Newer Cache configurations and IRIS can accept strings of up to 3,641,144 Bytes in length.
196
+
191
197
  */
192
198
 
193
199
 
@@ -1464,6 +1470,12 @@ int DBX_DBNAME::GlobalReference(DBX_DBNAME *c, const FunctionCallbackInfo<Value>
1464
1470
  n ++;
1465
1471
  }
1466
1472
 
1473
+ /* v2.5.32
1474
+ rc = pcon->utf16 ? dbx_validate_name(pmeth, (void *) pmeth->args[nx].cvalue.buf16_addr, (int) pmeth->args[nx].cvalue.len_used, pcon->utf16, 0) : dbx_validate_name(pmeth, (void *) pmeth->args[nx].svalue.buf_addr, (int) pmeth->args[nx].svalue.len_used, pcon->utf16, 0);
1475
+ if (rc != CACHE_SUCCESS) {
1476
+ return rc;
1477
+ }
1478
+
1467
1479
  if (pcon->dbtype != DBX_DBTYPE_YOTTADB && context == 0) {
1468
1480
  if (pmeth->lock) {
1469
1481
  rc = pcon->utf16 ? pcon->p_isc_so->p_CachePushLockW((int) pmeth->args[nx].cvalue.len_used, (unsigned short *) pmeth->args[nx].cvalue.buf16_addr) : pcon->p_isc_so->p_CachePushLock((int) pmeth->args[nx].svalue.len_used, (Callin_char_t *) pmeth->args[nx].svalue.buf_addr);
@@ -1483,6 +1495,10 @@ int DBX_DBNAME::GlobalReference(DBX_DBNAME *c, const FunctionCallbackInfo<Value>
1483
1495
  }
1484
1496
  }
1485
1497
  }
1498
+ if (rc != CACHE_SUCCESS) {
1499
+ return rc;
1500
+ }
1501
+ */
1486
1502
 
1487
1503
  nx ++;
1488
1504
  if (pgref && (pval = pgref->pkey)) {
@@ -1511,10 +1527,11 @@ int DBX_DBNAME::GlobalReference(DBX_DBNAME *c, const FunctionCallbackInfo<Value>
1511
1527
  printf("\r\n pval->type=%d; pval->num.int32=%d; pval->svalue.buf_addr=%s", pval->type, pval->num.int32, buffer);
1512
1528
  }
1513
1529
  */
1514
-
1530
+ /* v2.5.32
1515
1531
  if (pcon->dbtype != DBX_DBTYPE_YOTTADB && context == 0) {
1516
1532
  rc = dbx_reference(pmeth, nx);
1517
1533
  }
1534
+ */
1518
1535
  nx ++;
1519
1536
  pval = pval->pnext;
1520
1537
  }
@@ -1555,6 +1572,7 @@ int DBX_DBNAME::GlobalReference(DBX_DBNAME *c, const FunctionCallbackInfo<Value>
1555
1572
  }
1556
1573
  else if (!pcon->utf16 && pmeth->args[nx].svalue.len_used < 32) {
1557
1574
  T_STRNCPY(buffer, _dbxso(buffer), pmeth->args[nx].svalue.buf_addr, pmeth->args[nx].svalue.len_used);
1575
+ buffer[pmeth->args[nx].svalue.len_used] = '\0';
1558
1576
  }
1559
1577
  else {
1560
1578
  buffer[0] = '1';
@@ -1563,11 +1581,10 @@ int DBX_DBNAME::GlobalReference(DBX_DBNAME *c, const FunctionCallbackInfo<Value>
1563
1581
  pmeth->args[nx].type = DBX_DTYPE_DOUBLE;
1564
1582
  pmeth->args[nx].num.real = (double) strtod(buffer, NULL);
1565
1583
  }
1566
-
1584
+ /* v2.5.32
1567
1585
  if (pcon->dbtype != DBX_DBTYPE_YOTTADB && context == 0) {
1568
-
1569
1586
  if (pmeth->lock == 1) {
1570
- if (n < (pmeth->argc - 1)) { /* don't push lock timeout */
1587
+ if (n < (pmeth->argc - 1)) {
1571
1588
  rc = dbx_reference(pmeth, nx);
1572
1589
  }
1573
1590
  }
@@ -1575,10 +1592,56 @@ int DBX_DBNAME::GlobalReference(DBX_DBNAME *c, const FunctionCallbackInfo<Value>
1575
1592
  rc = dbx_reference(pmeth, nx);
1576
1593
  }
1577
1594
  }
1595
+ */
1578
1596
  }
1579
1597
 
1580
1598
  pmeth->cargc = nx;
1581
1599
 
1600
+ /* v2.5.32 */
1601
+ if (pcon->dbtype != DBX_DBTYPE_YOTTADB && context == 0) {
1602
+ rc = dbx_global_reference(pmeth);
1603
+ #if 0
1604
+ nx = 0;
1605
+ rc = pcon->utf16 ? dbx_validate_name(pmeth, (void *) pmeth->args[nx].cvalue.buf16_addr, (int) pmeth->args[nx].cvalue.len_used, pcon->utf16, 0) : dbx_validate_name(pmeth, (void *) pmeth->args[nx].svalue.buf_addr, (int) pmeth->args[nx].svalue.len_used, pcon->utf16, 0);
1606
+ if (rc != CACHE_SUCCESS) {
1607
+ return rc;
1608
+ }
1609
+
1610
+ if (pmeth->lock) {
1611
+ rc = pcon->utf16 ? pcon->p_isc_so->p_CachePushLockW((int) pmeth->args[nx].cvalue.len_used, (unsigned short *) pmeth->args[nx].cvalue.buf16_addr) : pcon->p_isc_so->p_CachePushLock((int) pmeth->args[nx].svalue.len_used, (Callin_char_t *) pmeth->args[nx].svalue.buf_addr);
1612
+ }
1613
+ else {
1614
+ if (pcon->utf16) {
1615
+ if (pmeth->args[nx].cvalue.buf16_addr[0] == 94)
1616
+ rc = pcon->p_isc_so->p_CachePushGlobalW((int) pmeth->args[nx].cvalue.len_used - 1, (unsigned short *) pmeth->args[nx].cvalue.buf16_addr + 1);
1617
+ else
1618
+ rc = pcon->p_isc_so->p_CachePushGlobalW((int) pmeth->args[nx].cvalue.len_used, (unsigned short *) pmeth->args[nx].cvalue.buf16_addr);
1619
+ }
1620
+ else {
1621
+ if (pmeth->args[nx].svalue.buf_addr[0] == '^')
1622
+ rc = pcon->p_isc_so->p_CachePushGlobal((int) pmeth->args[nx].svalue.len_used - 1, (Callin_char_t *) pmeth->args[nx].svalue.buf_addr + 1);
1623
+ else
1624
+ pcon->p_isc_so->p_CachePushGlobal((int) pmeth->args[nx].svalue.len_used, (Callin_char_t *) pmeth->args[nx].svalue.buf_addr);
1625
+ }
1626
+ }
1627
+
1628
+ if (rc != CACHE_SUCCESS) {
1629
+ return rc;
1630
+ }
1631
+
1632
+ for (nx = 1; nx < pmeth->cargc; nx ++) {
1633
+ if (pmeth->lock == 1) {
1634
+ if (nx < (pmeth->cargc - 1)) { /* don't push lock timeout */
1635
+ rc = dbx_reference(pmeth, nx);
1636
+ }
1637
+ }
1638
+ else {
1639
+ rc = dbx_reference(pmeth, nx);
1640
+ }
1641
+ }
1642
+ #endif
1643
+ }
1644
+
1582
1645
  return rc;
1583
1646
  }
1584
1647
 
@@ -1630,6 +1693,7 @@ void DBX_DBNAME::GetEx(const FunctionCallbackInfo<Value>& args, int binary)
1630
1693
  DBX_DBFUN_START(c, pcon, pmeth);
1631
1694
 
1632
1695
  rc = GlobalReference(c, args, pmeth, NULL, (async || pcon->net_connection || pcon->tlevel));
1696
+ DBX_DB_CHECK(rc);
1633
1697
 
1634
1698
  if (pcon->log_transmissions) {
1635
1699
  dbx_log_transmission(pcon, pmeth, (char *) DBX_DBNAME_STR "::get");
@@ -1740,6 +1804,7 @@ void DBX_DBNAME::Set(const FunctionCallbackInfo<Value>& args)
1740
1804
  DBX_DBFUN_START(c, pcon, pmeth);
1741
1805
 
1742
1806
  rc = GlobalReference(c, args, pmeth, NULL, (async || pcon->net_connection || pcon->tlevel));
1807
+ DBX_DB_CHECK(rc);
1743
1808
 
1744
1809
  if (pcon->log_transmissions) {
1745
1810
  dbx_log_transmission(pcon, pmeth, (char *) DBX_DBNAME_STR "::set");
@@ -1837,6 +1902,7 @@ void DBX_DBNAME::Defined(const FunctionCallbackInfo<Value>& args)
1837
1902
  DBX_DBFUN_START(c, pcon, pmeth);
1838
1903
 
1839
1904
  rc = GlobalReference(c, args, pmeth, NULL, (async || pcon->net_connection || pcon->tlevel));
1905
+ DBX_DB_CHECK(rc);
1840
1906
 
1841
1907
  if (pcon->log_transmissions) {
1842
1908
  dbx_log_transmission(pcon, pmeth, (char *) DBX_DBNAME_STR "::defined");
@@ -1935,6 +2001,7 @@ void DBX_DBNAME::Delete(const FunctionCallbackInfo<Value>& args)
1935
2001
  DBX_DBFUN_START(c, pcon, pmeth);
1936
2002
 
1937
2003
  rc = GlobalReference(c, args, pmeth, NULL, (async || pcon->net_connection || pcon->tlevel));
2004
+ DBX_DB_CHECK(rc);
1938
2005
 
1939
2006
  if (pcon->log_transmissions) {
1940
2007
  dbx_log_transmission(pcon, pmeth, (char *) DBX_DBNAME_STR "::delete");
@@ -2032,6 +2099,7 @@ void DBX_DBNAME::Next(const FunctionCallbackInfo<Value>& args)
2032
2099
  DBX_DBFUN_START(c, pcon, pmeth);
2033
2100
 
2034
2101
  rc = GlobalReference(c, args, pmeth, NULL, (async || pcon->net_connection || pcon->tlevel));
2102
+ DBX_DB_CHECK(rc);
2035
2103
 
2036
2104
  if (pcon->log_transmissions) {
2037
2105
  dbx_log_transmission(pcon, pmeth, (char *) DBX_DBNAME_STR "::next");
@@ -2128,6 +2196,7 @@ void DBX_DBNAME::Previous(const FunctionCallbackInfo<Value>& args)
2128
2196
  DBX_DBFUN_START(c, pcon, pmeth);
2129
2197
 
2130
2198
  rc = GlobalReference(c, args, pmeth, NULL, (async || pcon->net_connection || pcon->tlevel));
2199
+ DBX_DB_CHECK(rc);
2131
2200
 
2132
2201
  if (pcon->log_transmissions) {
2133
2202
  dbx_log_transmission(pcon, pmeth, (char *) DBX_DBNAME_STR "::previous");
@@ -2226,6 +2295,7 @@ void DBX_DBNAME::Increment(const FunctionCallbackInfo<Value>& args)
2226
2295
 
2227
2296
  pmeth->increment = 1;
2228
2297
  rc = GlobalReference(c, args, pmeth, NULL, (async || pcon->net_connection || pcon->tlevel));
2298
+ DBX_DB_CHECK(rc);
2229
2299
 
2230
2300
  if (pcon->log_transmissions) {
2231
2301
  dbx_log_transmission(pcon, pmeth, (char *) DBX_DBNAME_STR "::increment");
@@ -2325,6 +2395,7 @@ void DBX_DBNAME::Lock(const FunctionCallbackInfo<Value>& args)
2325
2395
 
2326
2396
  pmeth->lock = 1;
2327
2397
  rc = GlobalReference(c, args, pmeth, NULL, (async || pcon->net_connection || pcon->tlevel));
2398
+ DBX_DB_CHECK(rc);
2328
2399
 
2329
2400
  if (pcon->log_transmissions) {
2330
2401
  dbx_log_transmission(pcon, pmeth, (char *) DBX_DBNAME_STR "::lock");
@@ -2449,6 +2520,7 @@ void DBX_DBNAME::Unlock(const FunctionCallbackInfo<Value>& args)
2449
2520
 
2450
2521
  pmeth->lock = 2;
2451
2522
  rc = GlobalReference(c, args, pmeth, NULL, (async || pcon->net_connection || pcon->tlevel));
2523
+ DBX_DB_CHECK(rc);
2452
2524
 
2453
2525
  if (pcon->log_transmissions) {
2454
2526
  dbx_log_transmission(pcon, pmeth, (char *) DBX_DBNAME_STR "::unlock");
@@ -7286,7 +7358,6 @@ __try {
7286
7358
  if (pcon->p_isc_so && no_connections == 0 && pcon->p_isc_so->multiple_connections == 0) { /* v2.0.16 */
7287
7359
 
7288
7360
  if (pcon->p_isc_so->loaded) {
7289
- /* pcon->p_isc_so->p_CacheEnd(); */
7290
7361
  pcon->p_isc_so->p_CacheEnd();
7291
7362
  dbx_dso_unload(pcon->p_isc_so->p_library);
7292
7363
  pcon->p_isc_so->p_library = NULL;
@@ -7530,25 +7601,32 @@ __try {
7530
7601
  for (n = 0; n < pmeth->cargc; n ++) {
7531
7602
 
7532
7603
  if (n == 0) {
7533
- if (pcon->dbtype != DBX_DBTYPE_YOTTADB) {
7534
- if (pmeth->lock) {
7535
- rc = pcon->utf16 ? pcon->p_isc_so->p_CachePushLockW((int) pmeth->args[n].cvalue.len_used, (unsigned short *) pmeth->args[n].cvalue.buf16_addr) : pcon->p_isc_so->p_CachePushLock((int) pmeth->args[n].svalue.len_used, (Callin_char_t *) pmeth->args[n].svalue.buf_addr);
7604
+
7605
+ /* v2.5.32 */
7606
+ rc = pcon->utf16 ? dbx_validate_name(pmeth, (void *) pmeth->args[n].cvalue.buf16_addr, (int) pmeth->args[n].cvalue.len_used, pcon->utf16, 0) : dbx_validate_name(pmeth, (void *) pmeth->args[n].svalue.buf_addr, (int) pmeth->args[n].svalue.len_used, pcon->utf16, 0);
7607
+ if (rc != CACHE_SUCCESS) {
7608
+ break;
7609
+ }
7610
+ if (pmeth->lock) {
7611
+ rc = pcon->utf16 ? pcon->p_isc_so->p_CachePushLockW((int) pmeth->args[n].cvalue.len_used, (unsigned short *) pmeth->args[n].cvalue.buf16_addr) : pcon->p_isc_so->p_CachePushLock((int) pmeth->args[n].svalue.len_used, (Callin_char_t *) pmeth->args[n].svalue.buf_addr);
7612
+ }
7613
+ else {
7614
+ if (pcon->utf16) {
7615
+ if (pmeth->args[n].cvalue.buf16_addr[0] == 94)
7616
+ rc = pcon->p_isc_so->p_CachePushGlobalW((int) pmeth->args[n].cvalue.len_used - 1, (unsigned short *) pmeth->args[n].cvalue.buf16_addr + 1);
7617
+ else
7618
+ rc = pcon->p_isc_so->p_CachePushGlobalW((int) pmeth->args[n].cvalue.len_used, (unsigned short *) pmeth->args[n].cvalue.buf16_addr);
7536
7619
  }
7537
7620
  else {
7538
- if (pcon->utf16) {
7539
- if (pmeth->args[n].cvalue.buf16_addr[0] == 94)
7540
- rc = pcon->p_isc_so->p_CachePushGlobalW((int) pmeth->args[n].cvalue.len_used - 1, (unsigned short *) pmeth->args[n].cvalue.buf16_addr + 1);
7541
- else
7542
- rc = pcon->p_isc_so->p_CachePushGlobalW((int) pmeth->args[n].cvalue.len_used, (unsigned short *) pmeth->args[n].cvalue.buf16_addr);
7543
- }
7544
- else {
7545
- if (pmeth->args[n].svalue.buf_addr[0] == '^')
7546
- rc = pcon->p_isc_so->p_CachePushGlobal((int) pmeth->args[n].svalue.len_used - 1, (Callin_char_t *) pmeth->args[n].svalue.buf_addr + 1);
7547
- else
7548
- pcon->p_isc_so->p_CachePushGlobal((int) pmeth->args[n].svalue.len_used, (Callin_char_t *) pmeth->args[n].svalue.buf_addr);
7549
- }
7621
+ if (pmeth->args[n].svalue.buf_addr[0] == '^')
7622
+ rc = pcon->p_isc_so->p_CachePushGlobal((int) pmeth->args[n].svalue.len_used - 1, (Callin_char_t *) pmeth->args[n].svalue.buf_addr + 1);
7623
+ else
7624
+ rc = pcon->p_isc_so->p_CachePushGlobal((int) pmeth->args[n].svalue.len_used, (Callin_char_t *) pmeth->args[n].svalue.buf_addr);
7550
7625
  }
7551
7626
  }
7627
+ if (rc != CACHE_SUCCESS) {
7628
+ break;
7629
+ }
7552
7630
  continue;
7553
7631
  }
7554
7632
 
@@ -7560,6 +7638,9 @@ __try {
7560
7638
  else {
7561
7639
  rc = dbx_reference(pmeth, n);
7562
7640
  }
7641
+ if (rc != CACHE_SUCCESS) {
7642
+ break;
7643
+ }
7563
7644
  }
7564
7645
  return rc;
7565
7646
 
@@ -7602,7 +7683,6 @@ __try {
7602
7683
  }
7603
7684
 
7604
7685
  rc = dbx_global_reference(pmeth);
7605
-
7606
7686
  if (rc != CACHE_SUCCESS) {
7607
7687
  dbx_error_message(pmeth, rc);
7608
7688
  goto dbx_get_exit;
@@ -7671,7 +7751,6 @@ __try {
7671
7751
  }
7672
7752
 
7673
7753
  rc = dbx_global_reference(pmeth);
7674
-
7675
7754
  if (rc != CACHE_SUCCESS) {
7676
7755
  dbx_error_message(pmeth, rc);
7677
7756
  goto dbx_set_exit;
@@ -8248,6 +8327,8 @@ int dbx_merge(DBXMETH *pmeth)
8248
8327
  __try {
8249
8328
  #endif
8250
8329
 
8330
+ rc = CACHE_SUCCESS;
8331
+
8251
8332
  DBX_DB_LOCK(0);
8252
8333
 
8253
8334
  if (pcon->net_connection) {
@@ -10634,6 +10715,69 @@ __except (EXCEPTION_EXECUTE_HANDLER) {
10634
10715
  }
10635
10716
 
10636
10717
 
10718
+ /* v2.5.32 */
10719
+ int dbx_validate_name(DBXMETH *pmeth, void * pbuffer, int buffer_len, short char16, short context)
10720
+ {
10721
+ int rc, n;
10722
+ unsigned char c, *p, *pz;
10723
+
10724
+ rc = CACHE_SUCCESS;
10725
+ if (char16) { /* TODO */
10726
+ return rc;
10727
+ }
10728
+
10729
+ p = (unsigned char *) pbuffer;
10730
+ pz = (unsigned char *) ((unsigned char *) pbuffer + buffer_len);
10731
+ n = 0;
10732
+
10733
+ if (strstr((char *) p, "[")) {
10734
+ p = (unsigned char *) strstr((char *) p, "]");
10735
+ if (!p) {
10736
+ /* printf("dbx_validate_name: Invalid extended reference"); */
10737
+ return CACHE_BAD_GLOBAL;
10738
+ }
10739
+ }
10740
+ if (*p == '^') {
10741
+ p ++;
10742
+ }
10743
+
10744
+ c = (int) *p;
10745
+ if (!((c == 37) || dbx_isalpha((int) c))) {
10746
+ /* printf("dbx_validate_name: Invalid name - must begin with an alphabetic or '%%' (%d:%c)", (int) c, (char) c); */
10747
+ return CACHE_BAD_GLOBAL;
10748
+ }
10749
+ else {
10750
+ p ++;
10751
+ }
10752
+ c = (int) *(pz - 1);
10753
+ if (!(isdigit((int) c) || dbx_isalpha((int) c))) {
10754
+ /* printf("dbx_validate_name: Invalid name - must end with an alphanumeric (%d:%c)", (int) c, (char) c); */
10755
+ return CACHE_BAD_GLOBAL;
10756
+ }
10757
+
10758
+ /* Just test for control characters for now */
10759
+ while (p < pz) {
10760
+ c = (int) *p;
10761
+ if (((int) c) < 32) {
10762
+ /* printf("dbx_validate_name: Invalid name - must contain alphanumerics or '.' (%d:%c)", (int) c, (char) c); */
10763
+ rc = CACHE_BAD_GLOBAL;
10764
+ break;
10765
+ }
10766
+ p ++;
10767
+ }
10768
+ /*
10769
+ while (p < pz) {
10770
+ c = (int) *p;
10771
+ if (!((*p == '.') || isdigit((int) c) || dbx_isalpha((int) c))) {
10772
+ printf("dbx_validate_name: Invalid name - must contain alphanumerics or '.' (%d:%c)", (int) c, (char) c);
10773
+ rc = CACHE_BAD_GLOBAL;
10774
+ break;
10775
+ }
10776
+ p ++;
10777
+ }
10778
+ */
10779
+ return rc;
10780
+ }
10637
10781
 
10638
10782
  int cache_report_failure(DBXCON *pcon)
10639
10783
  {
@@ -11161,6 +11305,24 @@ int dbx_lcase(char *string)
11161
11305
  #endif
11162
11306
  }
11163
11307
 
11308
+ /* v2.5.32 */
11309
+ int dbx_isalpha(int c)
11310
+ {
11311
+ if (isalpha(c))
11312
+ return 1;
11313
+ else if (c == 170)
11314
+ return 1;
11315
+ else if (c == 181)
11316
+ return 1;
11317
+ else if (c == 186)
11318
+ return 1;
11319
+ else if (c >= 192 && c <= 255)
11320
+ return 1;
11321
+ else
11322
+ return 0;
11323
+ return 0;
11324
+ }
11325
+
11164
11326
 
11165
11327
  int dbx_create_string(DBXSTR *pstr, void *data, short type)
11166
11328
  {
package/src/mg-dbx.h CHANGED
@@ -32,8 +32,8 @@
32
32
  #define DBX_NODE_VERSION (NODE_MAJOR_VERSION * 10000) + (NODE_MINOR_VERSION * 100) + NODE_PATCH_VERSION
33
33
 
34
34
  #define DBX_VERSION_MAJOR "2"
35
- #define DBX_VERSION_MINOR "4"
36
- #define DBX_VERSION_BUILD "31"
35
+ #define DBX_VERSION_MINOR "5"
36
+ #define DBX_VERSION_BUILD "32"
37
37
 
38
38
  #define DBX_VERSION DBX_VERSION_MAJOR "." DBX_VERSION_MINOR "." DBX_VERSION_BUILD
39
39
 
@@ -702,6 +702,17 @@ typedef struct {
702
702
  #define YDB_TPCTX_QUERY 11
703
703
  #define YDB_TPCTX_ORDER 12
704
704
 
705
+ /* v2.5.32 */
706
+
707
+ #define DBX_DB_CHECK(RC) \
708
+ if (RC != CACHE_SUCCESS) { \
709
+ isolate->ThrowException(Exception::Error(dbx_new_string8(isolate, (char *) "Invalid global name", 1))); \
710
+ DBX_DBFUN_END(c); \
711
+ DBX_DB_UNLOCK(); \
712
+ dbx_request_memory_free(pcon, pmeth, 0); \
713
+ return; \
714
+ } \
715
+
705
716
  typedef struct {
706
717
  unsigned int len_alloc;
707
718
  unsigned int len_used;
@@ -1285,6 +1296,7 @@ int dbx_global_order (DBXMETH *pmeth, DBXQR
1285
1296
  int dbx_global_query (DBXMETH *pmeth, DBXQR *pqr_next, DBXQR *pqr_prev, short dir, short getdata);
1286
1297
  int dbx_parse_global_reference (DBXMETH *pmeth, DBXQR *pqr, char *global_ref, int global_ref_len);
1287
1298
  int dbx_parse_global_reference16 (DBXMETH *pmeth, DBXQR *pqr, unsigned short *global_ref, int global_ref_len);
1299
+ int dbx_validate_name (DBXMETH *pmeth, void * pbuffer, int buffer_len, short char16, short context);
1288
1300
 
1289
1301
  int dbx_launch_thread (DBXMETH *pmeth);
1290
1302
  #if defined(_WIN32)
@@ -1310,6 +1322,7 @@ DBXQR * dbx_alloc_dbxqr (DBXQR *pqr, int dsize,
1310
1322
  int dbx_free_dbxqr (DBXQR *pqr);
1311
1323
  int dbx_ucase (char *string);
1312
1324
  int dbx_lcase (char *string);
1325
+ int dbx_isalpha (int c);
1313
1326
 
1314
1327
  int dbx_create_string (DBXSTR *pstr, void *data, short type);
1315
1328
 
package/src/mg-global.cpp CHANGED
@@ -274,6 +274,7 @@ void mglobal::GetEx(const FunctionCallbackInfo<Value>& args, int binary)
274
274
  DBX_DBFUN_START(c, pcon, pmeth);
275
275
 
276
276
  rc = c->GlobalReference(c, args, pmeth, &gref, (async || pcon->net_connection || pcon->tlevel));
277
+ DBX_DB_CHECK(rc);
277
278
 
278
279
  if (pcon->log_transmissions) {
279
280
  dbx_log_transmission(pcon, pmeth, (char *) "mglobal::get");
@@ -385,6 +386,7 @@ void mglobal::Set(const FunctionCallbackInfo<Value>& args)
385
386
  DBX_DBFUN_START(c, pcon, pmeth);
386
387
 
387
388
  rc = c->GlobalReference(c, args, pmeth, &gref, (async || pcon->net_connection || pcon->tlevel));
389
+ DBX_DB_CHECK(rc);
388
390
 
389
391
  if (pcon->log_transmissions) {
390
392
  dbx_log_transmission(pcon, pmeth, (char *) "mglobal::set");
@@ -489,6 +491,7 @@ void mglobal::Defined(const FunctionCallbackInfo<Value>& args)
489
491
  DBX_DBFUN_START(c, pcon, pmeth);
490
492
 
491
493
  rc = c->GlobalReference(c, args, pmeth, &gref, (async || pcon->net_connection || pcon->tlevel));
494
+ DBX_DB_CHECK(rc);
492
495
 
493
496
  if (pcon->log_transmissions) {
494
497
  dbx_log_transmission(pcon, pmeth, (char *) "mglobal::defined");
@@ -592,6 +595,7 @@ void mglobal::Delete(const FunctionCallbackInfo<Value>& args)
592
595
  DBX_DBFUN_START(c, pcon, pmeth);
593
596
 
594
597
  rc = c->GlobalReference(c, args, pmeth, &gref, (async || pcon->net_connection || pcon->tlevel));
598
+ DBX_DB_CHECK(rc);
595
599
 
596
600
  if (pcon->log_transmissions) {
597
601
  dbx_log_transmission(pcon, pmeth, (char *) "mglobal::delete");
@@ -695,6 +699,7 @@ void mglobal::Next(const FunctionCallbackInfo<Value>& args)
695
699
  DBX_DBFUN_START(c, pcon, pmeth);
696
700
 
697
701
  rc = c->GlobalReference(c, args, pmeth, &gref, (async || pcon->net_connection || pcon->tlevel));
702
+ DBX_DB_CHECK(rc);
698
703
 
699
704
  if (pcon->log_transmissions) {
700
705
  dbx_log_transmission(pcon, pmeth, (char *) "mglobal::next");
@@ -797,6 +802,7 @@ void mglobal::Previous(const FunctionCallbackInfo<Value>& args)
797
802
  DBX_DBFUN_START(c, pcon, pmeth);
798
803
 
799
804
  rc = c->GlobalReference(c, args, pmeth, &gref, (async || pcon->net_connection || pcon->tlevel));
805
+ DBX_DB_CHECK(rc);
800
806
 
801
807
  if (pcon->log_transmissions) {
802
808
  dbx_log_transmission(pcon, pmeth, (char *) "mglobal::previous");
@@ -900,6 +906,7 @@ void mglobal::Increment(const FunctionCallbackInfo<Value>& args)
900
906
 
901
907
  pmeth->increment = 1;
902
908
  rc = c->GlobalReference(c, args, pmeth, &gref, (async || pcon->net_connection || pcon->tlevel));
909
+ DBX_DB_CHECK(rc);
903
910
 
904
911
  if (pcon->log_transmissions) {
905
912
  dbx_log_transmission(pcon, pmeth, (char *) "mglobal::increment");
@@ -1009,6 +1016,7 @@ void mglobal::Lock(const FunctionCallbackInfo<Value>& args)
1009
1016
 
1010
1017
  pmeth->lock = 1;
1011
1018
  rc = c->GlobalReference(c, args, pmeth, &gref, (async || pcon->net_connection || pcon->tlevel));
1019
+ DBX_DB_CHECK(rc);
1012
1020
 
1013
1021
  if (pcon->log_transmissions) {
1014
1022
  dbx_log_transmission(pcon, pmeth, (char *) "mglobal::lock");
@@ -1138,6 +1146,7 @@ void mglobal::Unlock(const FunctionCallbackInfo<Value>& args)
1138
1146
 
1139
1147
  pmeth->lock = 2;
1140
1148
  rc = c->GlobalReference(c, args, pmeth, &gref, (async || pcon->net_connection || pcon->tlevel));
1149
+ DBX_DB_CHECK(rc);
1141
1150
 
1142
1151
  if (pcon->log_transmissions) {
1143
1152
  dbx_log_transmission(pcon, pmeth, (char *) "mglobal::unlock");