13 static int joedbi(Arguments &arguments)
16 const Record_Id max_record_id
18 arguments.get_option<
index_t>(
"max_record_id",
"n", -1)
21 arguments.add_parameter(
"<file>");
23 const bool default_only =
false;
24 const bool include_shared =
false;
26 File_Parser file_parser
33 std::ostream null_stream(
nullptr);
34 Buffered_File *file = file_parser.parse(null_stream, arguments);
38 arguments.print_help(std::cerr) <<
'\n';
39 file_parser.print_help(std::cerr);
43 Blob_Reader_Command_Processor blob_processor(*file);
45 if (file->is_readonly())
47 Database db(max_record_id);
48 Readonly_Journal journal(*file);
49 journal.replay_log(db);
50 Readable_Interpreter interpreter(db);
51 interpreter.add_processor(blob_processor);
52 interpreter.main_loop(std::cin, std::cout);
56 Connection connection;
58 Writable_Database_Client client
66 client.transaction([max_record_id, &blob_processor]
68 const Readable &readable,
72 Interpreter interpreter(readable, writable, max_record_id);
73 interpreter.add_processor(blob_processor);
74 interpreter.main_loop(std::cin, std::cout);
83int main(
int argc,
char **argv)
@ write_existing_or_create_new
either write_existing or create_new depending on whether the file exists. Racy in Posix,...
int main_wrapper(int(*main)(Arguments &), int argc, char **argv)
Process command-line arguments and catch exceptions from main.