23 Readonly_Journal &journal,
29 journal.replay_with_checkpoint_comments(writable);
31 journal.replay_log(writable);
35 static int logdump_main(
int argc,
char **argv)
40 std::cerr <<
"usage: " << argv[0];
41 std::cerr <<
" [--sql] [--sqlite] [--raw] [--header] [--schema-only] [--ignore-errors] [--load] [--print-checkpoint] [--blob] <file.joedb>\n";
50 if (arg_index < argc && std::strcmp(argv[arg_index], s) == 0)\
57 OPTION(sqlite,
"--sqlite");
59 OPTION(header,
"--header");
60 OPTION(schema_only,
"--schema-only");
61 OPTION(ignore_errors,
"--ignore-errors");
63 OPTION(print_checkpoint,
"--print-checkpoint");
66 if (arg_index != argc - 1)
67 return logdump_main(1, argv);
79 std::optional<Readonly_Journal> journal;
88 Readonly_Journal::Check::all
91 catch (
const Exception &e)
95 std::cout <<
"Error opening journal file: " << e.what() <<
'\n';
96 std::cout <<
"run with the --ignore-errors flag to skip this check.\n";
101 std::unique_ptr<Writable> writable;
103 const Buffered_File *blob_reader = blob ? &file :
nullptr;
106 writable.reset(
new SQL_Dump_Writable(std::cout, blob_reader));
108 writable.reset(
new SQL_Dump_Writable(std::cout, blob_reader,
false));
110 writable.reset(
new Raw_Dump_Writable(std::cout));
112 writable.reset(
new Interpreter_Dump_Writable(std::cout, blob));
116 Selective_Writable selective_writable
121 journal->replay_log(selective_writable);
126 Multiplexer multiplexer{db, *writable};
127 dump(*journal, multiplexer, print_checkpoint);
130 dump(*journal, *writable, print_checkpoint);
void dump_header(std::ostream &out, Buffered_File &file)
void about_joedb(std::ostream &out)
@ read_existing
fails if does not exist
int main_exception_catcher(int(*main)(int, char **), int argc, char **argv)
Catch exception from main.
void dump(const Readable &db, Writable &writable, bool schema_only)