mysql2-core 0.3.7 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mysql2-core",
3
- "version": "0.3.7",
3
+ "version": "0.3.9",
4
4
  "description": "mysql2-core",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./src/index.ts",
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 ? "" + attr.true : `'1'`
147
+ const v2 = attr.true ? attr.true : `'1'`
148
148
  args.push(v2)
149
149
  } else {
150
- const v2 = attr.false ? "" + attr.false : `'0'`
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 && v !== undefined && !attr.ignored && !attr.noinsert) {
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 ? "" + attr.true : `'1'`
242
+ const v2 = attr.true ? attr.true : `'1'`
243
243
  args.push(v2)
244
244
  } else {
245
- const v2 = attr.false ? "" + attr.false : `'0'`
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
+ }