@trenskow/pged 5.0.20 → 5.0.22
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/package.json +1 -1
- package/query-builder.js +10 -2
package/package.json
CHANGED
package/query-builder.js
CHANGED
|
@@ -201,7 +201,8 @@ export default class QueryBuilder extends CustomPromise {
|
|
|
201
201
|
options.local = options.local || this._defaultPrimaryKey;
|
|
202
202
|
options.foreign = options.foreign || this._defaultPrimaryKey;
|
|
203
203
|
let local = options.local.substring(0, 1) == ':' ? this._dbCase(options.local) : `:${this._table}.${this._dbCase(options.local)}`;
|
|
204
|
-
let
|
|
204
|
+
let direct = local.substring(0, 1) == ':' ? ':' : '';
|
|
205
|
+
let foreign = options.foreign.substring(0, 1) == ':' ? `${direct}${this._dbCase(options.foreign.substring(1))}` : `${direct}${this._dbCase(options.table)}.${this._dbCase(options.foreign)}`;
|
|
205
206
|
options.conditions[local] = foreign;
|
|
206
207
|
}
|
|
207
208
|
options.conditions = this._formalizeConditions(options.conditions);
|
|
@@ -367,7 +368,14 @@ export default class QueryBuilder extends CustomPromise {
|
|
|
367
368
|
}
|
|
368
369
|
|
|
369
370
|
if (key.substring(0, 1) == ':') {
|
|
370
|
-
|
|
371
|
+
let value = condition[key];
|
|
372
|
+
if (typeof value === 'string' && value.substring(0, 1) == ':') {
|
|
373
|
+
value = this._dbCase(condition[key].substring(1));
|
|
374
|
+
} else {
|
|
375
|
+
this._queryParameters.push(this._formatParameter(key, condition[key]));
|
|
376
|
+
value = `$${this._queryParameters.length}`;
|
|
377
|
+
}
|
|
378
|
+
return this._buildCondition(key.substring(1), comparer, value);
|
|
371
379
|
}
|
|
372
380
|
|
|
373
381
|
let dbKey = key;
|