Fossil

Check-in [2de9e876]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Avoid using invalid SQL when checking to see if the vfile table needs to have the islink column added.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | symlinks
Files: files | file ages | folders
SHA1: 2de9e87600d6a447ee44969410ff5eef0aabd76d
User & Date: drh 2011-08-23 16:50:37
Context
2011-08-23
17:44
Fill islink field in vfile table when adding files. Support symlinks in export. Make manifest_file_perm() return 2 for symlinks. Add file_perm() function, and use it instead of file_isexe() when we need both isexe and islink properties. check-in: 4619361d user: dmitry tags: symlinks
16:50
Avoid using invalid SQL when checking to see if the vfile table needs to have the islink column added. check-in: 2de9e876 user: drh tags: symlinks
15:27
Merge in the latest changes from trunk. check-in: 6c880a4f user: drh tags: symlinks
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/db.c.

755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774

775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
  db_open_config(0);
  db_open_repository(0);

  /* If the "isexe" column is missing from the vfile table, then
  ** add it now.   This code added on 2010-03-06.  After all users have
  ** upgraded, this code can be safely deleted. 
  */
  rc = sqlite3_prepare(g.db, "SELECT isexe FROM vfile", -1, &pStmt, 0);
  nPrepare++;
  sqlite3_finalize(pStmt);
  if( rc==SQLITE_ERROR ){
    sqlite3_exec(g.db, "ALTER TABLE vfile ADD COLUMN isexe BOOLEAN", 0, 0, 0);
  }

  /* If the "islink" column is missing from the vfile table, then
  ** add it now.   This code added on 2011-01-17.  After all users have
  ** upgraded, this code can be safely deleted. 
  */
  rc = sqlite3_prepare(g.db, "SELECT islink FROM vfile", -1, &pStmt, 0);
  sqlite3_finalize(pStmt);

  if( rc==SQLITE_ERROR ){
    sqlite3_exec(g.db, "ALTER TABLE vfile ADD COLUMN islink BOOLEAN", 0, 0, 0);
  }

#if 0  
  /* If the "isLink" column is missing from the stashfile table, then
  ** add it now.   This code added on 2011-01-18.  After all users have
  ** upgraded, this code can be safely deleted. 
  **
  ** Table stashfile may not exist at all. We don't handle this case,
  ** and leave it to sqlite.
  */
  rc = sqlite3_prepare(g.db, "SELECT isLink FROM stashfile", -1, &pStmt, 0);
  sqlite3_finalize(pStmt);
  /* NOTE: this prints "SQLITE_ERROR: no such column: isLink" for some reason */
  if( rc==SQLITE_ERROR ){
    sqlite3_exec(g.db, "ALTER TABLE stashfile ADD COLUMN isLink BOOLEAN", 0, 0, 0);
  }
#endif

#if 0
  /* If the "mtime" column is missing from the vfile table, then
  ** add it now.   This code added on 2008-12-06.  After all users have
  ** upgraded, this code can be safely deleted. 
  */
  rc = sqlite3_prepare(g.db, "SELECT mtime FROM vfile", -1, &pStmt, 0);
  sqlite3_finalize(pStmt);
  if( rc==SQLITE_ERROR ){
    sqlite3_exec(g.db, "ALTER TABLE vfile ADD COLUMN mtime INTEGER", 0, 0, 0);
  }
#endif

#if 0
  /* If the "origname" column is missing from the vfile table, then
  ** add it now.   This code added on 2008-11-09.  After all users have
  ** upgraded, this code can be safely deleted. 
  */
  rc = sqlite3_prepare(g.db, "SELECT origname FROM vfile", -1, &pStmt, 0);
  sqlite3_finalize(pStmt);
  if( rc==SQLITE_ERROR ){
    sqlite3_exec(g.db, "ALTER TABLE vfile ADD COLUMN origname TEXT", 0, 0, 0);
  }
#endif

  return 1;
}

/*
** Locate the root directory of the local repository tree.  The root
** directory is found by searching for a file named "_FOSSIL_" or ".fos"
** that contains a valid repository database.







|
|
|
|
|






|
|
>
|
|


<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779








































780
781
782
783
784
785
786
  db_open_config(0);
  db_open_repository(0);

  /* If the "isexe" column is missing from the vfile table, then
  ** add it now.   This code added on 2010-03-06.  After all users have
  ** upgraded, this code can be safely deleted. 
  */
  rc = db_exists("SELECT 1 FROM %s.sqlite_master"
                 " WHERE name=='vfile' AND sql GLOB '* isexe *'",
                 db_name("localdb"));
  if( rc==0 ){
    db_multi_exec("ALTER TABLE vfile ADD COLUMN isexe BOOLEAN DEFAULT 0");
  }

  /* If the "islink" column is missing from the vfile table, then
  ** add it now.   This code added on 2011-01-17.  After all users have
  ** upgraded, this code can be safely deleted. 
  */
  rc = db_exists("SELECT 1 FROM %s.sqlite_master"
                 " WHERE name=='vfile' AND sql GLOB '* islink *'",
                 db_name("localdb"));
  if( rc==0 ){
    db_multi_exec("ALTER TABLE vfile ADD COLUMN islink BOOLEAN DEFAULT 0");
  }









































  return 1;
}

/*
** Locate the root directory of the local repository tree.  The root
** directory is found by searching for a file named "_FOSSIL_" or ".fos"
** that contains a valid repository database.