mirror of
https://github.com/tursodatabase/limbo.git
synced 2025-07-24 12:53:45 +00: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:
parent
1ff454853b
commit
60b78b3566
4 changed files with 70 additions and 9 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue