Joedb 10.2.0
The Journal-Only Embedded Database
Loading...
Searching...
No Matches
Readonly_Interpreted_File.cpp
Go to the documentation of this file.
3#include "joedb/Multiplexer.h"
5
6namespace joedb
7{
8 ////////////////////////////////////////////////////////////////////////////
10 ////////////////////////////////////////////////////////////////////////////
11 (
12 std::istream &stream,
13 bool readonly
14 ):
15 journal(*this)
16 {
17 if (!stream)
18 throw Exception("opening interpreted file: !stream");
19
20 stream.exceptions(std::ios::badbit);
21 stream.seekg(0);
22
23 Multiplexer multiplexer{db, journal};
24 Interpreter interpreter(db, multiplexer, Record_Id::null);
25 interpreter.set_echo(false);
26 interpreter.set_rethrow(true);
27 {
29 joedb::filebuf null_filebuf(null_file);
30 std::ostream null_stream(&null_filebuf);
31 interpreter.main_loop(stream, null_stream);
32 }
34
35 if (readonly)
37 }
38
39 ////////////////////////////////////////////////////////////////////////////
41 ////////////////////////////////////////////////////////////////////////////
42}
void main_loop(std::istream &in, std::ostream &out)
void set_rethrow(bool new_rethrow)
Readonly_Interpreted_File(std::istream &stream, bool readonly)
static const Record_Id null
Definition index_types.h:44
https://en.cppreference.com/w/cpp/io/basic_streambuf.html
Definition filebuf.h:17
@ create_new
fails if already exists, locks the file for writing