Fossil SCM

Add the --db-check option to the "fossil dbstat" command.

drh 2014-10-14 17:57 trunk
Commit d4e3f4c33d4904fdea32a40218cd003b0839e081
2 files changed +1 +11 -5
--- src/allrepo.c
+++ src/allrepo.c
@@ -197,10 +197,11 @@
197197
}else if( strncmp(zCmd, "dbstat", n)==0 ){
198198
zCmd = "dbstat --omit-version-info -R";
199199
showLabel = 1;
200200
quiet = 1;
201201
collect_argument(&extra, "brief", "b");
202
+ collect_argument(&extra, "db-check", 0);
202203
}else if( strncmp(zCmd, "extras", n)==0 ){
203204
if( showFile ){
204205
zCmd = "extras --chdir";
205206
}else{
206207
zCmd = "extras --header --chdir";
207208
--- src/allrepo.c
+++ src/allrepo.c
@@ -197,10 +197,11 @@
197 }else if( strncmp(zCmd, "dbstat", n)==0 ){
198 zCmd = "dbstat --omit-version-info -R";
199 showLabel = 1;
200 quiet = 1;
201 collect_argument(&extra, "brief", "b");
 
202 }else if( strncmp(zCmd, "extras", n)==0 ){
203 if( showFile ){
204 zCmd = "extras --chdir";
205 }else{
206 zCmd = "extras --header --chdir";
207
--- src/allrepo.c
+++ src/allrepo.c
@@ -197,10 +197,11 @@
197 }else if( strncmp(zCmd, "dbstat", n)==0 ){
198 zCmd = "dbstat --omit-version-info -R";
199 showLabel = 1;
200 quiet = 1;
201 collect_argument(&extra, "brief", "b");
202 collect_argument(&extra, "db-check", 0);
203 }else if( strncmp(zCmd, "extras", n)==0 ){
204 if( showFile ){
205 zCmd = "extras --chdir";
206 }else{
207 zCmd = "extras --header --chdir";
208
+11 -5
--- src/stat.c
+++ src/stat.c
@@ -151,32 +151,35 @@
151151
}
152152
153153
/*
154154
** COMMAND: dbstat*
155155
**
156
-** Usage: %fossil dbstat ?-brief | -b?
156
+** Usage: %fossil dbstat OPTIONS
157157
**
158158
** Shows statistics and global information about the repository.
159159
**
160
-** The (-brief|-b) option removes any "long-running" statistics, namely
161
-** those whose calculations are known to slow down as the repository
162
-** grows.
160
+** Options:
163161
**
162
+** --brief|-b Only show essential elements
163
+** --db-check Run a PRAGMA quick_check on the repository database
164
+** --omit-version-info Omit the SQLite and Fossil version information
164165
*/
165166
void dbstat_cmd(void){
166167
i64 t, fsize;
167168
int n, m;
168169
int szMax, szAvg;
169170
const char *zDb;
170171
int brief;
171172
int omitVers; /* Omit Fossil and SQLite version information */
173
+ int dbCheck; /* True for the --db-check option */
172174
char zBuf[100];
173175
const int colWidth = -19 /* printf alignment/width for left column */;
174176
const char *p, *z;
175177
176178
brief = find_option("brief", "b",0)!=0;
177179
omitVers = find_option("omit-version-info", 0, 0)!=0;
180
+ dbCheck = find_option("db-check",0,0)!=0;
178181
db_find_and_open_repository(0,0);
179182
180183
/* We should be done with options.. */
181184
verify_all_options();
182185
@@ -269,11 +272,14 @@
269272
db_int(0, "PRAGMA %s.page_count", zDb),
270273
db_int(0, "PRAGMA %s.page_size", zDb),
271274
db_int(0, "PRAGMA %s.freelist_count", zDb),
272275
db_text(0, "PRAGMA %s.encoding", zDb),
273276
db_text(0, "PRAGMA %s.journal_mode", zDb));
274
-
277
+ if( dbCheck ){
278
+ fossil_print("%*s%s\n", colWidth, "database-check:",
279
+ db_text(0, "PRAGMA quick_check(1)"));
280
+ }
275281
}
276282
277283
/*
278284
** WEBPAGE: urllist
279285
**
280286
--- src/stat.c
+++ src/stat.c
@@ -151,32 +151,35 @@
151 }
152
153 /*
154 ** COMMAND: dbstat*
155 **
156 ** Usage: %fossil dbstat ?-brief | -b?
157 **
158 ** Shows statistics and global information about the repository.
159 **
160 ** The (-brief|-b) option removes any "long-running" statistics, namely
161 ** those whose calculations are known to slow down as the repository
162 ** grows.
163 **
 
 
 
164 */
165 void dbstat_cmd(void){
166 i64 t, fsize;
167 int n, m;
168 int szMax, szAvg;
169 const char *zDb;
170 int brief;
171 int omitVers; /* Omit Fossil and SQLite version information */
 
172 char zBuf[100];
173 const int colWidth = -19 /* printf alignment/width for left column */;
174 const char *p, *z;
175
176 brief = find_option("brief", "b",0)!=0;
177 omitVers = find_option("omit-version-info", 0, 0)!=0;
 
178 db_find_and_open_repository(0,0);
179
180 /* We should be done with options.. */
181 verify_all_options();
182
@@ -269,11 +272,14 @@
269 db_int(0, "PRAGMA %s.page_count", zDb),
270 db_int(0, "PRAGMA %s.page_size", zDb),
271 db_int(0, "PRAGMA %s.freelist_count", zDb),
272 db_text(0, "PRAGMA %s.encoding", zDb),
273 db_text(0, "PRAGMA %s.journal_mode", zDb));
274
 
 
 
275 }
276
277 /*
278 ** WEBPAGE: urllist
279 **
280
--- src/stat.c
+++ src/stat.c
@@ -151,32 +151,35 @@
151 }
152
153 /*
154 ** COMMAND: dbstat*
155 **
156 ** Usage: %fossil dbstat OPTIONS
157 **
158 ** Shows statistics and global information about the repository.
159 **
160 ** Options:
 
 
161 **
162 ** --brief|-b Only show essential elements
163 ** --db-check Run a PRAGMA quick_check on the repository database
164 ** --omit-version-info Omit the SQLite and Fossil version information
165 */
166 void dbstat_cmd(void){
167 i64 t, fsize;
168 int n, m;
169 int szMax, szAvg;
170 const char *zDb;
171 int brief;
172 int omitVers; /* Omit Fossil and SQLite version information */
173 int dbCheck; /* True for the --db-check option */
174 char zBuf[100];
175 const int colWidth = -19 /* printf alignment/width for left column */;
176 const char *p, *z;
177
178 brief = find_option("brief", "b",0)!=0;
179 omitVers = find_option("omit-version-info", 0, 0)!=0;
180 dbCheck = find_option("db-check",0,0)!=0;
181 db_find_and_open_repository(0,0);
182
183 /* We should be done with options.. */
184 verify_all_options();
185
@@ -269,11 +272,14 @@
272 db_int(0, "PRAGMA %s.page_count", zDb),
273 db_int(0, "PRAGMA %s.page_size", zDb),
274 db_int(0, "PRAGMA %s.freelist_count", zDb),
275 db_text(0, "PRAGMA %s.encoding", zDb),
276 db_text(0, "PRAGMA %s.journal_mode", zDb));
277 if( dbCheck ){
278 fossil_print("%*s%s\n", colWidth, "database-check:",
279 db_text(0, "PRAGMA quick_check(1)"));
280 }
281 }
282
283 /*
284 ** WEBPAGE: urllist
285 **
286

Keyboard Shortcuts

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