aboutsummaryrefslogtreecommitdiff
path: root/ext/wasm/tester1.c-pp.js
diff options
context:
space:
mode:
authorstephan <stephan@noemail.net>2023-06-05 11:26:59 +0000
committerstephan <stephan@noemail.net>2023-06-05 11:26:59 +0000
commitc81dcaabe810d2620469da9380abcdd7639b3f23 (patch)
tree29e45f7345dae1e017ffbb4b6fd014f4815527c0 /ext/wasm/tester1.c-pp.js
parent706047470e670bd1ba080b613a7dac30353d694b (diff)
downloadsqlite-c81dcaabe810d2620469da9380abcdd7639b3f23.tar.gz
sqlite-c81dcaabe810d2620469da9380abcdd7639b3f23.zip
Add a JS test confirming that binding of statement parameters in a subquery works.
FossilOrigin-Name: 5dfaf0bce83c3e15ad605e3f07291ce219f1a2726ce77be27779897088ee13d5
Diffstat (limited to 'ext/wasm/tester1.c-pp.js')
-rw-r--r--ext/wasm/tester1.c-pp.js40
1 files changed, 40 insertions, 0 deletions
diff --git a/ext/wasm/tester1.c-pp.js b/ext/wasm/tester1.c-pp.js
index 0dd2c836f..ef85b1f73 100644
--- a/ext/wasm/tester1.c-pp.js
+++ b/ext/wasm/tester1.c-pp.js
@@ -98,6 +98,7 @@ self.sqlite3InitModule = sqlite3InitModule;
logTarget.append(ln);
};
const cbReverse = document.querySelector('#cb-log-reverse');
+ //cbReverse.setAttribute('checked','checked');
const cbReverseKey = 'tester1:cb-log-reverse';
const cbReverseIt = ()=>{
logTarget.classList[cbReverse.checked ? 'add' : 'remove']('reverse');
@@ -3006,6 +3007,45 @@ self.sqlite3InitModule = sqlite3InitModule;
}
})/*session API sanity tests*/
;/*end of session API group*/;
+ ////////////////////////////////////////////////////////////////////////
+ T.g('Bug Reports')
+ .t({
+ name: 'Delete via bound parameter in subquery',
+ test: function(sqlite3){
+ // Testing https://sqlite.org/forum/forumpost/40ce55bdf5
+ // with the exception that that post uses "external content"
+ // for the FTS index.
+ const db = new sqlite3.oo1.DB(':memory:','wt');
+ db.exec([
+ "create virtual table f using fts5 (path);",
+ "insert into f(path) values('abc'),('def'),('ghi');"
+ ]);
+ const fetchEm = ()=> db.exec({
+ sql: "SELECT * FROM f order by path",
+ rowMode: 'array'
+ });
+ const dump = function(lbl){
+ let rc = fetchEm();
+ log((lbl ? (lbl+' results') : ''),rc);
+ };
+ //dump('Full fts table');
+ let rc = fetchEm();
+ T.assert(3===rc.length);
+ db.exec(`
+ delete from f where rowid in (
+ select rowid from f where path = :path
+ )`,
+ {bind: {":path": "def"}}
+ );
+ //dump('After deleting one entry via subquery');
+ rc = fetchEm();
+ T.assert(2===rc.length)
+ .assert('abcghi'===rc.join(''));
+ //log('rc =',rc);
+ db.close();
+ }
+ })
+ ;/*end of Bug Reports group*/;
////////////////////////////////////////////////////////////////////////
log("Loading and initializing sqlite3 WASM module...");