From 6eb0940e07f4b718e6ef395d3239761af4f3ad71 Mon Sep 17 00:00:00 2001 From: Peng Wu Date: Fri, 1 Jul 2016 11:43:04 +0800 Subject: update Berkeley DB mask out methods --- src/storage/chewing_large_table2_bdb.cpp | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) (limited to 'src/storage/chewing_large_table2_bdb.cpp') diff --git a/src/storage/chewing_large_table2_bdb.cpp b/src/storage/chewing_large_table2_bdb.cpp index 10b5663..4813bff 100644 --- a/src/storage/chewing_large_table2_bdb.cpp +++ b/src/storage/chewing_large_table2_bdb.cpp @@ -386,24 +386,8 @@ int ChewingLargeTable2::remove_index_internal(int phrase_length, } /* mask out method */ -/* assume it is in-memory dbm. */ bool ChewingLargeTable2::mask_out(phrase_token_t mask, phrase_token_t value) { - /* use copy and sweep algorithm here. */ - DB * tmp_db = NULL; - - int ret = db_create(&tmp_db, NULL, 0); - assert(0 == ret); - - if (NULL == tmp_db) - return false; - - /* create in memory db. */ - ret = tmp_db->open(tmp_db, NULL, NULL, NULL, - DB_BTREE, DB_CREATE, 0600); - if (ret != 0) - return false; - DBC * cursorp = NULL; DBT db_key, db_data; @@ -435,7 +419,7 @@ bool ChewingLargeTable2::mask_out(phrase_token_t mask, memset(&db_data, 0, sizeof(DBT)); \ db_data.data = entry->m_chunk.begin(); \ db_data.size = entry->m_chunk.size(); \ - int ret = tmp_db->put(tmp_db, NULL, &db_key, &db_data, 0); \ + int ret = cursorp->put(cursorp, &db_key, &db_data, 0); \ assert(ret == 0); \ break; \ } @@ -471,9 +455,7 @@ bool ChewingLargeTable2::mask_out(phrase_token_t mask, cursorp->c_close(cursorp); m_db->sync(m_db, 0); - m_db->close(m_db, 0); - m_db = tmp_db; return true; } -- cgit