orange-orm 5.2.3 → 5.3.0
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/README.md +10 -0
- package/deno.lock +75 -0
- package/dist/index.browser.mjs +56 -16
- package/dist/index.mjs +378 -35
- package/docs/changelog.md +4 -0
- package/other.db +0 -0
- package/package.json +1 -1
- package/src/client/clientMap.js +2 -0
- package/src/client/createProviders.js +8 -0
- package/src/client/index.js +1 -0
- package/src/client/map.js +1 -0
- package/src/index.d.ts +7 -6
- package/src/index.js +11 -1
- package/src/map.d.ts +21 -18
- package/src/map2.d.ts +3 -0
- package/src/mariaDb/newDatabase.js +101 -0
- package/src/mariaDb/newPool.js +13 -0
- package/src/mariaDb/newTransaction.js +126 -0
- package/src/mySql/newTransaction.js +27 -1
- package/src/table/column/dateWithTimeZone/newEncode.js +14 -10
- package/src/table/column/string/newLikeColumnArg.js +1 -1
- package/src/table/commands/delete/singleCommand/newSingleCommandCore.js +5 -1
- package/src/table/commands/newUpdateCommandCore.js +23 -3
- package/src/table/isJsonUpdateSupported.js +1 -1
|
@@ -84,7 +84,7 @@ function newUpdateCommandCore(context, table, columns, row, concurrencyState) {
|
|
|
84
84
|
if (engine === 'pg') {
|
|
85
85
|
command = command.append(separator + columnSql + ' IS NOT DISTINCT FROM ').append(encoded);
|
|
86
86
|
}
|
|
87
|
-
else if (engine === 'mysql') {
|
|
87
|
+
else if (engine === 'mysql' || engine === 'mariadb') {
|
|
88
88
|
command = command.append(separator + columnSql + ' <=> ').append(encoded);
|
|
89
89
|
}
|
|
90
90
|
else if (engine === 'sqlite') {
|
|
@@ -123,7 +123,7 @@ function newUpdateCommandCore(context, table, columns, row, concurrencyState) {
|
|
|
123
123
|
if (engine === 'pg') {
|
|
124
124
|
command = command.append(separator).append(columnExpr).append(' IS NOT DISTINCT FROM ').append(encoded);
|
|
125
125
|
}
|
|
126
|
-
else if (engine === 'mysql') {
|
|
126
|
+
else if (engine === 'mysql' || engine === 'mariadb') {
|
|
127
127
|
command = command.append(separator).append(columnExpr).append(' <=> ').append(encoded);
|
|
128
128
|
}
|
|
129
129
|
else if (engine === 'sqlite') {
|
|
@@ -184,6 +184,11 @@ function newUpdateCommandCore(context, table, columns, row, concurrencyState) {
|
|
|
184
184
|
const sql = 'JSON_SET(' + expr.sql() + ', ' + jsonPath.sql + ', CAST(? AS JSON))';
|
|
185
185
|
return newParameterized(sql, expr.parameters.concat(jsonPath.parameters, [jsonValue]));
|
|
186
186
|
}
|
|
187
|
+
if (engine === 'mariadb') {
|
|
188
|
+
const jsonValue = JSON.stringify(value === undefined ? null : value);
|
|
189
|
+
const sql = 'JSON_SET(' + expr.sql() + ', ' + jsonPath.sql + ', JSON_EXTRACT(?, \'$\'))';
|
|
190
|
+
return newParameterized(sql, expr.parameters.concat(jsonPath.parameters, [jsonValue]));
|
|
191
|
+
}
|
|
187
192
|
if (engine === 'sqlite') {
|
|
188
193
|
const jsonValue = JSON.stringify(value === undefined ? null : value);
|
|
189
194
|
const sql = 'json_set(' + expr.sql() + ', ' + jsonPath.sql + ', json(?))';
|
|
@@ -208,7 +213,7 @@ function newUpdateCommandCore(context, table, columns, row, concurrencyState) {
|
|
|
208
213
|
const sql = expr.sql() + ' #- ' + pathLiteral;
|
|
209
214
|
return newParameterized(sql, expr.parameters);
|
|
210
215
|
}
|
|
211
|
-
if (engine === 'mysql') {
|
|
216
|
+
if (engine === 'mysql' || engine === 'mariadb') {
|
|
212
217
|
const sql = 'JSON_REMOVE(' + expr.sql() + ', ' + jsonPath.sql + ')';
|
|
213
218
|
return newParameterized(sql, expr.parameters.concat(jsonPath.parameters));
|
|
214
219
|
}
|
|
@@ -236,6 +241,12 @@ function newUpdateCommandCore(context, table, columns, row, concurrencyState) {
|
|
|
236
241
|
const sql = 'JSON_EXTRACT(' + columnSql + ', ' + jsonPath.sql + ')';
|
|
237
242
|
return newParameterized(sql, jsonPath.parameters);
|
|
238
243
|
}
|
|
244
|
+
if (engine === 'mariadb') {
|
|
245
|
+
const sql = isJsonObject(oldValue)
|
|
246
|
+
? 'JSON_EXTRACT(' + columnSql + ', ' + jsonPath.sql + ')'
|
|
247
|
+
: 'JSON_UNQUOTE(JSON_EXTRACT(' + columnSql + ', ' + jsonPath.sql + '))';
|
|
248
|
+
return newParameterized(sql, jsonPath.parameters);
|
|
249
|
+
}
|
|
239
250
|
if (engine === 'sqlite') {
|
|
240
251
|
const sql = 'json_extract(' + columnSql + ', ' + jsonPath.sql + ')';
|
|
241
252
|
return newParameterized(sql, jsonPath.parameters);
|
|
@@ -311,6 +322,15 @@ function newUpdateCommandCore(context, table, columns, row, concurrencyState) {
|
|
|
311
322
|
const jsonValue = JSON.stringify(value === undefined ? null : value);
|
|
312
323
|
return newParameterized('CAST(? AS JSON)', [jsonValue]);
|
|
313
324
|
}
|
|
325
|
+
if (engine === 'mariadb') {
|
|
326
|
+
if (isJsonObject(value)) {
|
|
327
|
+
const jsonValue = JSON.stringify(value);
|
|
328
|
+
return newParameterized('JSON_EXTRACT(?, \'$\')', [jsonValue]);
|
|
329
|
+
}
|
|
330
|
+
if (value === null || value === undefined)
|
|
331
|
+
return newParameterized('null');
|
|
332
|
+
return newParameterized('?', [String(value)]);
|
|
333
|
+
}
|
|
314
334
|
if (engine === 'sqlite') {
|
|
315
335
|
if (isJsonObject(value)) {
|
|
316
336
|
const jsonValue = JSON.stringify(value);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
function isJsonUpdateSupported(engine) {
|
|
2
|
-
return engine === 'pg' || engine === 'mysql' || engine === 'sqlite' || engine === 'mssql' || engine === 'mssqlNative' || engine === 'oracle';
|
|
2
|
+
return engine === 'pg' || engine === 'mysql' || engine === 'mariadb' || engine === 'sqlite' || engine === 'mssql' || engine === 'mssqlNative' || engine === 'oracle';
|
|
3
3
|
}
|
|
4
4
|
|
|
5
5
|
module.exports = isJsonUpdateSupported;
|