MCPcopy Create free account
hub / github.com/bcndev/bytecoin / DBsqliteKV

Method DBsqliteKV

src/platform/DBsqlite3.cpp:94–109  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

92}
93
94DBsqliteKV::DBsqliteKV(OpenMode open_mode, const std::string &full_path, uint64_t max_tx_size)
95 : full_path(full_path + ".sqlite") {
96 // if ()
97 // throw platform::sqlite::Error("SQLite cannot be used in read-only mode for now");
98 // lmdb_check(::mdb_env_set_mapsize(db_env.handle, max_db_size), "mdb_env_set_mapsize ");
99 // std::cout << "sqlite3_libversion=" << sqlite3_libversion() << std::endl;
100 // create_directories_if_necessary(full_path);
101 bool created = false;
102 db_dbi.open_check_create(open_mode, platform::expand_path(this->full_path), &created);
103 if (created)
104 db_dbi.exec("CREATE TABLE kv_table(kk BLOB PRIMARY KEY COLLATE BINARY, vv BLOB NOT NULL) WITHOUT ROWID");
105 stmt_get.prepare(db_dbi, "SELECT kk, vv FROM kv_table WHERE kk = ?");
106 stmt_insert.prepare(db_dbi, "INSERT INTO kv_table (kk, vv) VALUES (?, ?)");
107 stmt_update.prepare(db_dbi, "REPLACE INTO kv_table (kk, vv) VALUES (?, ?)");
108 stmt_del.prepare(db_dbi, "DELETE FROM kv_table WHERE kk = ?");
109}
110
111size_t DBsqliteKV::test_get_approximate_size() const { return 0; }
112

Callers

nothing calls this directly

Calls 4

expand_pathFunction · 0.85
open_check_createMethod · 0.80
execMethod · 0.80
prepareMethod · 0.45

Tested by

no test coverage detected