oo1.DB.exec() rowMode="$columnName": a minor optimization and a preemtive fix for a hypothetical corner-case bug.

FossilOrigin-Name: 0b2df22bd92914708ad0851d0401ad2cf3edb1968b88b2c07fe40792a731c5ba
This commit is contained in:
stephan 2022-12-24 11:16:49 +00:00
parent 0cdc01d01a
commit 4b4ae86445
3 changed files with 19 additions and 20 deletions

View File

@ -439,23 +439,22 @@ self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
if(util.isInt32(opt.rowMode)){
out.cbArg = (stmt)=>stmt.get(opt.rowMode);
break;
}else if('string'===typeof opt.rowMode && opt.rowMode.length>1){
}else if('string'===typeof opt.rowMode
&& opt.rowMode.length>1
&& '$'===opt.rowMode[0]){
/* "$X": fetch column named "X" (case-sensitive!). Prior
to 2022-12-14 ":X" and "@X" were also permitted, but
having so many options is unnecessary and likely to
cause confusion. */
if('$'===opt.rowMode[0]){
out.cbArg = function(stmt){
const rc = stmt.get(this.obj)[this.colName];
return (undefined===rc)
? toss3("exec(): unknown result column:",this.colName)
: rc;
}.bind({
obj:Object.create(null),
colName: opt.rowMode.substr(1)
});
break;
}
const $colName = opt.rowMode.substr(1);
out.cbArg = (stmt)=>{
const rc = stmt.get(Object.create(null))[$colName];
return (undefined===rc)
? toss3(capi.SQLITE_NOTFOUND,
"exec(): unknown result column:",$colName)
: rc;
};
break;
}
toss3("Invalid rowMode:",opt.rowMode);
}

View File

@ -1,5 +1,5 @@
C If\ssqlite3.oo1.DB.exec()'s\scallback\sreturns\sa\sliteral\sfalse,\sstop\sstep()ing\sover\sresults\sas\sif\sthe\send\sof\sthe\sresult\sset\shad\sbeen\sreached.\sUnrelated\sminor\scode-adjacent\scleanups.
D 2022-12-24T01:59:42.190
C oo1.DB.exec()\srowMode="$columnName":\sa\sminor\soptimization\sand\sa\spreemtive\sfix\sfor\sa\shypothetical\scorner-case\sbug.
D 2022-12-24T11:16:49.554
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@ -504,7 +504,7 @@ F ext/wasm/api/post-js-header.js 47b6b281f39ad59fa6e8b658308cd98ea292c286a68407b
F ext/wasm/api/pre-js.c-pp.js b88499dc303c21fc3f55f2c364a0f814f587b60a95784303881169f9e91c1d5f
F ext/wasm/api/sqlite3-api-cleanup.js 680d5ccfff54459db136a49b2199d9f879c8405d9c99af1dda0cc5e7c29056f4
F ext/wasm/api/sqlite3-api-glue.js f0651048a2601bf79f7f39c2c855f6417e65548417f5019ac9ac2ffb2463f2b9
F ext/wasm/api/sqlite3-api-oo1.js 06fcaf4007b68b39db20c83b2620d5c04322bcbe2abb9bde7941b191257b6d43
F ext/wasm/api/sqlite3-api-oo1.js 7ae49f6d9dcbc268d6fc9bce6bd070c72884d544bd0c6f12fa682d51027bf4d3
F ext/wasm/api/sqlite3-api-prologue.js 683956ea6ab5e0132db48bb693a6bb9dd92f36c8c0902af36572e9b29006ac6d
F ext/wasm/api/sqlite3-api-worker1.js e94ba98e44afccfa482874cd9acb325883ade50ed1f9f9526beb9de1711f182f
F ext/wasm/api/sqlite3-license-version-header.js a661182fc93fc2cf212dfd0b987f8e138a3ac98f850b1112e29b5fbdaecc87c3
@ -2067,8 +2067,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 96ba44946b3e88b6aa305c4363cbbfeab0d9120b3d8c4d2587d68b9293ea7cc6
R 7ef916e9c75ca3398704313fbddc267b
P 33a58c8ece3b37a8edc3434af36643e2d489a53a672d778c5b77e66666045c30
R d15205afc8348e399a5e2c3665229d17
U stephan
Z c6e787d4dc5ffd60ed702bf77e978ab3
Z 3c00734fbb2a03c4e427540c406cdc55
# Remove this line to create a well-formed Fossil manifest.

View File

@ -1 +1 @@
33a58c8ece3b37a8edc3434af36643e2d489a53a672d778c5b77e66666045c30
0b2df22bd92914708ad0851d0401ad2cf3edb1968b88b2c07fe40792a731c5ba