Fossil SCM

Provide a compile-time option to open the check-out database file (.fslckout or _FOSSIL_) in WAL mode. Also shorten source code lines to 80 characters in db.c.

drh 2013-02-21 22:21 trunk
Commit 8c35f07d062fe81770617021974459514ba938fb
1 file changed +15 -5
+15 -5
--- src/db.c
+++ src/db.c
@@ -1771,11 +1771,12 @@
17711771
db_swap_connections();
17721772
z = db_text(0, "SELECT value FROM global_config WHERE name=%Q", zName);
17731773
db_swap_connections();
17741774
}
17751775
if( ctrlSetting!=0 && ctrlSetting->versionable && g.localOpen ){
1776
- /* This is a versionable setting, try and get the info from a checked out file */
1776
+ /* This is a versionable setting, try and get the info from a
1777
+ ** checked out file */
17771778
z = db_get_do_versionable(zName, z);
17781779
}
17791780
if( z==0 ){
17801781
z = zDefault;
17811782
}
@@ -1984,11 +1985,15 @@
19841985
#if defined(_WIN32)
19851986
# define LOCALDB_NAME "./_FOSSIL_"
19861987
#else
19871988
# define LOCALDB_NAME "./.fslckout"
19881989
#endif
1989
- db_init_database(LOCALDB_NAME, zLocalSchema, (char*)0);
1990
+ db_init_database(LOCALDB_NAME, zLocalSchema,
1991
+#ifdef FOSSIL_LOCAL_WAL
1992
+ "COMMIT; PRAGMA journal_mode=WAL; BEGIN;",
1993
+#endif
1994
+ (char*)0);
19901995
db_delete_on_failure(LOCALDB_NAME);
19911996
db_open_local();
19921997
db_lset("repository", g.argv[2]);
19931998
db_record_repository_filename(blob_str(&path));
19941999
vid = db_int(0, "SELECT pid FROM plink y"
@@ -2017,11 +2022,14 @@
20172022
}
20182023
20192024
/*
20202025
** Print the value of a setting named zName
20212026
*/
2022
-static void print_setting(const struct stControlSettings *ctrlSetting, int localOpen){
2027
+static void print_setting(
2028
+ const struct stControlSettings *ctrlSetting,
2029
+ int localOpen
2030
+){
20232031
Stmt q;
20242032
if( g.repositoryOpen ){
20252033
db_prepare(&q,
20262034
"SELECT '(local)', value FROM config WHERE name=%Q"
20272035
" UNION ALL "
@@ -2042,13 +2050,15 @@
20422050
}
20432051
if( ctrlSetting->versionable && localOpen ){
20442052
/* Check to see if this is overridden by a versionable settings file */
20452053
Blob versionedPathname;
20462054
blob_zero(&versionedPathname);
2047
- blob_appendf(&versionedPathname, "%s/.fossil-settings/%s", g.zLocalRoot, ctrlSetting->name);
2055
+ blob_appendf(&versionedPathname, "%s/.fossil-settings/%s",
2056
+ g.zLocalRoot, ctrlSetting->name);
20482057
if( file_size(blob_str(&versionedPathname))>=0 ){
2049
- fossil_print(" (overridden by contents of file .fossil-settings/%s)\n", ctrlSetting->name);
2058
+ fossil_print(" (overridden by contents of file .fossil-settings/%s)\n",
2059
+ ctrlSetting->name);
20502060
}
20512061
}
20522062
db_finalize(&q);
20532063
}
20542064
20552065
--- src/db.c
+++ src/db.c
@@ -1771,11 +1771,12 @@
1771 db_swap_connections();
1772 z = db_text(0, "SELECT value FROM global_config WHERE name=%Q", zName);
1773 db_swap_connections();
1774 }
1775 if( ctrlSetting!=0 && ctrlSetting->versionable && g.localOpen ){
1776 /* This is a versionable setting, try and get the info from a checked out file */
 
1777 z = db_get_do_versionable(zName, z);
1778 }
1779 if( z==0 ){
1780 z = zDefault;
1781 }
@@ -1984,11 +1985,15 @@
1984 #if defined(_WIN32)
1985 # define LOCALDB_NAME "./_FOSSIL_"
1986 #else
1987 # define LOCALDB_NAME "./.fslckout"
1988 #endif
1989 db_init_database(LOCALDB_NAME, zLocalSchema, (char*)0);
 
 
 
 
1990 db_delete_on_failure(LOCALDB_NAME);
1991 db_open_local();
1992 db_lset("repository", g.argv[2]);
1993 db_record_repository_filename(blob_str(&path));
1994 vid = db_int(0, "SELECT pid FROM plink y"
@@ -2017,11 +2022,14 @@
2017 }
2018
2019 /*
2020 ** Print the value of a setting named zName
2021 */
2022 static void print_setting(const struct stControlSettings *ctrlSetting, int localOpen){
 
 
 
2023 Stmt q;
2024 if( g.repositoryOpen ){
2025 db_prepare(&q,
2026 "SELECT '(local)', value FROM config WHERE name=%Q"
2027 " UNION ALL "
@@ -2042,13 +2050,15 @@
2042 }
2043 if( ctrlSetting->versionable && localOpen ){
2044 /* Check to see if this is overridden by a versionable settings file */
2045 Blob versionedPathname;
2046 blob_zero(&versionedPathname);
2047 blob_appendf(&versionedPathname, "%s/.fossil-settings/%s", g.zLocalRoot, ctrlSetting->name);
 
2048 if( file_size(blob_str(&versionedPathname))>=0 ){
2049 fossil_print(" (overridden by contents of file .fossil-settings/%s)\n", ctrlSetting->name);
 
2050 }
2051 }
2052 db_finalize(&q);
2053 }
2054
2055
--- src/db.c
+++ src/db.c
@@ -1771,11 +1771,12 @@
1771 db_swap_connections();
1772 z = db_text(0, "SELECT value FROM global_config WHERE name=%Q", zName);
1773 db_swap_connections();
1774 }
1775 if( ctrlSetting!=0 && ctrlSetting->versionable && g.localOpen ){
1776 /* This is a versionable setting, try and get the info from a
1777 ** checked out file */
1778 z = db_get_do_versionable(zName, z);
1779 }
1780 if( z==0 ){
1781 z = zDefault;
1782 }
@@ -1984,11 +1985,15 @@
1985 #if defined(_WIN32)
1986 # define LOCALDB_NAME "./_FOSSIL_"
1987 #else
1988 # define LOCALDB_NAME "./.fslckout"
1989 #endif
1990 db_init_database(LOCALDB_NAME, zLocalSchema,
1991 #ifdef FOSSIL_LOCAL_WAL
1992 "COMMIT; PRAGMA journal_mode=WAL; BEGIN;",
1993 #endif
1994 (char*)0);
1995 db_delete_on_failure(LOCALDB_NAME);
1996 db_open_local();
1997 db_lset("repository", g.argv[2]);
1998 db_record_repository_filename(blob_str(&path));
1999 vid = db_int(0, "SELECT pid FROM plink y"
@@ -2017,11 +2022,14 @@
2022 }
2023
2024 /*
2025 ** Print the value of a setting named zName
2026 */
2027 static void print_setting(
2028 const struct stControlSettings *ctrlSetting,
2029 int localOpen
2030 ){
2031 Stmt q;
2032 if( g.repositoryOpen ){
2033 db_prepare(&q,
2034 "SELECT '(local)', value FROM config WHERE name=%Q"
2035 " UNION ALL "
@@ -2042,13 +2050,15 @@
2050 }
2051 if( ctrlSetting->versionable && localOpen ){
2052 /* Check to see if this is overridden by a versionable settings file */
2053 Blob versionedPathname;
2054 blob_zero(&versionedPathname);
2055 blob_appendf(&versionedPathname, "%s/.fossil-settings/%s",
2056 g.zLocalRoot, ctrlSetting->name);
2057 if( file_size(blob_str(&versionedPathname))>=0 ){
2058 fossil_print(" (overridden by contents of file .fossil-settings/%s)\n",
2059 ctrlSetting->name);
2060 }
2061 }
2062 db_finalize(&q);
2063 }
2064
2065

Keyboard Shortcuts

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