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.
Commit
8c35f07d062fe81770617021974459514ba938fb
Parent
43988bc490beb71…
1 file changed
+15
-5
M
src/db.c
+15
-5
| --- src/db.c | ||
| +++ src/db.c | ||
| @@ -1771,11 +1771,12 @@ | ||
| 1771 | 1771 | db_swap_connections(); |
| 1772 | 1772 | z = db_text(0, "SELECT value FROM global_config WHERE name=%Q", zName); |
| 1773 | 1773 | db_swap_connections(); |
| 1774 | 1774 | } |
| 1775 | 1775 | 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 */ | |
| 1777 | 1778 | z = db_get_do_versionable(zName, z); |
| 1778 | 1779 | } |
| 1779 | 1780 | if( z==0 ){ |
| 1780 | 1781 | z = zDefault; |
| 1781 | 1782 | } |
| @@ -1984,11 +1985,15 @@ | ||
| 1984 | 1985 | #if defined(_WIN32) |
| 1985 | 1986 | # define LOCALDB_NAME "./_FOSSIL_" |
| 1986 | 1987 | #else |
| 1987 | 1988 | # define LOCALDB_NAME "./.fslckout" |
| 1988 | 1989 | #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); | |
| 1990 | 1995 | db_delete_on_failure(LOCALDB_NAME); |
| 1991 | 1996 | db_open_local(); |
| 1992 | 1997 | db_lset("repository", g.argv[2]); |
| 1993 | 1998 | db_record_repository_filename(blob_str(&path)); |
| 1994 | 1999 | vid = db_int(0, "SELECT pid FROM plink y" |
| @@ -2017,11 +2022,14 @@ | ||
| 2017 | 2022 | } |
| 2018 | 2023 | |
| 2019 | 2024 | /* |
| 2020 | 2025 | ** Print the value of a setting named zName |
| 2021 | 2026 | */ |
| 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 | +){ | |
| 2023 | 2031 | Stmt q; |
| 2024 | 2032 | if( g.repositoryOpen ){ |
| 2025 | 2033 | db_prepare(&q, |
| 2026 | 2034 | "SELECT '(local)', value FROM config WHERE name=%Q" |
| 2027 | 2035 | " UNION ALL " |
| @@ -2042,13 +2050,15 @@ | ||
| 2042 | 2050 | } |
| 2043 | 2051 | if( ctrlSetting->versionable && localOpen ){ |
| 2044 | 2052 | /* Check to see if this is overridden by a versionable settings file */ |
| 2045 | 2053 | Blob versionedPathname; |
| 2046 | 2054 | 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); | |
| 2048 | 2057 | 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); | |
| 2050 | 2060 | } |
| 2051 | 2061 | } |
| 2052 | 2062 | db_finalize(&q); |
| 2053 | 2063 | } |
| 2054 | 2064 | |
| 2055 | 2065 |
| --- 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 |