1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-24 22:22:08 +03:00

Add a JS test confirming that binding of statement parameters in a subquery works.

FossilOrigin-Name: 5dfaf0bce83c3e15ad605e3f07291ce219f1a2726ce77be27779897088ee13d5
This commit is contained in:
stephan
2023-06-05 11:26:59 +00:00
parent 706047470e
commit c81dcaabe8
3 changed files with 48 additions and 8 deletions

View File

@ -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...");

View File

@ -1,5 +1,5 @@
C Generalize\sthe\ssrc-verify.c\sutility\sprogram\sand\sprovide\sadditional\sdocumentation\nin\sthe\sheader\scomment.
D 2023-06-05T01:05:46.192
C Add\sa\sJS\stest\sconfirming\sthat\sbinding\sof\sstatement\sparameters\sin\sa\ssubquery\sworks.
D 2023-06-05T11:26:59.145
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@ -547,7 +547,7 @@ F ext/wasm/test-opfs-vfs.html 1f2d672f3f3fce810dfd48a8d56914aba22e45c6834e262555
F ext/wasm/test-opfs-vfs.js f09266873e1a34d9bdb6d3981ec8c9e382f31f215c9fd2f9016d2394b8ae9b7b
F ext/wasm/tester1-worker.html ebc4b820a128963afce328ecf63ab200bd923309eb939f4110510ab449e9814c
F ext/wasm/tester1.c-pp.html 1c1bc78b858af2019e663b1a31e76657b73dc24bede28ca92fbe917c3a972af2
F ext/wasm/tester1.c-pp.js 0c2df45b3bd2f193b862c491f6cc440d2a6f6bd1237d0c2d1f3272ea185f02b8
F ext/wasm/tester1.c-pp.js 3650032f3eee1db54ac63d83c99fe87b57e405470fb6561fa846b2dbcafc4fb6
F ext/wasm/tests/opfs/concurrency/index.html 0802373d57034d51835ff6041cda438c7a982deea6079efd98098d3e42fbcbc1
F ext/wasm/tests/opfs/concurrency/test.js a98016113eaf71e81ddbf71655aa29b0fed9a8b79a3cdd3620d1658eb1cc9a5d
F ext/wasm/tests/opfs/concurrency/worker.js 0a8c1a3e6ebb38aabbee24f122693f1fb29d599948915c76906681bb7da1d3d2
@ -2073,8 +2073,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P c9fda8d6dba36841415d0f445b4081b051bfaa70428b605ac0b9ca4ae98f7d49
R e7690e0368ac1bfdeb0f14274f730ca3
U drh
Z 811356101b2366481e1c6bca269b4085
P 7ed84046ef0c2c64031cac3a3a6b43aac3ac40aeb36838d8d046493f2d5ed122
R fb2d629d7e0e9d1d69cce979961f331c
U stephan
Z b652f6f027cd42809f280711384f7583
# Remove this line to create a well-formed Fossil manifest.

View File

@ -1 +1 @@
7ed84046ef0c2c64031cac3a3a6b43aac3ac40aeb36838d8d046493f2d5ed122
5dfaf0bce83c3e15ad605e3f07291ce219f1a2726ce77be27779897088ee13d5