diff options
author | stephan <stephan@noemail.net> | 2023-01-28 05:09:26 +0000 |
---|---|---|
committer | stephan <stephan@noemail.net> | 2023-01-28 05:09:26 +0000 |
commit | e84454ff16acf8da0814dfb334e0b6628293ae81 (patch) | |
tree | 616d7cb9767ef9a2aba634960c547b1c800a6e5b /ext/wasm/api/sqlite3-api-oo1.js | |
parent | 65f7942d0678a56f788d54a636c9c30ed63b5ee6 (diff) | |
download | sqlite-e84454ff16acf8da0814dfb334e0b6628293ae81.tar.gz sqlite-e84454ff16acf8da0814dfb334e0b6628293ae81.zip |
Enhance oo1.DB.exec() to simplify returning whole result sets.
FossilOrigin-Name: 7b168ee2af09f04b41a6ef4c14ccaddc0c9b0bfe9dc1e6a86d8f5317606bd78d
Diffstat (limited to 'ext/wasm/api/sqlite3-api-oo1.js')
-rw-r--r-- | ext/wasm/api/sqlite3-api-oo1.js | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/ext/wasm/api/sqlite3-api-oo1.js b/ext/wasm/api/sqlite3-api-oo1.js index fddd7b38e..26aa80f72 100644 --- a/ext/wasm/api/sqlite3-api-oo1.js +++ b/ext/wasm/api/sqlite3-api-oo1.js @@ -422,6 +422,10 @@ self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){ default: toss3("Invalid returnValue value:",opt.returnValue); } + if(!opt.callback && !opt.returnValue && undefined!==opt.rowMode){ + if(!opt.resultRows) opt.resultRows = []; + out.returnVal = ()=>opt.resultRows; + } if(opt.callback || opt.resultRows){ switch((undefined===opt.rowMode) ? 'array' : opt.rowMode) { @@ -770,8 +774,11 @@ self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){ - `returnValue`: is a string specifying what this function should return: - A) The default value is `"this"`, meaning that the - DB object itself should be returned. + A) The default value is (usually) `"this"`, meaning that the + DB object itself should be returned. The exceptions is if + the caller passes neither of `callback` nor `returnValue` + but does pass an explicit `rowMode` then the default + `returnValue` is `"resultRows"`, described below. B) `"resultRows"` means to return the value of the `resultRows` option. If `resultRows` is not set, this @@ -791,9 +798,6 @@ self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){ - `callback` and `resultRows`: permit an array entries with semantics similar to those described for `bind` above. - - If passed neither a callback nor returnValue but is passed a - rowMode, default to returning the result set. - */ exec: function(/*(sql [,obj]) || (obj)*/){ affirmDbOpen(this); |