diff options
| author | levlam <levlam@telegram.org> | 2018-08-06 17:22:22 +0300 |
|---|---|---|
| committer | levlam <levlam@telegram.org> | 2018-08-06 17:22:22 +0300 |
| commit | 7c145a412b1443accd23a107f4dfb1144550510a (patch) | |
| tree | 9e44410d56be2db1c0fc0945ebf9954c9167a01f /tddb/td/db/SqliteKeyValue.cpp | |
| parent | 3616f205bb4874cf55ce9485d99794ee4387f72c (diff) | |
Custom language packs support.
GitOrigin-RevId: e7f76319dae5be3e20f81b41a0226e5f96f91ba1
Diffstat (limited to 'tddb/td/db/SqliteKeyValue.cpp')
| -rw-r--r-- | tddb/td/db/SqliteKeyValue.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/tddb/td/db/SqliteKeyValue.cpp b/tddb/td/db/SqliteKeyValue.cpp index 78cb3b1f4..2eec9c7eb 100644 --- a/tddb/td/db/SqliteKeyValue.cpp +++ b/tddb/td/db/SqliteKeyValue.cpp @@ -24,9 +24,7 @@ Result<bool> SqliteKeyValue::init(string path) { } Status SqliteKeyValue::init_with_connection(SqliteDb connection, string table_name) { - auto init_guard = ScopeExit() + [&]() { - clear(); - }; + auto init_guard = ScopeExit() + [&]() { close(); }; db_ = std::move(connection); table_name_ = std::move(table_name); TRY_STATUS(init(db_, table_name_)); @@ -60,13 +58,14 @@ Status SqliteKeyValue::init_with_connection(SqliteDb connection, string table_na return Status::OK(); } -void SqliteKeyValue::close_and_destroy() { - drop(db_, table_name_).ensure(); - auto path = std::move(path_); - clear(); - if (!path.empty()) { - destroy(path).ignore(); +Status SqliteKeyValue::drop() { + if (empty()) { + return Status::OK(); } + + auto result = drop(db_, table_name_); + close(); + return result; } SqliteKeyValue::SeqNo SqliteKeyValue::set(Slice key, Slice value) { |
