@miniflare/d1
Advanced tools
Comparing version 2.12.2 to 2.13.0
@@ -196,12 +196,26 @@ var __create = Object.create; | ||
} | ||
#query = (query) => { | ||
const meta = { start: import_perf_hooks.performance.now() }; | ||
#prepareAndBind(query) { | ||
const sql = splitSqlQuery(query.sql)[0]; | ||
const stmt = this.db.prepare(sql); | ||
const params = normaliseParams(query.params); | ||
if (params.length === 0) | ||
return stmt; | ||
try { | ||
return stmt.bind(params); | ||
} catch (e) { | ||
try { | ||
return stmt.bind(Object.fromEntries(params.map((v, i) => [i + 1, v]))); | ||
} catch { | ||
} | ||
throw e; | ||
} | ||
} | ||
#query = (query) => { | ||
const meta = { start: import_perf_hooks.performance.now() }; | ||
const stmt = this.#prepareAndBind(query); | ||
let results; | ||
if (stmt.reader) { | ||
results = stmt.all(params); | ||
results = stmt.all(); | ||
} else { | ||
const result = stmt.run(params); | ||
const result = stmt.run(); | ||
results = []; | ||
@@ -215,8 +229,6 @@ meta.last_row_id = Number(result.lastInsertRowid); | ||
const meta = { start: import_perf_hooks.performance.now() }; | ||
const sql = splitSqlQuery(query.sql)[0]; | ||
const stmt = this.db.prepare(sql); | ||
const stmt = this.#prepareAndBind(query); | ||
if (stmt.reader) | ||
throw new Error(EXECUTE_RETURNS_DATA_MESSAGE); | ||
const params = normaliseParams(query.params); | ||
const result = stmt.run(params); | ||
const result = stmt.run(); | ||
meta.last_row_id = Number(result.lastInsertRowid); | ||
@@ -223,0 +235,0 @@ meta.changes = result.changes; |
{ | ||
"name": "@miniflare/d1", | ||
"version": "2.12.2", | ||
"version": "2.13.0", | ||
"description": "Workers D1 module for Miniflare: a fun, full-featured, fully-local simulator for Cloudflare Workers", | ||
@@ -39,8 +39,8 @@ "keywords": [ | ||
"dependencies": { | ||
"@miniflare/core": "2.12.2", | ||
"@miniflare/shared": "2.12.2" | ||
"@miniflare/core": "2.13.0", | ||
"@miniflare/shared": "2.13.0" | ||
}, | ||
"devDependencies": { | ||
"@miniflare/shared-test": "2.12.2" | ||
"@miniflare/shared-test": "2.13.0" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
29062
564
+ Added@miniflare/core@2.13.0(transitive)
+ Added@miniflare/queues@2.13.0(transitive)
+ Added@miniflare/shared@2.13.0(transitive)
+ Added@miniflare/watcher@2.13.0(transitive)
- Removed@miniflare/core@2.12.2(transitive)
- Removed@miniflare/queues@2.12.2(transitive)
- Removed@miniflare/shared@2.12.2(transitive)
- Removed@miniflare/watcher@2.12.2(transitive)
Updated@miniflare/core@2.13.0
Updated@miniflare/shared@2.13.0