dbgate-datalib 6.0.0 → 6.1.1

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.
@@ -43,7 +43,7 @@ class DuplicatorItemHolder {
43
43
  return this.item.name;
44
44
  }
45
45
  constructor(item, duplicator) {
46
- var _a, _b, _c, _d, _e;
46
+ var _a, _b, _c, _d, _e, _f;
47
47
  this.item = item;
48
48
  this.duplicator = duplicator;
49
49
  this.references = [];
@@ -56,7 +56,7 @@ class DuplicatorItemHolder {
56
56
  this.table = duplicator.db.tables.find(x => x.pureName.toUpperCase() == item.name.toUpperCase());
57
57
  this.autoColumn = (_a = this.table.columns.find(x => x.autoIncrement)) === null || _a === void 0 ? void 0 : _a.columnName;
58
58
  if (((_c = (_b = this.table.primaryKey) === null || _b === void 0 ? void 0 : _b.columns) === null || _c === void 0 ? void 0 : _c.length) != 1 ||
59
- ((_e = (_d = this.table.primaryKey) === null || _d === void 0 ? void 0 : _d.columns) === null || _e === void 0 ? void 0 : _e[0].columnName) != this.autoColumn) {
59
+ ((_f = (_e = (_d = this.table.primaryKey) === null || _d === void 0 ? void 0 : _d.columns) === null || _e === void 0 ? void 0 : _e[0]) === null || _f === void 0 ? void 0 : _f.columnName) != this.autoColumn) {
60
60
  this.autoColumn = null;
61
61
  }
62
62
  }
@@ -111,6 +111,9 @@ class DuplicatorItemHolder {
111
111
  dmp.putCollection(',', this.weakReferences, weakref => {
112
112
  dmp.put('(^case ^when ^exists (^select * ^from %f where %i = %v) ^then 1 ^else 0 ^end) as %i', weakref.ref, weakref.foreignKey.columns[0].refColumnName, row[weakref.foreignKey.columns[0].columnName], weakref.foreignKey.columns[0].columnName);
113
113
  });
114
+ if (this.duplicator.driver.dialect.requireFromDual) {
115
+ dmp.put(' ^from ^dual');
116
+ }
114
117
  });
115
118
  const qrow = qres.rows[0];
116
119
  return this.weakReferences.filter(x => qrow[x.columnName] == 0).map(x => x.columnName);
@@ -157,6 +160,7 @@ class DuplicatorItemHolder {
157
160
  res = yield (0, dbgate_tools_1.runQueryOnDriver)(pool, driver, dmp => dmp.selectScopeIdentity(this.table));
158
161
  }
159
162
  // console.log('IDRES', JSON.stringify(res));
163
+ // console.log('*********** ENTRIES OF', res?.rows?.[0]);
160
164
  const resId = (_f = (_e = Object.entries((_d = res === null || res === void 0 ? void 0 : res.rows) === null || _d === void 0 ? void 0 : _d[0])) === null || _e === void 0 ? void 0 : _e[0]) === null || _f === void 0 ? void 0 : _f[1];
161
165
  if (resId != null) {
162
166
  this.idMap[chunk[this.autoColumn]] = resId;
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "6.0.0",
2
+ "version": "6.1.1",
3
3
  "name": "dbgate-datalib",
4
4
  "main": "lib/index.js",
5
5
  "typings": "lib/index.d.ts",
@@ -13,13 +13,13 @@
13
13
  "lib"
14
14
  ],
15
15
  "dependencies": {
16
- "dbgate-sqltree": "^6.0.0",
17
- "dbgate-tools": "^6.0.0",
18
- "dbgate-filterparser": "^6.0.0",
16
+ "dbgate-sqltree": "^6.1.1",
17
+ "dbgate-tools": "^6.1.1",
18
+ "dbgate-filterparser": "^6.1.1",
19
19
  "uuid": "^3.4.0"
20
20
  },
21
21
  "devDependencies": {
22
- "dbgate-types": "^6.0.0",
22
+ "dbgate-types": "^6.1.1",
23
23
  "@types/node": "^13.7.0",
24
24
  "jest": "^28.1.3",
25
25
  "ts-jest": "^28.0.7",