Fossil SCM

When db_open_config() is called with the useAttach parameter set to non-zero, it may need to close and reopen the database using ATTACH if that was not done previously.

drh 2012-11-20 20:31 trunk merge
Commit fb04f278294a8ca6f40425d5a0681c41e4c25169
1 file changed +9 -1
+9 -1
--- src/db.c
+++ src/db.c
@@ -765,11 +765,19 @@
765765
** case, invoke this routine with useAttach as 1.
766766
*/
767767
void db_open_config(int useAttach){
768768
char *zDbName;
769769
const char *zHome;
770
- if( g.configOpen ) return;
770
+ if( g.configOpen ){
771
+ if( useAttach==g.useAttach ) return;
772
+ if( g.useAttach ){
773
+ db_detach("configdb");
774
+ }else if( g.dbConfig ){
775
+ sqlite3_close(g.dbConfig);
776
+ g.dbConfig = 0;
777
+ }
778
+ }
771779
#if defined(_WIN32)
772780
zHome = fossil_getenv("LOCALAPPDATA");
773781
if( zHome==0 ){
774782
zHome = fossil_getenv("APPDATA");
775783
if( zHome==0 ){
776784
--- src/db.c
+++ src/db.c
@@ -765,11 +765,19 @@
765 ** case, invoke this routine with useAttach as 1.
766 */
767 void db_open_config(int useAttach){
768 char *zDbName;
769 const char *zHome;
770 if( g.configOpen ) return;
 
 
 
 
 
 
 
 
771 #if defined(_WIN32)
772 zHome = fossil_getenv("LOCALAPPDATA");
773 if( zHome==0 ){
774 zHome = fossil_getenv("APPDATA");
775 if( zHome==0 ){
776
--- src/db.c
+++ src/db.c
@@ -765,11 +765,19 @@
765 ** case, invoke this routine with useAttach as 1.
766 */
767 void db_open_config(int useAttach){
768 char *zDbName;
769 const char *zHome;
770 if( g.configOpen ){
771 if( useAttach==g.useAttach ) return;
772 if( g.useAttach ){
773 db_detach("configdb");
774 }else if( g.dbConfig ){
775 sqlite3_close(g.dbConfig);
776 g.dbConfig = 0;
777 }
778 }
779 #if defined(_WIN32)
780 zHome = fossil_getenv("LOCALAPPDATA");
781 if( zHome==0 ){
782 zHome = fossil_getenv("APPDATA");
783 if( zHome==0 ){
784

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button