vsql-node 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/README.md CHANGED
@@ -146,7 +146,7 @@ type, which is cast to the type it's used as:
146
146
  |--------------------------|--------------------------------------------------------|
147
147
  | `null`, `undefined` | `NULL` |
148
148
  | `boolean` | `BOOLEAN` |
149
- | `number` | `BIGINT` if it's a safe integer, otherwise `DOUBLE PRECISION` |
149
+ | `number` | `BIGINT` if it's a safe integer, otherwise `DOUBLE PRECISION` (`NaN` and `±Infinity` are a `RangeError`) |
150
150
  | `bigint` | `BIGINT` (`NUMERIC` if it's out of range) |
151
151
  | `string` | `CHARACTER VARYING` |
152
152
  | `Buffer`, `Uint8Array` | `BINARY VARYING` (also any other view, or an `ArrayBuffer`) |
package/lib/convert.js CHANGED
@@ -145,6 +145,11 @@ function toParam(value) {
145
145
  if (Number.isSafeInteger(value)) {
146
146
  return [lib.SQL_BIGINT, lib.SQL_BIGINT, 0, 0, value];
147
147
  }
148
+ // vsql doesn't have NaN or infinities (a DOUBLE PRECISION that overflows
149
+ // is an error), and they couldn't be read back.
150
+ if (!Number.isFinite(value)) {
151
+ throw new RangeError(`invalid number: ${value}`);
152
+ }
148
153
  return [lib.SQL_DOUBLE, lib.SQL_DOUBLE, 0, 0, value];
149
154
 
150
155
  case 'bigint':
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vsql-node",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "A Node.js driver for vsql, a single file or in-memory SQL database.",
5
5
  "keywords": [
6
6
  "vsql",