summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2011-08-30 12:45:43 +0800
committerPeng Wu <alexepico@gmail.com>2011-08-30 12:45:43 +0800
commit071817f652adc002f3ede82dd61008d773566b0f (patch)
tree940a52a4d821f397b02290a4f74139d43f5b30d7
parent938be01277acf6f1652794dc141e86e213ce1a5f (diff)
downloadlibpinyin-071817f652adc002f3ede82dd61008d773566b0f.zip
libpinyin-071817f652adc002f3ede82dd61008d773566b0f.tar.gz
libpinyin-071817f652adc002f3ede82dd61008d773566b0f.tar.xz
switch berkeley db to memory db
-rw-r--r--src/pinyin.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/pinyin.cpp b/src/pinyin.cpp
index 2f439a7..b3f4f1b 100644
--- a/src/pinyin.cpp
+++ b/src/pinyin.cpp
@@ -72,7 +72,7 @@ pinyin_context_t * pinyin_init(const char * systemdir, const char * userdir){
context->m_system_bigram->attach(filename, ATTACH_READONLY);
context->m_user_bigram = new Bigram;
filename = g_build_filename(context->m_user_dir, "user.db", NULL);
- context->m_user_bigram->attach(filename, ATTACH_CREATE|ATTACH_READWRITE);
+ context->m_user_bigram->load_db(filename);
context->m_pinyin_lookup = new PinyinLookup
( &(context->m_custom), context->m_pinyin_table,
@@ -389,6 +389,9 @@ bool pinyin_save(pinyin_context_t * context){
newlog->save(filename);
delete newlog;
+ filename = g_build_filename(context->m_user_dir, "user.db", NULL);
+ context->m_user_bigram->save_db(filename);
+
return true;
}