Module: sip-router
Branch: janakj/postgres
Commit: d79af6c63a8386f8d50b5dc41e045e754a70a587
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=d79af6c…
Author: Jan Janak <jan(a)iptel.org>
Committer: Jan Janak <jan(a)iptel.org>
Date: Mon Apr 14 18:52:47 2003 +0000
- fixed daylight saving bug previously found in mysql module
- struct tm structure properly initialized
- gmtime changed to localtime because mktime expects local time later
---
modules/db_postgres/db_val.c | 13 ++++++++++++-
1 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/modules/db_postgres/db_val.c b/modules/db_postgres/db_val.c
index 6c91a7d..9af7d9e 100644
--- a/modules/db_postgres/db_val.c
+++ b/modules/db_postgres/db_val.c
@@ -33,6 +33,9 @@
* History
* -------
* 2003-04-06 initial code written (Greg Fausak/Andy Fullford)
+ * 2003-04-14 gmtime changed to localtime because mktime later
+ * expects localtime, changed daylight saving bug
+ * previously found in mysql module (janakj)
*
*/
@@ -94,7 +97,15 @@ static inline int str2time(const char* _s, time_t* _v)
}
#endif
+ memset(&t, '\0', sizeof(struct tm));
strptime(_s,"%Y-%m-%d %H:%M:%S %z",&t);
+
+ /* Daylight saving information got lost in the database
+ * so let mktime to guess it. This eliminates the bug when
+ * contacts reloaded from the database have different time
+ * of expiration by one hour when daylight saving is used
+ */
+ t.tm_isdst = -1;
*_v = mktime(&t);
return 0;
@@ -147,7 +158,7 @@ static inline int time2str(time_t _v, char* _s, int* _l)
}
#endif
- t = gmtime(&_v);
+ t = localtime(&_v);
if((bl=strftime(_s,(size_t)(*_l)-1,"'%Y-%m-%d %H:%M:%S %z'",t))>0)
*_l = bl;
Module: sip-router
Branch: janakj/bdb
Commit: f1b7917b954c7d8b34c688212b01d04096ea5cfc
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=f1b7917…
Author: Jan Janak <jan(a)iptel.org>
Committer: Jan Janak <jan(a)iptel.org>
Date: Sun Feb 15 15:08:43 2009 +0100
Merge commit 'berkeley/trunk' into bdb
* commit 'berkeley/trunk': (41 commits)
- unify common rows and row allocation functionality in the DB API core
- fix compilation on OpenBSD, related to missing includes paths and wrong
- disable big integer (DB_BIGINT) support for non SQL DB modules for now
- remove not reached return statement at the end of val2str functions
- fix link entity names, patch from Carsten Gross
- port from opensips r4526, credits goes to bogdan
- renamed: bdb_recover -> kambdb_recover
- regenerated all READMEs (make modules-readme exclude_modules="")
- renaming: changed entities in documentation
- renaming: openser -> kamailio
- renaming scripts part 1
- fix some FAQ entries, change missing entity, regenerate READMEs
- change name in copyright headers
- fix unnecessary module library links, related to #1855859
- titles for admin, devel and faq chapters are defined via entities for coherence and easier management
- updated some old entity names
- content of faq removed (mistakenly added by me after Henning did the cleanup for modules' docs; rev 3839)
- entity &user; replaced with &admin; to obey naming structure (entities to be replaced by xinclude); updated obsolete address tags
- step 2 for the rest of modules to re-link history from sgml to xml files
- step 1 for the rest of modules to re-link history from sgml to xml files
...
---
Module: sip-router
Branch: janakj/bdb
Commit: 986445fbfdfd58dfb21992a9a098adda3be7a396
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=986445f…
Author: Jan Janak <jan(a)iptel.org>
Committer: Jan Janak <jan(a)iptel.org>
Date: Sun Feb 15 15:54:00 2009 +0100
Fixed wrong order of directives in modules Makefile.
Some of the directives in the Makefile of the module were listed in a
wrong order and as a result they had no effect.
---
modules/db_berkeley/Makefile | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/modules/db_berkeley/Makefile b/modules/db_berkeley/Makefile
index 5671867..851d961 100644
--- a/modules/db_berkeley/Makefile
+++ b/modules/db_berkeley/Makefile
@@ -4,6 +4,9 @@
#
#
# WARNING: do not run this directly, it should be run by the master Makefile
+include ../../Makefile.defs
+auto_gen=
+NAME=db_berkeley.so
# extra debug messages
# -DBDB_EXTRA_DEBUG is optional
@@ -11,9 +14,6 @@ DEFS +=-I$(LOCALBASE)/include -I$(LOCALBASE)/BerkeleyDB.4.6/include \
-I$(SYSBASE)/include
-include ../../Makefile.defs
-auto_gen=
-NAME=db_berkeley.so
LIBS=-L$(LOCALBASE)/lib -L$(SYSBASE)/lib -L$(LOCALBASE)/BerkeleyDB.4.6/lib -ldb
include ../../Makefile.modules
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.