Module: sip-router
Branch: janakj/bdb
Commit: ea6985f7cf6c18d67618ae222d53fce4f162eb9c
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=ea6985f…
Author: Henning Westerholt <henning.westerholt(a)1und1.de>
Committer: Henning Westerholt <henning.westerholt(a)1und1.de>
Date: Wed Sep 24 11:02:42 2008 +0000
- disable big integer (DB_BIGINT) support for non SQL DB modules for now
- if such a value is used, an error will be returned and also logged
git-svn-id: https://openser.svn.sourceforge.net/svnroot/openser/trunk@4986 689a6050-402a-0410-94f2-e92a70836424
---
modules/db_berkeley/km_bdb_res.c | 6 ++++++
modules/db_berkeley/km_bdb_val.c | 4 ++++
2 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/modules/db_berkeley/km_bdb_res.c b/modules/db_berkeley/km_bdb_res.c
index c165122..93a408b 100644
--- a/modules/db_berkeley/km_bdb_res.c
+++ b/modules/db_berkeley/km_bdb_res.c
@@ -424,6 +424,9 @@ int bdb_is_neq_type(db_type_t _t0, db_type_t _t1)
case DB_INT:
if(_t0==DB_DATETIME || _t0==DB_BITMAP)
return 0;
+ case DB_BIGINT:
+ LM_ERR("BIGINT not supported");
+ return 0;
case DB_DATETIME:
if(_t0==DB_INT)
return 0;
@@ -514,6 +517,9 @@ int bdb_cmp_val(db_val_t* _vp, db_val_t* _v)
case DB_INT:
return (_vp->val.int_val<_v->val.int_val)?-1:
(_vp->val.int_val>_v->val.int_val)?1:0;
+ case DB_BIGINT:
+ LM_ERR("BIGINT not supported");
+ return -1;
case DB_DOUBLE:
return (_vp->val.double_val<_v->val.double_val)?-1:
(_vp->val.double_val>_v->val.double_val)?1:0;
diff --git a/modules/db_berkeley/km_bdb_val.c b/modules/db_berkeley/km_bdb_val.c
index 1e239ed..1f20c9c 100644
--- a/modules/db_berkeley/km_bdb_val.c
+++ b/modules/db_berkeley/km_bdb_val.c
@@ -112,6 +112,10 @@ int bdb_str2val(db_type_t _t, db_val_t* _v, char* _s, int _l)
}
break;
+ case DB_BIGINT:
+ LM_ERR("BIGINT not supported");
+ return -1;
+
case DB_BITMAP:
if (db_str2int(_s, &VAL_INT(_v)) < 0) {
LM_ERR("Error while converting BITMAP value from string\n");
Module: sip-router
Branch: janakj/bdb
Commit: 2582b7a760241411a8eccff504be88c17c5ae737
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=2582b7a…
Author: Henning Westerholt <henning.westerholt(a)1und1.de>
Committer: Henning Westerholt <henning.westerholt(a)1und1.de>
Date: Mon Dec 15 16:33:22 2008 +0000
- unify common rows and row allocation functionality in the DB API core
git-svn-id: https://openser.svn.sourceforge.net/svnroot/openser/trunk@5362 689a6050-402a-0410-94f2-e92a70836424
---
modules/db_berkeley/km_bdb_res.c | 31 ++++++-------------------------
1 files changed, 6 insertions(+), 25 deletions(-)
diff --git a/modules/db_berkeley/km_bdb_res.c b/modules/db_berkeley/km_bdb_res.c
index 93a408b..0049d7b 100644
--- a/modules/db_berkeley/km_bdb_res.c
+++ b/modules/db_berkeley/km_bdb_res.c
@@ -120,20 +120,10 @@ int bdb_convert_row(db_res_t* _res, char *bdb_result, int* _lres)
/* Save the number of rows in the current fetch */
RES_ROW_N(_res) = 1;
- /* Allocate storage to hold the bdb result values */
- len = sizeof(db_val_t) * RES_COL_N(_res);
- ROW_VALUES(row) = (db_val_t*)pkg_malloc(len);
-
- if (!ROW_VALUES(row)) {
- LM_ERR("no private memory left\n");
- return -1;
+ if (db_allocate_row(_res, row) != 0) {
+ LM_ERR("could not allocate row");
+ return -2;
}
- LM_DBG("allocate %d bytes for row values at %p\n", len, ROW_VALUES(row));
- memset(ROW_VALUES(row), 0, len);
-
- /* Save the number of columns in the ROW structure */
- ROW_N(row) = RES_COL_N(_res);
-
/*
* Allocate an array of pointers one per column.
* It that will be used to hold the address of the string representation of each column.
@@ -257,19 +247,10 @@ int bdb_append_row(db_res_t* _res, char *bdb_result, int* _lres, int _rx)
row = &(RES_ROWS(_res)[_rx]);
- /* Allocate storage to hold the bdb result values */
- len = sizeof(db_val_t) * RES_COL_N(_res);
- ROW_VALUES(row) = (db_val_t*)pkg_malloc(len);
-
- if (!ROW_VALUES(row)) {
- LM_ERR("no private memory left\n");
- return -1;
+ if (db_allocate_row(_res, row) != 0) {
+ LM_ERR("could not allocate row");
+ return -2;
}
- LM_DBG("allocate %d bytes for row values at %p\n", len, ROW_VALUES(row));
- memset(ROW_VALUES(row), 0, len);
-
- /* Save the number of columns in the ROW structure */
- ROW_N(row) = RES_COL_N(_res);
/*
* Allocate an array of pointers one per column.
Module: sip-router
Branch: janakj/bdb
Commit: b75657222b654f20d75408be5c2161a4b8880127
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=b756572…
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/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;
}
Module: sip-router
Branch: janakj/bdb
Commit: 2eb8cc0833aef2a0dcacdb25c804c0187cd74a13
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=2eb8cc0…
Author: Henning Westerholt <henning.westerholt(a)1und1.de>
Committer: Henning Westerholt <henning.westerholt(a)1und1.de>
Date: Mon Jan 7 14:26:27 2008 +0000
further cleanups in core database API
- move use_table and close function for SQL DBs to core
- move query, raw_query, insert, update, delete functions for SQL DBs to core
- all this functions were almost identical implemented in the three DB,
this functions uses now a function pointer based interface to do the work
- the use_table functions from dbtext and db_berkeley uses also now the core API
- move result management function from db_col to db_res to the other result
management functions, they are not useful alone
- change postgres module to match more the structure of mysql and unixodbc,
remove the 'PARANOID' #define, the other modules don't have this and prefix
all functions with db_postgres, make this more consistent to mysql module
- prefix all functions in unixodbc module with db_unixodbc, make this consistent
to the other modules, cleanup the namespace
- prefix val2str function in mysql with db_mysql too
- move the SQL_BUF_LENGTH to core API, all modules need this
- remove the static SQL char buffer from postgres and unixodbc, uses the one
provided from the core API
- move documentation from db/doc to API files in doxygen format
- improve and extend documentation for the whole API
- make database API const correct, to guard against implementation errors and
allow better compiler optimizations
- change interface free_connection function in SQL DBs to connection structure
to allow the usage of core API do_close
- fix indention for postgres driver and make logging messages consistent
- remove now unneeded system header includes for SQL DBs
- remove transaction related code from postgres driver, this is not used at all
and according to Klaus also brings no performance benefit if used.
- probably some other smaller cleanups
Tested with the testcases, so basic functionality should work.. Please test! :-)
git-svn-id: https://openser.svn.sourceforge.net/svnroot/openser/trunk@3506 689a6050-402a-0410-94f2-e92a70836424
---
modules/db_berkeley/km_db_berkeley.c | 6 +-----
1 files changed, 1 insertions(+), 5 deletions(-)
diff --git a/modules/db_berkeley/km_db_berkeley.c b/modules/db_berkeley/km_db_berkeley.c
index b4ccc7c..8049baf 100644
--- a/modules/db_berkeley/km_db_berkeley.c
+++ b/modules/db_berkeley/km_db_berkeley.c
@@ -134,11 +134,7 @@ static void destroy(void)
int bdb_use_table(db_con_t* _h, const char* _t)
{
- if ((!_h) || (!_t))
- return -1;
-
- CON_TABLE(_h) = _t;
- return 0;
+ return db_use_table(_h, _t);
}
/*