34 #define PROG_NAME "xapian-check" 35 #define PROG_DESC "Check the consistency of a database or table" 38 cout <<
"Usage: " PROG_NAME " DATABASE_DIRECTORY|PATH_TO_BTREE [[F][t][f][b][v][+]]\n\n" 39 "If a whole database is checked, then additional cross-checks between\n" 40 "the tables are performed.\n\n" 41 "The btree(s) is/are always checked - control the output verbosity with:\n" 42 " F = attempt to fix a broken database (implemented for chert currently)\n" 43 " t = short tree printing\n" 44 " f = full tree printing\n" 45 " b = show free blocks\n" 46 " v = show stats about B-tree (default)\n" 48 " e.g. " PROG_NAME " /var/lib/xapian/data/default\n" 49 " " PROG_NAME " /var/lib/xapian/data/default/postlist fbv\n";
53 main(
int argc,
char **argv)
55 if (argc > 1 && argv[1][0] ==
'-') {
56 if (strcmp(argv[1],
"--help") == 0) {
61 if (strcmp(argv[1],
"--version") == 0) {
66 if (argc < 2 || argc > 3) {
72 const char * opt_string = argv[2];
73 if (!opt_string) opt_string =
"v";
74 for (
const char *p = opt_string; *p; ++p) {
89 cerr <<
"option " << opt_string <<
" unknown\n";
90 cerr <<
"use t,f,b,v and/or + in the option string\n";
98 cout <<
"Total errors found: " << errors <<
'\n';
101 cout <<
"No errors found\n";
106 cerr << argv[0] <<
": Unknown exception\n";
static size_t check(const std::string &path, int opts=0, std::ostream *out=NULL)
Check the integrity of a database or database table.
const int DBCHECK_SHOW_FREELIST
Show the bitmap for the B-tree.
const int DBCHECK_FULL_TREE
Show a full display of the B-tree contents.
Public interfaces for the Xapian library.
const int DBCHECK_FIX
Fix problems.
std::string get_description() const
Return a string describing this object.
All exceptions thrown by Xapian are subclasses of Xapian::Error.
int main(int argc, char **argv)
const int DBCHECK_SHORT_TREE
Show a short-format display of the B-tree contents.
const int DBCHECK_SHOW_STATS
Show statistics for the B-tree.