-C Sync\sw/trunk
-D 2023-06-29T17:58:51.696
+C Issue\sNK_DbAboutToClose\snotifications\sfor\sany\sshell\sDB\sabout\sto\sbe\sclosed,\swhether\spresently\svisible\sin\sShellExState\sor\snot.
+D 2023-09-02T22:00:48.464
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
F src/resolve.c 37953a5f36c60bea413c3c04efcd433b6177009f508ef2ace0494728912fe2e9
F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97 x
F src/select.c 383b9dba12493c365ee2036bcadd73013b7c0f7d2afcda0c378317c335d60ac2 x
-F src/shell.c.in 3d9053cee4ccb6744e4b18f1f980d037bfebc8a01c162fbc6f35e194858a4ab1
-F src/shext_linkage.h 4a686427844d5d2b71f2095cb032280fb262490795f0710487ebbedb3732f1cb x
+F src/shell.c.in 4528d910b082e4cf251de767cd04bda10f3795d1e2d7f28eb14d5267a6ba969a
+F src/shext_linkage.h f7c8331f6e3c4a53a7bd70d2aa3d28fec9b206638140d804d35fdaaade54496c x
F src/sqlite.h.in 3076d78836b6dac53b3ab0875fc8fd15bca8077aad4d33c85336e05af6aef8c7 x
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
F src/sqlite3ext.h da473ce2b3d0ae407a6300c4a164589b9a6bfdbec9462688a8593ff16f3bb6e4
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P a61f9377014ee582ec469f1066196e07b745295724c6d3ff4baffcaed22ae5a1 24927c1377314a10177da4a57191593440aa97fd0c5949fdf25a22df1d947600 2f9d4444aa503102a00d6e6769dadc57d4b26a2c07f145f23f2f28e0c161246d
-R bd3140ab1e0bb2a93e6d3c105e3f3689
+P fe9aa2e9c17f33a8f6045e9cf755f8251d261c34f89a59d658b72f7c99a6a12c
+R d5f163c7f28125775ba39d501d65bd13
U larrybr
-Z 497f78a875664dfe4baa50f499afe15b
+Z 2b8a61033c96da67076a31e0f7c46650
# Remove this line to create a well-formed Fossil manifest.
** Attempt to close the database connection. Report errors.
** The close is done under mutex protection for globalDb.
*/
-static void close_db(sqlite3 *db){
+static void close_db(ShellInState *psi, sqlite3 *db){
int rc;
+#if SHELL_DYNAMIC_EXTENSION
+ if( db!=0 ) notify_subscribers(psi, NK_DbAboutToClose, db);
+#endif
if( db==globalDb ){
/* This should only block for the time needed to handle ^C interrupt. */
sqlite3_mutex_enter(pGlobalDbLock);
const char *zWhy = (DBX(psx)==0)? "(?)" : sqlite3_errmsg(DBX(psx));
utf8_printf(STD_ERR,"Error: unable to open database \"%s\": %s\n",
zDbFilename, zWhy);
- close_db(DBX(psx));
+ close_db(psi,DBX(psx));
if( bail_on_error && !stdin_is_interactive ){
shell_terminate("-bail used in batch mode.");
}
sqlite3_exec(newDb, "COMMIT;", 0, 0, 0);
// sqlite3_exec(DBX(psx), "PRAGMA writable_schema=OFF;", 0, 0, 0);
}
- close_db(newDb);
+ close_db(ISS(psx),newDb);
}
/*
}
end_ar_command:
if( cmd.db!=DBX(pState) ){
- close_db(cmd.db);
+ close_db(ISS(pState),cmd.db);
}
sqlite3_free(cmd.zSrcTable);
SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE, zVfs);
if( rc!=SQLITE_OK ){
*pzErr = smprintf("cannot open \"%s\"\n", zDestFile);
- close_db(pDest);
+ close_db(ISS(psx),pDest);
return DCR_Error;
}
if( bAsync ){
pBackup = sqlite3_backup_init(pDest, "main", DBX(psx), zDb);
if( pBackup==0 ){
*pzErr = smprintf("%s failed, %s\n", azArg[0], sqlite3_errmsg(pDest));
- close_db(pDest);
+ close_db(ISS(psx),pDest);
return DCR_Error;
}
while( (rc = sqlite3_backup_step(pBackup,100))==SQLITE_OK ){}
*pzErr = smprintf("%s\n", sqlite3_errmsg(pDest));
rc = 1;
}
- close_db(pDest);
+ close_db(ISS(psx),pDest);
return DCR_Ok|rc;
}
#endif /* !defined(SQLITE_SHELL_FIDDLE) */
return DCR_Error;
}else if( psi->aAuxDb[i].db ){
session_close_all(psi, i);
- close_db(psi->aAuxDb[i].db);
+ close_db(psi,psi->aAuxDb[i].db);
psi->aAuxDb[i].db = 0;
}
}else{
/* Close the existing database */
session_close_all(psi, -1);
-#if SHELL_DYNAMIC_EXTENSION
- if( DBX(p)!=0 ) notify_subscribers(psi, NK_DbAboutToClose, DBX(p));
-#endif
- close_db(DBX(p));
+ close_db(psi,DBX(p));
DBX(p) = 0;
psi->pAuxDb->zDbFilename = 0;
sqlite3_free(psi->pAuxDb->zFreeOnClose);
#if SHELL_DYNAMIC_EXTENSION
notify_subscribers(psi, NK_DbAboutToClose, psx->dbUser);
#endif
- close_db(psx->dbUser);
+ close_db(psi,psx->dbUser);
}
for(i=0; i<ArraySize(psi->aAuxDb); i++){
sqlite3_free(psi->aAuxDb[i].zFreeOnClose);
if( psi->aAuxDb[i].db ){
session_close_all(psi, i);
- close_db(psi->aAuxDb[i].db);
+ close_db(psi,psi->aAuxDb[i].db);
}
}
find_home_dir(1);
* pvSubject is the newly set .dbUser value. */
NK_DbUserVanishing, /* Current ShellExState .dbUser will soon vanish,
* pvSubject is the vanishing .dbUser value. */
- NK_DbAboutToClose, /* A possibly ShellExState-visible DB will soon be
- * closed, pvSubject is the DB's sqlite3 pointer. */
+ NK_DbAboutToClose, /* Possibly (or not) ShellExState-visible DB will soon
+ * be closed, pvSubject is the DB's sqlite3 pointer. */
NK_ExtensionUnload, /* The ShellExState .dbShell DB will soon be closed,
* soon to be followed by unloading of all dynamic
* extensions; pvSubject is the DB's sqlite3 pointer. */