| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent e1f86c1 commit 3999786
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -500,13 +500,13 @@ more data types than SQLite, only a subset of JavaScript types are supported. | |||
| 500 | 500 | Attempting to write an unsupported data type to SQLite will result in an | |
| 501 | 501 | exception. | |
| 502 | 502 | ||
| 503 | - | SQLite | JavaScript | | ||
| 504 | - | --------- | -------------------- | | ||
| 505 | - | `NULL` | {null} | | ||
| 506 | - | `INTEGER` | {number} or {bigint} | | ||
| 507 | - | `REAL` | {number} | | ||
| 508 | - | `TEXT` | {string} | | ||
| 509 | - | `BLOB` | {Uint8Array} | | ||
| 503 | + | SQLite | JavaScript | | ||
| 504 | + | --------- | -------------------------- | | ||
| 505 | + | `NULL` | {null} | | ||
| 506 | + | `INTEGER` | {number} or {bigint} | | ||
| 507 | + | `REAL` | {number} | | ||
| 508 | + | `TEXT` | {string} | | ||
| 509 | + | `BLOB` | {TypedArray} or {DataView} | | ||
| 510 | 510 | ||
| 511 | 511 | ## `sqlite.constants` | |
| 512 | 512 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -213,7 +213,7 @@ class UserDefinedFunction { | |||
| 213 | 213 | } else if (result->IsString()) { | |
| 214 | 214 | Utf8Value val(isolate, result.As<String>()); | |
| 215 | 215 | sqlite3_result_text(ctx, *val, val.length(), SQLITE_TRANSIENT); | |
| 216 | - } else if (result->IsUint8Array()) { | ||
| 216 | + } else if (result->IsArrayBufferView()) { | ||
| 217 | 217 | ArrayBufferViewContents<uint8_t> buf(result); | |
| 218 | 218 | sqlite3_result_blob(ctx, buf.data(), buf.length(), SQLITE_TRANSIENT); | |
| 219 | 219 | } else if (result->IsBigInt()) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -274,13 +274,18 @@ suite('DatabaseSync.prototype.function()', () => { | |||
| 274 | 274 | db.function('retString', () => { return 'foo'; }); | |
| 275 | 275 | db.function('retBigInt', () => { return 5n; }); | |
| 276 | 276 | db.function('retUint8Array', () => { return new Uint8Array([1, 2, 3]); }); | |
| 277 | + db.function('retArrayBufferView', () => { | ||
| 278 | + const arrayBuffer = new Uint8Array([1, 2, 3]).buffer; | ||
| 279 | + return new DataView(arrayBuffer); | ||
| 280 | + }); | ||
| 277 | 281 | const stmt = db.prepare(`SELECT | |
| 278 | 282 | retUndefined() AS retUndefined, | |
| 279 | 283 | retNull() AS retNull, | |
| 280 | 284 | retNumber() AS retNumber, | |
| 281 | 285 | retString() AS retString, | |
| 282 | 286 | retBigInt() AS retBigInt, | |
| 283 | - retUint8Array() AS retUint8Array | ||
| 287 | + retUint8Array() AS retUint8Array, | ||
| 288 | + retArrayBufferView() AS retArrayBufferView | ||
| 284 | 289 | `); | |
| 285 | 290 | assert.deepStrictEqual(stmt.get(), { | |
| 286 | 291 | __proto__: null, | |
@@ -290,6 +295,7 @@ suite('DatabaseSync.prototype.function()', () => { | |||
| 290 | 295 | retString: 'foo', | |
| 291 | 296 | retBigInt: 5, | |
| 292 | 297 | retUint8Array: new Uint8Array([1, 2, 3]), | |
| 298 | + retArrayBufferView: new Uint8Array([1, 2, 3]), | ||
| 293 | 299 | }); | |
| 294 | 300 | }); | |
| 295 | 301 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments