Fossil

Check-in [5acf6171]
Login

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

Overview
Comment:Add software version information and database stats to the /stat page.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 5acf617104131086d9120b8943dff1f5cdec64dd
User & Date: drh 2010-07-06 21:22:43
Context
2010-07-07
14:57
Update the built-in SQLite to the latest 3.7.0 beta snapshot that includes fixes for large databases in WAL mode. check-in: f0cd78c1 user: drh tags: trunk
2010-07-06
21:22
Add software version information and database stats to the /stat page. check-in: 5acf6171 user: drh tags: trunk
20:51
Update the built-in SQLite to the latest beta of version 3.7.0. check-in: 8733f07f user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/db.c.

608
609
610
611
612
613
614

615
616
617
618
619
620

621
622
623
624
625
626
627
** zDbName is the name of a database file.  If no other database
** file is open, then open this one.  If another database file is
** already open, then attach zDbName using the name zLabel.
*/
void db_open_or_attach(const char *zDbName, const char *zLabel){
  if( !g.db ){
    g.db = openDatabase(zDbName);

    db_connection_init();
  }else{
#ifdef __MINGW32__
    zDbName = sqlite3_win32_mbcs_to_utf8(zDbName);
#endif
    db_multi_exec("ATTACH DATABASE %Q AS %s", zDbName, zLabel);

  }
}

/*
** Open the user database in "~/.fossil".  Create the database anew if
** it does not already exist.
**







>






>







608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
** zDbName is the name of a database file.  If no other database
** file is open, then open this one.  If another database file is
** already open, then attach zDbName using the name zLabel.
*/
void db_open_or_attach(const char *zDbName, const char *zLabel){
  if( !g.db ){
    g.db = openDatabase(zDbName);
    g.zRepoDb = "main";
    db_connection_init();
  }else{
#ifdef __MINGW32__
    zDbName = sqlite3_win32_mbcs_to_utf8(zDbName);
#endif
    db_multi_exec("ATTACH DATABASE %Q AS %s", zDbName, zLabel);
    g.zRepoDb = mprintf("%s", zLabel);
  }
}

/*
** Open the user database in "~/.fossil".  Create the database anew if
** it does not already exist.
**

Changes to src/main.c.

53
54
55
56
57
58
59

60
61
62
63
64
65
66
  sqlite3 *db;            /* The connection to the databases */
  sqlite3 *dbConfig;      /* Separate connection for global_config table */
  int useAttach;          /* True if global_config is attached to repository */
  int configOpen;         /* True if the config database is open */
  long long int now;      /* Seconds since 1970 */
  int repositoryOpen;     /* True if the main repository database is open */
  char *zRepositoryName;  /* Name of the repository database */

  const char *zHome;      /* Name of user home directory */
  int localOpen;          /* True if the local database is open */
  char *zLocalRoot;       /* The directory holding the  local database */
  int minPrefix;          /* Number of digits needed for a distinct UUID */
  int fSqlTrace;          /* True if -sqltrace flag is present */
  int fSqlPrint;          /* True if -sqlprint flag is present */
  int fQuiet;             /* True if -quiet flag is present */







>







53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
  sqlite3 *db;            /* The connection to the databases */
  sqlite3 *dbConfig;      /* Separate connection for global_config table */
  int useAttach;          /* True if global_config is attached to repository */
  int configOpen;         /* True if the config database is open */
  long long int now;      /* Seconds since 1970 */
  int repositoryOpen;     /* True if the main repository database is open */
  char *zRepositoryName;  /* Name of the repository database */
  char *zRepoDb;          /* SQLite database name for the repository */
  const char *zHome;      /* Name of user home directory */
  int localOpen;          /* True if the local database is open */
  char *zLocalRoot;       /* The directory holding the  local database */
  int minPrefix;          /* Number of digits needed for a distinct UUID */
  int fSqlTrace;          /* True if -sqltrace flag is present */
  int fSqlPrint;          /* True if -sqlprint flag is present */
  int fQuiet;             /* True if -quiet flag is present */

Changes to src/stat.c.

59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74

75
76
77
78

79
80
81
82

83
84
85
86
87
88
89
90
















91
92
93
      b = 1;
    }
    a = t/fsize;
    @ %d(a):%d(b)
    @ </td></tr>
  }
  @ <tr><th>Number&nbsp;Of&nbsp;Check-ins:</th><td>
  n = db_int(0, "SELECT count(distinct mid) FROM mlink");
  @ %d(n)
  @ </td></tr>
  @ <tr><th>Number&nbsp;Of&nbsp;Files:</th><td>
  n = db_int(0, "SELECT count(*) FROM filename");
  @ %d(n)
  @ </td></tr>
  @ <tr><th>Number&nbsp;Of&nbsp;Wiki&nbsp;Pages:</th><td>
  n = db_int(0, "SELECT count(*) FROM tag WHERE +tagname GLOB 'wiki-*'");

  @ %d(n)
  @ </td></tr>
  @ <tr><th>Number&nbsp;Of&nbsp;Tickets:</th><td>
  n = db_int(0, "SELECT count(*) FROM tag WHERE +tagname GLOB 'tkt-*'");

  @ %d(n)
  @ </td></tr>
  @ <tr><th>Duration&nbsp;Of&nbsp;Project:</th><td>
  n = db_int(0, "SELECT julianday('now') - (SELECT min(mtime) FROM event) + 0.99");

  @ %d(n) days
  @ </td></tr>
  @ <tr><th>Project&nbsp;ID:</th><td>
  @ %h(db_get("project-code",""))
  @ </td></tr>
  @ <tr><th>Server&nbsp;ID:</th><td>
  @ %h(db_get("server-code",""))
  @ </td></tr>
















  @ </table></p>
  style_footer();
}







|



|



|
>



|
>



|
>








>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
      b = 1;
    }
    a = t/fsize;
    @ %d(a):%d(b)
    @ </td></tr>
  }
  @ <tr><th>Number&nbsp;Of&nbsp;Check-ins:</th><td>
  n = db_int(0, "SELECT count(distinct mid) FROM mlink /*scan*/");
  @ %d(n)
  @ </td></tr>
  @ <tr><th>Number&nbsp;Of&nbsp;Files:</th><td>
  n = db_int(0, "SELECT count(*) FROM filename /*scan*/");
  @ %d(n)
  @ </td></tr>
  @ <tr><th>Number&nbsp;Of&nbsp;Wiki&nbsp;Pages:</th><td>
  n = db_int(0, "SELECT count(*) FROM tag  /*scan*/"
                " WHERE +tagname GLOB 'wiki-*'");
  @ %d(n)
  @ </td></tr>
  @ <tr><th>Number&nbsp;Of&nbsp;Tickets:</th><td>
  n = db_int(0, "SELECT count(*) FROM tag  /*scan*/"
                " WHERE +tagname GLOB 'tkt-*'");
  @ %d(n)
  @ </td></tr>
  @ <tr><th>Duration&nbsp;Of&nbsp;Project:</th><td>
  n = db_int(0, "SELECT julianday('now') - (SELECT min(mtime) FROM event)"
                " + 0.99");
  @ %d(n) days
  @ </td></tr>
  @ <tr><th>Project&nbsp;ID:</th><td>
  @ %h(db_get("project-code",""))
  @ </td></tr>
  @ <tr><th>Server&nbsp;ID:</th><td>
  @ %h(db_get("server-code",""))
  @ </td></tr>

  @ <tr><th>Fossil&nbsp;Version:</th><td>
  @ %h(MANIFEST_DATE) %h(MANIFEST_VERSION)
  @ </td></tr>
  @ <tr><th>SQLite&nbsp;Version:</th><td>
  @ %h(db_text(0, "SELECT substr(sqlite_source_id(),1,30)"))
  @ (%h(SQLITE_VERSION))
  @ </td></tr>
  @ <tr><th>Database&nbsp;Stats:</th><td>
  @ %d(db_int(0, "PRAGMA %s.page_count", g.zRepoDb)) pages,
  @ %d(db_int(0, "PRAGMA %s.page_size", g.zRepoDb)) bytes/page,
  @ %d(db_int(0, "PRAGMA %s.freelist_count", g.zRepoDb)) free pages,
  @ %s(db_text(0, "PRAGMA %s.encoding", g.zRepoDb)),
  @ %s(db_text(0, "PRAGMA %s.journal_mode", g.zRepoDb)) mode
  @ </td></tr>

  @ </table></p>
  style_footer();
}