@mikro-orm/knex 6.6.18-dev.2 → 6.6.18-dev.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.
- package/AbstractSqlDriver.js +12 -3
- package/package.json +2 -2
package/AbstractSqlDriver.js
CHANGED
|
@@ -670,7 +670,10 @@ class AbstractSqlDriver extends core_1.DatabaseDriver {
|
|
|
670
670
|
sql = sql.substring(0, sql.length - 2) + ' where ';
|
|
671
671
|
const pkProps = meta.primaryKeys.concat(...meta.concurrencyCheckKeys);
|
|
672
672
|
const pks = core_1.Utils.flatten(pkProps.map(pk => meta.properties[pk].fieldNames));
|
|
673
|
-
|
|
673
|
+
const useTupleIn = pks.length <= 1 || this.platform.allowsComparingTuples();
|
|
674
|
+
const condTemplate = useTupleIn
|
|
675
|
+
? `(${pks.map(() => '?').join(', ')})`
|
|
676
|
+
: `(${pks.map(pk => `${this.platform.quoteIdentifier(pk)} = ?`).join(' and ')})`;
|
|
674
677
|
const conds = where.map(cond => {
|
|
675
678
|
if (core_1.Utils.isPlainObject(cond) && core_1.Utils.getObjectKeysSize(cond) === 1) {
|
|
676
679
|
cond = Object.values(cond)[0];
|
|
@@ -684,12 +687,18 @@ class AbstractSqlDriver extends core_1.DatabaseDriver {
|
|
|
684
687
|
params.push(cond[pk]);
|
|
685
688
|
}
|
|
686
689
|
});
|
|
687
|
-
return
|
|
690
|
+
return condTemplate;
|
|
688
691
|
}
|
|
689
692
|
params.push(cond);
|
|
690
693
|
return '?';
|
|
691
694
|
});
|
|
692
|
-
|
|
695
|
+
if (useTupleIn) {
|
|
696
|
+
sql += pks.length > 1 ? `(${pks.map(pk => `${this.platform.quoteIdentifier(pk)}`).join(', ')})` : this.platform.quoteIdentifier(pks[0]);
|
|
697
|
+
sql += ` in (${conds.join(', ')})`;
|
|
698
|
+
}
|
|
699
|
+
else {
|
|
700
|
+
sql += conds.join(' or ');
|
|
701
|
+
}
|
|
693
702
|
if (this.platform.usesReturningStatement() && returning.size > 0) {
|
|
694
703
|
const returningFields = core_1.Utils.flatten([...returning].map(prop => meta.properties[prop].fieldNames));
|
|
695
704
|
/* istanbul ignore next */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/knex",
|
|
3
|
-
"version": "6.6.18-dev.
|
|
3
|
+
"version": "6.6.18-dev.4",
|
|
4
4
|
"description": "TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, PostgreSQL and SQLite databases as well as usage with vanilla JavaScript.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "index.mjs",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"@mikro-orm/core": "^6.6.17"
|
|
67
67
|
},
|
|
68
68
|
"peerDependencies": {
|
|
69
|
-
"@mikro-orm/core": "6.6.18-dev.
|
|
69
|
+
"@mikro-orm/core": "6.6.18-dev.4",
|
|
70
70
|
"better-sqlite3": "*",
|
|
71
71
|
"libsql": "*",
|
|
72
72
|
"mariadb": "*"
|