Add a basic INSERT RETURNING test for the oo1.DB.exec() API.

FossilOrigin-Name: d29d62cf7658aeb49f3c8a5d0b0809d945ebc9b79379a255eb88f771d2a2c430
This commit is contained in:
stephan 2023-05-19 16:12:06 +00:00
parent 2492b6c0fb
commit 416aeb16ee
4 changed files with 21 additions and 13 deletions

View File

@ -783,7 +783,7 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
should return:
A) The default value is (usually) `"this"`, meaning that the
DB object itself should be returned. The exceptions is if
DB object itself should be returned. The exception is if
the caller passes neither of `callback` nor `returnValue`
but does pass an explicit `rowMode` then the default
`returnValue` is `"resultRows"`, described below.

View File

@ -1335,8 +1335,8 @@ self.sqlite3InitModule = sqlite3InitModule;
sql:['CREATE TABLE t(a,b);',
// ^^^ using TEMP TABLE breaks the db export test
"INSERT INTO t(a,b) VALUES(1,2),(3,4),",
"(?,?),('blob',X'6869')"/*intentionally missing semicolon to test for
off-by-one bug in string-to-WASM conversion*/],
"(?,?)"/*intentionally missing semicolon to test for
off-by-one bug in string-to-WASM conversion*/],
saveSql: list,
bind: [5,6]
});
@ -1344,12 +1344,20 @@ self.sqlite3InitModule = sqlite3InitModule;
T.assert(rc === db)
.assert(2 === list.length)
.assert('string'===typeof list[1])
.assert(4===db.changes())
.assert(3===db.changes())
.assert(this.progressHandlerCount > 0,
"Expecting progress callback.")
if(wasm.bigIntEnabled){
T.assert(4n===db.changes(false,true));
T.assert(3n===db.changes(false,true));
}
rc = db.exec({
sql: "INSERT INTO t values('blob',X'6869') RETURNING 13",
rowMode: 0
});
T.assert(Array.isArray(rc))
.assert(1===rc.length)
.assert(13 === rc[0])
.assert(1===db.changes());
let vals = db.selectValues('select a from t order by a limit 2');
T.assert( 2 === vals.length )

View File

@ -1,5 +1,5 @@
C sqlite3.oo1.Stmt.finalize()\snow\sthrows\sif\ssqlite3_finalize()\sreturns\snon-zero.\sThis\sis\sintended\sto\saddress\sthe\sINSERT\sRETURNING\scase\scovered\sin\s[forum:36f7a2e7494897df|forum\spost\s36f7a2e7494897df].
D 2023-05-19T15:54:41.587
C Add\sa\sbasic\sINSERT\sRETURNING\stest\sfor\sthe\soo1.DB.exec()\sAPI.
D 2023-05-19T16:12:06.386
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@ -494,7 +494,7 @@ F ext/wasm/api/post-js-header.js 47b6b281f39ad59fa6e8b658308cd98ea292c286a68407b
F ext/wasm/api/pre-js.c-pp.js ad906703f7429590f2fbf5e6498513bf727a1a4f0ebfa057afb08161d7511219
F ext/wasm/api/sqlite3-api-cleanup.js cc21e3486da748463e02bbe51e2464c6ac136587cdfd5aa00cd0b5385f6ca808
F ext/wasm/api/sqlite3-api-glue.js f1b2dcb944de5138bb5bd9a1559d2e76a4f3ec25260963d709e8237476688803
F ext/wasm/api/sqlite3-api-oo1.js 5378c0be7a4acd50e5aae4bc4134ac0a18feb3afcb347e230d994322c5c73aa7
F ext/wasm/api/sqlite3-api-oo1.js 440f628008f6a6b1ff64c995e527e13dcce5183edf13c7d07e100670f400343a
F ext/wasm/api/sqlite3-api-prologue.js 17f4ec398ba34c5c666fea8e8c4eb82064a35b302f2f2eb355283cd8d3f68ed5
F ext/wasm/api/sqlite3-api-worker1.js 40a5b1813fcbe789f23ae196c833432c8c83e7054d660194ddfc51eab1c5b9bf
F ext/wasm/api/sqlite3-license-version-header.js 0c807a421f0187e778dc1078f10d2994b915123c1223fe752b60afdcd1263f89
@ -546,7 +546,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 959bf094afa7564b264b3617a7cf324664dd68777c01d18b6cbf3c8d1827edea
F ext/wasm/tester1.c-pp.js 8f3507b22f829818a37fc44ffa81e84b4192a2ebde6a351d14b9009e136883d9
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
@ -2070,8 +2070,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 6ac18827d8c5be35442dc452af703023c759916c179f165c4e54b3e430a8f7b0
R c8d9ad9c35ee306f20ca771ef244e9ad
P f23eb5c6d36546ee1e181a03660e0b2dc8005bba24bee8bae594b0c78bd152cd
R 32b181e7b8ad923e1605fccaa4e3edb6
U stephan
Z 4750efca665c22043c87ba69bd06ab99
Z b201dd24265915e86f6b649a6645e0c4
# Remove this line to create a well-formed Fossil manifest.

View File

@ -1 +1 @@
f23eb5c6d36546ee1e181a03660e0b2dc8005bba24bee8bae594b0c78bd152cd
d29d62cf7658aeb49f3c8a5d0b0809d945ebc9b79379a255eb88f771d2a2c430