mysql2-core 0.3.8 → 0.3.9
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 +1558 -2
- package/lib/index.js +265 -454
- package/package.json +1 -1
- package/src/build.ts +8 -8
- package/src/index.ts +327 -476
- package/src/metadata.ts +2 -22
package/package.json
CHANGED
package/src/build.ts
CHANGED
|
@@ -102,7 +102,7 @@ export function buildToSave<T>(obj: T, table: string, attrs: Attributes, ver?: s
|
|
|
102
102
|
const v2 = attr.true ? attr.true : `'1'`
|
|
103
103
|
args.push(v2)
|
|
104
104
|
} else {
|
|
105
|
-
const v2 = attr.false ? attr.false : `'0'`
|
|
105
|
+
const v2 = attr.false && attr.false !== 0 ? attr.false : `'0'`
|
|
106
106
|
args.push(v2)
|
|
107
107
|
}
|
|
108
108
|
} else {
|
|
@@ -144,10 +144,10 @@ export function buildToSave<T>(obj: T, table: string, attrs: Attributes, ver?: s
|
|
|
144
144
|
x = buildParam(i++)
|
|
145
145
|
if (typeof v === "boolean") {
|
|
146
146
|
if (v === true) {
|
|
147
|
-
const v2 = attr.true ?
|
|
147
|
+
const v2 = attr.true ? attr.true : `'1'`
|
|
148
148
|
args.push(v2)
|
|
149
149
|
} else {
|
|
150
|
-
const v2 = attr.false
|
|
150
|
+
const v2 = attr.false && attr.false !== 0 ? attr.false : `'0'`
|
|
151
151
|
args.push(v2)
|
|
152
152
|
}
|
|
153
153
|
} else {
|
|
@@ -186,7 +186,7 @@ export function buildToSaveBatch<T>(objs: T[], table: string, attrs: Attributes,
|
|
|
186
186
|
if (v == null) {
|
|
187
187
|
v = attr.default
|
|
188
188
|
}
|
|
189
|
-
if (v != null &&
|
|
189
|
+
if (v != null && !attr.ignored && !attr.noinsert) {
|
|
190
190
|
const field = attr.column ? attr.column : k
|
|
191
191
|
cols.push(field)
|
|
192
192
|
if (k === ver) {
|
|
@@ -205,7 +205,7 @@ export function buildToSaveBatch<T>(objs: T[], table: string, attrs: Attributes,
|
|
|
205
205
|
const v2 = attr.true ? attr.true : `'1'`
|
|
206
206
|
args.push(v2)
|
|
207
207
|
} else {
|
|
208
|
-
const v2 = attr.false ? attr.false : `'0'`
|
|
208
|
+
const v2 = attr.false && attr.false !== 0 ? attr.false : `'0'`
|
|
209
209
|
args.push(v2)
|
|
210
210
|
}
|
|
211
211
|
} else {
|
|
@@ -239,10 +239,10 @@ export function buildToSaveBatch<T>(objs: T[], table: string, attrs: Attributes,
|
|
|
239
239
|
x = buildParam(i++)
|
|
240
240
|
if (typeof v === "boolean") {
|
|
241
241
|
if (v === true) {
|
|
242
|
-
const v2 = attr.true ?
|
|
242
|
+
const v2 = attr.true ? attr.true : `'1'`
|
|
243
243
|
args.push(v2)
|
|
244
244
|
} else {
|
|
245
|
-
const v2 = attr.false
|
|
245
|
+
const v2 = attr.false && attr.false !== 0 ? attr.false : `'0'`
|
|
246
246
|
args.push(v2)
|
|
247
247
|
}
|
|
248
248
|
} else {
|
|
@@ -270,4 +270,4 @@ export function toString(v: number): string {
|
|
|
270
270
|
return "" + v
|
|
271
271
|
}
|
|
272
272
|
return "null"
|
|
273
|
-
}
|
|
273
|
+
}
|