mirror of
https://github.com/aljazceru/turso.git
synced 2026-01-05 09:14:24 +01:00
bind/js: Partially implements pragma
Some pragmas may return more than one value, which would break the current logic. So this cause should be handled in the future
This commit is contained in:
@@ -77,13 +77,19 @@ class Database {
|
||||
|
||||
pragma(source, options) {
|
||||
if (options == null) options = {};
|
||||
|
||||
if (typeof source !== "string")
|
||||
throw new TypeError("Expected first argument to be a string");
|
||||
|
||||
if (typeof options !== "object")
|
||||
throw new TypeError("Expected second argument to be an options object");
|
||||
|
||||
const simple = options["simple"];
|
||||
const stmt = this.prepare(`PRAGMA ${source}`, this, true);
|
||||
return simple ? stmt.pluck().get() : stmt.all();
|
||||
const pragma = `PRAGMA ${source}`;
|
||||
|
||||
return simple
|
||||
? this.db.pragma(pragma, true)
|
||||
: this.db.pragma(pragma, false);
|
||||
}
|
||||
|
||||
backup(filename, options) {
|
||||
|
||||
Reference in New Issue
Block a user