Fossil SCM
Remove dead/unneeded code
Commit
107b959b22f0ea2db1922e769e3ad85782c108b4
Parent
c8c564687929e42…
1 file changed
-46
M
src/db.c
-46
| --- src/db.c | ||
| +++ src/db.c | ||
| @@ -852,32 +852,10 @@ | ||
| 852 | 852 | g.zConfigDbType = "configdb"; |
| 853 | 853 | } |
| 854 | 854 | g.zConfigDbName = zDbName; |
| 855 | 855 | } |
| 856 | 856 | |
| 857 | - | |
| 858 | -/* | |
| 859 | -** Returns TRUE if zTable exists in the local database but lacks column | |
| 860 | -** zColumn | |
| 861 | -*/ | |
| 862 | -static int db_local_table_exists_but_lacks_column( | |
| 863 | - const char *zTable, | |
| 864 | - const char *zColumn | |
| 865 | -){ | |
| 866 | - char *zDef = db_text(0, "SELECT sql FROM %s.sqlite_master" | |
| 867 | - " WHERE name=='%s' /*scan*/", | |
| 868 | - db_name("localdb"), zTable); | |
| 869 | - int rc = 0; | |
| 870 | - if( zDef ){ | |
| 871 | - char *zPattern = mprintf("* %s *", zColumn); | |
| 872 | - rc = sqlite3_strglob(zPattern, zDef)==0; | |
| 873 | - fossil_free(zPattern); | |
| 874 | - fossil_free(zDef); | |
| 875 | - } | |
| 876 | - return rc; | |
| 877 | -} | |
| 878 | - | |
| 879 | 857 | /* |
| 880 | 858 | ** If zDbName is a valid local database file, open it and return |
| 881 | 859 | ** true. If it is not a valid local database file, return 0. |
| 882 | 860 | */ |
| 883 | 861 | static int isValidLocalDb(const char *zDbName){ |
| @@ -890,34 +868,10 @@ | ||
| 890 | 868 | db_open_or_attach(zDbName, "localdb", 0); |
| 891 | 869 | zVFileDef = db_text(0, "SELECT sql FROM %s.sqlite_master" |
| 892 | 870 | " WHERE name=='vfile'", db_name("localdb")); |
| 893 | 871 | if( zVFileDef==0 ) return 0; |
| 894 | 872 | |
| 895 | - /* If the "isexe" column is missing from the vfile table, then | |
| 896 | - ** add it now. This code added on 2010-03-06. After all users have | |
| 897 | - ** upgraded, this code can be safely deleted. | |
| 898 | - */ | |
| 899 | - if( !sqlite3_strglob("* isexe *", zVFileDef) ){ | |
| 900 | - db_multi_exec("ALTER TABLE vfile ADD COLUMN isexe BOOLEAN DEFAULT 0"); | |
| 901 | - } | |
| 902 | - | |
| 903 | - /* If "islink"/"isLink" columns are missing from tables, then | |
| 904 | - ** add them now. This code added on 2011-01-17 and 2011-08-27. | |
| 905 | - ** After all users have upgraded, this code can be safely deleted. | |
| 906 | - */ | |
| 907 | - if( !sqlite3_strglob("* islink *", zVFileDef) ){ | |
| 908 | - db_multi_exec("ALTER TABLE vfile ADD COLUMN islink BOOLEAN DEFAULT 0"); | |
| 909 | - if( db_local_table_exists_but_lacks_column("stashfile", "isLink") ){ | |
| 910 | - db_multi_exec("ALTER TABLE stashfile ADD COLUMN isLink BOOL DEFAULT 0"); | |
| 911 | - } | |
| 912 | - if( db_local_table_exists_but_lacks_column("undo", "isLink") ){ | |
| 913 | - db_multi_exec("ALTER TABLE undo ADD COLUMN isLink BOOLEAN DEFAULT 0"); | |
| 914 | - } | |
| 915 | - if( db_local_table_exists_but_lacks_column("undo_vfile", "islink") ){ | |
| 916 | - db_multi_exec("ALTER TABLE undo_vfile ADD COLUMN islink BOOL DEFAULT 0"); | |
| 917 | - } | |
| 918 | - } | |
| 919 | 873 | return 1; |
| 920 | 874 | } |
| 921 | 875 | |
| 922 | 876 | /* |
| 923 | 877 | ** Locate the root directory of the local repository tree. The root |
| 924 | 878 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -852,32 +852,10 @@ | |
| 852 | g.zConfigDbType = "configdb"; |
| 853 | } |
| 854 | g.zConfigDbName = zDbName; |
| 855 | } |
| 856 | |
| 857 | |
| 858 | /* |
| 859 | ** Returns TRUE if zTable exists in the local database but lacks column |
| 860 | ** zColumn |
| 861 | */ |
| 862 | static int db_local_table_exists_but_lacks_column( |
| 863 | const char *zTable, |
| 864 | const char *zColumn |
| 865 | ){ |
| 866 | char *zDef = db_text(0, "SELECT sql FROM %s.sqlite_master" |
| 867 | " WHERE name=='%s' /*scan*/", |
| 868 | db_name("localdb"), zTable); |
| 869 | int rc = 0; |
| 870 | if( zDef ){ |
| 871 | char *zPattern = mprintf("* %s *", zColumn); |
| 872 | rc = sqlite3_strglob(zPattern, zDef)==0; |
| 873 | fossil_free(zPattern); |
| 874 | fossil_free(zDef); |
| 875 | } |
| 876 | return rc; |
| 877 | } |
| 878 | |
| 879 | /* |
| 880 | ** If zDbName is a valid local database file, open it and return |
| 881 | ** true. If it is not a valid local database file, return 0. |
| 882 | */ |
| 883 | static int isValidLocalDb(const char *zDbName){ |
| @@ -890,34 +868,10 @@ | |
| 890 | db_open_or_attach(zDbName, "localdb", 0); |
| 891 | zVFileDef = db_text(0, "SELECT sql FROM %s.sqlite_master" |
| 892 | " WHERE name=='vfile'", db_name("localdb")); |
| 893 | if( zVFileDef==0 ) return 0; |
| 894 | |
| 895 | /* If the "isexe" column is missing from the vfile table, then |
| 896 | ** add it now. This code added on 2010-03-06. After all users have |
| 897 | ** upgraded, this code can be safely deleted. |
| 898 | */ |
| 899 | if( !sqlite3_strglob("* isexe *", zVFileDef) ){ |
| 900 | db_multi_exec("ALTER TABLE vfile ADD COLUMN isexe BOOLEAN DEFAULT 0"); |
| 901 | } |
| 902 | |
| 903 | /* If "islink"/"isLink" columns are missing from tables, then |
| 904 | ** add them now. This code added on 2011-01-17 and 2011-08-27. |
| 905 | ** After all users have upgraded, this code can be safely deleted. |
| 906 | */ |
| 907 | if( !sqlite3_strglob("* islink *", zVFileDef) ){ |
| 908 | db_multi_exec("ALTER TABLE vfile ADD COLUMN islink BOOLEAN DEFAULT 0"); |
| 909 | if( db_local_table_exists_but_lacks_column("stashfile", "isLink") ){ |
| 910 | db_multi_exec("ALTER TABLE stashfile ADD COLUMN isLink BOOL DEFAULT 0"); |
| 911 | } |
| 912 | if( db_local_table_exists_but_lacks_column("undo", "isLink") ){ |
| 913 | db_multi_exec("ALTER TABLE undo ADD COLUMN isLink BOOLEAN DEFAULT 0"); |
| 914 | } |
| 915 | if( db_local_table_exists_but_lacks_column("undo_vfile", "islink") ){ |
| 916 | db_multi_exec("ALTER TABLE undo_vfile ADD COLUMN islink BOOL DEFAULT 0"); |
| 917 | } |
| 918 | } |
| 919 | return 1; |
| 920 | } |
| 921 | |
| 922 | /* |
| 923 | ** Locate the root directory of the local repository tree. The root |
| 924 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -852,32 +852,10 @@ | |
| 852 | g.zConfigDbType = "configdb"; |
| 853 | } |
| 854 | g.zConfigDbName = zDbName; |
| 855 | } |
| 856 | |
| 857 | /* |
| 858 | ** If zDbName is a valid local database file, open it and return |
| 859 | ** true. If it is not a valid local database file, return 0. |
| 860 | */ |
| 861 | static int isValidLocalDb(const char *zDbName){ |
| @@ -890,34 +868,10 @@ | |
| 868 | db_open_or_attach(zDbName, "localdb", 0); |
| 869 | zVFileDef = db_text(0, "SELECT sql FROM %s.sqlite_master" |
| 870 | " WHERE name=='vfile'", db_name("localdb")); |
| 871 | if( zVFileDef==0 ) return 0; |
| 872 | |
| 873 | return 1; |
| 874 | } |
| 875 | |
| 876 | /* |
| 877 | ** Locate the root directory of the local repository tree. The root |
| 878 |