Fossil SCM

Remove dead/unneeded code

jan.nijtmans 2014-01-04 21:14 UTC sqlite-min-to-3.7.17
Commit 107b959b22f0ea2db1922e769e3ad85782c108b4
1 file changed -46
-46
--- src/db.c
+++ src/db.c
@@ -852,32 +852,10 @@
852852
g.zConfigDbType = "configdb";
853853
}
854854
g.zConfigDbName = zDbName;
855855
}
856856
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
-
879857
/*
880858
** If zDbName is a valid local database file, open it and return
881859
** true. If it is not a valid local database file, return 0.
882860
*/
883861
static int isValidLocalDb(const char *zDbName){
@@ -890,34 +868,10 @@
890868
db_open_or_attach(zDbName, "localdb", 0);
891869
zVFileDef = db_text(0, "SELECT sql FROM %s.sqlite_master"
892870
" WHERE name=='vfile'", db_name("localdb"));
893871
if( zVFileDef==0 ) return 0;
894872
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
- }
919873
return 1;
920874
}
921875
922876
/*
923877
** Locate the root directory of the local repository tree. The root
924878
--- 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

Keyboard Shortcuts

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