orange-orm 5.3.0 → 5.3.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.
- package/dist/index.browser.mjs +62 -36
- package/dist/index.mjs +68 -36
- package/docs/changelog.md +3 -0
- package/package.json +2 -1
- package/src/bunSqlite/newTransaction.js +2 -1
- package/src/client/index.js +1 -1
- package/src/getManyDto.js +7 -5
- package/src/mssql/newTransaction.js +2 -1
- package/src/nodeSqlite/newTransaction.js +2 -1
- package/src/oracle/newTransaction.js +2 -1
- package/src/patchTable.js +1 -5
- package/src/pg/pool/newPgPool.js +1 -1
- package/src/sqlite3/newTransaction.js +2 -1
- package/src/table/column/bigint/newEncode.js +1 -1
- package/src/table/column/date/newEncode.js +1 -1
- package/src/table/column/dateWithTimeZone/newEncode.js +2 -2
- package/src/table/column.js +2 -7
- package/src/table/commands/newInsertAndForgetCommand.js +2 -2
- package/src/table/relatedTable/aggregate.js +4 -5
- package/src/table/relatedTable/where.js +4 -5
- package/src/table/relation/newManyCacheCore.js +1 -1
- package/src/table/resultToRows/dbRowToRow.js +38 -5
- package/src/tedious/newTransaction.js +2 -1
- package/src/table/query/extractLimitQuery.js +0 -23
package/dist/index.browser.mjs
CHANGED
|
@@ -4257,7 +4257,7 @@ function requireClient () {
|
|
|
4257
4257
|
if (arguments[i][isColumnProxyKey])
|
|
4258
4258
|
args[i] = { [columnRefKey]: arguments[i][columnPathKey] };
|
|
4259
4259
|
else
|
|
4260
|
-
args[i] = arguments[i](tableProxy(
|
|
4260
|
+
args[i] = arguments[i](tableProxy());
|
|
4261
4261
|
}
|
|
4262
4262
|
else
|
|
4263
4263
|
args[i] = arguments[i];
|
|
@@ -5599,7 +5599,7 @@ function requireNewEncode$5 () {
|
|
|
5599
5599
|
value = purify(value);
|
|
5600
5600
|
if (value == null) {
|
|
5601
5601
|
if (column.dbNull === null)
|
|
5602
|
-
;
|
|
5602
|
+
return 'null';
|
|
5603
5603
|
return '\'' + column.dbNull + '\'';
|
|
5604
5604
|
}
|
|
5605
5605
|
var encodeCore = getSessionSingleton(context, 'encodeDate') || encodeDate;
|
|
@@ -5734,12 +5734,12 @@ function requireNewEncode$4 () {
|
|
|
5734
5734
|
return 'null';
|
|
5735
5735
|
return '\'' + column.dbNull + '\'';
|
|
5736
5736
|
}
|
|
5737
|
-
var encodeCore = getSessionSingleton(context, 'encodeDateTz') || getSessionSingleton(context, '
|
|
5737
|
+
var encodeCore = getSessionSingleton(context, 'encodeDateTz') || getSessionSingleton(context, 'encodeDate') || encodeDate;
|
|
5738
5738
|
return encodeCore(value);
|
|
5739
5739
|
};
|
|
5740
5740
|
|
|
5741
5741
|
encode.direct = function(context, value) {
|
|
5742
|
-
var encodeCore = getSessionSingleton(context, 'encodeDateTz') || getSessionSingleton(context, '
|
|
5742
|
+
var encodeCore = getSessionSingleton(context, 'encodeDateTz') || getSessionSingleton(context, 'encodeDate') || encodeDate;
|
|
5743
5743
|
return encodeCore(value);
|
|
5744
5744
|
};
|
|
5745
5745
|
|
|
@@ -5943,7 +5943,7 @@ function requireNewEncode$2 () {
|
|
|
5943
5943
|
value = purify(value);
|
|
5944
5944
|
if (value == null) {
|
|
5945
5945
|
if (column.dbNull === null)
|
|
5946
|
-
;
|
|
5946
|
+
return 'null';
|
|
5947
5947
|
return '\'' + column.dbNull + '\'';
|
|
5948
5948
|
}
|
|
5949
5949
|
var encodeCore = getSessionSingleton(context, 'encodeBigint') || encodeBigint;
|
|
@@ -6292,18 +6292,13 @@ function requireColumn () {
|
|
|
6292
6292
|
return c;
|
|
6293
6293
|
};
|
|
6294
6294
|
|
|
6295
|
-
c.date = function() {
|
|
6296
|
-
requireDate()(column);
|
|
6297
|
-
return c;
|
|
6298
|
-
};
|
|
6299
|
-
|
|
6300
6295
|
c.dateWithTimeZone = function() {
|
|
6301
6296
|
requireDateWithTimeZone()(column);
|
|
6302
6297
|
return c;
|
|
6303
6298
|
};
|
|
6304
6299
|
|
|
6305
|
-
c.numeric = function(
|
|
6306
|
-
requireNumeric()(column
|
|
6300
|
+
c.numeric = function() {
|
|
6301
|
+
requireNumeric()(column);
|
|
6307
6302
|
return c;
|
|
6308
6303
|
};
|
|
6309
6304
|
|
|
@@ -8899,6 +8894,10 @@ function requireDbRowToRow () {
|
|
|
8899
8894
|
function dbRowToRow(context, span, dbRow) {
|
|
8900
8895
|
var table = span.table;
|
|
8901
8896
|
var row = decodeDbRow(context, span, table, dbRow);
|
|
8897
|
+
if (!hasPrimaryKey(row, table)) {
|
|
8898
|
+
skipNestedLegs(span, dbRow);
|
|
8899
|
+
return null;
|
|
8900
|
+
}
|
|
8902
8901
|
var cache = table._cache;
|
|
8903
8902
|
if (!cache.tryGet(context, row)) {
|
|
8904
8903
|
var queryContext = span.queryContext;
|
|
@@ -8915,13 +8914,15 @@ function requireDbRowToRow () {
|
|
|
8915
8914
|
var c = {};
|
|
8916
8915
|
|
|
8917
8916
|
c.visitOne = function(leg) {
|
|
8918
|
-
dbRowToRow(context, leg.span, dbRow);
|
|
8919
|
-
|
|
8917
|
+
let child = dbRowToRow(context, leg.span, dbRow);
|
|
8918
|
+
if (child)
|
|
8919
|
+
leg.expand(row);
|
|
8920
8920
|
};
|
|
8921
8921
|
|
|
8922
8922
|
c.visitJoin = function(leg) {
|
|
8923
|
-
dbRowToRow(context, leg.span, dbRow);
|
|
8924
|
-
|
|
8923
|
+
let child = dbRowToRow(context, leg.span, dbRow);
|
|
8924
|
+
if (child)
|
|
8925
|
+
leg.expand(row);
|
|
8925
8926
|
};
|
|
8926
8927
|
|
|
8927
8928
|
c.visitMany = function() {
|
|
@@ -8936,6 +8937,33 @@ function requireDbRowToRow () {
|
|
|
8936
8937
|
return row;
|
|
8937
8938
|
}
|
|
8938
8939
|
|
|
8940
|
+
function hasPrimaryKey(row, table) {
|
|
8941
|
+
return table._primaryColumns.every((column) => {
|
|
8942
|
+
let value = row[column.alias];
|
|
8943
|
+
return value !== null && value !== undefined;
|
|
8944
|
+
});
|
|
8945
|
+
}
|
|
8946
|
+
|
|
8947
|
+
function skipNestedLegs(span, dbRow) {
|
|
8948
|
+
span.legs.forEach((leg) => {
|
|
8949
|
+
leg.accept({
|
|
8950
|
+
visitOne() {
|
|
8951
|
+
skipSpan(leg.span, dbRow);
|
|
8952
|
+
},
|
|
8953
|
+
visitJoin() {
|
|
8954
|
+
skipSpan(leg.span, dbRow);
|
|
8955
|
+
},
|
|
8956
|
+
visitMany() {
|
|
8957
|
+
}
|
|
8958
|
+
});
|
|
8959
|
+
});
|
|
8960
|
+
}
|
|
8961
|
+
|
|
8962
|
+
function skipSpan(span, dbRow) {
|
|
8963
|
+
decodeDbRow(undefined, span, span.table, dbRow);
|
|
8964
|
+
skipNestedLegs(span, dbRow);
|
|
8965
|
+
}
|
|
8966
|
+
|
|
8939
8967
|
dbRowToRow_1 = dbRowToRow;
|
|
8940
8968
|
return dbRowToRow_1;
|
|
8941
8969
|
}
|
|
@@ -10277,10 +10305,9 @@ function requireWhere$1 () {
|
|
|
10277
10305
|
function newWhere(_relations, _depth) {
|
|
10278
10306
|
|
|
10279
10307
|
function where(context, fn) {
|
|
10280
|
-
|
|
10281
|
-
let { relations, alias } = extract(includeMany, _relations);
|
|
10308
|
+
let { relations, alias } = extract(_relations);
|
|
10282
10309
|
const table = relations[relations.length - 1].childTable;
|
|
10283
|
-
if (!relations[0].isMany
|
|
10310
|
+
if (!relations[0].isMany)
|
|
10284
10311
|
table._rootAlias = alias;
|
|
10285
10312
|
|
|
10286
10313
|
try {
|
|
@@ -10296,11 +10323,11 @@ function requireWhere$1 () {
|
|
|
10296
10323
|
}
|
|
10297
10324
|
return where;
|
|
10298
10325
|
|
|
10299
|
-
function extract(
|
|
10326
|
+
function extract(relations) {
|
|
10300
10327
|
let alias = relations[0].toLeg().table._dbName;
|
|
10301
10328
|
let result = [];
|
|
10302
10329
|
for (let i = 0; i < relations.length; i++) {
|
|
10303
|
-
if (relations[i].isMany
|
|
10330
|
+
if (relations[i].isMany) {
|
|
10304
10331
|
result = [relations[i]];
|
|
10305
10332
|
alias = relations[i].toLeg().table._dbName;
|
|
10306
10333
|
}
|
|
@@ -10327,10 +10354,9 @@ function requireAggregate$1 () {
|
|
|
10327
10354
|
function newAggregate(_relations) {
|
|
10328
10355
|
|
|
10329
10356
|
function aggregate(context, fn) {
|
|
10330
|
-
|
|
10331
|
-
let { relations, alias } = extract(includeMany, _relations);
|
|
10357
|
+
let { relations, alias } = extract(_relations);
|
|
10332
10358
|
const table = relations[relations.length - 1].childTable;
|
|
10333
|
-
if (!relations[0].isMany
|
|
10359
|
+
if (!relations[0].isMany)
|
|
10334
10360
|
table._rootAlias = alias;
|
|
10335
10361
|
|
|
10336
10362
|
try {
|
|
@@ -10345,11 +10371,11 @@ function requireAggregate$1 () {
|
|
|
10345
10371
|
}
|
|
10346
10372
|
return aggregate;
|
|
10347
10373
|
|
|
10348
|
-
function extract(
|
|
10374
|
+
function extract(relations) {
|
|
10349
10375
|
let alias = relations[0].toLeg().table._dbName;
|
|
10350
10376
|
let result = [];
|
|
10351
10377
|
for (let i = 0; i < relations.length; i++) {
|
|
10352
|
-
if (relations[i].isMany
|
|
10378
|
+
if (relations[i].isMany) {
|
|
10353
10379
|
result = [relations[i]];
|
|
10354
10380
|
alias = relations[i].toLeg().table._dbName;
|
|
10355
10381
|
}
|
|
@@ -11010,7 +11036,7 @@ function requireNewManyCacheCore () {
|
|
|
11010
11036
|
}
|
|
11011
11037
|
var rows = newArray();
|
|
11012
11038
|
rows.push(childRow);
|
|
11013
|
-
|
|
11039
|
+
cache.tryAdd(key, rows);
|
|
11014
11040
|
}
|
|
11015
11041
|
|
|
11016
11042
|
function newArray() {
|
|
@@ -11736,16 +11762,18 @@ function requireGetManyDto$1 () {
|
|
|
11736
11762
|
outRow[column.alias] = column.decode(context, row[keys[j]]);
|
|
11737
11763
|
}
|
|
11738
11764
|
|
|
11739
|
-
|
|
11740
|
-
|
|
11741
|
-
|
|
11742
|
-
|
|
11765
|
+
if (outRow) {
|
|
11766
|
+
for (let j = 0; j < aggregateKeys.length; j++) {
|
|
11767
|
+
const key = aggregateKeys[j];
|
|
11768
|
+
const parse = span.aggregates[key].column?.decode || ((context, arg) => Number.parseFloat(arg));
|
|
11769
|
+
outRow[key] = parse(context, row[keys[j + columnsLength]]);
|
|
11770
|
+
}
|
|
11743
11771
|
}
|
|
11744
11772
|
|
|
11745
11773
|
outRows[i] = outRow;
|
|
11746
11774
|
if (updateParent)
|
|
11747
11775
|
updateParent(outRow, i);
|
|
11748
|
-
if (shouldCreateMap) {
|
|
11776
|
+
if (shouldCreateMap && outRow) {
|
|
11749
11777
|
fkIds[i] = getIds(outRow);
|
|
11750
11778
|
addToMap(rowsMap, fkIds[i], outRow);
|
|
11751
11779
|
}
|
|
@@ -12936,7 +12964,6 @@ function requirePatchTable () {
|
|
|
12936
12964
|
let result;
|
|
12937
12965
|
for (let i = 0; i < relation.columns.length; i++) {
|
|
12938
12966
|
let p = relation.columns[i].alias;
|
|
12939
|
-
row[p];
|
|
12940
12967
|
result = await remove({ path: ['dummy', p], oldValue: (oldValue || {})[p], op, options: options }, table, row) || result;
|
|
12941
12968
|
}
|
|
12942
12969
|
return result || {};
|
|
@@ -12949,8 +12976,7 @@ function requirePatchTable () {
|
|
|
12949
12976
|
let p = relation.columns[i].alias;
|
|
12950
12977
|
let childKey = relation.childTable._primaryColumns[i].alias;
|
|
12951
12978
|
if (path[1] === childKey) {
|
|
12952
|
-
|
|
12953
|
-
result = await remove({ path: ['dummy', p], oldValue: (oldValue || {})[p], op, options: options }, table, row) || result;
|
|
12979
|
+
result = await remove({ path: ['dummy', p], oldValue: oldValue[p], op, options: options }, table, row) || result;
|
|
12954
12980
|
break;
|
|
12955
12981
|
}
|
|
12956
12982
|
}
|
|
@@ -16955,7 +16981,7 @@ function requireNewPgPool () {
|
|
|
16955
16981
|
if (!pg) {
|
|
16956
16982
|
pg = await import('pg');
|
|
16957
16983
|
pg = pg.default || pg;
|
|
16958
|
-
let types = pg.types
|
|
16984
|
+
let types = pg.types;
|
|
16959
16985
|
types.setTypeParser(1700, function(val) {
|
|
16960
16986
|
return parseFloat(val);
|
|
16961
16987
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -4258,7 +4258,7 @@ function requireClient () {
|
|
|
4258
4258
|
if (arguments[i][isColumnProxyKey])
|
|
4259
4259
|
args[i] = { [columnRefKey]: arguments[i][columnPathKey] };
|
|
4260
4260
|
else
|
|
4261
|
-
args[i] = arguments[i](tableProxy(
|
|
4261
|
+
args[i] = arguments[i](tableProxy());
|
|
4262
4262
|
}
|
|
4263
4263
|
else
|
|
4264
4264
|
args[i] = arguments[i];
|
|
@@ -5600,7 +5600,7 @@ function requireNewEncode$5 () {
|
|
|
5600
5600
|
value = purify(value);
|
|
5601
5601
|
if (value == null) {
|
|
5602
5602
|
if (column.dbNull === null)
|
|
5603
|
-
;
|
|
5603
|
+
return 'null';
|
|
5604
5604
|
return '\'' + column.dbNull + '\'';
|
|
5605
5605
|
}
|
|
5606
5606
|
var encodeCore = getSessionSingleton(context, 'encodeDate') || encodeDate;
|
|
@@ -5735,12 +5735,12 @@ function requireNewEncode$4 () {
|
|
|
5735
5735
|
return 'null';
|
|
5736
5736
|
return '\'' + column.dbNull + '\'';
|
|
5737
5737
|
}
|
|
5738
|
-
var encodeCore = getSessionSingleton(context, 'encodeDateTz') || getSessionSingleton(context, '
|
|
5738
|
+
var encodeCore = getSessionSingleton(context, 'encodeDateTz') || getSessionSingleton(context, 'encodeDate') || encodeDate;
|
|
5739
5739
|
return encodeCore(value);
|
|
5740
5740
|
};
|
|
5741
5741
|
|
|
5742
5742
|
encode.direct = function(context, value) {
|
|
5743
|
-
var encodeCore = getSessionSingleton(context, 'encodeDateTz') || getSessionSingleton(context, '
|
|
5743
|
+
var encodeCore = getSessionSingleton(context, 'encodeDateTz') || getSessionSingleton(context, 'encodeDate') || encodeDate;
|
|
5744
5744
|
return encodeCore(value);
|
|
5745
5745
|
};
|
|
5746
5746
|
|
|
@@ -5944,7 +5944,7 @@ function requireNewEncode$2 () {
|
|
|
5944
5944
|
value = purify(value);
|
|
5945
5945
|
if (value == null) {
|
|
5946
5946
|
if (column.dbNull === null)
|
|
5947
|
-
;
|
|
5947
|
+
return 'null';
|
|
5948
5948
|
return '\'' + column.dbNull + '\'';
|
|
5949
5949
|
}
|
|
5950
5950
|
var encodeCore = getSessionSingleton(context, 'encodeBigint') || encodeBigint;
|
|
@@ -6293,18 +6293,13 @@ function requireColumn () {
|
|
|
6293
6293
|
return c;
|
|
6294
6294
|
};
|
|
6295
6295
|
|
|
6296
|
-
c.date = function() {
|
|
6297
|
-
requireDate()(column);
|
|
6298
|
-
return c;
|
|
6299
|
-
};
|
|
6300
|
-
|
|
6301
6296
|
c.dateWithTimeZone = function() {
|
|
6302
6297
|
requireDateWithTimeZone()(column);
|
|
6303
6298
|
return c;
|
|
6304
6299
|
};
|
|
6305
6300
|
|
|
6306
|
-
c.numeric = function(
|
|
6307
|
-
requireNumeric()(column
|
|
6301
|
+
c.numeric = function() {
|
|
6302
|
+
requireNumeric()(column);
|
|
6308
6303
|
return c;
|
|
6309
6304
|
};
|
|
6310
6305
|
|
|
@@ -8900,6 +8895,10 @@ function requireDbRowToRow () {
|
|
|
8900
8895
|
function dbRowToRow(context, span, dbRow) {
|
|
8901
8896
|
var table = span.table;
|
|
8902
8897
|
var row = decodeDbRow(context, span, table, dbRow);
|
|
8898
|
+
if (!hasPrimaryKey(row, table)) {
|
|
8899
|
+
skipNestedLegs(span, dbRow);
|
|
8900
|
+
return null;
|
|
8901
|
+
}
|
|
8903
8902
|
var cache = table._cache;
|
|
8904
8903
|
if (!cache.tryGet(context, row)) {
|
|
8905
8904
|
var queryContext = span.queryContext;
|
|
@@ -8916,13 +8915,15 @@ function requireDbRowToRow () {
|
|
|
8916
8915
|
var c = {};
|
|
8917
8916
|
|
|
8918
8917
|
c.visitOne = function(leg) {
|
|
8919
|
-
dbRowToRow(context, leg.span, dbRow);
|
|
8920
|
-
|
|
8918
|
+
let child = dbRowToRow(context, leg.span, dbRow);
|
|
8919
|
+
if (child)
|
|
8920
|
+
leg.expand(row);
|
|
8921
8921
|
};
|
|
8922
8922
|
|
|
8923
8923
|
c.visitJoin = function(leg) {
|
|
8924
|
-
dbRowToRow(context, leg.span, dbRow);
|
|
8925
|
-
|
|
8924
|
+
let child = dbRowToRow(context, leg.span, dbRow);
|
|
8925
|
+
if (child)
|
|
8926
|
+
leg.expand(row);
|
|
8926
8927
|
};
|
|
8927
8928
|
|
|
8928
8929
|
c.visitMany = function() {
|
|
@@ -8937,6 +8938,33 @@ function requireDbRowToRow () {
|
|
|
8937
8938
|
return row;
|
|
8938
8939
|
}
|
|
8939
8940
|
|
|
8941
|
+
function hasPrimaryKey(row, table) {
|
|
8942
|
+
return table._primaryColumns.every((column) => {
|
|
8943
|
+
let value = row[column.alias];
|
|
8944
|
+
return value !== null && value !== undefined;
|
|
8945
|
+
});
|
|
8946
|
+
}
|
|
8947
|
+
|
|
8948
|
+
function skipNestedLegs(span, dbRow) {
|
|
8949
|
+
span.legs.forEach((leg) => {
|
|
8950
|
+
leg.accept({
|
|
8951
|
+
visitOne() {
|
|
8952
|
+
skipSpan(leg.span, dbRow);
|
|
8953
|
+
},
|
|
8954
|
+
visitJoin() {
|
|
8955
|
+
skipSpan(leg.span, dbRow);
|
|
8956
|
+
},
|
|
8957
|
+
visitMany() {
|
|
8958
|
+
}
|
|
8959
|
+
});
|
|
8960
|
+
});
|
|
8961
|
+
}
|
|
8962
|
+
|
|
8963
|
+
function skipSpan(span, dbRow) {
|
|
8964
|
+
decodeDbRow(undefined, span, span.table, dbRow);
|
|
8965
|
+
skipNestedLegs(span, dbRow);
|
|
8966
|
+
}
|
|
8967
|
+
|
|
8940
8968
|
dbRowToRow_1 = dbRowToRow;
|
|
8941
8969
|
return dbRowToRow_1;
|
|
8942
8970
|
}
|
|
@@ -10278,10 +10306,9 @@ function requireWhere$1 () {
|
|
|
10278
10306
|
function newWhere(_relations, _depth) {
|
|
10279
10307
|
|
|
10280
10308
|
function where(context, fn) {
|
|
10281
|
-
|
|
10282
|
-
let { relations, alias } = extract(includeMany, _relations);
|
|
10309
|
+
let { relations, alias } = extract(_relations);
|
|
10283
10310
|
const table = relations[relations.length - 1].childTable;
|
|
10284
|
-
if (!relations[0].isMany
|
|
10311
|
+
if (!relations[0].isMany)
|
|
10285
10312
|
table._rootAlias = alias;
|
|
10286
10313
|
|
|
10287
10314
|
try {
|
|
@@ -10297,11 +10324,11 @@ function requireWhere$1 () {
|
|
|
10297
10324
|
}
|
|
10298
10325
|
return where;
|
|
10299
10326
|
|
|
10300
|
-
function extract(
|
|
10327
|
+
function extract(relations) {
|
|
10301
10328
|
let alias = relations[0].toLeg().table._dbName;
|
|
10302
10329
|
let result = [];
|
|
10303
10330
|
for (let i = 0; i < relations.length; i++) {
|
|
10304
|
-
if (relations[i].isMany
|
|
10331
|
+
if (relations[i].isMany) {
|
|
10305
10332
|
result = [relations[i]];
|
|
10306
10333
|
alias = relations[i].toLeg().table._dbName;
|
|
10307
10334
|
}
|
|
@@ -10328,10 +10355,9 @@ function requireAggregate$1 () {
|
|
|
10328
10355
|
function newAggregate(_relations) {
|
|
10329
10356
|
|
|
10330
10357
|
function aggregate(context, fn) {
|
|
10331
|
-
|
|
10332
|
-
let { relations, alias } = extract(includeMany, _relations);
|
|
10358
|
+
let { relations, alias } = extract(_relations);
|
|
10333
10359
|
const table = relations[relations.length - 1].childTable;
|
|
10334
|
-
if (!relations[0].isMany
|
|
10360
|
+
if (!relations[0].isMany)
|
|
10335
10361
|
table._rootAlias = alias;
|
|
10336
10362
|
|
|
10337
10363
|
try {
|
|
@@ -10346,11 +10372,11 @@ function requireAggregate$1 () {
|
|
|
10346
10372
|
}
|
|
10347
10373
|
return aggregate;
|
|
10348
10374
|
|
|
10349
|
-
function extract(
|
|
10375
|
+
function extract(relations) {
|
|
10350
10376
|
let alias = relations[0].toLeg().table._dbName;
|
|
10351
10377
|
let result = [];
|
|
10352
10378
|
for (let i = 0; i < relations.length; i++) {
|
|
10353
|
-
if (relations[i].isMany
|
|
10379
|
+
if (relations[i].isMany) {
|
|
10354
10380
|
result = [relations[i]];
|
|
10355
10381
|
alias = relations[i].toLeg().table._dbName;
|
|
10356
10382
|
}
|
|
@@ -11011,7 +11037,7 @@ function requireNewManyCacheCore () {
|
|
|
11011
11037
|
}
|
|
11012
11038
|
var rows = newArray();
|
|
11013
11039
|
rows.push(childRow);
|
|
11014
|
-
|
|
11040
|
+
cache.tryAdd(key, rows);
|
|
11015
11041
|
}
|
|
11016
11042
|
|
|
11017
11043
|
function newArray() {
|
|
@@ -11737,16 +11763,18 @@ function requireGetManyDto$1 () {
|
|
|
11737
11763
|
outRow[column.alias] = column.decode(context, row[keys[j]]);
|
|
11738
11764
|
}
|
|
11739
11765
|
|
|
11740
|
-
|
|
11741
|
-
|
|
11742
|
-
|
|
11743
|
-
|
|
11766
|
+
if (outRow) {
|
|
11767
|
+
for (let j = 0; j < aggregateKeys.length; j++) {
|
|
11768
|
+
const key = aggregateKeys[j];
|
|
11769
|
+
const parse = span.aggregates[key].column?.decode || ((context, arg) => Number.parseFloat(arg));
|
|
11770
|
+
outRow[key] = parse(context, row[keys[j + columnsLength]]);
|
|
11771
|
+
}
|
|
11744
11772
|
}
|
|
11745
11773
|
|
|
11746
11774
|
outRows[i] = outRow;
|
|
11747
11775
|
if (updateParent)
|
|
11748
11776
|
updateParent(outRow, i);
|
|
11749
|
-
if (shouldCreateMap) {
|
|
11777
|
+
if (shouldCreateMap && outRow) {
|
|
11750
11778
|
fkIds[i] = getIds(outRow);
|
|
11751
11779
|
addToMap(rowsMap, fkIds[i], outRow);
|
|
11752
11780
|
}
|
|
@@ -12937,7 +12965,6 @@ function requirePatchTable () {
|
|
|
12937
12965
|
let result;
|
|
12938
12966
|
for (let i = 0; i < relation.columns.length; i++) {
|
|
12939
12967
|
let p = relation.columns[i].alias;
|
|
12940
|
-
row[p];
|
|
12941
12968
|
result = await remove({ path: ['dummy', p], oldValue: (oldValue || {})[p], op, options: options }, table, row) || result;
|
|
12942
12969
|
}
|
|
12943
12970
|
return result || {};
|
|
@@ -12950,8 +12977,7 @@ function requirePatchTable () {
|
|
|
12950
12977
|
let p = relation.columns[i].alias;
|
|
12951
12978
|
let childKey = relation.childTable._primaryColumns[i].alias;
|
|
12952
12979
|
if (path[1] === childKey) {
|
|
12953
|
-
|
|
12954
|
-
result = await remove({ path: ['dummy', p], oldValue: (oldValue || {})[p], op, options: options }, table, row) || result;
|
|
12980
|
+
result = await remove({ path: ['dummy', p], oldValue: oldValue[p], op, options: options }, table, row) || result;
|
|
12955
12981
|
break;
|
|
12956
12982
|
}
|
|
12957
12983
|
}
|
|
@@ -18002,7 +18028,7 @@ function requireNewPgPool () {
|
|
|
18002
18028
|
if (!pg) {
|
|
18003
18029
|
pg = await import('pg');
|
|
18004
18030
|
pg = pg.default || pg;
|
|
18005
|
-
let types = pg.types
|
|
18031
|
+
let types = pg.types;
|
|
18006
18032
|
types.setTypeParser(1700, function(val) {
|
|
18007
18033
|
return parseFloat(val);
|
|
18008
18034
|
});
|
|
@@ -18589,6 +18615,7 @@ function requireNewTransaction$7 () {
|
|
|
18589
18615
|
rdb.pool = pool;
|
|
18590
18616
|
}
|
|
18591
18617
|
rdb.engine = 'sqlite';
|
|
18618
|
+
rdb.maxParameters = 32766;
|
|
18592
18619
|
rdb.encodeBoolean = encodeBoolean;
|
|
18593
18620
|
rdb.encodeBinary = encodeBinary;
|
|
18594
18621
|
rdb.decodeBinary = decodeBinary;
|
|
@@ -19022,6 +19049,7 @@ function requireNewTransaction$6 () {
|
|
|
19022
19049
|
rdb.pool = pool;
|
|
19023
19050
|
}
|
|
19024
19051
|
rdb.engine = 'sqlite';
|
|
19052
|
+
rdb.maxParameters = 32766;
|
|
19025
19053
|
rdb.encodeBoolean = encodeBoolean;
|
|
19026
19054
|
rdb.encodeBinary = encodeBinary;
|
|
19027
19055
|
rdb.decodeBinary = decodeBinary;
|
|
@@ -19458,6 +19486,7 @@ function requireNewTransaction$5 () {
|
|
|
19458
19486
|
rdb.pool = pool;
|
|
19459
19487
|
}
|
|
19460
19488
|
rdb.engine = 'sqlite';
|
|
19489
|
+
rdb.maxParameters = 32766;
|
|
19461
19490
|
rdb.encodeBoolean = encodeBoolean;
|
|
19462
19491
|
rdb.decodeJSON = decodeJSON;
|
|
19463
19492
|
rdb.encodeJSON = JSON.stringify;
|
|
@@ -20876,6 +20905,7 @@ function requireNewTransaction$3 () {
|
|
|
20876
20905
|
rdb.pool = pool;
|
|
20877
20906
|
}
|
|
20878
20907
|
rdb.engine = 'mssqlNative';
|
|
20908
|
+
rdb.maxParameters = 2100;
|
|
20879
20909
|
rdb.encodeBoolean = encodeBoolean;
|
|
20880
20910
|
rdb.decodeJSON = decodeJSON;
|
|
20881
20911
|
rdb.encodeJSON = JSON.stringify;
|
|
@@ -21638,6 +21668,7 @@ function requireNewTransaction$2 () {
|
|
|
21638
21668
|
rdb.pool = pool;
|
|
21639
21669
|
}
|
|
21640
21670
|
rdb.engine = 'mssql';
|
|
21671
|
+
rdb.maxParameters = 2100;
|
|
21641
21672
|
rdb.encodeBoolean = encodeBoolean;
|
|
21642
21673
|
rdb.decodeJSON = decodeJSON;
|
|
21643
21674
|
rdb.encodeJSON = JSON.stringify;
|
|
@@ -23206,6 +23237,7 @@ function requireNewTransaction () {
|
|
|
23206
23237
|
|
|
23207
23238
|
rdb.begin = 'SET TRANSACTION ISOLATION LEVEL READ COMMITTED';
|
|
23208
23239
|
rdb.engine = 'oracle';
|
|
23240
|
+
rdb.maxParameters = 32768;
|
|
23209
23241
|
rdb.encodeBoolean = encodeBoolean;
|
|
23210
23242
|
rdb.decodeJSON = decodeJSON;
|
|
23211
23243
|
rdb.encodeJSON = JSON.stringify;
|
package/docs/changelog.md
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
## Changelog
|
|
2
|
+
__5.3.1__
|
|
3
|
+
Fixes crashes in getById/getMany when a missing relation has nested hasMany/hasOne/references in the strategy. [#177](https://github.com/alfateam/orange-orm/issues/177)
|
|
4
|
+
Added max parameter chunking for getManyDto hasMany subqueries on MSSQL, SQLite and Oracle.
|
|
2
5
|
__5.3.0__
|
|
3
6
|
Support for MariaDB [#169](https://github.com/alfateam/orange-orm/issues/169)
|
|
4
7
|
__5.2.4__
|
package/package.json
CHANGED
|
@@ -19,6 +19,7 @@ function newResolveTransaction(domain, pool, { readonly = false } = {}) {
|
|
|
19
19
|
rdb.pool = pool;
|
|
20
20
|
}
|
|
21
21
|
rdb.engine = 'sqlite';
|
|
22
|
+
rdb.maxParameters = 32766;
|
|
22
23
|
rdb.encodeBoolean = encodeBoolean;
|
|
23
24
|
rdb.encodeBinary = encodeBinary;
|
|
24
25
|
rdb.decodeBinary = decodeBinary;
|
|
@@ -106,4 +107,4 @@ function decodeJSON(value) {
|
|
|
106
107
|
return JSON.parse(value);
|
|
107
108
|
}
|
|
108
109
|
|
|
109
|
-
module.exports = newResolveTransaction;
|
|
110
|
+
module.exports = newResolveTransaction;
|
package/src/client/index.js
CHANGED
|
@@ -1086,7 +1086,7 @@ function column(path, ...previous) {
|
|
|
1086
1086
|
if (arguments[i][isColumnProxyKey])
|
|
1087
1087
|
args[i] = { [columnRefKey]: arguments[i][columnPathKey] };
|
|
1088
1088
|
else
|
|
1089
|
-
args[i] = arguments[i](tableProxy(
|
|
1089
|
+
args[i] = arguments[i](tableProxy());
|
|
1090
1090
|
}
|
|
1091
1091
|
else
|
|
1092
1092
|
args[i] = arguments[i];
|
package/src/getManyDto.js
CHANGED
|
@@ -126,16 +126,18 @@ async function decode(context, strategy, span, rows, keys = rows.length > 0 ? Ob
|
|
|
126
126
|
outRow[column.alias] = column.decode(context, row[keys[j]]);
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
129
|
+
if (outRow) {
|
|
130
|
+
for (let j = 0; j < aggregateKeys.length; j++) {
|
|
131
|
+
const key = aggregateKeys[j];
|
|
132
|
+
const parse = span.aggregates[key].column?.decode || ((context, arg) => Number.parseFloat(arg));
|
|
133
|
+
outRow[key] = parse(context, row[keys[j + columnsLength]]);
|
|
134
|
+
}
|
|
133
135
|
}
|
|
134
136
|
|
|
135
137
|
outRows[i] = outRow;
|
|
136
138
|
if (updateParent)
|
|
137
139
|
updateParent(outRow, i);
|
|
138
|
-
if (shouldCreateMap) {
|
|
140
|
+
if (shouldCreateMap && outRow) {
|
|
139
141
|
fkIds[i] = getIds(outRow);
|
|
140
142
|
addToMap(rowsMap, fkIds[i], outRow);
|
|
141
143
|
}
|
|
@@ -19,6 +19,7 @@ function newResolveTransaction(domain, pool, { readonly = false } = {}) {
|
|
|
19
19
|
rdb.pool = pool;
|
|
20
20
|
}
|
|
21
21
|
rdb.engine = 'mssqlNative';
|
|
22
|
+
rdb.maxParameters = 2100;
|
|
22
23
|
rdb.encodeBoolean = encodeBoolean;
|
|
23
24
|
rdb.decodeJSON = decodeJSON;
|
|
24
25
|
rdb.encodeJSON = JSON.stringify;
|
|
@@ -117,4 +118,4 @@ function decodeJSON(value){
|
|
|
117
118
|
return JSON.parse(value);
|
|
118
119
|
}
|
|
119
120
|
|
|
120
|
-
module.exports = newResolveTransaction;
|
|
121
|
+
module.exports = newResolveTransaction;
|
|
@@ -19,6 +19,7 @@ function newResolveTransaction(domain, pool, { readonly = false } = {}) {
|
|
|
19
19
|
rdb.pool = pool;
|
|
20
20
|
}
|
|
21
21
|
rdb.engine = 'sqlite';
|
|
22
|
+
rdb.maxParameters = 32766;
|
|
22
23
|
rdb.encodeBoolean = encodeBoolean;
|
|
23
24
|
rdb.encodeBinary = encodeBinary;
|
|
24
25
|
rdb.decodeBinary = decodeBinary;
|
|
@@ -106,4 +107,4 @@ function decodeJSON(value) {
|
|
|
106
107
|
return JSON.parse(value);
|
|
107
108
|
}
|
|
108
109
|
|
|
109
|
-
module.exports = newResolveTransaction;
|
|
110
|
+
module.exports = newResolveTransaction;
|
|
@@ -21,6 +21,7 @@ function newResolveTransaction(domain, pool, { readonly = false } = {}) {
|
|
|
21
21
|
|
|
22
22
|
rdb.begin = 'SET TRANSACTION ISOLATION LEVEL READ COMMITTED';
|
|
23
23
|
rdb.engine = 'oracle';
|
|
24
|
+
rdb.maxParameters = 32768;
|
|
24
25
|
rdb.encodeBoolean = encodeBoolean;
|
|
25
26
|
rdb.decodeJSON = decodeJSON;
|
|
26
27
|
rdb.encodeJSON = JSON.stringify;
|
|
@@ -110,4 +111,4 @@ function decodeJSON(value) {
|
|
|
110
111
|
return JSON.parse(value);
|
|
111
112
|
}
|
|
112
113
|
|
|
113
|
-
module.exports = newResolveTransaction;
|
|
114
|
+
module.exports = newResolveTransaction;
|
package/src/patchTable.js
CHANGED
|
@@ -267,8 +267,6 @@ async function patchTableCore(context, table, patches, { strategy = undefined, d
|
|
|
267
267
|
let result;
|
|
268
268
|
for (let i = 0; i < relation.columns.length; i++) {
|
|
269
269
|
let p = relation.columns[i].alias;
|
|
270
|
-
let dto = {};
|
|
271
|
-
dto[p] = row[p];
|
|
272
270
|
result = await remove({ path: ['dummy', p], oldValue: (oldValue || {})[p], op, options: options }, table, row) || result;
|
|
273
271
|
}
|
|
274
272
|
return result || {};
|
|
@@ -281,9 +279,7 @@ async function patchTableCore(context, table, patches, { strategy = undefined, d
|
|
|
281
279
|
let p = relation.columns[i].alias;
|
|
282
280
|
let childKey = relation.childTable._primaryColumns[i].alias;
|
|
283
281
|
if (path[1] === childKey) {
|
|
284
|
-
|
|
285
|
-
dto[p] = row[p];
|
|
286
|
-
result = await remove({ path: ['dummy', p], oldValue: (oldValue || {})[p], op, options: options }, table, row) || result;
|
|
282
|
+
result = await remove({ path: ['dummy', p], oldValue: oldValue[p], op, options: options }, table, row) || result;
|
|
287
283
|
break;
|
|
288
284
|
}
|
|
289
285
|
}
|
package/src/pg/pool/newPgPool.js
CHANGED
|
@@ -22,7 +22,7 @@ function newPgPool(connectionString, poolOptions) {
|
|
|
22
22
|
if (!pg) {
|
|
23
23
|
pg = await import('pg');
|
|
24
24
|
pg = pg.default || pg;
|
|
25
|
-
let types = pg.types
|
|
25
|
+
let types = pg.types;
|
|
26
26
|
types.setTypeParser(1700, function(val) {
|
|
27
27
|
return parseFloat(val);
|
|
28
28
|
});
|
|
@@ -17,6 +17,7 @@ function newResolveTransaction(domain, pool, { readonly = false } = {}) {
|
|
|
17
17
|
rdb.pool = pool;
|
|
18
18
|
}
|
|
19
19
|
rdb.engine = 'sqlite';
|
|
20
|
+
rdb.maxParameters = 32766;
|
|
20
21
|
rdb.encodeBoolean = encodeBoolean;
|
|
21
22
|
rdb.decodeJSON = decodeJSON;
|
|
22
23
|
rdb.encodeJSON = JSON.stringify;
|
|
@@ -102,4 +103,4 @@ function decodeJSON(value) {
|
|
|
102
103
|
return JSON.parse(value);
|
|
103
104
|
}
|
|
104
105
|
|
|
105
|
-
module.exports = newResolveTransaction;
|
|
106
|
+
module.exports = newResolveTransaction;
|
|
@@ -23,12 +23,12 @@ function _new(column) {
|
|
|
23
23
|
return 'null';
|
|
24
24
|
return '\'' + column.dbNull + '\'';
|
|
25
25
|
}
|
|
26
|
-
var encodeCore = getSessionSingleton(context, 'encodeDateTz') || getSessionSingleton(context, '
|
|
26
|
+
var encodeCore = getSessionSingleton(context, 'encodeDateTz') || getSessionSingleton(context, 'encodeDate') || encodeDate;
|
|
27
27
|
return encodeCore(value);
|
|
28
28
|
};
|
|
29
29
|
|
|
30
30
|
encode.direct = function(context, value) {
|
|
31
|
-
var encodeCore = getSessionSingleton(context, 'encodeDateTz') || getSessionSingleton(context, '
|
|
31
|
+
var encodeCore = getSessionSingleton(context, 'encodeDateTz') || getSessionSingleton(context, 'encodeDate') || encodeDate;
|
|
32
32
|
return encodeCore(value);
|
|
33
33
|
};
|
|
34
34
|
|
package/src/table/column.js
CHANGED
|
@@ -28,18 +28,13 @@ function defineColumn(column, table) {
|
|
|
28
28
|
return c;
|
|
29
29
|
};
|
|
30
30
|
|
|
31
|
-
c.date = function() {
|
|
32
|
-
require('./column/date')(column);
|
|
33
|
-
return c;
|
|
34
|
-
};
|
|
35
|
-
|
|
36
31
|
c.dateWithTimeZone = function() {
|
|
37
32
|
require('./column/dateWithTimeZone')(column);
|
|
38
33
|
return c;
|
|
39
34
|
};
|
|
40
35
|
|
|
41
|
-
c.numeric = function(
|
|
42
|
-
require('./column/numeric')(column
|
|
36
|
+
c.numeric = function() {
|
|
37
|
+
require('./column/numeric')(column);
|
|
43
38
|
return c;
|
|
44
39
|
};
|
|
45
40
|
|
|
@@ -3,8 +3,8 @@ var newImmutable = require('../../newImmutable');
|
|
|
3
3
|
var createPatch = require('../../client/createPatch');
|
|
4
4
|
var createDto = require('../resultToRows/toDto/createDto');
|
|
5
5
|
|
|
6
|
-
function newInsertCommand(table, row
|
|
7
|
-
return new InsertCommand(table, row
|
|
6
|
+
function newInsertCommand(table, row) {
|
|
7
|
+
return new InsertCommand(table, row);
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
function InsertCommand(table, row) {
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
function newAggregate(_relations) {
|
|
2
2
|
|
|
3
3
|
function aggregate(context, fn) {
|
|
4
|
-
|
|
5
|
-
let { relations, alias } = extract(includeMany, _relations);
|
|
4
|
+
let { relations, alias } = extract(_relations);
|
|
6
5
|
const table = relations[relations.length - 1].childTable;
|
|
7
|
-
if (!relations[0].isMany
|
|
6
|
+
if (!relations[0].isMany)
|
|
8
7
|
table._rootAlias = alias;
|
|
9
8
|
|
|
10
9
|
try {
|
|
@@ -19,11 +18,11 @@ function newAggregate(_relations) {
|
|
|
19
18
|
}
|
|
20
19
|
return aggregate;
|
|
21
20
|
|
|
22
|
-
function extract(
|
|
21
|
+
function extract(relations) {
|
|
23
22
|
let alias = relations[0].toLeg().table._dbName;
|
|
24
23
|
let result = [];
|
|
25
24
|
for (let i = 0; i < relations.length; i++) {
|
|
26
|
-
if (relations[i].isMany
|
|
25
|
+
if (relations[i].isMany) {
|
|
27
26
|
result = [relations[i]];
|
|
28
27
|
alias = relations[i].toLeg().table._dbName;
|
|
29
28
|
}
|
|
@@ -3,10 +3,9 @@ const negotiateRawSqlFilter = require('../column/negotiateRawSqlFilter');
|
|
|
3
3
|
function newWhere(_relations, _depth) {
|
|
4
4
|
|
|
5
5
|
function where(context, fn) {
|
|
6
|
-
|
|
7
|
-
let { relations, alias } = extract(includeMany, _relations);
|
|
6
|
+
let { relations, alias } = extract(_relations);
|
|
8
7
|
const table = relations[relations.length - 1].childTable;
|
|
9
|
-
if (!relations[0].isMany
|
|
8
|
+
if (!relations[0].isMany)
|
|
10
9
|
table._rootAlias = alias;
|
|
11
10
|
|
|
12
11
|
try {
|
|
@@ -22,11 +21,11 @@ function newWhere(_relations, _depth) {
|
|
|
22
21
|
}
|
|
23
22
|
return where;
|
|
24
23
|
|
|
25
|
-
function extract(
|
|
24
|
+
function extract(relations) {
|
|
26
25
|
let alias = relations[0].toLeg().table._dbName;
|
|
27
26
|
let result = [];
|
|
28
27
|
for (let i = 0; i < relations.length; i++) {
|
|
29
|
-
if (relations[i].isMany
|
|
28
|
+
if (relations[i].isMany) {
|
|
30
29
|
result = [relations[i]];
|
|
31
30
|
alias = relations[i].toLeg().table._dbName;
|
|
32
31
|
}
|
|
@@ -4,6 +4,10 @@ var decodeDbRow = require('./decodeDbRow');
|
|
|
4
4
|
function dbRowToRow(context, span, dbRow) {
|
|
5
5
|
var table = span.table;
|
|
6
6
|
var row = decodeDbRow(context, span, table, dbRow);
|
|
7
|
+
if (!hasPrimaryKey(row, table)) {
|
|
8
|
+
skipNestedLegs(span, dbRow);
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
7
11
|
var cache = table._cache;
|
|
8
12
|
if (!cache.tryGet(context, row)) {
|
|
9
13
|
var queryContext = span.queryContext;
|
|
@@ -20,13 +24,15 @@ function dbRowToRow(context, span, dbRow) {
|
|
|
20
24
|
var c = {};
|
|
21
25
|
|
|
22
26
|
c.visitOne = function(leg) {
|
|
23
|
-
dbRowToRow(context, leg.span, dbRow);
|
|
24
|
-
|
|
27
|
+
let child = dbRowToRow(context, leg.span, dbRow);
|
|
28
|
+
if (child)
|
|
29
|
+
leg.expand(row);
|
|
25
30
|
};
|
|
26
31
|
|
|
27
32
|
c.visitJoin = function(leg) {
|
|
28
|
-
dbRowToRow(context, leg.span, dbRow);
|
|
29
|
-
|
|
33
|
+
let child = dbRowToRow(context, leg.span, dbRow);
|
|
34
|
+
if (child)
|
|
35
|
+
leg.expand(row);
|
|
30
36
|
};
|
|
31
37
|
|
|
32
38
|
c.visitMany = function() {
|
|
@@ -41,4 +47,31 @@ function dbRowToRow(context, span, dbRow) {
|
|
|
41
47
|
return row;
|
|
42
48
|
}
|
|
43
49
|
|
|
44
|
-
|
|
50
|
+
function hasPrimaryKey(row, table) {
|
|
51
|
+
return table._primaryColumns.every((column) => {
|
|
52
|
+
let value = row[column.alias];
|
|
53
|
+
return value !== null && value !== undefined;
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function skipNestedLegs(span, dbRow) {
|
|
58
|
+
span.legs.forEach((leg) => {
|
|
59
|
+
leg.accept({
|
|
60
|
+
visitOne() {
|
|
61
|
+
skipSpan(leg.span, dbRow);
|
|
62
|
+
},
|
|
63
|
+
visitJoin() {
|
|
64
|
+
skipSpan(leg.span, dbRow);
|
|
65
|
+
},
|
|
66
|
+
visitMany() {
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function skipSpan(span, dbRow) {
|
|
73
|
+
decodeDbRow(undefined, span, span.table, dbRow);
|
|
74
|
+
skipNestedLegs(span, dbRow);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
module.exports = dbRowToRow;
|
|
@@ -19,6 +19,7 @@ function newResolveTransaction(domain, pool, { readonly = false } = {}) {
|
|
|
19
19
|
rdb.pool = pool;
|
|
20
20
|
}
|
|
21
21
|
rdb.engine = 'mssql';
|
|
22
|
+
rdb.maxParameters = 2100;
|
|
22
23
|
rdb.encodeBoolean = encodeBoolean;
|
|
23
24
|
rdb.decodeJSON = decodeJSON;
|
|
24
25
|
rdb.encodeJSON = JSON.stringify;
|
|
@@ -114,4 +115,4 @@ function decodeJSON(value){
|
|
|
114
115
|
return JSON.parse(value);
|
|
115
116
|
}
|
|
116
117
|
|
|
117
|
-
module.exports = newResolveTransaction;
|
|
118
|
+
module.exports = newResolveTransaction;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
var newWhereSql = require('./singleQuery/newWhereSql');
|
|
2
|
-
var negotiateLimit = require('./singleQuery/negotiateLimit');
|
|
3
|
-
var newParameterized = require('./newParameterized');
|
|
4
|
-
var getSessionContext = require('../getSessionContext');
|
|
5
|
-
|
|
6
|
-
function _new(table, filter, span, alias, orderBy, limit) {
|
|
7
|
-
//unused ?
|
|
8
|
-
|
|
9
|
-
if (!limit)
|
|
10
|
-
return;
|
|
11
|
-
var whereSql = newWhereSql(table, filter, alias);
|
|
12
|
-
var safeLimit = negotiateLimit(limit);
|
|
13
|
-
var sql;
|
|
14
|
-
if (getSessionContext().limit === 'TOP') {
|
|
15
|
-
safeLimit = safeLimit.replace('limit', 'top');
|
|
16
|
-
sql = 'select ' + safeLimit + ' * from ' + table._dbName + ' ' + alias + whereSql + orderBy;
|
|
17
|
-
}
|
|
18
|
-
sql = 'select * from ' + table._dbName + ' ' + alias + whereSql + orderBy + safeLimit;
|
|
19
|
-
|
|
20
|
-
return newParameterized(sql, filter.parameters);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
module.exports = _new;
|