Module: sip-router
Branch: janakj/bdb
Commit: c8928bf3a707be39b59176ec64dcd7a3951c1f10
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=c8928bf…
Author: Will Quan <wiquan(a)employees.org>
Committer: Will Quan <wiquan(a)employees.org>
Date: Wed Nov 7 17:32:35 2007 +0000
Add function bdb_time2str
git-svn-id: https://openser.svn.sourceforge.net/svnroot/openser/trunk@3049 689a6050-402a-0410-94f2-e92a70836424
---
modules/db_berkeley/bdb_val.c | 43 ++++++++++++++++++++++++++++++++++++++++-
1 files changed, 42 insertions(+), 1 deletions(-)
diff --git a/modules/db_berkeley/bdb_val.c b/modules/db_berkeley/bdb_val.c
index b030ec6..c1330c9 100644
--- a/modules/db_berkeley/bdb_val.c
+++ b/modules/db_berkeley/bdb_val.c
@@ -35,6 +35,47 @@
#include "bdb_val.h"
#include <string.h>
+/**
+ * A copy of db_ut::db_time2str EXCEPT does not wrap the date in single-quotes
+ *
+ * Convert a time_t value to string (w.o single-quote)
+ * \param _v source value
+ * \param _s target string
+ * \param _l available length and target length
+ * \return -1 on error, 0 on success
+ * \todo This functions add quotes to the time value. This
+ * should be done in the val2str function, as some databases
+ * like db_berkeley don't need or like this at all.
+ */
+inline int bdb_time2str(time_t _v, char* _s, int* _l)
+{
+ struct tm* t;
+ int l;
+
+ if ((!_s) || (!_l) || (*_l < 2)) {
+ LM_ERR("Invalid parameter value\n");
+ return -1;
+ }
+
+// *_s++ = '\'';
+
+ /* Convert time_t structure to format accepted by the database */
+ t = localtime(&_v);
+ l = strftime(_s, *_l -1, "%Y-%m-%d %H:%M:%S", t);
+
+ if (l == 0) {
+ LM_ERR("Error during time conversion\n");
+ /* the value of _s is now unspecified */
+ _s = NULL;
+ _l = 0;
+ return -1;
+ }
+ *_l = l;
+
+// *(_s + l) = '\'';
+// *_l = l + 2;
+ return 0;
+}
/**
* Does not copy strings
@@ -207,7 +248,7 @@ int bdb_val2str(db_val_t* _v, char* _s, int* _len)
break;
case DB_DATETIME:
- if (db_time2str(VAL_TIME(_v), _s, _len) < 0) {
+ if (bdb_time2str(VAL_TIME(_v), _s, _len) < 0) {
LM_ERR("Error while converting time_t to string\n");
return -6;
} else {
Module: sip-router
Branch: janakj/bdb
Commit: 16f4fa3431d64dcaec7e3cbc2a46531fecfc9eb5
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=16f4fa3…
Author: Will Quan <wiquan(a)employees.org>
Committer: Will Quan <wiquan(a)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/bdb_lib.c | 18 ++++++++++++++++--
1 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/modules/db_berkeley/bdb_lib.c b/modules/db_berkeley/bdb_lib.c
index 54ee975..8b9f37f 100644
--- a/modules/db_berkeley/bdb_lib.c
+++ b/modules/db_berkeley/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;
}
Module: sip-router
Branch: janakj/oracle
Commit: 23f036db07bc32a7e2ca4ab96902c2f4335f63bf
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=23f036d…
Author: Jan Janak <jan(a)iptel.org>
Committer: Jan Janak <jan(a)iptel.org>
Date: Sun Feb 15 14:35:34 2009 +0100
Merge branch 'master' of ssh://git.sip-router.org/sip-router into oracle
* 'master' of ssh://git.sip-router.org/sip-router:
libsrdb1: futex warning fix
- port from kamailio trunk, r5607
- sync transformations add/lookup with kamailio
init_mi_core() exported via mi.h
mi include file
MI: core part
script parsing: while support
script engine: while() support
script engine: switch() and break execution
script engine: switch() fixup and optimizations
script parsing: C style switch() & case support
expr engine: minor additions
---