@maiyunnet/kebab 5.0.3 → 5.0.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/index.d.ts +1 -1
- package/index.js +1 -1
- package/lib/sql.js +10 -10
- package/package.json +1 -1
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* --- 本文件用来定义每个目录实体地址的常量 ---
|
|
7
7
|
*/
|
|
8
8
|
/** --- 当前系统版本号 --- */
|
|
9
|
-
export const VER = '5.0.
|
|
9
|
+
export const VER = '5.0.4';
|
|
10
10
|
// --- 服务端用的路径 ---
|
|
11
11
|
const imu = decodeURIComponent(import.meta.url).replace('file://', '').replace(/^\/(\w:)/, '$1');
|
|
12
12
|
/** --- /xxx/xxx --- */
|
package/lib/sql.js
CHANGED
|
@@ -113,7 +113,7 @@ export class Sql {
|
|
|
113
113
|
else {
|
|
114
114
|
// --- v1: json ---
|
|
115
115
|
sql += this.placeholder() + ', ';
|
|
116
|
-
this._data.push(lText.stringifyJson(v1));
|
|
116
|
+
this._data.push(this._service === ESERVICE.MYSQL ? lText.stringifyJson(v1) : v1);
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
119
|
else if (v1.x !== undefined) {
|
|
@@ -133,7 +133,7 @@ export class Sql {
|
|
|
133
133
|
else {
|
|
134
134
|
// --- v1: json ---
|
|
135
135
|
sql += this.placeholder() + ', ';
|
|
136
|
-
this._data.push(lText.stringifyJson(v1));
|
|
136
|
+
this._data.push(this._service === ESERVICE.MYSQL ? lText.stringifyJson(v1) : v1);
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
139
|
else if (v1 instanceof Buffer) {
|
|
@@ -148,7 +148,7 @@ export class Sql {
|
|
|
148
148
|
else {
|
|
149
149
|
// --- json ---
|
|
150
150
|
sql += this.placeholder() + ', ';
|
|
151
|
-
this._data.push(lText.stringifyJson(v1));
|
|
151
|
+
this._data.push(this._service === ESERVICE.MYSQL ? lText.stringifyJson(v1) : v1);
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
154
|
sql = sql.slice(0, -2) + '), ';
|
|
@@ -203,7 +203,7 @@ export class Sql {
|
|
|
203
203
|
else {
|
|
204
204
|
// --- v: json ---
|
|
205
205
|
values += this.placeholder() + ', ';
|
|
206
|
-
this._data.push(lText.stringifyJson(v));
|
|
206
|
+
this._data.push(this._service === ESERVICE.MYSQL ? lText.stringifyJson(v) : v);
|
|
207
207
|
}
|
|
208
208
|
}
|
|
209
209
|
else if (v.x !== undefined) {
|
|
@@ -223,7 +223,7 @@ export class Sql {
|
|
|
223
223
|
else {
|
|
224
224
|
// --- v: json ---
|
|
225
225
|
values += this.placeholder() + ', ';
|
|
226
|
-
this._data.push(lText.stringifyJson(v));
|
|
226
|
+
this._data.push(this._service === ESERVICE.MYSQL ? lText.stringifyJson(v) : v);
|
|
227
227
|
}
|
|
228
228
|
}
|
|
229
229
|
else if (v instanceof Buffer) {
|
|
@@ -238,7 +238,7 @@ export class Sql {
|
|
|
238
238
|
else {
|
|
239
239
|
// --- json ---
|
|
240
240
|
values += this.placeholder() + ', ';
|
|
241
|
-
this._data.push(lText.stringifyJson(v));
|
|
241
|
+
this._data.push(this._service === ESERVICE.MYSQL ? lText.stringifyJson(v) : v);
|
|
242
242
|
}
|
|
243
243
|
}
|
|
244
244
|
sql = sql.slice(0, -2) + ') VALUES (' + values.slice(0, -2) + ')';
|
|
@@ -385,7 +385,7 @@ export class Sql {
|
|
|
385
385
|
else {
|
|
386
386
|
// --- v: json ---
|
|
387
387
|
sql += this.placeholder() + ', ';
|
|
388
|
-
this._data.push(lText.stringifyJson(v));
|
|
388
|
+
this._data.push(this._service === ESERVICE.MYSQL ? lText.stringifyJson(v) : v);
|
|
389
389
|
}
|
|
390
390
|
}
|
|
391
391
|
else if (v.x !== undefined) {
|
|
@@ -411,7 +411,7 @@ export class Sql {
|
|
|
411
411
|
else {
|
|
412
412
|
// --- 8 ---
|
|
413
413
|
sql += this.placeholder() + ', ';
|
|
414
|
-
this._data.push(lText.stringifyJson(v));
|
|
414
|
+
this._data.push(this._service === ESERVICE.MYSQL ? lText.stringifyJson(v) : v);
|
|
415
415
|
}
|
|
416
416
|
}
|
|
417
417
|
}
|
|
@@ -427,7 +427,7 @@ export class Sql {
|
|
|
427
427
|
else {
|
|
428
428
|
// --- json ---
|
|
429
429
|
sql += this.placeholder() + ', ';
|
|
430
|
-
this._data.push(lText.stringifyJson(v));
|
|
430
|
+
this._data.push(this._service === ESERVICE.MYSQL ? lText.stringifyJson(v) : v);
|
|
431
431
|
}
|
|
432
432
|
}
|
|
433
433
|
}
|
|
@@ -1084,7 +1084,7 @@ export function format(sql, data, service = ESERVICE.MYSQL) {
|
|
|
1084
1084
|
if (val instanceof Buffer) {
|
|
1085
1085
|
return `'\\x${val.toString('hex')}'`;
|
|
1086
1086
|
}
|
|
1087
|
-
return `'${
|
|
1087
|
+
return `'${lText.stringifyJson(val).replace(/'/g, "''")}'`;
|
|
1088
1088
|
});
|
|
1089
1089
|
}
|
|
1090
1090
|
/**
|