Module: sip-router
Branch: janakj/bdb
Commit: 56177cc155a42959aadbcbf720fb88ac289905b0
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=56177cc…
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/km_bdb_val.c | 43 +++++++++++++++++++++++++++++++++++++-
1 files changed, 42 insertions(+), 1 deletions(-)
diff --git a/modules/db_berkeley/km_bdb_val.c b/modules/db_berkeley/km_bdb_val.c
index b030ec6..c1330c9 100644
--- a/modules/db_berkeley/km_bdb_val.c
+++ b/modules/db_berkeley/km_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: 749259efdfd2bfec4baa3829c615a74843217a62
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=749259e…
Author: Henning Westerholt <henning.westerholt(a)1und1.de>
Committer: Henning Westerholt <henning.westerholt(a)1und1.de>
Date: Thu Oct 4 11:15:01 2007 +0000
- import berkeley database module into trunk
- Many thanks to William Quan from Cisco Systems for the contribution
- based on patch #1803180, renamed from berkely_db to db_berkeley
- Some work still remains:
- build berkley_db as own debian package
- add berkley_db to the xml database creation process to generate the
content in scripts/db_berkley/openser like the dbtext stuff
- evaluate if its possible to use the db_free_row and db_free_rows
functions for this module
- port to new logging system
git-svn-id: https://openser.svn.sourceforge.net/svnroot/openser/trunk@2844 689a6050-402a-0410-94f2-e92a70836424
---
Module: sip-router
Branch: master
Commit: 8be42318025c413d0aecf01f84d32b5e1a0af2f6
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=8be4231…
Author: Jan Janak <jan(a)iptel.org>
Committer: Jan Janak <jan(a)iptel.org>
Date: Thu Feb 19 00:02:32 2009 +0100
Merge branch janakj/flatstore into branch master
* commit 'origin/janakj/flatstore': (57 commits)
Make km_sources compile, part two.
Link with libkmi, sources from kamailio use the management interface.
Make km_ sources compile:
Link also with libsrdb1
Added prefix km_ to locally included header files.
Align defines protecting header files with filenames.
Remove km_Makefile and km_README.
Renamed to db_flatstore.
Make the module compile in the sip-router source tree.
- disable big integer (DB_BIGINT) support for non SQL DB modules for now
- don't link with unnecessary libs, related to bug #1855859
- fix link entity names, patch from Carsten Gross
- rebuilt default READMEs
- renaming: changed entities in documentation
- renaming scripts part 1
- fix some FAQ entries, change missing entity, regenerate READMEs
- change name in copyright headers
- a set of minimalistic config files for testing purposes
- adding missing end of doxygen group
- missing READMEs added
...
---
Here is how you can import a kamailio module with full history (that means all
previous commits done on the svn will also be visible in git) into the
sip-router git repository.
First off, make sure you have a local copy of the sip-router git repository
with kamailio history merged into it. You can find a step-by-step guide in the
previous email with subject "Annotated git configuration file".
I suppose that the module you want to import into the git repository will be
based on the sources present in the kamailio svn trunk, so as the next step
create a new branch based on the kamailio trunk:
git co -b sqlops_filtered km/trunk
The name of the new branch is sqlops_filtered because I am importing kamailio
sqlops module, "_filtered" because this branch will be used to filter commits.
Like revision numbers in svn (and unlike versions in cvs), git commits,
identified by those cryptic sha1 hashes, record the state of _all_ files in
the source tree at the time when the commit was made. But this is a problem
because we only one to import the files in modules/sqlops directory and ignore
all other files outside this directory. Even if you try to checkout an older
commit which changed only files within modules/sqlops, you always get a full
source tree, including files of all other modules. There is no way you can get
a particular revision of selected files only--like you can do it with cvs.
But there is a solution: git-filter-branch. This is a handy git command which
(among other things) can walk through all commits in the history of the
current branch and tranform the commits into new commits with selected files
only. To include only files in modules/sqlops we can do the following:
git-filter-branch --subdirectory-filter modules/sqlops
The command rewrite the history of the current branch, your current branch
should be sqlops_filtered if you followed this guide from the beginning. If
you investigate the history of the branch with git log, you should see only
commits that are related to files in modules/sqlops. (The module contained
only one commit at the time of writing of this memo so don't be surprised if
you only see one commit in the history).
If you examine your current working directory now, you'll notice that the
directory contains files from modules/sqlops in the top level directory. We
need to put them back into modules/sqlopts before we can merge the branch into
sip-router tree, this can be done with git-filter-branch again. But before we
can run the command second time, we need to remove some residual files from
the previous run:
rm -rf .git/refs/original
And the following command will move all the files back to modules/sqlops
subdirectory:
git-filter-branch --index-filter 'git ls-files -s |
sed "s-\t-&modules/sqlopt/-" |
GIT_INDEX_FILE=$GIT_INDEX_FILE.new git update-index --index-info &&
mv $GIT_INDEX_FILE.new $GIT_INDEX_FILE' HEAD
The previous command might look a little scary, but it is documented in man
git-filter-branch if you are interested in details.
If you examine your current working directory now, it should contain modules
directory with sqlops subdirectory and all the module files there. This branch
is now ready to be merged into the sip-router tree, so create a new branch,
for example sqlops, based on the sip-router master branch:
git co -b sqlops sr/master
And now you can merge branch sqlops_filtered into the newly created branch:
git merge sqlops_filtered
And if everything went well, congratulations, you successfully imported your
first kamailio module into the sip-router git repository. Branch
sqlops_filtered is no more needed so you can safely delete it.
Jan.