Module: sip-router
Branch: janakj/bdb
Commit: e4a39affff2140f41c031c94610236718efb7e03
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=e4a39af…
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/bdb_res.c | 6 ++++++
modules/db_berkeley/bdb_val.c | 4 ++++
2 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/modules/db_berkeley/bdb_res.c b/modules/db_berkeley/bdb_res.c
index c165122..93a408b 100644
--- a/modules/db_berkeley/bdb_res.c
+++ b/modules/db_berkeley/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/bdb_val.c b/modules/db_berkeley/bdb_val.c
index 1e239ed..1f20c9c 100644
--- a/modules/db_berkeley/bdb_val.c
+++ b/modules/db_berkeley/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: 423e2078e1fb99c4f5bd2575ba0d739c96d159df
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=423e207…
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/bdb_res.c | 31 ++++++-------------------------
1 files changed, 6 insertions(+), 25 deletions(-)
diff --git a/modules/db_berkeley/bdb_res.c b/modules/db_berkeley/bdb_res.c
index 93a408b..0049d7b 100644
--- a/modules/db_berkeley/bdb_res.c
+++ b/modules/db_berkeley/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: 3904bb0de19f991292c69e61ebfe387d2d10809f
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=3904bb0…
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/db_berkeley.c | 6 +-----
1 files changed, 1 insertions(+), 5 deletions(-)
diff --git a/modules/db_berkeley/db_berkeley.c b/modules/db_berkeley/db_berkeley.c
index b4ccc7c..8049baf 100644
--- a/modules/db_berkeley/db_berkeley.c
+++ b/modules/db_berkeley/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);
}
/*
Module: sip-router
Branch: janakj/bdb
Commit: bbd5ceca0c61b5346e38e7c8a0efbcb4ea9a0a9d
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=bbd5cec…
Author: Henning Westerholt <henning.westerholt(a)1und1.de>
Committer: Henning Westerholt <henning.westerholt(a)1und1.de>
Date: Wed Feb 6 15:46:09 2008 +0000
further changes after the db name change
- update INSTALL file
- fix Makefile skip modules variable
- fix module Makefile, lib name
- change db_bind_mod to add the db prefix in the function
- change db url defines in db_berkeley and db_text
- change database modules names in module struct
- fix debian packaging
- fix tests
git-svn-id: https://openser.svn.sourceforge.net/svnroot/openser/trunk@3642 689a6050-402a-0410-94f2-e92a70836424
---
modules/db_berkeley/README | 4 ++--
modules/db_berkeley/db_berkeley.c | 2 +-
modules/db_berkeley/doc/db_berkeley_user.sgml | 4 ++--
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/modules/db_berkeley/README b/modules/db_berkeley/README
index 1f7dda5..4cc84b4 100644
--- a/modules/db_berkeley/README
+++ b/modules/db_berkeley/README
@@ -228,8 +228,8 @@ by default none is loaded
Modify the OpenSER configuration file to use db_berkeley
module. The database URL for modules must be the path to the
directory where the Berkeley DB table-files are located,
- prefixed by "db_berkeley://", e.g.,
- "db_berkeley:///usr/local/etc/openser/db_berkeley".
+ prefixed by "berkeley://", e.g.,
+ "berkeley:///usr/local/etc/openser/db_berkeley".
A couple other IMPORTANT things to consider are the 'db_mode'
and the 'use_domain' modparams. The description of these
diff --git a/modules/db_berkeley/db_berkeley.c b/modules/db_berkeley/db_berkeley.c
index 74fea05..7c69751 100644
--- a/modules/db_berkeley/db_berkeley.c
+++ b/modules/db_berkeley/db_berkeley.c
@@ -47,7 +47,7 @@
#define CFG_DIR "/tmp"
#endif
-#define BDB_ID "db_berkeley://"
+#define BDB_ID "berkeley://"
#define BDB_ID_LEN (sizeof(BDB_ID)-1)
#define BDB_PATH_LEN 256
diff --git a/modules/db_berkeley/doc/db_berkeley_user.sgml b/modules/db_berkeley/doc/db_berkeley_user.sgml
index c08222f..b2bd6e3 100644
--- a/modules/db_berkeley/doc/db_berkeley_user.sgml
+++ b/modules/db_berkeley/doc/db_berkeley_user.sgml
@@ -253,8 +253,8 @@ modparam("db_berkeley", "journal_roll_interval", 3600)
<para>
Modify the OpenSER configuration file to use db_berkeley module.
The database URL for modules must be the path to the directory where
- the Berkeley DB table-files are located, prefixed by "db_berkeley://",
- e.g., "db_berkeley:///usr/local/etc/openser/db_berkeley".
+ the Berkeley DB table-files are located, prefixed by "berkeley://",
+ e.g., "berkeley:///usr/local/etc/openser/db_berkeley".
</para>
<para>
Module: sip-router
Branch: janakj/bdb
Commit: 44dab431e3f9b04d33d5d0ea88f90840ad4ef464
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=44dab43…
Author: Henning Westerholt <henning.westerholt(a)1und1.de>
Committer: Henning Westerholt <henning.westerholt(a)1und1.de>
Date: Fri Feb 8 14:32:23 2008 +0000
- port db_text and db_berkeley to the new core DB API
- remove free_* methods that are not needed anymore
- adjust structure to the other SQL based modules
- basic queries works, but otherwise not that much tested
git-svn-id: https://openser.svn.sourceforge.net/svnroot/openser/trunk@3668 689a6050-402a-0410-94f2-e92a70836424
---
modules/db_berkeley/bdb_res.c | 426 +++++++++----------------------------
modules/db_berkeley/bdb_res.h | 5 -
modules/db_berkeley/bdb_val.c | 2 +
modules/db_berkeley/db_berkeley.c | 10 +-
4 files changed, 107 insertions(+), 336 deletions(-)
Diff: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commitdiff;h=44d…