@mikro-orm/knex 6.0.0-dev.2 → 6.0.0-dev.200
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/AbstractSqlConnection.d.ts → AbstractSqlConnection.d.ts} +8 -4
- package/{dist/AbstractSqlConnection.js → AbstractSqlConnection.js} +35 -18
- package/AbstractSqlDriver.d.ts +73 -0
- package/AbstractSqlDriver.js +1085 -0
- package/AbstractSqlPlatform.d.ts +22 -0
- package/{dist/AbstractSqlPlatform.js → AbstractSqlPlatform.js} +46 -19
- package/{dist/MonkeyPatchable.d.ts → MonkeyPatchable.d.ts} +1 -0
- package/{dist/MonkeyPatchable.js → MonkeyPatchable.js} +3 -0
- package/PivotCollectionPersister.d.ts +17 -0
- package/PivotCollectionPersister.js +128 -0
- package/{dist/README.md → README.md} +66 -109
- package/{dist/SqlEntityManager.d.ts → SqlEntityManager.d.ts} +6 -10
- package/{dist/SqlEntityManager.js → SqlEntityManager.js} +5 -10
- package/SqlEntityRepository.d.ts +24 -0
- package/{dist/SqlEntityRepository.js → SqlEntityRepository.js} +11 -8
- package/{dist/index.d.ts → index.d.ts} +1 -0
- package/{dist/index.js → index.js} +6 -1
- package/index.mjs +211 -0
- package/package.json +20 -49
- package/query/ArrayCriteriaNode.d.ts +10 -0
- package/{dist/query → query}/ArrayCriteriaNode.js +7 -2
- package/{dist/query → query}/CriteriaNode.d.ts +11 -9
- package/{dist/query → query}/CriteriaNode.js +31 -15
- package/query/CriteriaNodeFactory.d.ts +12 -0
- package/{dist/query → query}/CriteriaNodeFactory.js +32 -15
- package/query/ObjectCriteriaNode.d.ts +15 -0
- package/{dist/query → query}/ObjectCriteriaNode.js +68 -21
- package/query/QueryBuilder.d.ts +284 -0
- package/query/QueryBuilder.js +1218 -0
- package/{dist/query → query}/QueryBuilderHelper.d.ts +26 -23
- package/query/QueryBuilderHelper.js +661 -0
- package/query/ScalarCriteriaNode.d.ts +10 -0
- package/{dist/query → query}/ScalarCriteriaNode.js +12 -8
- package/query/enums.d.ts +15 -0
- package/query/enums.js +20 -0
- package/{dist/query → query}/index.js +5 -1
- package/{dist/schema → schema}/DatabaseSchema.d.ts +6 -3
- package/{dist/schema → schema}/DatabaseSchema.js +35 -25
- package/{dist/schema → schema}/DatabaseTable.d.ts +21 -13
- package/schema/DatabaseTable.js +645 -0
- package/{dist/schema → schema}/SchemaComparator.d.ts +9 -7
- package/{dist/schema → schema}/SchemaComparator.js +99 -25
- package/{dist/schema → schema}/SchemaHelper.d.ts +20 -13
- package/{dist/schema → schema}/SchemaHelper.js +70 -18
- package/{dist/schema/SchemaGenerator.d.ts → schema/SqlSchemaGenerator.d.ts} +11 -14
- package/{dist/schema/SchemaGenerator.js → schema/SqlSchemaGenerator.js} +149 -63
- package/{dist/schema → schema}/index.d.ts +1 -1
- package/{dist/schema → schema}/index.js +6 -2
- package/{dist/typings.d.ts → typings.d.ts} +45 -22
- package/CHANGELOG.md +0 -661
- package/dist/AbstractSqlDriver.d.ts +0 -55
- package/dist/AbstractSqlDriver.js +0 -644
- package/dist/AbstractSqlPlatform.d.ts +0 -21
- package/dist/LICENSE +0 -21
- package/dist/SqlEntityRepository.d.ts +0 -23
- package/dist/index.mjs +0 -26
- package/dist/package.json +0 -99
- package/dist/query/ArrayCriteriaNode.d.ts +0 -9
- package/dist/query/CriteriaNodeFactory.d.ts +0 -12
- package/dist/query/ObjectCriteriaNode.d.ts +0 -14
- package/dist/query/QueryBuilder.d.ts +0 -211
- package/dist/query/QueryBuilder.js +0 -688
- package/dist/query/QueryBuilderHelper.js +0 -523
- package/dist/query/ScalarCriteriaNode.d.ts +0 -9
- package/dist/query/enums.d.ts +0 -8
- package/dist/query/enums.js +0 -12
- package/dist/schema/DatabaseTable.js +0 -319
- /package/{dist/query → query}/index.d.ts +0 -0
- /package/{dist/typings.js → typings.js} +0 -0
|
@@ -1,644 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AbstractSqlDriver = void 0;
|
|
4
|
-
const core_1 = require("@mikro-orm/core");
|
|
5
|
-
const QueryBuilder_1 = require("./query/QueryBuilder");
|
|
6
|
-
const SqlEntityManager_1 = require("./SqlEntityManager");
|
|
7
|
-
class AbstractSqlDriver extends core_1.DatabaseDriver {
|
|
8
|
-
constructor(config, platform, connection, connector) {
|
|
9
|
-
super(config, connector);
|
|
10
|
-
this.replicas = [];
|
|
11
|
-
this.connection = new connection(this.config);
|
|
12
|
-
this.replicas = this.createReplicas(conf => new connection(this.config, conf, 'read'));
|
|
13
|
-
this.platform = platform;
|
|
14
|
-
}
|
|
15
|
-
getPlatform() {
|
|
16
|
-
return this.platform;
|
|
17
|
-
}
|
|
18
|
-
createEntityManager(useContext) {
|
|
19
|
-
return new SqlEntityManager_1.SqlEntityManager(this.config, this, this.metadata, useContext);
|
|
20
|
-
}
|
|
21
|
-
async find(entityName, where, options = {}) {
|
|
22
|
-
options = { populate: [], orderBy: [], ...options };
|
|
23
|
-
const meta = this.metadata.find(entityName);
|
|
24
|
-
const populate = this.autoJoinOneToOneOwner(meta, options.populate, options.fields);
|
|
25
|
-
const joinedProps = this.joinedProps(meta, populate);
|
|
26
|
-
const qb = this.createQueryBuilder(entityName, options.ctx, !!options.ctx, false);
|
|
27
|
-
const fields = this.buildFields(meta, populate, joinedProps, qb, options.fields);
|
|
28
|
-
const joinedPropsOrderBy = this.buildJoinedPropsOrderBy(entityName, qb, meta, joinedProps);
|
|
29
|
-
if (core_1.Utils.isPrimaryKey(where, meta.compositePK)) {
|
|
30
|
-
where = { [core_1.Utils.getPrimaryKeyHash(meta.primaryKeys)]: where };
|
|
31
|
-
}
|
|
32
|
-
qb.select(fields)
|
|
33
|
-
.populate(populate)
|
|
34
|
-
.where(where)
|
|
35
|
-
.orderBy([...core_1.Utils.asArray(options.orderBy), ...joinedPropsOrderBy])
|
|
36
|
-
.groupBy(options.groupBy)
|
|
37
|
-
.having(options.having)
|
|
38
|
-
.withSchema(this.getSchemaName(meta, options));
|
|
39
|
-
if (options.limit !== undefined) {
|
|
40
|
-
qb.limit(options.limit, options.offset);
|
|
41
|
-
}
|
|
42
|
-
if (options.lockMode) {
|
|
43
|
-
qb.setLockMode(options.lockMode, options.lockTableAliases);
|
|
44
|
-
}
|
|
45
|
-
core_1.Utils.asArray(options.flags).forEach(flag => qb.setFlag(flag));
|
|
46
|
-
const result = await this.rethrow(qb.execute('all'));
|
|
47
|
-
if (joinedProps.length > 0) {
|
|
48
|
-
return this.mergeJoinedResult(result, meta);
|
|
49
|
-
}
|
|
50
|
-
return result;
|
|
51
|
-
}
|
|
52
|
-
async findOne(entityName, where, options) {
|
|
53
|
-
const opts = { populate: [], ...(options || {}) };
|
|
54
|
-
const meta = this.metadata.find(entityName);
|
|
55
|
-
const populate = this.autoJoinOneToOneOwner(meta, opts.populate, opts.fields);
|
|
56
|
-
const joinedProps = this.joinedProps(meta, populate);
|
|
57
|
-
if (joinedProps.length === 0) {
|
|
58
|
-
opts.limit = 1;
|
|
59
|
-
}
|
|
60
|
-
const res = await this.find(entityName, where, opts);
|
|
61
|
-
return res[0] || null;
|
|
62
|
-
}
|
|
63
|
-
mapResult(result, meta, populate = [], qb, map = {}) {
|
|
64
|
-
const ret = super.mapResult(result, meta);
|
|
65
|
-
/* istanbul ignore if */
|
|
66
|
-
if (!ret) {
|
|
67
|
-
return null;
|
|
68
|
-
}
|
|
69
|
-
if (qb) {
|
|
70
|
-
this.mapJoinedProps(ret, meta, populate, qb, ret, map);
|
|
71
|
-
}
|
|
72
|
-
return ret;
|
|
73
|
-
}
|
|
74
|
-
mapJoinedProps(result, meta, populate, qb, root, map, parentJoinPath) {
|
|
75
|
-
const joinedProps = this.joinedProps(meta, populate);
|
|
76
|
-
joinedProps.forEach(p => {
|
|
77
|
-
const relation = meta.properties[p.field];
|
|
78
|
-
/* istanbul ignore next */
|
|
79
|
-
if (!relation) {
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
|
-
const meta2 = this.metadata.find(relation.type);
|
|
83
|
-
const path = parentJoinPath ? `${parentJoinPath}.${relation.name}` : `${meta.name}.${relation.name}`;
|
|
84
|
-
const relationAlias = qb.getAliasForJoinPath(path);
|
|
85
|
-
const relationPojo = {};
|
|
86
|
-
// If the primary key value for the relation is null, we know we haven't joined to anything
|
|
87
|
-
// and therefore we don't return any record (since all values would be null)
|
|
88
|
-
const hasPK = meta2.primaryKeys.every(pk => meta2.properties[pk].fieldNames.every(name => {
|
|
89
|
-
return root[`${relationAlias}__${name}`] != null;
|
|
90
|
-
}));
|
|
91
|
-
if (!hasPK) {
|
|
92
|
-
// initialize empty collections
|
|
93
|
-
if ([core_1.ReferenceType.MANY_TO_MANY, core_1.ReferenceType.ONE_TO_MANY].includes(relation.reference)) {
|
|
94
|
-
result[relation.name] = result[relation.name] || [];
|
|
95
|
-
}
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
meta2.props
|
|
99
|
-
.filter(prop => this.platform.shouldHaveColumn(prop, p.children || []))
|
|
100
|
-
.forEach(prop => {
|
|
101
|
-
if (prop.fieldNames.length > 1) { // composite keys
|
|
102
|
-
relationPojo[prop.name] = prop.fieldNames.map(name => root[`${relationAlias}__${name}`]);
|
|
103
|
-
prop.fieldNames.map(name => delete root[`${relationAlias}__${name}`]);
|
|
104
|
-
}
|
|
105
|
-
else {
|
|
106
|
-
const alias = `${relationAlias}__${prop.fieldNames[0]}`;
|
|
107
|
-
relationPojo[prop.name] = root[alias];
|
|
108
|
-
delete root[alias];
|
|
109
|
-
}
|
|
110
|
-
});
|
|
111
|
-
const key = `${meta.name}-${(core_1.Utils.getCompositeKeyHash(result, meta))}`;
|
|
112
|
-
if (map[key]) {
|
|
113
|
-
result[relation.name] = map[key][relation.name];
|
|
114
|
-
}
|
|
115
|
-
else {
|
|
116
|
-
map[key] = result;
|
|
117
|
-
}
|
|
118
|
-
if ([core_1.ReferenceType.MANY_TO_MANY, core_1.ReferenceType.ONE_TO_MANY].includes(relation.reference)) {
|
|
119
|
-
result[relation.name] = result[relation.name] || [];
|
|
120
|
-
this.appendToCollection(meta2, result[relation.name], relationPojo);
|
|
121
|
-
}
|
|
122
|
-
else {
|
|
123
|
-
result[relation.name] = relationPojo;
|
|
124
|
-
}
|
|
125
|
-
const populateChildren = p.children || [];
|
|
126
|
-
this.mapJoinedProps(relationPojo, meta2, populateChildren, qb, root, map, path);
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
appendToCollection(meta, collection, relationPojo) {
|
|
130
|
-
if (collection.length === 0) {
|
|
131
|
-
return void collection.push(relationPojo);
|
|
132
|
-
}
|
|
133
|
-
const last = collection[collection.length - 1];
|
|
134
|
-
const pk1 = core_1.Utils.getCompositeKeyHash(last, meta);
|
|
135
|
-
const pk2 = core_1.Utils.getCompositeKeyHash(relationPojo, meta);
|
|
136
|
-
if (pk1 !== pk2) {
|
|
137
|
-
collection.push(relationPojo);
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
async count(entityName, where, options = {}, ctx) {
|
|
141
|
-
const meta = this.metadata.find(entityName);
|
|
142
|
-
const pks = meta.primaryKeys;
|
|
143
|
-
const qb = this.createQueryBuilder(entityName, ctx, !!ctx, false)
|
|
144
|
-
.groupBy(options.groupBy)
|
|
145
|
-
.having(options.having)
|
|
146
|
-
.populate(options.populate ?? [])
|
|
147
|
-
.withSchema(this.getSchemaName(meta, options))
|
|
148
|
-
.where(where);
|
|
149
|
-
return this.rethrow(qb.getCount(pks, true));
|
|
150
|
-
}
|
|
151
|
-
async nativeInsert(entityName, data, options = {}) {
|
|
152
|
-
options.convertCustomTypes ?? (options.convertCustomTypes = true);
|
|
153
|
-
const meta = this.metadata.find(entityName);
|
|
154
|
-
const collections = this.extractManyToMany(entityName, data);
|
|
155
|
-
const pks = this.getPrimaryKeyFields(entityName);
|
|
156
|
-
const qb = this.createQueryBuilder(entityName, options.ctx, true, options.convertCustomTypes).withSchema(this.getSchemaName(meta, options));
|
|
157
|
-
const res = await this.rethrow(qb.insert(data).execute('run', false));
|
|
158
|
-
res.row = res.row || {};
|
|
159
|
-
let pk;
|
|
160
|
-
if (pks.length > 1) { // owner has composite pk
|
|
161
|
-
pk = core_1.Utils.getPrimaryKeyCond(data, pks);
|
|
162
|
-
}
|
|
163
|
-
else {
|
|
164
|
-
res.insertId = data[pks[0]] || res.insertId || res.row[pks[0]];
|
|
165
|
-
pk = [res.insertId];
|
|
166
|
-
}
|
|
167
|
-
await this.processManyToMany(meta, pk, collections, false, options);
|
|
168
|
-
return res;
|
|
169
|
-
}
|
|
170
|
-
async nativeInsertMany(entityName, data, options = {}) {
|
|
171
|
-
options.processCollections ?? (options.processCollections = true);
|
|
172
|
-
options.convertCustomTypes ?? (options.convertCustomTypes = true);
|
|
173
|
-
const meta = this.metadata.get(entityName);
|
|
174
|
-
const collections = options.processCollections ? data.map(d => this.extractManyToMany(entityName, d)) : [];
|
|
175
|
-
const pks = this.getPrimaryKeyFields(entityName);
|
|
176
|
-
const set = new Set();
|
|
177
|
-
data.forEach(row => Object.keys(row).forEach(k => set.add(k)));
|
|
178
|
-
const props = [...set].map(name => meta.properties[name] ?? { name, fieldNames: [name] });
|
|
179
|
-
const fields = core_1.Utils.flatten(props.map(prop => prop.fieldNames));
|
|
180
|
-
let res;
|
|
181
|
-
if (fields.length === 0) {
|
|
182
|
-
const qb = this.createQueryBuilder(entityName, options.ctx, true, options.convertCustomTypes).withSchema(this.getSchemaName(meta, options));
|
|
183
|
-
res = await this.rethrow(qb.insert(data).execute('run', false));
|
|
184
|
-
}
|
|
185
|
-
else {
|
|
186
|
-
let sql = `insert into ${this.getTableName(meta, options)} `;
|
|
187
|
-
/* istanbul ignore next */
|
|
188
|
-
sql += fields.length > 0 ? '(' + fields.map(k => this.platform.quoteIdentifier(k)).join(', ') + ')' : 'default';
|
|
189
|
-
sql += ` values `;
|
|
190
|
-
const params = [];
|
|
191
|
-
sql += data.map(row => {
|
|
192
|
-
const keys = [];
|
|
193
|
-
props.forEach(prop => {
|
|
194
|
-
if (prop.fieldNames.length > 1) {
|
|
195
|
-
params.push(...row[prop.name]);
|
|
196
|
-
keys.push(...prop.fieldNames.map(_ => '?'));
|
|
197
|
-
}
|
|
198
|
-
else if (prop.customType && 'convertToDatabaseValueSQL' in prop.customType && !this.platform.isRaw(row[prop.name])) {
|
|
199
|
-
keys.push(prop.customType.convertToDatabaseValueSQL('?', this.platform));
|
|
200
|
-
params.push(row[prop.name]);
|
|
201
|
-
}
|
|
202
|
-
else {
|
|
203
|
-
params.push(row[prop.name]);
|
|
204
|
-
keys.push('?');
|
|
205
|
-
}
|
|
206
|
-
});
|
|
207
|
-
return '(' + keys.join(', ') + ')';
|
|
208
|
-
}).join(', ');
|
|
209
|
-
if (this.platform.usesReturningStatement()) {
|
|
210
|
-
/* istanbul ignore next */
|
|
211
|
-
const returningProps = meta.props.filter(prop => prop.primary || prop.defaultRaw);
|
|
212
|
-
const returningFields = core_1.Utils.flatten(returningProps.map(prop => prop.fieldNames));
|
|
213
|
-
/* istanbul ignore next */
|
|
214
|
-
sql += returningFields.length > 0 ? ` returning ${returningFields.map(field => this.platform.quoteIdentifier(field)).join(', ')}` : '';
|
|
215
|
-
}
|
|
216
|
-
res = await this.execute(sql, params, 'run', options.ctx);
|
|
217
|
-
}
|
|
218
|
-
let pk;
|
|
219
|
-
/* istanbul ignore next */
|
|
220
|
-
if (pks.length > 1) { // owner has composite pk
|
|
221
|
-
pk = data.map(d => core_1.Utils.getPrimaryKeyCond(d, pks));
|
|
222
|
-
}
|
|
223
|
-
else {
|
|
224
|
-
res.row ?? (res.row = {});
|
|
225
|
-
res.rows ?? (res.rows = []);
|
|
226
|
-
pk = data.map((d, i) => d[pks[0]] ?? res.rows[i]?.[pks[0]]).map(d => [d]);
|
|
227
|
-
res.insertId = res.insertId || res.row[pks[0]];
|
|
228
|
-
}
|
|
229
|
-
for (let i = 0; i < collections.length; i++) {
|
|
230
|
-
await this.processManyToMany(meta, pk[i], collections[i], false, options);
|
|
231
|
-
}
|
|
232
|
-
return res;
|
|
233
|
-
}
|
|
234
|
-
async nativeUpdate(entityName, where, data, options = {}) {
|
|
235
|
-
options.convertCustomTypes ?? (options.convertCustomTypes = true);
|
|
236
|
-
const meta = this.metadata.find(entityName);
|
|
237
|
-
const pks = this.getPrimaryKeyFields(entityName);
|
|
238
|
-
const collections = this.extractManyToMany(entityName, data);
|
|
239
|
-
let res = { affectedRows: 0, insertId: 0, row: {} };
|
|
240
|
-
if (core_1.Utils.isPrimaryKey(where) && pks.length === 1) {
|
|
241
|
-
where = { [pks[0]]: where };
|
|
242
|
-
}
|
|
243
|
-
if (core_1.Utils.hasObjectKeys(data)) {
|
|
244
|
-
const qb = this.createQueryBuilder(entityName, options.ctx, true, options.convertCustomTypes)
|
|
245
|
-
.update(data)
|
|
246
|
-
.withSchema(this.getSchemaName(meta, options))
|
|
247
|
-
.where(where);
|
|
248
|
-
res = await this.rethrow(qb.execute('run', false));
|
|
249
|
-
}
|
|
250
|
-
/* istanbul ignore next */
|
|
251
|
-
const pk = pks.map(pk => core_1.Utils.extractPK(data[pk] || where, meta));
|
|
252
|
-
await this.processManyToMany(meta, pk, collections, true, options);
|
|
253
|
-
return res;
|
|
254
|
-
}
|
|
255
|
-
async nativeUpdateMany(entityName, where, data, options = {}) {
|
|
256
|
-
options.processCollections ?? (options.processCollections = true);
|
|
257
|
-
options.convertCustomTypes ?? (options.convertCustomTypes = true);
|
|
258
|
-
const meta = this.metadata.get(entityName);
|
|
259
|
-
const collections = options.processCollections ? data.map(d => this.extractManyToMany(entityName, d)) : [];
|
|
260
|
-
const keys = new Set();
|
|
261
|
-
data.forEach(row => Object.keys(row).forEach(k => keys.add(k)));
|
|
262
|
-
const pkCond = core_1.Utils.flatten(meta.primaryKeys.map(pk => meta.properties[pk].fieldNames)).map(pk => `${this.platform.quoteIdentifier(pk)} = ?`).join(' and ');
|
|
263
|
-
const params = [];
|
|
264
|
-
let sql = `update ${this.getTableName(meta, options)} set `;
|
|
265
|
-
keys.forEach(key => {
|
|
266
|
-
const prop = meta.properties[key];
|
|
267
|
-
prop.fieldNames.forEach((fieldName, fieldNameIdx) => {
|
|
268
|
-
sql += `${this.platform.quoteIdentifier(fieldName)} = case`;
|
|
269
|
-
where.forEach((cond, idx) => {
|
|
270
|
-
if (key in data[idx]) {
|
|
271
|
-
const pks = core_1.Utils.getOrderedPrimaryKeys(cond, meta);
|
|
272
|
-
sql += ` when (${pkCond}) then `;
|
|
273
|
-
if (prop.customType && 'convertToDatabaseValueSQL' in prop.customType && !this.platform.isRaw(data[idx][key])) {
|
|
274
|
-
sql += prop.customType.convertToDatabaseValueSQL('?', this.platform);
|
|
275
|
-
}
|
|
276
|
-
else {
|
|
277
|
-
sql += '?';
|
|
278
|
-
}
|
|
279
|
-
params.push(...pks, prop.fieldNames.length > 1 ? data[idx][key][fieldNameIdx] : data[idx][key]);
|
|
280
|
-
}
|
|
281
|
-
});
|
|
282
|
-
sql += ` else ${this.platform.quoteIdentifier(fieldName)} end, `;
|
|
283
|
-
return sql;
|
|
284
|
-
});
|
|
285
|
-
});
|
|
286
|
-
if (meta.versionProperty) {
|
|
287
|
-
const versionProperty = meta.properties[meta.versionProperty];
|
|
288
|
-
const quotedFieldName = this.platform.quoteIdentifier(versionProperty.fieldNames[0]);
|
|
289
|
-
sql += `${quotedFieldName} = `;
|
|
290
|
-
if (versionProperty.type.toLowerCase() === 'date') {
|
|
291
|
-
sql += this.platform.getCurrentTimestampSQL(versionProperty.length);
|
|
292
|
-
}
|
|
293
|
-
else {
|
|
294
|
-
sql += `${quotedFieldName} + 1`;
|
|
295
|
-
}
|
|
296
|
-
sql += `, `;
|
|
297
|
-
}
|
|
298
|
-
sql = sql.substring(0, sql.length - 2) + ' where ';
|
|
299
|
-
const pkProps = meta.primaryKeys.concat(...meta.concurrencyCheckKeys);
|
|
300
|
-
const pks = core_1.Utils.flatten(pkProps.map(pk => meta.properties[pk].fieldNames));
|
|
301
|
-
sql += pks.length > 1 ? `(${pks.map(pk => `${this.platform.quoteIdentifier(pk)}`).join(', ')})` : this.platform.quoteIdentifier(pks[0]);
|
|
302
|
-
const conds = where.map(cond => {
|
|
303
|
-
if (pks.length > 1) {
|
|
304
|
-
pkProps.forEach(pk => params.push(cond[pk]));
|
|
305
|
-
return `(${new Array(pks.length).fill('?').join(', ')})`;
|
|
306
|
-
}
|
|
307
|
-
params.push(cond);
|
|
308
|
-
return '?';
|
|
309
|
-
});
|
|
310
|
-
const values = pks.length > 1 && this.platform.requiresValuesKeyword() ? 'values ' : '';
|
|
311
|
-
sql += ` in (${values}${conds.join(', ')})`;
|
|
312
|
-
const res = await this.rethrow(this.execute(sql, params, 'run', options.ctx));
|
|
313
|
-
for (let i = 0; i < collections.length; i++) {
|
|
314
|
-
await this.processManyToMany(meta, where[i], collections[i], false, options);
|
|
315
|
-
}
|
|
316
|
-
return res;
|
|
317
|
-
}
|
|
318
|
-
async nativeDelete(entityName, where, options = {}) {
|
|
319
|
-
const meta = this.metadata.find(entityName);
|
|
320
|
-
const pks = this.getPrimaryKeyFields(entityName);
|
|
321
|
-
if (core_1.Utils.isPrimaryKey(where) && pks.length === 1) {
|
|
322
|
-
where = { [pks[0]]: where };
|
|
323
|
-
}
|
|
324
|
-
const qb = this.createQueryBuilder(entityName, options.ctx, true, false).delete(where).withSchema(this.getSchemaName(meta, options));
|
|
325
|
-
return this.rethrow(qb.execute('run', false));
|
|
326
|
-
}
|
|
327
|
-
async syncCollection(coll, options) {
|
|
328
|
-
const wrapped = coll.owner.__helper;
|
|
329
|
-
const meta = wrapped.__meta;
|
|
330
|
-
const pks = wrapped.getPrimaryKeys(true);
|
|
331
|
-
const snap = coll.getSnapshot();
|
|
332
|
-
const includes = (arr, item) => !!arr.find(i => core_1.Utils.equals(i, item));
|
|
333
|
-
const snapshot = snap ? snap.map(item => item.__helper.getPrimaryKeys(true)) : [];
|
|
334
|
-
const current = coll.getItems(false).map(item => item.__helper.getPrimaryKeys(true));
|
|
335
|
-
const deleteDiff = snap ? snapshot.filter(item => !includes(current, item)) : true;
|
|
336
|
-
const insertDiff = current.filter(item => !includes(snapshot, item));
|
|
337
|
-
const target = snapshot.filter(item => includes(current, item)).concat(...insertDiff);
|
|
338
|
-
const equals = core_1.Utils.equals(current, target);
|
|
339
|
-
const ctx = options?.ctx;
|
|
340
|
-
// wrong order if we just delete and insert to the end (only owning sides can have fixed order)
|
|
341
|
-
if (coll.property.owner && coll.property.fixedOrder && !equals && Array.isArray(deleteDiff)) {
|
|
342
|
-
deleteDiff.length = insertDiff.length = 0;
|
|
343
|
-
deleteDiff.push(...snapshot);
|
|
344
|
-
insertDiff.push(...current);
|
|
345
|
-
}
|
|
346
|
-
if (coll.property.reference === core_1.ReferenceType.ONE_TO_MANY) {
|
|
347
|
-
const cols = coll.property.referencedColumnNames;
|
|
348
|
-
const qb = this.createQueryBuilder(coll.property.type, ctx, true)
|
|
349
|
-
.withSchema(this.getSchemaName(meta, options))
|
|
350
|
-
.update({ [coll.property.mappedBy]: pks })
|
|
351
|
-
.getKnexQuery()
|
|
352
|
-
.whereIn(cols, insertDiff);
|
|
353
|
-
return this.rethrow(this.execute(qb));
|
|
354
|
-
}
|
|
355
|
-
/* istanbul ignore next */
|
|
356
|
-
const ownerSchema = wrapped.getSchema() === '*' ? this.config.get('schema') : wrapped.getSchema();
|
|
357
|
-
const pivotMeta = this.metadata.find(coll.property.pivotTable);
|
|
358
|
-
if (pivotMeta.schema === '*') {
|
|
359
|
-
/* istanbul ignore next */
|
|
360
|
-
options ?? (options = {});
|
|
361
|
-
options.schema = ownerSchema;
|
|
362
|
-
}
|
|
363
|
-
return this.rethrow(this.updateCollectionDiff(meta, coll.property, pks, deleteDiff, insertDiff, options));
|
|
364
|
-
}
|
|
365
|
-
async loadFromPivotTable(prop, owners, where = {}, orderBy, ctx, options) {
|
|
366
|
-
const pivotProp2 = this.getPivotInverseProperty(prop);
|
|
367
|
-
const ownerMeta = this.metadata.find(pivotProp2.type);
|
|
368
|
-
const cond = { [`${prop.pivotTable}.${pivotProp2.name}`]: { $in: ownerMeta.compositePK ? owners : owners.map(o => o[0]) } };
|
|
369
|
-
/* istanbul ignore if */
|
|
370
|
-
if (!core_1.Utils.isEmpty(where) && Object.keys(where).every(k => core_1.Utils.isOperator(k, false))) {
|
|
371
|
-
where = cond;
|
|
372
|
-
}
|
|
373
|
-
else {
|
|
374
|
-
where = { ...where, ...cond };
|
|
375
|
-
}
|
|
376
|
-
orderBy = this.getPivotOrderBy(prop, orderBy);
|
|
377
|
-
const qb = this.createQueryBuilder(prop.type, ctx, !!ctx)
|
|
378
|
-
.unsetFlag(core_1.QueryFlag.CONVERT_CUSTOM_TYPES)
|
|
379
|
-
.withSchema(this.getSchemaName(prop.targetMeta, options));
|
|
380
|
-
const populate = this.autoJoinOneToOneOwner(prop.targetMeta, [{ field: prop.pivotTable }]);
|
|
381
|
-
const fields = this.buildFields(prop.targetMeta, (options?.populate ?? []), [], qb, options?.fields);
|
|
382
|
-
qb.select(fields).populate(populate).where(where).orderBy(orderBy).setLockMode(options?.lockMode, options?.lockTableAliases);
|
|
383
|
-
if (owners.length === 1 && (options?.offset != null || options?.limit != null)) {
|
|
384
|
-
qb.limit(options.limit, options.offset);
|
|
385
|
-
}
|
|
386
|
-
const items = owners.length ? await this.rethrow(qb.execute('all')) : [];
|
|
387
|
-
const map = {};
|
|
388
|
-
const pkProps = ownerMeta.getPrimaryProps();
|
|
389
|
-
owners.forEach(owner => {
|
|
390
|
-
const key = core_1.Utils.getPrimaryKeyHash(prop.joinColumns.map((col, idx) => {
|
|
391
|
-
const pkProp = pkProps[idx];
|
|
392
|
-
return pkProp.customType ? pkProp.customType.convertToJSValue(owner[idx], this.platform) : owner[idx];
|
|
393
|
-
}));
|
|
394
|
-
return map[key] = [];
|
|
395
|
-
});
|
|
396
|
-
items.forEach((item) => {
|
|
397
|
-
const key = core_1.Utils.getPrimaryKeyHash(prop.joinColumns.map((col, idx) => {
|
|
398
|
-
const pkProp = pkProps[idx];
|
|
399
|
-
return pkProp.customType ? pkProp.customType.convertToJSValue(item[`fk__${col}`], this.platform) : item[`fk__${col}`];
|
|
400
|
-
}));
|
|
401
|
-
map[key].push(item);
|
|
402
|
-
prop.joinColumns.forEach(col => delete item[`fk__${col}`]);
|
|
403
|
-
prop.inverseJoinColumns.forEach(col => delete item[`fk__${col}`]);
|
|
404
|
-
});
|
|
405
|
-
return map;
|
|
406
|
-
}
|
|
407
|
-
async execute(queryOrKnex, params = [], method = 'all', ctx) {
|
|
408
|
-
return this.rethrow(this.connection.execute(queryOrKnex, params, method, ctx));
|
|
409
|
-
}
|
|
410
|
-
getTableName(meta, options) {
|
|
411
|
-
let tableName = this.platform.quoteIdentifier(meta.collection);
|
|
412
|
-
if (options.schema === '*') {
|
|
413
|
-
return this.platform.quoteIdentifier(this.config.get('schema')) + '.' + tableName;
|
|
414
|
-
}
|
|
415
|
-
if (meta.schema || options.schema) {
|
|
416
|
-
tableName = this.platform.quoteIdentifier(options.schema ?? meta.schema) + '.' + tableName;
|
|
417
|
-
}
|
|
418
|
-
return tableName;
|
|
419
|
-
}
|
|
420
|
-
/**
|
|
421
|
-
* 1:1 owner side needs to be marked for population so QB auto-joins the owner id
|
|
422
|
-
*/
|
|
423
|
-
autoJoinOneToOneOwner(meta, populate, fields = []) {
|
|
424
|
-
if (!this.config.get('autoJoinOneToOneOwner') || fields.length > 0) {
|
|
425
|
-
return populate;
|
|
426
|
-
}
|
|
427
|
-
const relationsToPopulate = populate.map(({ field }) => field);
|
|
428
|
-
const toPopulate = meta.relations
|
|
429
|
-
.filter(prop => prop.reference === core_1.ReferenceType.ONE_TO_ONE && !prop.owner && !relationsToPopulate.includes(prop.name))
|
|
430
|
-
.map(prop => ({ field: prop.name, strategy: prop.strategy }));
|
|
431
|
-
return [...populate, ...toPopulate];
|
|
432
|
-
}
|
|
433
|
-
joinedProps(meta, populate) {
|
|
434
|
-
return populate.filter(p => {
|
|
435
|
-
const prop = meta.properties[p.field] || {};
|
|
436
|
-
return (p.strategy || prop.strategy || this.config.get('loadStrategy')) === core_1.LoadStrategy.JOINED && prop.reference !== core_1.ReferenceType.SCALAR;
|
|
437
|
-
});
|
|
438
|
-
}
|
|
439
|
-
/**
|
|
440
|
-
* @internal
|
|
441
|
-
*/
|
|
442
|
-
mergeJoinedResult(rawResults, meta) {
|
|
443
|
-
// group by the root entity primary key first
|
|
444
|
-
const map = {};
|
|
445
|
-
const res = [];
|
|
446
|
-
rawResults.forEach(item => {
|
|
447
|
-
const pk = core_1.Utils.getCompositeKeyHash(item, meta);
|
|
448
|
-
if (map[pk]) {
|
|
449
|
-
map[pk].push(item);
|
|
450
|
-
}
|
|
451
|
-
else {
|
|
452
|
-
map[pk] = [item];
|
|
453
|
-
res.push(item);
|
|
454
|
-
}
|
|
455
|
-
});
|
|
456
|
-
return res;
|
|
457
|
-
}
|
|
458
|
-
getFieldsForJoinedLoad(qb, meta, explicitFields, populate = [], parentTableAlias, parentJoinPath) {
|
|
459
|
-
const fields = [];
|
|
460
|
-
const joinedProps = this.joinedProps(meta, populate);
|
|
461
|
-
const shouldHaveColumn = (prop, populate, fields) => {
|
|
462
|
-
if (!this.platform.shouldHaveColumn(prop, populate)) {
|
|
463
|
-
return false;
|
|
464
|
-
}
|
|
465
|
-
if (!fields || prop.primary) {
|
|
466
|
-
return true;
|
|
467
|
-
}
|
|
468
|
-
return fields.includes(prop.name);
|
|
469
|
-
};
|
|
470
|
-
// alias all fields in the primary table
|
|
471
|
-
meta.props
|
|
472
|
-
.filter(prop => shouldHaveColumn(prop, populate, explicitFields))
|
|
473
|
-
.forEach(prop => fields.push(...this.mapPropToFieldNames(qb, prop, parentTableAlias)));
|
|
474
|
-
joinedProps.forEach(relation => {
|
|
475
|
-
const prop = meta.properties[relation.field];
|
|
476
|
-
const meta2 = this.metadata.find(prop.type);
|
|
477
|
-
const tableAlias = qb.getNextAlias(prop.name);
|
|
478
|
-
const field = parentTableAlias ? `${parentTableAlias}.${prop.name}` : prop.name;
|
|
479
|
-
const path = parentJoinPath ? `${parentJoinPath}.${prop.name}` : `${meta.name}.${prop.name}`;
|
|
480
|
-
qb.join(field, tableAlias, {}, 'leftJoin', path);
|
|
481
|
-
const childExplicitFields = explicitFields?.filter(f => core_1.Utils.isPlainObject(f)).map(o => o[prop.name])[0] || [];
|
|
482
|
-
explicitFields?.forEach(f => {
|
|
483
|
-
if (typeof f === 'string' && f.startsWith(`${prop.name}.`)) {
|
|
484
|
-
childExplicitFields.push(f.substring(prop.name.length + 1));
|
|
485
|
-
}
|
|
486
|
-
});
|
|
487
|
-
fields.push(...this.getFieldsForJoinedLoad(qb, meta2, childExplicitFields.length === 0 ? undefined : childExplicitFields, relation.children, tableAlias, path));
|
|
488
|
-
});
|
|
489
|
-
return fields;
|
|
490
|
-
}
|
|
491
|
-
/**
|
|
492
|
-
* @internal
|
|
493
|
-
*/
|
|
494
|
-
mapPropToFieldNames(qb, prop, tableAlias) {
|
|
495
|
-
const aliased = qb.ref(tableAlias ? `${tableAlias}__${prop.fieldNames[0]}` : prop.fieldNames[0]).toString();
|
|
496
|
-
if (prop.customType?.convertToJSValueSQL && tableAlias) {
|
|
497
|
-
const prefixed = qb.ref(prop.fieldNames[0]).withSchema(tableAlias).toString();
|
|
498
|
-
return [qb.raw(prop.customType.convertToJSValueSQL(prefixed, this.platform) + ' as ' + aliased).toString()];
|
|
499
|
-
}
|
|
500
|
-
if (prop.formula) {
|
|
501
|
-
const alias = qb.ref(tableAlias ?? qb.alias).toString();
|
|
502
|
-
return [`${prop.formula(alias)} as ${aliased}`];
|
|
503
|
-
}
|
|
504
|
-
if (tableAlias) {
|
|
505
|
-
return prop.fieldNames.map(fieldName => qb.ref(fieldName).withSchema(tableAlias).as(`${tableAlias}__${fieldName}`));
|
|
506
|
-
}
|
|
507
|
-
return prop.fieldNames;
|
|
508
|
-
}
|
|
509
|
-
createQueryBuilder(entityName, ctx, write, convertCustomTypes) {
|
|
510
|
-
const qb = new QueryBuilder_1.QueryBuilder(entityName, this.metadata, this, ctx, undefined, write ? 'write' : 'read');
|
|
511
|
-
if (!convertCustomTypes) {
|
|
512
|
-
qb.unsetFlag(core_1.QueryFlag.CONVERT_CUSTOM_TYPES);
|
|
513
|
-
}
|
|
514
|
-
return qb;
|
|
515
|
-
}
|
|
516
|
-
extractManyToMany(entityName, data) {
|
|
517
|
-
if (!this.metadata.has(entityName)) {
|
|
518
|
-
return {};
|
|
519
|
-
}
|
|
520
|
-
const ret = {};
|
|
521
|
-
this.metadata.find(entityName).relations.forEach(prop => {
|
|
522
|
-
if (prop.reference === core_1.ReferenceType.MANY_TO_MANY && data[prop.name]) {
|
|
523
|
-
ret[prop.name] = data[prop.name].map((item) => core_1.Utils.asArray(item));
|
|
524
|
-
delete data[prop.name];
|
|
525
|
-
}
|
|
526
|
-
});
|
|
527
|
-
return ret;
|
|
528
|
-
}
|
|
529
|
-
async processManyToMany(meta, pks, collections, clear, options) {
|
|
530
|
-
if (!meta) {
|
|
531
|
-
return;
|
|
532
|
-
}
|
|
533
|
-
for (const prop of meta.relations) {
|
|
534
|
-
if (collections[prop.name]) {
|
|
535
|
-
await this.rethrow(this.updateCollectionDiff(meta, prop, pks, clear, collections[prop.name], options));
|
|
536
|
-
}
|
|
537
|
-
}
|
|
538
|
-
}
|
|
539
|
-
async updateCollectionDiff(meta, prop, pks, deleteDiff, insertDiff, options) {
|
|
540
|
-
if (!deleteDiff) {
|
|
541
|
-
deleteDiff = [];
|
|
542
|
-
}
|
|
543
|
-
if (deleteDiff === true || deleteDiff.length > 0) {
|
|
544
|
-
const qb1 = this.createQueryBuilder(prop.pivotTable, options?.ctx, true)
|
|
545
|
-
.withSchema(this.getSchemaName(meta, options))
|
|
546
|
-
.unsetFlag(core_1.QueryFlag.CONVERT_CUSTOM_TYPES);
|
|
547
|
-
const knex = qb1.getKnex();
|
|
548
|
-
if (Array.isArray(deleteDiff)) {
|
|
549
|
-
knex.whereIn(prop.inverseJoinColumns, deleteDiff);
|
|
550
|
-
}
|
|
551
|
-
prop.joinColumns.forEach((joinColumn, idx) => knex.andWhere(joinColumn, pks[idx]));
|
|
552
|
-
await this.execute(knex.delete());
|
|
553
|
-
}
|
|
554
|
-
if (insertDiff.length === 0) {
|
|
555
|
-
return;
|
|
556
|
-
}
|
|
557
|
-
const items = insertDiff.map(item => {
|
|
558
|
-
const cond = {};
|
|
559
|
-
prop.joinColumns.forEach((joinColumn, idx) => cond[joinColumn] = pks[idx]);
|
|
560
|
-
prop.inverseJoinColumns.forEach((inverseJoinColumn, idx) => cond[inverseJoinColumn] = item[idx]);
|
|
561
|
-
return cond;
|
|
562
|
-
});
|
|
563
|
-
/* istanbul ignore else */
|
|
564
|
-
if (this.platform.allowsMultiInsert()) {
|
|
565
|
-
await this.nativeInsertMany(prop.pivotTable, items, { ...options, convertCustomTypes: false, processCollections: false });
|
|
566
|
-
}
|
|
567
|
-
else {
|
|
568
|
-
await core_1.Utils.runSerial(items, item => {
|
|
569
|
-
return this.createQueryBuilder(prop.pivotTable, options?.ctx, true)
|
|
570
|
-
.unsetFlag(core_1.QueryFlag.CONVERT_CUSTOM_TYPES)
|
|
571
|
-
.withSchema(this.getSchemaName(meta, options))
|
|
572
|
-
.insert(item)
|
|
573
|
-
.execute('run', false);
|
|
574
|
-
});
|
|
575
|
-
}
|
|
576
|
-
}
|
|
577
|
-
async lockPessimistic(entity, options) {
|
|
578
|
-
const meta = entity.__helper.__meta;
|
|
579
|
-
const qb = this.createQueryBuilder(entity.constructor.name, options.ctx).unsetFlag(core_1.QueryFlag.CONVERT_CUSTOM_TYPES).withSchema(options.schema ?? meta.schema);
|
|
580
|
-
const cond = core_1.Utils.getPrimaryKeyCond(entity, meta.primaryKeys);
|
|
581
|
-
qb.select('1').where(cond).setLockMode(options.lockMode, options.lockTableAliases);
|
|
582
|
-
await this.rethrow(qb.execute());
|
|
583
|
-
}
|
|
584
|
-
buildJoinedPropsOrderBy(entityName, qb, meta, populate, parentPath) {
|
|
585
|
-
const orderBy = [];
|
|
586
|
-
const joinedProps = this.joinedProps(meta, populate);
|
|
587
|
-
joinedProps.forEach(relation => {
|
|
588
|
-
const prop = meta.properties[relation.field];
|
|
589
|
-
const propOrderBy = prop.orderBy;
|
|
590
|
-
const path = `${parentPath ? parentPath : entityName}.${relation.field}`;
|
|
591
|
-
const propAlias = qb.getAliasForJoinPath(path);
|
|
592
|
-
if (propOrderBy) {
|
|
593
|
-
Object.keys(propOrderBy).forEach(field => {
|
|
594
|
-
orderBy.push({ [`${propAlias}.${field}`]: propOrderBy[field] });
|
|
595
|
-
});
|
|
596
|
-
}
|
|
597
|
-
if (relation.children) {
|
|
598
|
-
const meta2 = this.metadata.find(prop.type);
|
|
599
|
-
orderBy.push(...this.buildJoinedPropsOrderBy(prop.name, qb, meta2, relation.children, path));
|
|
600
|
-
}
|
|
601
|
-
});
|
|
602
|
-
return orderBy;
|
|
603
|
-
}
|
|
604
|
-
buildFields(meta, populate, joinedProps, qb, fields) {
|
|
605
|
-
const lazyProps = meta.props.filter(prop => prop.lazy && !populate.some(p => p.field === prop.name || p.all));
|
|
606
|
-
const hasLazyFormulas = meta.props.some(p => p.lazy && p.formula);
|
|
607
|
-
const requiresSQLConversion = meta.props.some(p => p.customType?.convertToJSValueSQL);
|
|
608
|
-
const hasExplicitFields = !!fields;
|
|
609
|
-
const ret = [];
|
|
610
|
-
if (joinedProps.length > 0) {
|
|
611
|
-
ret.push(...this.getFieldsForJoinedLoad(qb, meta, fields, populate));
|
|
612
|
-
}
|
|
613
|
-
else if (fields) {
|
|
614
|
-
for (const field of [...fields]) {
|
|
615
|
-
if (core_1.Utils.isPlainObject(field) || field.toString().includes('.')) {
|
|
616
|
-
continue;
|
|
617
|
-
}
|
|
618
|
-
ret.push(field);
|
|
619
|
-
}
|
|
620
|
-
ret.unshift(...meta.primaryKeys.filter(pk => !fields.includes(pk)));
|
|
621
|
-
}
|
|
622
|
-
else if (lazyProps.filter(p => !p.formula).length > 0) {
|
|
623
|
-
const props = meta.props.filter(prop => this.platform.shouldHaveColumn(prop, populate, false));
|
|
624
|
-
ret.push(...core_1.Utils.flatten(props.filter(p => !lazyProps.includes(p)).map(p => p.fieldNames)));
|
|
625
|
-
}
|
|
626
|
-
else if (hasLazyFormulas || requiresSQLConversion) {
|
|
627
|
-
ret.push('*');
|
|
628
|
-
}
|
|
629
|
-
if (ret.length > 0 && !hasExplicitFields) {
|
|
630
|
-
meta.props
|
|
631
|
-
.filter(prop => prop.formula && !lazyProps.includes(prop))
|
|
632
|
-
.forEach(prop => {
|
|
633
|
-
const alias = qb.ref(qb.alias).toString();
|
|
634
|
-
const aliased = qb.ref(prop.fieldNames[0]).toString();
|
|
635
|
-
ret.push(`${prop.formula(alias)} as ${aliased}`);
|
|
636
|
-
});
|
|
637
|
-
meta.props
|
|
638
|
-
.filter(prop => prop.customType?.convertToDatabaseValueSQL || prop.customType?.convertToJSValueSQL)
|
|
639
|
-
.forEach(prop => ret.push(prop.name));
|
|
640
|
-
}
|
|
641
|
-
return ret.length > 0 ? ret : ['*'];
|
|
642
|
-
}
|
|
643
|
-
}
|
|
644
|
-
exports.AbstractSqlDriver = AbstractSqlDriver;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { Constructor, EntityManager, EntityRepository, IDatabaseDriver } from '@mikro-orm/core';
|
|
2
|
-
import { Platform } from '@mikro-orm/core';
|
|
3
|
-
import type { SchemaHelper } from './schema';
|
|
4
|
-
import { SchemaGenerator } from './schema';
|
|
5
|
-
export declare abstract class AbstractSqlPlatform extends Platform {
|
|
6
|
-
protected readonly schemaHelper?: SchemaHelper;
|
|
7
|
-
usesPivotTable(): boolean;
|
|
8
|
-
indexForeignKeys(): boolean;
|
|
9
|
-
getRepositoryClass<T>(): Constructor<EntityRepository<T>>;
|
|
10
|
-
getSchemaHelper(): SchemaHelper | undefined;
|
|
11
|
-
getSchemaGenerator(driver: IDatabaseDriver): SchemaGenerator;
|
|
12
|
-
getEntityGenerator(em: EntityManager): any;
|
|
13
|
-
getMigrator(em: EntityManager): any;
|
|
14
|
-
quoteValue(value: any): string;
|
|
15
|
-
formatQuery(sql: string, params: readonly any[]): string;
|
|
16
|
-
getSearchJsonPropertySQL(path: string, type: string): string;
|
|
17
|
-
isRaw(value: any): boolean;
|
|
18
|
-
supportsSchemas(): boolean;
|
|
19
|
-
/** @inheritDoc */
|
|
20
|
-
generateCustomOrder(escapedColumn: string, values: unknown[]): string;
|
|
21
|
-
}
|