jsql-neo 2.1.3 → 2.1.4

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 (2) hide show
  1. package/lib/btree.js +3 -4
  2. package/package.json +1 -1
package/lib/btree.js CHANGED
@@ -57,8 +57,7 @@ class BTree {
57
57
  while (i >= 0 && key < node.keys[i]) i--;
58
58
  i++;
59
59
 
60
- if (this._unique && i > 0 && node.keys[i - 1] === key) {
61
- // 唯一索引:追加行号
60
+ if (i > 0 && node.keys[i - 1] === key) {
62
61
  if (!node.values[i - 1].includes(rowIndex)) {
63
62
  node.values[i - 1].push(rowIndex);
64
63
  }
@@ -72,9 +71,9 @@ class BTree {
72
71
  while (i >= 0 && key < node.keys[i]) i--;
73
72
  i++;
74
73
 
75
- if (node.children[i].keys.length === this._order - 1) {
74
+ if (node.children[i] && node.children[i].keys.length === this._order - 1) {
76
75
  this._splitChild(node, i);
77
- if (key > node.keys[i]) i++;
76
+ if (key >= node.keys[i] && i + 1 < node.children.length) i++;
78
77
  }
79
78
  this._insertNonFull(node.children[i], key, rowIndex);
80
79
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jsql-neo",
3
- "version": "2.1.3",
3
+ "version": "2.1.4",
4
4
  "description": "JSQL-NEO — Pure JavaScript embedded database with B-Tree indexes, WAL, hash JOIN, Redis-compatible Cache, and MySQL-style error codes",
5
5
  "main": "index.js",
6
6
  "files": [