| 92 | } |
| 93 | |
| 94 | DBsqliteKV::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 | |
| 111 | size_t DBsqliteKV::test_get_approximate_size() const { return 0; } |
| 112 |
nothing calls this directly
no test coverage detected