Module: sip-router Branch: janakj/bdb Commit: b75657222b654f20d75408be5c2161a4b8880127 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=b7565722...
Author: Will Quan wiquan@employees.org Committer: Will Quan wiquan@employees.org Date: Wed Nov 28 20:34:07 2007 +0000
Moved definition of STANDARD_TABLES, EXTRA_TABLES, PRESENCE_TABLES to openserdbctl.base. Add tables 'dispatcher' and 'dialog' to list of STANDARD_TABLES (Patch provided from Ovidiu Sas). Modified bdb_lib::bdblib_create_table to return error if the table does not exist. These are all fixes for Bug# 1836601: db_berkeley don't work
git-svn-id: https://openser.svn.sourceforge.net/svnroot/openser/trunk@3227 689a6050-402a-0410-94f2-e92a70836424
---
modules/db_berkeley/km_bdb_lib.c | 18 ++++++++++++++++-- 1 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/modules/db_berkeley/km_bdb_lib.c b/modules/db_berkeley/km_bdb_lib.c index 54ee975..8b9f37f 100644 --- a/modules/db_berkeley/km_bdb_lib.c +++ b/modules/db_berkeley/km_bdb_lib.c @@ -543,6 +543,20 @@ void bdblib_log(int op, table_p _tp, char* _msg, int len) }
/** + * The function is called to create a handle to a db table. + * + * On startup, we do not create any of the db handles. + * Instead it is done on first-use (lazy-initialized) to only create handles to + * files (db) that we require. + * + * There is one db file per openser table (eg. acc), and they should exist + * in your DB_PATH (refer to openserctlrc) directory. + * + * This function does _not_ create the underlying binary db tables. + * Creating the tables MUST be manually performed before + * openser startup by 'openserdbctl create' + * + * Function returns NULL on error, which will cause openser to exit. * */ table_p bdblib_create_table(database_p _db, str *_s) @@ -581,12 +595,12 @@ table_p bdblib_create_table(database_p _db, str *_s) LM_DBG("CREATE TABLE = %s\n", tblname); #endif
- flags = DB_CREATE | DB_THREAD; + flags = DB_THREAD;
if ((rc = bdb->open(bdb, NULL, tblname, NULL, DB_HASH, flags, 0664)) != 0) { _db->dbenv->err(_db->dbenv, rc, "DB->open: %s", tblname); - LM_ERR("bdb open: %s.\n",db_strerror(rc)); + LM_ERR("bdb open failed: %s.\n",db_strerror(rc)); pkg_free(tp); return NULL; }