diff options
author | Peng Wu <alexepico@gmail.com> | 2016-03-03 16:41:39 +0800 |
---|---|---|
committer | Peng Wu <alexepico@gmail.com> | 2016-03-03 16:41:39 +0800 |
commit | 9d0f69f772571e2ea2e3c9f50198d843d07227a8 (patch) | |
tree | ea37f4a56ef29e6000b31b5573563dd258bf2712 /src/storage | |
parent | 9ce89e8d3ac1926e87d8964337d72526ffc57c6e (diff) | |
download | libpinyin-9d0f69f772571e2ea2e3c9f50198d843d07227a8.tar.gz libpinyin-9d0f69f772571e2ea2e3c9f50198d843d07227a8.tar.xz libpinyin-9d0f69f772571e2ea2e3c9f50198d843d07227a8.zip |
write attach_option function
Diffstat (limited to 'src/storage')
-rw-r--r-- | src/storage/bdb_utils.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/storage/bdb_utils.h b/src/storage/bdb_utils.h index 513c42f..f908d23 100644 --- a/src/storage/bdb_utils.h +++ b/src/storage/bdb_utils.h @@ -22,6 +22,20 @@ #ifndef BDB_UTILS_H #define BDB_UTILS_H +#include <assert.h> #include <db.h> +inline u_int32_t attach_option(guint32 flags) { + u_int32_t db_flags = 0; + + if (flags & ATTACH_READONLY) + db_flags |= DB_RDONLY; + if (flags & ATTACH_READWRITE) + assert(!(flags & ATTACH_READONLY)); + if (flags & ATTACH_CREATE) + db_flags |= DB_CREATE; + + return db_flags; +} + #endif |