baja-lite 1.2.0 → 1.2.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/package.json +1 -1
- package/sql.d.ts +2 -2
- package/sql.js +17 -10
package/package.json
CHANGED
package/sql.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { ExtensionCodec } from "@msgpack/msgpack";
|
|
1
2
|
import { XML } from './convert-xml.js';
|
|
2
|
-
import { ArrayList } from './list.js';
|
|
3
3
|
import { EnumMap } from './enum.js';
|
|
4
|
-
import {
|
|
4
|
+
import { ArrayList } from './list.js';
|
|
5
5
|
export declare const extensionCodec: ExtensionCodec<undefined>;
|
|
6
6
|
declare const _daoDBName: unique symbol;
|
|
7
7
|
declare const _tableName: unique symbol;
|
package/sql.js
CHANGED
|
@@ -9,21 +9,21 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
9
9
|
};
|
|
10
10
|
var _b, _c, _d, _e;
|
|
11
11
|
var _f, _g, _h, _j;
|
|
12
|
-
import {
|
|
13
|
-
import
|
|
12
|
+
import { decode, DecodeError, encode, ExtensionCodec } from "@msgpack/msgpack";
|
|
13
|
+
import HTML from 'html-parse-stringify';
|
|
14
14
|
import * as ite from 'iterare';
|
|
15
|
-
import
|
|
15
|
+
import LGet from 'lodash.get';
|
|
16
|
+
import mustache from 'mustache';
|
|
16
17
|
import pino from 'pino';
|
|
18
|
+
import { formatDialect, mysql, postgresql, sqlite } from 'sql-formatter';
|
|
19
|
+
import tslib from 'tslib';
|
|
20
|
+
import { convert } from './convert-xml.js';
|
|
21
|
+
import { Throw } from './error.js';
|
|
17
22
|
import { excuteSplit, ExcuteSplitMode, sleep } from './fn.js';
|
|
23
|
+
import { ArrayList } from './list.js';
|
|
18
24
|
import { add, calc, ten2Any } from './math.js';
|
|
19
|
-
import mustache from 'mustache';
|
|
20
25
|
import { C2P, C2P2, P2C } from './object.js';
|
|
21
|
-
import {
|
|
22
|
-
import HTML from 'html-parse-stringify';
|
|
23
|
-
import { convert } from './convert-xml.js';
|
|
24
|
-
import { ArrayList } from './list.js';
|
|
25
|
-
import LGet from 'lodash.get';
|
|
26
|
-
import { encode, decode, ExtensionCodec, DecodeError } from "@msgpack/msgpack";
|
|
26
|
+
import { emptyString } from './string.js';
|
|
27
27
|
const iterate = ite.iterate;
|
|
28
28
|
BigInt.prototype.toJSON = function () { return this.toString(); };
|
|
29
29
|
const BIGINT_EXT_TYPE = 0;
|
|
@@ -2607,6 +2607,8 @@ export class SqlService {
|
|
|
2607
2607
|
option.mode ?? (option.mode = InsertMode.Insert);
|
|
2608
2608
|
const isArray = option.data instanceof Array;
|
|
2609
2609
|
const datas = option.data instanceof Array ? option.data : [option.data];
|
|
2610
|
+
if (datas.length === 0)
|
|
2611
|
+
return 0n;
|
|
2610
2612
|
if (option.sync === SyncMode.Sync) {
|
|
2611
2613
|
const fn = () => {
|
|
2612
2614
|
const result = excuteSplit(ExcuteSplitMode.SyncTrust, datas, _data => {
|
|
@@ -2713,6 +2715,8 @@ export class SqlService {
|
|
|
2713
2715
|
update(option) {
|
|
2714
2716
|
Throw.if(!this[_ids] || this[_ids].length === 0, 'not found id');
|
|
2715
2717
|
const datas = option.data instanceof Array ? option.data : [option.data];
|
|
2718
|
+
if (datas.length === 0)
|
|
2719
|
+
return 0;
|
|
2716
2720
|
if (option.sync === SyncMode.Sync) {
|
|
2717
2721
|
const fn = () => {
|
|
2718
2722
|
const result = excuteSplit(ExcuteSplitMode.SyncTrust, datas, _data => {
|
|
@@ -2774,6 +2778,9 @@ export class SqlService {
|
|
|
2774
2778
|
option.where = ids.map(i => ({ [idName]: i }));
|
|
2775
2779
|
}
|
|
2776
2780
|
const wheres = option.where instanceof Array ? option.where : [option.where];
|
|
2781
|
+
if (wheres.length === 0) {
|
|
2782
|
+
return 0;
|
|
2783
|
+
}
|
|
2777
2784
|
const sqls = [];
|
|
2778
2785
|
if (option.mode === DeleteMode.Common) {
|
|
2779
2786
|
const params = new Array();
|