aboutsummaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
Diffstat (limited to 'main')
-rw-r--r--main/kamailio/0001-utils-Install-the-sqlite-scripts.patch66
-rw-r--r--main/kamailio/0001-utils-add-sqlite-support-to-kamctl-kamdbctl.patch1223
-rw-r--r--main/kamailio/APKBUILD37
-rw-r--r--main/kamailio/kamailio-3.1-backslash.patch44
-rw-r--r--main/kamailio/sqlite.patch712
5 files changed, 18 insertions, 2064 deletions
diff --git a/main/kamailio/0001-utils-Install-the-sqlite-scripts.patch b/main/kamailio/0001-utils-Install-the-sqlite-scripts.patch
deleted file mode 100644
index 0c72f64511..0000000000
--- a/main/kamailio/0001-utils-Install-the-sqlite-scripts.patch
+++ /dev/null
@@ -1,66 +0,0 @@
-From 3ced6fc0e5298ac6f2f6dade4d564078ec586ebf Mon Sep 17 00:00:00 2001
-From: Natanael Copa <ncopa@alpinelinux.org>
-Date: Thu, 26 May 2011 14:04:26 +0000
-Subject: [PATCH] utils: Install the sqlite scripts
-
-Fix the makefiles to actually install the sqlite scripts
----
- modules_k/db_sqlite/Makefile | 10 ++++++++++
- utils/kamctl/Makefile | 23 +++++++++++++++++++++++
- 2 files changed, 33 insertions(+), 0 deletions(-)
-
-diff --git a/modules_k/db_sqlite/Makefile b/modules_k/db_sqlite/Makefile
-index 9a75593..1f1dd2d 100644
---- a/modules_k/db_sqlite/Makefile
-+++ b/modules_k/db_sqlite/Makefile
-@@ -13,3 +13,13 @@ DEFS+=-DOPENSER_MOD_INTERFACE
- SERLIBPATH=../../lib
- SER_LIBS+=$(SERLIBPATH)/srdb1/srdb1
- include ../../Makefile.modules
-+
-+ifeq ($(INSTALL_FLAVOUR),kamailio)
-+# extra install for kamailio
-+
-+install-sqlite-scripts: $(bin_prefix)/$(bin_dir)
-+ SQLITEON=yes make -C ../../utils/kamctl/ install-modules
-+
-+install-scripts: install-sqlite-scripts
-+
-+endif # INSTALL_FLAVOUR
-diff --git a/utils/kamctl/Makefile b/utils/kamctl/Makefile
-index 0f2643b..8b0f790 100644
---- a/utils/kamctl/Makefile
-+++ b/utils/kamctl/Makefile
-@@ -245,6 +245,29 @@ install-modules: $(bin_prefix)/$(bin_dir)
- fi ;\
- done ;\
- fi
-+ # install sqlite stuff
-+ if [ "$(SQLITEON)" = "yes" ]; then \
-+ mkdir -p $(modules_prefix)/$(lib_dir)/kamctl ; \
-+ sed -e "s#/usr/local/sbin#$(bin_target)#g" \
-+ < kamctl.sqlite > /tmp/kamctl.sqlite ; \
-+ $(INSTALL_CFG) /tmp/kamctl.sqlite \
-+ $(modules_prefix)/$(lib_dir)/kamctl/kamctl.sqlite ; \
-+ rm -fr /tmp/kamctl.sqlite ; \
-+ sed -e "s#/usr/local/share/kamailio#$(data_target)#g" \
-+ < kamdbctl.sqlite > /tmp/kamdbctl.sqlite ; \
-+ $(INSTALL_TOUCH) $(modules_prefix)/$(lib_dir)/kamctl/kamdbctl.sqlite ; \
-+ $(INSTALL_CFG) /tmp/kamdbctl.sqlite $(modules_prefix)/$(lib_dir)/kamctl/ ; \
-+ rm -fr /tmp/kamdbctl.sqlite ; \
-+ mkdir -p $(data_prefix)/$(data_dir)/sqlite ; \
-+ for FILE in $(wildcard sqlite/*) ; do \
-+ if [ -f $$FILE ] ; then \
-+ $(INSTALL_TOUCH) $$FILE \
-+ $(data_prefix)/$(data_dir)/sqlite/`basename "$$FILE"` ; \
-+ $(INSTALL_CFG) $$FILE \
-+ $(data_prefix)/$(data_dir)/sqlite/`basename "$$FILE"` ; \
-+ fi ;\
-+ done ; \
-+ fi
-
-
- $(cfg_prefix)/$(cfg_dir):
---
-1.7.4.5
-
diff --git a/main/kamailio/0001-utils-add-sqlite-support-to-kamctl-kamdbctl.patch b/main/kamailio/0001-utils-add-sqlite-support-to-kamctl-kamdbctl.patch
deleted file mode 100644
index 30525faf85..0000000000
--- a/main/kamailio/0001-utils-add-sqlite-support-to-kamctl-kamdbctl.patch
+++ /dev/null
@@ -1,1223 +0,0 @@
-From 215a55e097c07b497747caf2a04c65cb11d783c6 Mon Sep 17 00:00:00 2001
-From: Natanael Copa <ncopa@alpinelinux.org>
-Date: Thu, 26 May 2011 07:07:19 +0000
-Subject: [PATCH] utils: add sqlite support to kamctl/kamdbctl
-
-I basically copied the postgrersql scripts and simplified them a bit
----
- utils/kamctl/kamctl | 6 +
- utils/kamctl/kamctl.sqlite | 51 +++++++++
- utils/kamctl/kamctlrc | 6 +-
- utils/kamctl/kamdbctl | 13 ++
- utils/kamctl/kamdbctl.sqlite | 152 ++++++++++++++++++++++++++
- utils/kamctl/sqlite/acc-create.sql | 28 +++++
- utils/kamctl/sqlite/alias_db-create.sql | 12 ++
- utils/kamctl/sqlite/auth_db-create.sql | 15 +++
- utils/kamctl/sqlite/avpops-create.sql | 15 +++
- utils/kamctl/sqlite/carrierroute-create.sql | 42 +++++++
- utils/kamctl/sqlite/cpl-create.sql | 10 ++
- utils/kamctl/sqlite/dialog-create.sql | 29 +++++
- utils/kamctl/sqlite/dialplan-create.sql | 13 ++
- utils/kamctl/sqlite/dispatcher-create.sql | 11 ++
- utils/kamctl/sqlite/domain-create.sql | 8 ++
- utils/kamctl/sqlite/domainpolicy-create.sql | 13 ++
- utils/kamctl/sqlite/drouting-create.sql | 39 +++++++
- utils/kamctl/sqlite/group-create.sql | 19 +++
- utils/kamctl/sqlite/htable-create.sql | 9 ++
- utils/kamctl/sqlite/imc-create.sql | 19 +++
- utils/kamctl/sqlite/lcr-create.sql | 43 +++++++
- utils/kamctl/sqlite/matrix-create.sql | 9 ++
- utils/kamctl/sqlite/msilo-create.sql | 16 +++
- utils/kamctl/sqlite/mtree-create.sql | 8 ++
- utils/kamctl/sqlite/pdt-create.sql | 9 ++
- utils/kamctl/sqlite/permissions-create.sql | 21 ++++
- utils/kamctl/sqlite/presence-create.sql | 92 ++++++++++++++++
- utils/kamctl/sqlite/purple-create.sql | 9 ++
- utils/kamctl/sqlite/registrar-create.sql | 22 ++++
- utils/kamctl/sqlite/rls-create.sql | 42 +++++++
- utils/kamctl/sqlite/siptrace-create.sql | 20 ++++
- utils/kamctl/sqlite/speeddial-create.sql | 14 +++
- utils/kamctl/sqlite/standard-create.sql | 5 +
- utils/kamctl/sqlite/uac-create.sql | 16 +++
- utils/kamctl/sqlite/uri_db-create.sql | 10 ++
- utils/kamctl/sqlite/userblacklist-create.sql | 21 ++++
- utils/kamctl/sqlite/usrloc-create.sql | 22 ++++
- 37 files changed, 887 insertions(+), 2 deletions(-)
- create mode 100644 utils/kamctl/kamctl.sqlite
- create mode 100644 utils/kamctl/kamdbctl.sqlite
- create mode 100644 utils/kamctl/sqlite/acc-create.sql
- create mode 100644 utils/kamctl/sqlite/alias_db-create.sql
- create mode 100644 utils/kamctl/sqlite/auth_db-create.sql
- create mode 100644 utils/kamctl/sqlite/avpops-create.sql
- create mode 100644 utils/kamctl/sqlite/carrierroute-create.sql
- create mode 100644 utils/kamctl/sqlite/cpl-create.sql
- create mode 100644 utils/kamctl/sqlite/dialog-create.sql
- create mode 100644 utils/kamctl/sqlite/dialplan-create.sql
- create mode 100644 utils/kamctl/sqlite/dispatcher-create.sql
- create mode 100644 utils/kamctl/sqlite/domain-create.sql
- create mode 100644 utils/kamctl/sqlite/domainpolicy-create.sql
- create mode 100644 utils/kamctl/sqlite/drouting-create.sql
- create mode 100644 utils/kamctl/sqlite/group-create.sql
- create mode 100644 utils/kamctl/sqlite/htable-create.sql
- create mode 100644 utils/kamctl/sqlite/imc-create.sql
- create mode 100644 utils/kamctl/sqlite/lcr-create.sql
- create mode 100644 utils/kamctl/sqlite/matrix-create.sql
- create mode 100644 utils/kamctl/sqlite/msilo-create.sql
- create mode 100644 utils/kamctl/sqlite/mtree-create.sql
- create mode 100644 utils/kamctl/sqlite/pdt-create.sql
- create mode 100644 utils/kamctl/sqlite/permissions-create.sql
- create mode 100644 utils/kamctl/sqlite/presence-create.sql
- create mode 100644 utils/kamctl/sqlite/purple-create.sql
- create mode 100644 utils/kamctl/sqlite/registrar-create.sql
- create mode 100644 utils/kamctl/sqlite/rls-create.sql
- create mode 100644 utils/kamctl/sqlite/siptrace-create.sql
- create mode 100644 utils/kamctl/sqlite/speeddial-create.sql
- create mode 100644 utils/kamctl/sqlite/standard-create.sql
- create mode 100644 utils/kamctl/sqlite/uac-create.sql
- create mode 100644 utils/kamctl/sqlite/uri_db-create.sql
- create mode 100644 utils/kamctl/sqlite/userblacklist-create.sql
- create mode 100644 utils/kamctl/sqlite/usrloc-create.sql
-
-diff --git a/utils/kamctl/kamctl b/utils/kamctl/kamctl
-index 2ec550a..c548849 100755
---- a/utils/kamctl/kamctl
-+++ b/utils/kamctl/kamctl
-@@ -124,6 +124,12 @@ case $DBENGINE in
- DBENGINELOADED=1
- fi
- ;;
-+ SQLITE|sqlite)
-+ if [ -f "$MYLIBDIR/kamctl.sqlite" ]; then
-+ . "$MYLIBDIR/kamctl.sqlite"
-+ DBENGINELOADED=1
-+ fi
-+ ;;
-
- esac
-
-diff --git a/utils/kamctl/kamctl.sqlite b/utils/kamctl/kamctl.sqlite
-new file mode 100644
-index 0000000..8c3eb21
---- /dev/null
-+++ b/utils/kamctl/kamctl.sqlite
-@@ -0,0 +1,51 @@
-+#
-+# $Id$
-+#
-+# control tool for maintaining Kamailio
-+#
-+#===================================================================
-+
-+##### ----------------------------------------------- #####
-+### SQLITE specific variables and functions
-+#
-+
-+##### ----------------------------------------------- #####
-+### load SQL base
-+#
-+if [ -f "$MYLIBDIR/kamctl.sqlbase" ]; then
-+ . "$MYLIBDIR/kamctl.sqlbase"
-+else
-+ echo "Cannot load SQL core functions '$MYLIBDIR/kamctl.sqlbase' - exiting ..."
-+ exit -1
-+fi
-+
-+DBNAME=$DB_PATH
-+
-+##### ----------------------------------------------- #####
-+### binaries
-+if [ -z "$SQLITE" ] ; then
-+ locate_tool sqlite3
-+ if [ -z "$TOOLPATH" ] ; then
-+ echo "error: 'sqlite3' tool not found: set SQLITE variable to correct tool path"
-+ exit
-+ fi
-+ SQLITE="$TOOLPATH"
-+fi
-+
-+
-+# input: sql query, optional sqlite3 command-line params
-+sqlite_query() {
-+ # if password not yet queried, query it now
-+ mecho "sqlite_query: $SQLITE $2 $DBNAME $1"
-+ $SQLITE $2 $DBNAME "$1"
-+}
-+
-+# input: sql query, optional sqlite3 command-line params
-+sqlite_ro_query() {
-+ sqlite_query "$@"
-+}
-+
-+DBCMD=sqlite_query
-+DBROCMD=sqlite_ro_query
-+DBRAWPARAMS=
-+
-diff --git a/utils/kamctl/kamctlrc b/utils/kamctl/kamctlrc
-index 5e888bd..ceb6f54 100644
---- a/utils/kamctl/kamctlrc
-+++ b/utils/kamctl/kamctlrc
-@@ -12,7 +12,9 @@
- ## chrooted directory
- # $CHROOT_DIR="/path/to/chrooted/directory"
-
--## database type: MYSQL, PGSQL, ORACLE, DB_BERKELEY, or DBTEXT, by default none is loaded
-+## database type: MYSQL, PGSQL, ORACLE, DB_BERKELEY, DBTEXT, or SQLITE
-+# by default none is loaded
-+#
- # If you want to setup a database with kamdbctl, you must at least specify
- # this parameter.
- # DBENGINE=MYSQL
-@@ -23,7 +25,7 @@
- ## database name (for ORACLE this is TNS name)
- # DBNAME=openser
-
--# database path used by dbtext or db_berkeley
-+# database path used by dbtext, db_berkeley or sqlite
- # DB_PATH="/usr/local/etc/kamailio/dbtext"
-
- ## database read/write user
-diff --git a/utils/kamctl/kamdbctl b/utils/kamctl/kamdbctl
-index c04bebd..d60f10f 100755
---- a/utils/kamctl/kamdbctl
-+++ b/utils/kamctl/kamdbctl
-@@ -108,6 +108,15 @@ case $DBENGINE in
- merr "could not load the script in $MYLIBDIR/kamdbctl.db_berkeley for database engine $DBENGINE"
- fi
- ;;
-+ SQLITE|sqlite)
-+ if [ -f "$MYLIBDIR/kamdbctl.sqlite" ]; then
-+ . "$MYLIBDIR/kamdbctl.sqlite"
-+ USED_DBENGINE="sqlite"
-+ DBNAME=$DB_PATH
-+ else
-+ merr "could not load the script in $MYLIBDIR/kamdbctl.sqlite for database engine $DBENGINE"
-+ fi
-+ ;;
- esac
-
- if [ -z "$USED_DBENGINE" ] ; then
-@@ -194,6 +203,10 @@ case $1 in
- usage
- exit 1
- fi
-+ if [ "$USED_DBENGINE" = "sqlite" ]; then
-+ cp $DB_PATH $1
-+ exit $?
-+ fi
- tmp_file=`mktemp /tmp/kamdbctl.XXXXXXXXXX` || exit 1
- openser_dump $DBNAME $tmp_file
- ret=$?
-diff --git a/utils/kamctl/kamdbctl.sqlite b/utils/kamctl/kamdbctl.sqlite
-new file mode 100644
-index 0000000..ecb51aa
---- /dev/null
-+++ b/utils/kamctl/kamdbctl.sqlite
-@@ -0,0 +1,152 @@
-+# $Id$
-+#
-+# Script for adding and dropping Kamailio sqlite tables
-+#
-+
-+# path to the database schemas
-+DATA_DIR="/usr/local/share/kamailio"
-+if [ -d "$DATA_DIR/sqlite" ] ; then
-+ DB_SCHEMA="$DATA_DIR/sqlite"
-+else
-+ DB_SCHEMA="./sqlite"
-+fi
-+
-+#################################################################
-+# config vars
-+#################################################################
-+
-+CMD="sqlite3"
-+DUMP_CMD="sql_dump"
-+#################################################################
-+
-+sql_dump()
-+{
-+ $CMD ${1:-$DB_PATH} .dump
-+}
-+
-+# execute sql command with optional db name
-+sql_query()
-+{
-+ $CMD "$@"
-+}
-+
-+
-+openser_drop() # pars: <database name>
-+{
-+if [ $# -ne 1 ] ; then
-+ merr "openser_drop function takes one param"
-+ exit 1
-+fi
-+
-+if ! rm $1; then
-+ merr "Dropping database $1 failed!"
-+ exit 1
-+fi
-+
-+minfo "Database $1 dropped"
-+} #openser_drop
-+
-+
-+openser_create () # pars: <database name>
-+{
-+if [ $# -ne 1 ] ; then
-+ merr "openser_create function takes one param"
-+ exit 1
-+fi
-+
-+minfo "creating database $1 ..."
-+
-+if [ $? -ne 0 ] ; then
-+ merr "Creating database failed!"
-+ exit 1
-+fi
-+
-+#sql_query "$1" "CREATE FUNCTION "concat" (text,text) RETURNS text AS 'SELECT \$1 || \$2;' LANGUAGE 'sql';
-+# CREATE FUNCTION "rand" () RETURNS double precision AS 'SELECT random();' LANGUAGE 'sql';"
-+# emulate mysql proprietary functions used by the lcr module in postgresql
-+
-+#if [ $? -ne 0 ] ; then
-+# merr "Creating mysql emulation functions failed!"
-+# exit 1
-+#fi
-+
-+for TABLE in $STANDARD_MODULES; do
-+ mdbg "Creating core table: $TABLE"
-+ sql_query "$1" < $DB_SCHEMA/$TABLE-create.sql
-+ if [ $? -ne 0 ] ; then
-+ merr "Creating core tables failed!"
-+ exit 1
-+ fi
-+done
-+
-+if [ -e $DB_SCHEMA/extensions-create.sql ]
-+then
-+ minfo "Creating custom extensions tables"
-+ sql_query $1 < $DB_SCHEMA/extensions-create.sql
-+ if [ $? -ne 0 ] ; then
-+ merr "Creating custom extensions tables failed!"
-+ exit 1
-+ fi
-+fi
-+
-+minfo "Core Kamailio tables succesfully created."
-+
-+get_answer $INSTALL_PRESENCE_TABLES "Install presence related tables? (y/n): "
-+if [ "$ANSWER" = "y" ]; then
-+ presence_create $1
-+fi
-+
-+get_answer $INSTALL_EXTRA_TABLES "Install tables for $EXTRA_MODULES? (y/n): "
-+if [ "$ANSWER" = "y" ]; then
-+ extra_create $1
-+fi
-+} # openser_create
-+
-+
-+presence_create () # pars: <database name>
-+{
-+if [ $# -ne 1 ] ; then
-+ merr "presence_create function takes one param"
-+ exit 1
-+fi
-+
-+minfo "creating presence tables into $1 ..."
-+
-+sql_query "$1" < $DB_SCHEMA/presence-create.sql
-+
-+if [ $? -ne 0 ] ; then
-+ merr "Failed to create presence tables!"
-+ exit 1
-+fi
-+
-+sql_query "$1" < $DB_SCHEMA/rls-create.sql
-+
-+if [ $? -ne 0 ] ; then
-+ merr "Failed to create rls-presence tables!"
-+ exit 1
-+fi
-+
-+minfo "Presence tables succesfully created."
-+} # end presence_create
-+
-+
-+extra_create () # pars: <database name>
-+{
-+if [ $# -ne 1 ] ; then
-+ merr "extra_create function takes one param"
-+ exit 1
-+fi
-+
-+minfo "creating extra tables into $1 ..."
-+
-+for TABLE in $EXTRA_MODULES; do
-+ mdbg "Creating extra table: $TABLE"
-+ sql_query "$1" < $DB_SCHEMA/$TABLE-create.sql
-+ if [ $? -ne 0 ] ; then
-+ merr "Creating extra tables failed!"
-+ exit 1
-+ fi
-+done
-+
-+minfo "Extra tables succesfully created."
-+} # end extra_create
-diff --git a/utils/kamctl/sqlite/acc-create.sql b/utils/kamctl/sqlite/acc-create.sql
-new file mode 100644
-index 0000000..4d23363
---- /dev/null
-+++ b/utils/kamctl/sqlite/acc-create.sql
-@@ -0,0 +1,28 @@
-+INSERT INTO version (table_name, table_version) values ('acc','4');
-+CREATE TABLE acc (
-+ id INTEGER PRIMARY KEY NOT NULL,
-+ method VARCHAR(16) DEFAULT '' NOT NULL,
-+ from_tag VARCHAR(64) DEFAULT '' NOT NULL,
-+ to_tag VARCHAR(64) DEFAULT '' NOT NULL,
-+ callid VARCHAR(64) DEFAULT '' NOT NULL,
-+ sip_code VARCHAR(3) DEFAULT '' NOT NULL,
-+ sip_reason VARCHAR(32) DEFAULT '' NOT NULL,
-+ time TIMESTAMP WITHOUT TIME ZONE NOT NULL
-+);
-+
-+CREATE INDEX acc_callid_idx ON acc (callid);
-+
-+INSERT INTO version (table_name, table_version) values ('missed_calls','3');
-+CREATE TABLE missed_calls (
-+ id INTEGER PRIMARY KEY NOT NULL,
-+ method VARCHAR(16) DEFAULT '' NOT NULL,
-+ from_tag VARCHAR(64) DEFAULT '' NOT NULL,
-+ to_tag VARCHAR(64) DEFAULT '' NOT NULL,
-+ callid VARCHAR(64) DEFAULT '' NOT NULL,
-+ sip_code VARCHAR(3) DEFAULT '' NOT NULL,
-+ sip_reason VARCHAR(32) DEFAULT '' NOT NULL,
-+ time TIMESTAMP WITHOUT TIME ZONE NOT NULL
-+);
-+
-+CREATE INDEX missed_calls_callid_idx ON missed_calls (callid);
-+
-diff --git a/utils/kamctl/sqlite/alias_db-create.sql b/utils/kamctl/sqlite/alias_db-create.sql
-new file mode 100644
-index 0000000..90656e9
---- /dev/null
-+++ b/utils/kamctl/sqlite/alias_db-create.sql
-@@ -0,0 +1,12 @@
-+INSERT INTO version (table_name, table_version) values ('dbaliases','1');
-+CREATE TABLE dbaliases (
-+ id INTEGER PRIMARY KEY NOT NULL,
-+ alias_username VARCHAR(64) DEFAULT '' NOT NULL,
-+ alias_domain VARCHAR(64) DEFAULT '' NOT NULL,
-+ username VARCHAR(64) DEFAULT '' NOT NULL,
-+ domain VARCHAR(64) DEFAULT '' NOT NULL,
-+ CONSTRAINT dbaliases_alias_idx UNIQUE (alias_username, alias_domain)
-+);
-+
-+CREATE INDEX dbaliases_target_idx ON dbaliases (username, domain);
-+
-diff --git a/utils/kamctl/sqlite/auth_db-create.sql b/utils/kamctl/sqlite/auth_db-create.sql
-new file mode 100644
-index 0000000..7d6d1f8
---- /dev/null
-+++ b/utils/kamctl/sqlite/auth_db-create.sql
-@@ -0,0 +1,15 @@
-+INSERT INTO version (table_name, table_version) values ('subscriber','6');
-+CREATE TABLE subscriber (
-+ id INTEGER PRIMARY KEY NOT NULL,
-+ username VARCHAR(64) DEFAULT '' NOT NULL,
-+ domain VARCHAR(64) DEFAULT '' NOT NULL,
-+ password VARCHAR(25) DEFAULT '' NOT NULL,
-+ email_address VARCHAR(64) DEFAULT '' NOT NULL,
-+ ha1 VARCHAR(64) DEFAULT '' NOT NULL,
-+ ha1b VARCHAR(64) DEFAULT '' NOT NULL,
-+ rpid VARCHAR(64) DEFAULT NULL,
-+ CONSTRAINT subscriber_account_idx UNIQUE (username, domain)
-+);
-+
-+CREATE INDEX subscriber_username_idx ON subscriber (username);
-+
-diff --git a/utils/kamctl/sqlite/avpops-create.sql b/utils/kamctl/sqlite/avpops-create.sql
-new file mode 100644
-index 0000000..007ecb5
---- /dev/null
-+++ b/utils/kamctl/sqlite/avpops-create.sql
-@@ -0,0 +1,15 @@
-+INSERT INTO version (table_name, table_version) values ('usr_preferences','2');
-+CREATE TABLE usr_preferences (
-+ id INTEGER PRIMARY KEY NOT NULL,
-+ uuid VARCHAR(64) DEFAULT '' NOT NULL,
-+ username VARCHAR(128) DEFAULT 0 NOT NULL,
-+ domain VARCHAR(64) DEFAULT '' NOT NULL,
-+ attribute VARCHAR(32) DEFAULT '' NOT NULL,
-+ type INTEGER DEFAULT 0 NOT NULL,
-+ value VARCHAR(128) DEFAULT '' NOT NULL,
-+ last_modified TIMESTAMP WITHOUT TIME ZONE DEFAULT '1900-01-01 00:00:01' NOT NULL
-+);
-+
-+CREATE INDEX usr_preferences_ua_idx ON usr_preferences (uuid, attribute);
-+CREATE INDEX usr_preferences_uda_idx ON usr_preferences (username, domain, attribute);
-+
-diff --git a/utils/kamctl/sqlite/carrierroute-create.sql b/utils/kamctl/sqlite/carrierroute-create.sql
-new file mode 100644
-index 0000000..baafbee
---- /dev/null
-+++ b/utils/kamctl/sqlite/carrierroute-create.sql
-@@ -0,0 +1,42 @@
-+INSERT INTO version (table_name, table_version) values ('carrierroute','3');
-+CREATE TABLE carrierroute (
-+ id INTEGER PRIMARY KEY NOT NULL,
-+ carrier INTEGER DEFAULT 0 NOT NULL,
-+ domain INTEGER DEFAULT 0 NOT NULL,
-+ scan_prefix VARCHAR(64) DEFAULT '' NOT NULL,
-+ flags INTEGER DEFAULT 0 NOT NULL,
-+ mask INTEGER DEFAULT 0 NOT NULL,
-+ prob REAL DEFAULT 0 NOT NULL,
-+ strip INTEGER DEFAULT 0 NOT NULL,
-+ rewrite_host VARCHAR(128) DEFAULT '' NOT NULL,
-+ rewrite_prefix VARCHAR(64) DEFAULT '' NOT NULL,
-+ rewrite_suffix VARCHAR(64) DEFAULT '' NOT NULL,
-+ description VARCHAR(255) DEFAULT NULL
-+);
-+
-+INSERT INTO version (table_name, table_version) values ('carrierfailureroute','2');
-+CREATE TABLE carrierfailureroute (
-+ id INTEGER PRIMARY KEY NOT NULL,
-+ carrier INTEGER DEFAULT 0 NOT NULL,
-+ domain INTEGER DEFAULT 0 NOT NULL,
-+ scan_prefix VARCHAR(64) DEFAULT '' NOT NULL,
-+ host_name VARCHAR(128) DEFAULT '' NOT NULL,
-+ reply_code VARCHAR(3) DEFAULT '' NOT NULL,
-+ flags INTEGER DEFAULT 0 NOT NULL,
-+ mask INTEGER DEFAULT 0 NOT NULL,
-+ next_domain INTEGER DEFAULT 0 NOT NULL,
-+ description VARCHAR(255) DEFAULT NULL
-+);
-+
-+INSERT INTO version (table_name, table_version) values ('carrier_name','1');
-+CREATE TABLE carrier_name (
-+ id INTEGER PRIMARY KEY NOT NULL,
-+ carrier VARCHAR(64) DEFAULT NULL
-+);
-+
-+INSERT INTO version (table_name, table_version) values ('domain_name','1');
-+CREATE TABLE domain_name (
-+ id INTEGER PRIMARY KEY NOT NULL,
-+ domain VARCHAR(64) DEFAULT NULL
-+);
-+
-diff --git a/utils/kamctl/sqlite/cpl-create.sql b/utils/kamctl/sqlite/cpl-create.sql
-new file mode 100644
-index 0000000..8beedf5
---- /dev/null
-+++ b/utils/kamctl/sqlite/cpl-create.sql
-@@ -0,0 +1,10 @@
-+INSERT INTO version (table_name, table_version) values ('cpl','1');
-+CREATE TABLE cpl (
-+ id INTEGER PRIMARY KEY NOT NULL,
-+ username VARCHAR(64) NOT NULL,
-+ domain VARCHAR(64) DEFAULT '' NOT NULL,
-+ cpl_xml TEXT,
-+ cpl_bin TEXT,
-+ CONSTRAINT cpl_account_idx UNIQUE (username, domain)
-+);
-+
-diff --git a/utils/kamctl/sqlite/dialog-create.sql b/utils/kamctl/sqlite/dialog-create.sql
-new file mode 100644
-index 0000000..bb086a5
---- /dev/null
-+++ b/utils/kamctl/sqlite/dialog-create.sql
-@@ -0,0 +1,29 @@
-+INSERT INTO version (table_name, table_version) values ('dialog','5');
-+CREATE TABLE dialog (
-+ id INTEGER PRIMARY KEY NOT NULL,
-+ hash_entry INTEGER NOT NULL,
-+ hash_id INTEGER NOT NULL,
-+ callid VARCHAR(255) NOT NULL,
-+ from_uri VARCHAR(128) NOT NULL,
-+ from_tag VARCHAR(64) NOT NULL,
-+ to_uri VARCHAR(128) NOT NULL,
-+ to_tag VARCHAR(64) NOT NULL,
-+ caller_cseq VARCHAR(7) NOT NULL,
-+ callee_cseq VARCHAR(7) NOT NULL,
-+ caller_route_set VARCHAR(512),
-+ callee_route_set VARCHAR(512),
-+ caller_contact VARCHAR(128) NOT NULL,
-+ callee_contact VARCHAR(128) NOT NULL,
-+ caller_sock VARCHAR(64) NOT NULL,
-+ callee_sock VARCHAR(64) NOT NULL,
-+ state INTEGER NOT NULL,
-+ start_time INTEGER NOT NULL,
-+ timeout INTEGER DEFAULT 0 NOT NULL,
-+ sflags INTEGER DEFAULT 0 NOT NULL,
-+ toroute INTEGER DEFAULT 0 NOT NULL,
-+ toroute_name VARCHAR(32),
-+ req_uri VARCHAR(128) NOT NULL
-+);
-+
-+CREATE INDEX dialog_hash_idx ON dialog (hash_entry, hash_id);
-+
-diff --git a/utils/kamctl/sqlite/dialplan-create.sql b/utils/kamctl/sqlite/dialplan-create.sql
-new file mode 100644
-index 0000000..1a85e50
---- /dev/null
-+++ b/utils/kamctl/sqlite/dialplan-create.sql
-@@ -0,0 +1,13 @@
-+INSERT INTO version (table_name, table_version) values ('dialplan','1');
-+CREATE TABLE dialplan (
-+ id INTEGER PRIMARY KEY NOT NULL,
-+ dpid INTEGER NOT NULL,
-+ pr INTEGER NOT NULL,
-+ match_op INTEGER NOT NULL,
-+ match_exp VARCHAR(64) NOT NULL,
-+ match_len INTEGER NOT NULL,
-+ subst_exp VARCHAR(64) NOT NULL,
-+ repl_exp VARCHAR(32) NOT NULL,
-+ attrs VARCHAR(32) NOT NULL
-+);
-+
-diff --git a/utils/kamctl/sqlite/dispatcher-create.sql b/utils/kamctl/sqlite/dispatcher-create.sql
-new file mode 100644
-index 0000000..ec37fc4
---- /dev/null
-+++ b/utils/kamctl/sqlite/dispatcher-create.sql
-@@ -0,0 +1,11 @@
-+INSERT INTO version (table_name, table_version) values ('dispatcher','4');
-+CREATE TABLE dispatcher (
-+ id INTEGER PRIMARY KEY NOT NULL,
-+ setid INTEGER DEFAULT 0 NOT NULL,
-+ destination VARCHAR(192) DEFAULT '' NOT NULL,
-+ flags INTEGER DEFAULT 0 NOT NULL,
-+ priority INTEGER DEFAULT 0 NOT NULL,
-+ attrs VARCHAR(128) DEFAULT '' NOT NULL,
-+ description VARCHAR(64) DEFAULT '' NOT NULL
-+);
-+
-diff --git a/utils/kamctl/sqlite/domain-create.sql b/utils/kamctl/sqlite/domain-create.sql
-new file mode 100644
-index 0000000..0b1fbe4
---- /dev/null
-+++ b/utils/kamctl/sqlite/domain-create.sql
-@@ -0,0 +1,8 @@
-+INSERT INTO version (table_name, table_version) values ('domain','1');
-+CREATE TABLE domain (
-+ id INTEGER PRIMARY KEY NOT NULL,
-+ domain VARCHAR(64) DEFAULT '' NOT NULL,
-+ last_modified TIMESTAMP WITHOUT TIME ZONE DEFAULT '1900-01-01 00:00:01' NOT NULL,
-+ CONSTRAINT domain_domain_idx UNIQUE (domain)
-+);
-+
-diff --git a/utils/kamctl/sqlite/domainpolicy-create.sql b/utils/kamctl/sqlite/domainpolicy-create.sql
-new file mode 100644
-index 0000000..c7cb279
---- /dev/null
-+++ b/utils/kamctl/sqlite/domainpolicy-create.sql
-@@ -0,0 +1,13 @@
-+INSERT INTO version (table_name, table_version) values ('domainpolicy','2');
-+CREATE TABLE domainpolicy (
-+ id INTEGER PRIMARY KEY NOT NULL,
-+ rule VARCHAR(255) NOT NULL,
-+ type VARCHAR(255) NOT NULL,
-+ att VARCHAR(255),
-+ val VARCHAR(128),
-+ description VARCHAR(255) NOT NULL,
-+ CONSTRAINT domainpolicy_rav_idx UNIQUE (rule, att, val)
-+);
-+
-+CREATE INDEX domainpolicy_rule_idx ON domainpolicy (rule);
-+
-diff --git a/utils/kamctl/sqlite/drouting-create.sql b/utils/kamctl/sqlite/drouting-create.sql
-new file mode 100644
-index 0000000..9c962fa
---- /dev/null
-+++ b/utils/kamctl/sqlite/drouting-create.sql
-@@ -0,0 +1,39 @@
-+INSERT INTO version (table_name, table_version) values ('dr_gateways','3');
-+CREATE TABLE dr_gateways (
-+ gwid INTEGER PRIMARY KEY NOT NULL,
-+ type INTEGER DEFAULT 0 NOT NULL,
-+ address VARCHAR(128) NOT NULL,
-+ strip INTEGER DEFAULT 0 NOT NULL,
-+ pri_prefix VARCHAR(64) DEFAULT NULL,
-+ attrs VARCHAR(255) DEFAULT NULL,
-+ description VARCHAR(128) DEFAULT '' NOT NULL
-+);
-+
-+INSERT INTO version (table_name, table_version) values ('dr_rules','3');
-+CREATE TABLE dr_rules (
-+ ruleid INTEGER PRIMARY KEY NOT NULL,
-+ groupid VARCHAR(255) NOT NULL,
-+ prefix VARCHAR(64) NOT NULL,
-+ timerec VARCHAR(255) NOT NULL,
-+ priority INTEGER DEFAULT 0 NOT NULL,
-+ routeid VARCHAR(64) NOT NULL,
-+ gwlist VARCHAR(255) NOT NULL,
-+ description VARCHAR(128) DEFAULT '' NOT NULL
-+);
-+
-+INSERT INTO version (table_name, table_version) values ('dr_gw_lists','1');
-+CREATE TABLE dr_gw_lists (
-+ id INTEGER PRIMARY KEY NOT NULL,
-+ gwlist VARCHAR(255) NOT NULL,
-+ description VARCHAR(128) DEFAULT '' NOT NULL
-+);
-+
-+INSERT INTO version (table_name, table_version) values ('dr_groups','2');
-+CREATE TABLE dr_groups (
-+ id INTEGER PRIMARY KEY NOT NULL,
-+ username VARCHAR(64) NOT NULL,
-+ domain VARCHAR(128) DEFAULT '' NOT NULL,
-+ groupid INTEGER DEFAULT 0 NOT NULL,
-+ description VARCHAR(128) DEFAULT '' NOT NULL
-+);
-+
-diff --git a/utils/kamctl/sqlite/group-create.sql b/utils/kamctl/sqlite/group-create.sql
-new file mode 100644
-index 0000000..fbd91c5
---- /dev/null
-+++ b/utils/kamctl/sqlite/group-create.sql
-@@ -0,0 +1,19 @@
-+INSERT INTO version (table_name, table_version) values ('grp','2');
-+CREATE TABLE grp (
-+ id INTEGER PRIMARY KEY NOT NULL,
-+ username VARCHAR(64) DEFAULT '' NOT NULL,
-+ domain VARCHAR(64) DEFAULT '' NOT NULL,
-+ grp VARCHAR(64) DEFAULT '' NOT NULL,
-+ last_modified TIMESTAMP WITHOUT TIME ZONE DEFAULT '1900-01-01 00:00:01' NOT NULL,
-+ CONSTRAINT grp_account_group_idx UNIQUE (username, domain, grp)
-+);
-+
-+INSERT INTO version (table_name, table_version) values ('re_grp','1');
-+CREATE TABLE re_grp (
-+ id INTEGER PRIMARY KEY NOT NULL,
-+ reg_exp VARCHAR(128) DEFAULT '' NOT NULL,
-+ group_id INTEGER DEFAULT 0 NOT NULL
-+);
-+
-+CREATE INDEX re_grp_group_idx ON re_grp (group_id);
-+
-diff --git a/utils/kamctl/sqlite/htable-create.sql b/utils/kamctl/sqlite/htable-create.sql
-new file mode 100644
-index 0000000..59fa681
---- /dev/null
-+++ b/utils/kamctl/sqlite/htable-create.sql
-@@ -0,0 +1,9 @@
-+INSERT INTO version (table_name, table_version) values ('htable','1');
-+CREATE TABLE htable (
-+ id INTEGER PRIMARY KEY NOT NULL,
-+ key_name VARCHAR(64) DEFAULT '' NOT NULL,
-+ key_type INTEGER DEFAULT 0 NOT NULL,
-+ value_type INTEGER DEFAULT 0 NOT NULL,
-+ key_value VARCHAR(128) DEFAULT '' NOT NULL
-+);
-+
-diff --git a/utils/kamctl/sqlite/imc-create.sql b/utils/kamctl/sqlite/imc-create.sql
-new file mode 100644
-index 0000000..99d68c1
---- /dev/null
-+++ b/utils/kamctl/sqlite/imc-create.sql
-@@ -0,0 +1,19 @@
-+INSERT INTO version (table_name, table_version) values ('imc_rooms','1');
-+CREATE TABLE imc_rooms (
-+ id INTEGER PRIMARY KEY NOT NULL,
-+ name VARCHAR(64) NOT NULL,
-+ domain VARCHAR(64) NOT NULL,
-+ flag INTEGER NOT NULL,
-+ CONSTRAINT imc_rooms_name_domain_idx UNIQUE (name, domain)
-+);
-+
-+INSERT INTO version (table_name, table_version) values ('imc_members','1');
-+CREATE TABLE imc_members (
-+ id INTEGER PRIMARY KEY NOT NULL,
-+ username VARCHAR(64) NOT NULL,
-+ domain VARCHAR(64) NOT NULL,
-+ room VARCHAR(64) NOT NULL,
-+ flag INTEGER NOT NULL,
-+ CONSTRAINT imc_members_account_room_idx UNIQUE (username, domain, room)
-+);
-+
-diff --git a/utils/kamctl/sqlite/lcr-create.sql b/utils/kamctl/sqlite/lcr-create.sql
-new file mode 100644
-index 0000000..bf93141
---- /dev/null
-+++ b/utils/kamctl/sqlite/lcr-create.sql
-@@ -0,0 +1,43 @@
-+INSERT INTO version (table_name, table_version) values ('lcr_gw','2');
-+CREATE TABLE lcr_gw (
-+ id INTEGER PRIMARY KEY NOT NULL,
-+ lcr_id SMALLINT NOT NULL,
-+ gw_name VARCHAR(128),
-+ ip_addr VARCHAR(15),
-+ hostname VARCHAR(64),
-+ port SMALLINT,
-+ params VARCHAR(64),
-+ uri_scheme SMALLINT,
-+ transport SMALLINT,
-+ strip SMALLINT,
-+ prefix VARCHAR(16) DEFAULT NULL,
-+ tag VARCHAR(64) DEFAULT NULL,
-+ flags INTEGER DEFAULT 0 NOT NULL,
-+ defunct INTEGER DEFAULT NULL,
-+ CONSTRAINT lcr_gw_lcr_id_ip_addr_port_hostname_idx UNIQUE (lcr_id, ip_addr, port, hostname)
-+);
-+
-+INSERT INTO version (table_name, table_version) values ('lcr_rule_target','1');
-+CREATE TABLE lcr_rule_target (
-+ id INTEGER PRIMARY KEY NOT NULL,
-+ lcr_id SMALLINT NOT NULL,
-+ rule_id INTEGER NOT NULL,
-+ gw_id INTEGER NOT NULL,
-+ priority SMALLINT NOT NULL,
-+ weight INTEGER DEFAULT 1 NOT NULL,
-+ CONSTRAINT lcr_rule_target_rule_id_gw_id_idx UNIQUE (rule_id, gw_id)
-+);
-+
-+CREATE INDEX lcr_rule_target_lcr_id_idx ON lcr_rule_target (lcr_id);
-+
-+INSERT INTO version (table_name, table_version) values ('lcr_rule','1');
-+CREATE TABLE lcr_rule (
-+ id INTEGER PRIMARY KEY NOT NULL,
-+ lcr_id SMALLINT NOT NULL,
-+ prefix VARCHAR(16) DEFAULT NULL,
-+ from_uri VARCHAR(64) DEFAULT NULL,
-+ stopper INTEGER DEFAULT 0 NOT NULL,
-+ enabled INTEGER DEFAULT 1 NOT NULL,
-+ CONSTRAINT lcr_rule_lcr_id_prefix_from_uri_idx UNIQUE (lcr_id, prefix, from_uri)
-+);
-+
-diff --git a/utils/kamctl/sqlite/matrix-create.sql b/utils/kamctl/sqlite/matrix-create.sql
-new file mode 100644
-index 0000000..50f2ed8
---- /dev/null
-+++ b/utils/kamctl/sqlite/matrix-create.sql
-@@ -0,0 +1,9 @@
-+INSERT INTO version (table_name, table_version) values ('matrix','1');
-+CREATE TABLE matrix (
-+ first INTEGER NOT NULL,
-+ second SMALLINT NOT NULL,
-+ res INTEGER NOT NULL
-+);
-+
-+CREATE INDEX matrix_matrix_idx ON matrix (first, second);
-+
-diff --git a/utils/kamctl/sqlite/msilo-create.sql b/utils/kamctl/sqlite/msilo-create.sql
-new file mode 100644
-index 0000000..7234112
---- /dev/null
-+++ b/utils/kamctl/sqlite/msilo-create.sql
-@@ -0,0 +1,16 @@
-+INSERT INTO version (table_name, table_version) values ('silo','5');
-+CREATE TABLE silo (
-+ id INTEGER PRIMARY KEY NOT NULL,
-+ src_addr VARCHAR(128) DEFAULT '' NOT NULL,
-+ dst_addr VARCHAR(128) DEFAULT '' NOT NULL,
-+ username VARCHAR(64) DEFAULT '' NOT NULL,
-+ domain VARCHAR(64) DEFAULT '' NOT NULL,
-+ inc_time INTEGER DEFAULT 0 NOT NULL,
-+ exp_time INTEGER DEFAULT 0 NOT NULL,
-+ snd_time INTEGER DEFAULT 0 NOT NULL,
-+ ctype VARCHAR(32) DEFAULT 'text/plain' NOT NULL,
-+ body BYTEA DEFAULT '' NOT NULL
-+);
-+
-+CREATE INDEX silo_account_idx ON silo (username, domain);
-+
-diff --git a/utils/kamctl/sqlite/mtree-create.sql b/utils/kamctl/sqlite/mtree-create.sql
-new file mode 100644
-index 0000000..9b6f56f
---- /dev/null
-+++ b/utils/kamctl/sqlite/mtree-create.sql
-@@ -0,0 +1,8 @@
-+INSERT INTO version (table_name, table_version) values ('mtree','1');
-+CREATE TABLE mtree (
-+ id INTEGER PRIMARY KEY NOT NULL,
-+ tprefix VARCHAR(32) DEFAULT '' NOT NULL,
-+ tvalue VARCHAR(128) DEFAULT '' NOT NULL,
-+ CONSTRAINT mtree_tprefix_idx UNIQUE (tprefix)
-+);
-+
-diff --git a/utils/kamctl/sqlite/pdt-create.sql b/utils/kamctl/sqlite/pdt-create.sql
-new file mode 100644
-index 0000000..46b517a
---- /dev/null
-+++ b/utils/kamctl/sqlite/pdt-create.sql
-@@ -0,0 +1,9 @@
-+INSERT INTO version (table_name, table_version) values ('pdt','1');
-+CREATE TABLE pdt (
-+ id INTEGER PRIMARY KEY NOT NULL,
-+ sdomain VARCHAR(128) NOT NULL,
-+ prefix VARCHAR(32) NOT NULL,
-+ domain VARCHAR(128) DEFAULT '' NOT NULL,
-+ CONSTRAINT pdt_sdomain_prefix_idx UNIQUE (sdomain, prefix)
-+);
-+
-diff --git a/utils/kamctl/sqlite/permissions-create.sql b/utils/kamctl/sqlite/permissions-create.sql
-new file mode 100644
-index 0000000..ff3ac56
---- /dev/null
-+++ b/utils/kamctl/sqlite/permissions-create.sql
-@@ -0,0 +1,21 @@
-+INSERT INTO version (table_name, table_version) values ('trusted','5');
-+CREATE TABLE trusted (
-+ id INTEGER PRIMARY KEY NOT NULL,
-+ src_ip VARCHAR(50) NOT NULL,
-+ proto VARCHAR(4) NOT NULL,
-+ from_pattern VARCHAR(64) DEFAULT NULL,
-+ tag VARCHAR(64)
-+);
-+
-+CREATE INDEX trusted_peer_idx ON trusted (src_ip);
-+
-+INSERT INTO version (table_name, table_version) values ('address','4');
-+CREATE TABLE address (
-+ id INTEGER PRIMARY KEY NOT NULL,
-+ grp SMALLINT DEFAULT 1 NOT NULL,
-+ ip_addr VARCHAR(15) NOT NULL,
-+ mask SMALLINT DEFAULT 32 NOT NULL,
-+ port SMALLINT DEFAULT 0 NOT NULL,
-+ tag VARCHAR(64)
-+);
-+
-diff --git a/utils/kamctl/sqlite/presence-create.sql b/utils/kamctl/sqlite/presence-create.sql
-new file mode 100644
-index 0000000..fe89b36
---- /dev/null
-+++ b/utils/kamctl/sqlite/presence-create.sql
-@@ -0,0 +1,92 @@
-+INSERT INTO version (table_name, table_version) values ('presentity','3');
-+CREATE TABLE presentity (
-+ id INTEGER PRIMARY KEY NOT NULL,
-+ username VARCHAR(64) NOT NULL,
-+ domain VARCHAR(64) NOT NULL,
-+ event VARCHAR(64) NOT NULL,
-+ etag VARCHAR(64) NOT NULL,
-+ expires INTEGER NOT NULL,
-+ received_time INTEGER NOT NULL,
-+ body BYTEA NOT NULL,
-+ sender VARCHAR(128) NOT NULL,
-+ CONSTRAINT presentity_presentity_idx UNIQUE (username, domain, event, etag)
-+);
-+
-+INSERT INTO version (table_name, table_version) values ('active_watchers','9');
-+CREATE TABLE active_watchers (
-+ id INTEGER PRIMARY KEY NOT NULL,
-+ presentity_uri VARCHAR(128) NOT NULL,
-+ watcher_username VARCHAR(64) NOT NULL,
-+ watcher_domain VARCHAR(64) NOT NULL,
-+ to_user VARCHAR(64) NOT NULL,
-+ to_domain VARCHAR(64) NOT NULL,
-+ event VARCHAR(64) DEFAULT 'presence' NOT NULL,
-+ event_id VARCHAR(64),
-+ to_tag VARCHAR(64) NOT NULL,
-+ from_tag VARCHAR(64) NOT NULL,
-+ callid VARCHAR(128) NOT NULL,
-+ local_cseq INTEGER NOT NULL,
-+ remote_cseq INTEGER NOT NULL,
-+ contact VARCHAR(128) NOT NULL,
-+ record_route TEXT,
-+ expires INTEGER NOT NULL,
-+ status INTEGER DEFAULT 2 NOT NULL,
-+ reason VARCHAR(64) NOT NULL,
-+ version INTEGER DEFAULT 0 NOT NULL,
-+ socket_info VARCHAR(64) NOT NULL,
-+ local_contact VARCHAR(128) NOT NULL,
-+ CONSTRAINT active_watchers_active_watchers_idx UNIQUE (presentity_uri, callid, to_tag, from_tag)
-+);
-+
-+INSERT INTO version (table_name, table_version) values ('watchers','3');
-+CREATE TABLE watchers (
-+ id INTEGER PRIMARY KEY NOT NULL,
-+ presentity_uri VARCHAR(128) NOT NULL,
-+ watcher_username VARCHAR(64) NOT NULL,
-+ watcher_domain VARCHAR(64) NOT NULL,
-+ event VARCHAR(64) DEFAULT 'presence' NOT NULL,
-+ status INTEGER NOT NULL,
-+ reason VARCHAR(64),
-+ inserted_time INTEGER NOT NULL,
-+ CONSTRAINT watchers_watcher_idx UNIQUE (presentity_uri, watcher_username, watcher_domain, event)
-+);
-+
-+INSERT INTO version (table_name, table_version) values ('xcap','3');
-+CREATE TABLE xcap (
-+ id INTEGER PRIMARY KEY NOT NULL,
-+ username VARCHAR(64) NOT NULL,
-+ domain VARCHAR(64) NOT NULL,
-+ doc BYTEA NOT NULL,
-+ doc_type INTEGER NOT NULL,
-+ etag VARCHAR(64) NOT NULL,
-+ source INTEGER NOT NULL,
-+ doc_uri VARCHAR(128) NOT NULL,
-+ port INTEGER NOT NULL,
-+ CONSTRAINT xcap_account_doc_type_idx UNIQUE (username, domain, doc_type, doc_uri)
-+);
-+
-+CREATE INDEX xcap_source_idx ON xcap (source);
-+
-+INSERT INTO version (table_name, table_version) values ('pua','6');
-+CREATE TABLE pua (
-+ id INTEGER PRIMARY KEY NOT NULL,
-+ pres_uri VARCHAR(128) NOT NULL,
-+ pres_id VARCHAR(64) NOT NULL,
-+ event INTEGER NOT NULL,
-+ expires INTEGER NOT NULL,
-+ desired_expires INTEGER NOT NULL,
-+ flag INTEGER NOT NULL,
-+ etag VARCHAR(64) NOT NULL,
-+ tuple_id VARCHAR(64),
-+ watcher_uri VARCHAR(128) NOT NULL,
-+ call_id VARCHAR(128) NOT NULL,
-+ to_tag VARCHAR(64) NOT NULL,
-+ from_tag VARCHAR(64) NOT NULL,
-+ cseq INTEGER NOT NULL,
-+ record_route TEXT,
-+ contact VARCHAR(128) NOT NULL,
-+ remote_contact VARCHAR(128) NOT NULL,
-+ version INTEGER NOT NULL,
-+ extra_headers TEXT NOT NULL
-+);
-+
-diff --git a/utils/kamctl/sqlite/purple-create.sql b/utils/kamctl/sqlite/purple-create.sql
-new file mode 100644
-index 0000000..b58c53e
---- /dev/null
-+++ b/utils/kamctl/sqlite/purple-create.sql
-@@ -0,0 +1,9 @@
-+INSERT INTO version (table_name, table_version) values ('purplemap','1');
-+CREATE TABLE purplemap (
-+ id INTEGER PRIMARY KEY NOT NULL,
-+ sip_user VARCHAR(128) NOT NULL,
-+ ext_user VARCHAR(128) NOT NULL,
-+ ext_prot VARCHAR(16) NOT NULL,
-+ ext_pass VARCHAR(64)
-+);
-+
-diff --git a/utils/kamctl/sqlite/registrar-create.sql b/utils/kamctl/sqlite/registrar-create.sql
-new file mode 100644
-index 0000000..68f2adc
---- /dev/null
-+++ b/utils/kamctl/sqlite/registrar-create.sql
-@@ -0,0 +1,22 @@
-+INSERT INTO version (table_name, table_version) values ('aliases','1004');
-+CREATE TABLE aliases (
-+ id INTEGER PRIMARY KEY NOT NULL,
-+ username VARCHAR(64) DEFAULT '' NOT NULL,
-+ domain VARCHAR(64) DEFAULT NULL,
-+ contact VARCHAR(255) DEFAULT '' NOT NULL,
-+ received VARCHAR(128) DEFAULT NULL,
-+ path VARCHAR(128) DEFAULT NULL,
-+ expires TIMESTAMP WITHOUT TIME ZONE DEFAULT '2020-05-28 21:32:15' NOT NULL,
-+ q REAL DEFAULT 1.0 NOT NULL,
-+ callid VARCHAR(255) DEFAULT 'Default-Call-ID' NOT NULL,
-+ cseq INTEGER DEFAULT 13 NOT NULL,
-+ last_modified TIMESTAMP WITHOUT TIME ZONE DEFAULT '1900-01-01 00:00:01' NOT NULL,
-+ flags INTEGER DEFAULT 0 NOT NULL,
-+ cflags INTEGER DEFAULT 0 NOT NULL,
-+ user_agent VARCHAR(255) DEFAULT '' NOT NULL,
-+ socket VARCHAR(64) DEFAULT NULL,
-+ methods INTEGER DEFAULT NULL
-+);
-+
-+CREATE INDEX aliases_alias_idx ON aliases (username, domain, contact);
-+
-diff --git a/utils/kamctl/sqlite/rls-create.sql b/utils/kamctl/sqlite/rls-create.sql
-new file mode 100644
-index 0000000..b15120d
---- /dev/null
-+++ b/utils/kamctl/sqlite/rls-create.sql
-@@ -0,0 +1,42 @@
-+INSERT INTO version (table_name, table_version) values ('rls_presentity','0');
-+CREATE TABLE rls_presentity (
-+ id INTEGER PRIMARY KEY NOT NULL,
-+ rlsubs_did VARCHAR(255) NOT NULL,
-+ resource_uri VARCHAR(128) NOT NULL,
-+ content_type VARCHAR(64) NOT NULL,
-+ presence_state BYTEA NOT NULL,
-+ expires INTEGER NOT NULL,
-+ updated INTEGER NOT NULL,
-+ auth_state INTEGER NOT NULL,
-+ reason VARCHAR(64) NOT NULL,
-+ CONSTRAINT rls_presentity_rls_presentity_idx UNIQUE (rlsubs_did, resource_uri)
-+);
-+
-+CREATE INDEX rls_presentity_updated_idx ON rls_presentity (updated);
-+
-+INSERT INTO version (table_name, table_version) values ('rls_watchers','1');
-+CREATE TABLE rls_watchers (
-+ id INTEGER PRIMARY KEY NOT NULL,
-+ presentity_uri VARCHAR(128) NOT NULL,
-+ to_user VARCHAR(64) NOT NULL,
-+ to_domain VARCHAR(64) NOT NULL,
-+ watcher_username VARCHAR(64) NOT NULL,
-+ watcher_domain VARCHAR(64) NOT NULL,
-+ event VARCHAR(64) DEFAULT 'presence' NOT NULL,
-+ event_id VARCHAR(64),
-+ to_tag VARCHAR(64) NOT NULL,
-+ from_tag VARCHAR(64) NOT NULL,
-+ callid VARCHAR(64) NOT NULL,
-+ local_cseq INTEGER NOT NULL,
-+ remote_cseq INTEGER NOT NULL,
-+ contact VARCHAR(64) NOT NULL,
-+ record_route TEXT,
-+ expires INTEGER NOT NULL,
-+ status INTEGER DEFAULT 2 NOT NULL,
-+ reason VARCHAR(64) NOT NULL,
-+ version INTEGER DEFAULT 0 NOT NULL,
-+ socket_info VARCHAR(64) NOT NULL,
-+ local_contact VARCHAR(128) NOT NULL,
-+ CONSTRAINT rls_watchers_rls_watcher_idx UNIQUE (presentity_uri, callid, to_tag, from_tag)
-+);
-+
-diff --git a/utils/kamctl/sqlite/siptrace-create.sql b/utils/kamctl/sqlite/siptrace-create.sql
-new file mode 100644
-index 0000000..a784d0b
---- /dev/null
-+++ b/utils/kamctl/sqlite/siptrace-create.sql
-@@ -0,0 +1,20 @@
-+INSERT INTO version (table_name, table_version) values ('sip_trace','2');
-+CREATE TABLE sip_trace (
-+ id INTEGER PRIMARY KEY NOT NULL,
-+ time_stamp TIMESTAMP WITHOUT TIME ZONE DEFAULT '1900-01-01 00:00:01' NOT NULL,
-+ callid VARCHAR(255) DEFAULT '' NOT NULL,
-+ traced_user VARCHAR(128) DEFAULT '' NOT NULL,
-+ msg TEXT NOT NULL,
-+ method VARCHAR(50) DEFAULT '' NOT NULL,
-+ status VARCHAR(128) DEFAULT '' NOT NULL,
-+ fromip VARCHAR(50) DEFAULT '' NOT NULL,
-+ toip VARCHAR(50) DEFAULT '' NOT NULL,
-+ fromtag VARCHAR(64) DEFAULT '' NOT NULL,
-+ direction VARCHAR(4) DEFAULT '' NOT NULL
-+);
-+
-+CREATE INDEX sip_trace_traced_user_idx ON sip_trace (traced_user);
-+CREATE INDEX sip_trace_date_idx ON sip_trace (time_stamp);
-+CREATE INDEX sip_trace_fromip_idx ON sip_trace (fromip);
-+CREATE INDEX sip_trace_callid_idx ON sip_trace (callid);
-+
-diff --git a/utils/kamctl/sqlite/speeddial-create.sql b/utils/kamctl/sqlite/speeddial-create.sql
-new file mode 100644
-index 0000000..64e1ae6
---- /dev/null
-+++ b/utils/kamctl/sqlite/speeddial-create.sql
-@@ -0,0 +1,14 @@
-+INSERT INTO version (table_name, table_version) values ('speed_dial','2');
-+CREATE TABLE speed_dial (
-+ id INTEGER PRIMARY KEY NOT NULL,
-+ username VARCHAR(64) DEFAULT '' NOT NULL,
-+ domain VARCHAR(64) DEFAULT '' NOT NULL,
-+ sd_username VARCHAR(64) DEFAULT '' NOT NULL,
-+ sd_domain VARCHAR(64) DEFAULT '' NOT NULL,
-+ new_uri VARCHAR(128) DEFAULT '' NOT NULL,
-+ fname VARCHAR(64) DEFAULT '' NOT NULL,
-+ lname VARCHAR(64) DEFAULT '' NOT NULL,
-+ description VARCHAR(64) DEFAULT '' NOT NULL,
-+ CONSTRAINT speed_dial_speed_dial_idx UNIQUE (username, domain, sd_domain, sd_username)
-+);
-+
-diff --git a/utils/kamctl/sqlite/standard-create.sql b/utils/kamctl/sqlite/standard-create.sql
-new file mode 100644
-index 0000000..0add99d
---- /dev/null
-+++ b/utils/kamctl/sqlite/standard-create.sql
-@@ -0,0 +1,5 @@
-+CREATE TABLE version (
-+ table_name VARCHAR(32) NOT NULL,
-+ table_version INTEGER DEFAULT 0 NOT NULL
-+);
-+
-diff --git a/utils/kamctl/sqlite/uac-create.sql b/utils/kamctl/sqlite/uac-create.sql
-new file mode 100644
-index 0000000..f0cf80d
---- /dev/null
-+++ b/utils/kamctl/sqlite/uac-create.sql
-@@ -0,0 +1,16 @@
-+INSERT INTO version (table_name, table_version) values ('uacreg','1');
-+CREATE TABLE uacreg (
-+ id INTEGER PRIMARY KEY NOT NULL,
-+ l_uuid VARCHAR(64) DEFAULT '' NOT NULL,
-+ l_username VARCHAR(64) DEFAULT '' NOT NULL,
-+ l_domain VARCHAR(128) DEFAULT '' NOT NULL,
-+ r_username VARCHAR(64) DEFAULT '' NOT NULL,
-+ r_domain VARCHAR(128) DEFAULT '' NOT NULL,
-+ realm VARCHAR(64) DEFAULT '' NOT NULL,
-+ auth_username VARCHAR(64) DEFAULT '' NOT NULL,
-+ auth_password VARCHAR(64) DEFAULT '' NOT NULL,
-+ auth_proxy VARCHAR(64) DEFAULT '' NOT NULL,
-+ expires INTEGER DEFAULT 0 NOT NULL,
-+ CONSTRAINT uacreg_l_uuid_idx UNIQUE (l_uuid)
-+);
-+
-diff --git a/utils/kamctl/sqlite/uri_db-create.sql b/utils/kamctl/sqlite/uri_db-create.sql
-new file mode 100644
-index 0000000..8e291fc
---- /dev/null
-+++ b/utils/kamctl/sqlite/uri_db-create.sql
-@@ -0,0 +1,10 @@
-+INSERT INTO version (table_name, table_version) values ('uri','1');
-+CREATE TABLE uri (
-+ id INTEGER PRIMARY KEY NOT NULL,
-+ username VARCHAR(64) DEFAULT '' NOT NULL,
-+ domain VARCHAR(64) DEFAULT '' NOT NULL,
-+ uri_user VARCHAR(64) DEFAULT '' NOT NULL,
-+ last_modified TIMESTAMP WITHOUT TIME ZONE DEFAULT '1900-01-01 00:00:01' NOT NULL,
-+ CONSTRAINT uri_account_idx UNIQUE (username, domain, uri_user)
-+);
-+
-diff --git a/utils/kamctl/sqlite/userblacklist-create.sql b/utils/kamctl/sqlite/userblacklist-create.sql
-new file mode 100644
-index 0000000..34d9eb1
---- /dev/null
-+++ b/utils/kamctl/sqlite/userblacklist-create.sql
-@@ -0,0 +1,21 @@
-+INSERT INTO version (table_name, table_version) values ('userblacklist','1');
-+CREATE TABLE userblacklist (
-+ id INTEGER PRIMARY KEY NOT NULL,
-+ username VARCHAR(64) DEFAULT '' NOT NULL,
-+ domain VARCHAR(64) DEFAULT '' NOT NULL,
-+ prefix VARCHAR(64) DEFAULT '' NOT NULL,
-+ whitelist SMALLINT DEFAULT 0 NOT NULL
-+);
-+
-+CREATE INDEX userblacklist_userblacklist_idx ON userblacklist (username, domain, prefix);
-+
-+INSERT INTO version (table_name, table_version) values ('globalblacklist','1');
-+CREATE TABLE globalblacklist (
-+ id INTEGER PRIMARY KEY NOT NULL,
-+ prefix VARCHAR(64) DEFAULT '' NOT NULL,
-+ whitelist SMALLINT DEFAULT 0 NOT NULL,
-+ description VARCHAR(255) DEFAULT NULL
-+);
-+
-+CREATE INDEX globalblacklist_globalblacklist_idx ON globalblacklist (prefix);
-+
-diff --git a/utils/kamctl/sqlite/usrloc-create.sql b/utils/kamctl/sqlite/usrloc-create.sql
-new file mode 100644
-index 0000000..6eb7d07
---- /dev/null
-+++ b/utils/kamctl/sqlite/usrloc-create.sql
-@@ -0,0 +1,22 @@
-+INSERT INTO version (table_name, table_version) values ('location','1004');
-+CREATE TABLE location (
-+ id INTEGER PRIMARY KEY NOT NULL,
-+ username VARCHAR(64) DEFAULT '' NOT NULL,
-+ domain VARCHAR(64) DEFAULT NULL,
-+ contact VARCHAR(255) DEFAULT '' NOT NULL,
-+ received VARCHAR(128) DEFAULT NULL,
-+ path VARCHAR(128) DEFAULT NULL,
-+ expires TIMESTAMP WITHOUT TIME ZONE DEFAULT '2020-05-28 21:32:15' NOT NULL,
-+ q REAL DEFAULT 1.0 NOT NULL,
-+ callid VARCHAR(255) DEFAULT 'Default-Call-ID' NOT NULL,
-+ cseq INTEGER DEFAULT 13 NOT NULL,
-+ last_modified TIMESTAMP WITHOUT TIME ZONE DEFAULT '1900-01-01 00:00:01' NOT NULL,
-+ flags INTEGER DEFAULT 0 NOT NULL,
-+ cflags INTEGER DEFAULT 0 NOT NULL,
-+ user_agent VARCHAR(255) DEFAULT '' NOT NULL,
-+ socket VARCHAR(64) DEFAULT NULL,
-+ methods INTEGER DEFAULT NULL
-+);
-+
-+CREATE INDEX location_account_contact_idx ON location (username, domain, contact);
-+
---
-1.7.4.5
-
diff --git a/main/kamailio/APKBUILD b/main/kamailio/APKBUILD
index 9933495068..b97dd43f2a 100644
--- a/main/kamailio/APKBUILD
+++ b/main/kamailio/APKBUILD
@@ -1,9 +1,9 @@
# Contributor: Michael Mason <ms13sp@gmail.com>
-# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+# Maintainer: Nathan Angelacos <nangel@alpinelinux.org>
pkgname=kamailio
-pkgver=3.1.4
-pkgrel=1
-pkgdesc="Open Source SIP Server"
+pkgver=3.2.0
+pkgrel=0
+pkgdesc="Open Source SIP Proxy"
url="http://www.kamailio.org/"
pkgusers="kamailio"
pkggroups="kamailio"
@@ -12,31 +12,29 @@ license="GPL"
depends=
arch=all
makedepends="bison flex expat-dev postgresql-dev pcre-dev mysql-dev
- libxml2-dev curl-dev unixodbc-dev confuse-dev ncurses-dev sqlite-dev"
+ libxml2-dev curl-dev unixodbc-dev confuse-dev ncurses-dev sqlite-dev lua-dev"
install="$pkgname.pre-install $pkgname.pre-upgrade"
subpackages="$pkgname-doc $pkgname-postgres $pkgname-presence $pkgname-pcre
- $pkgname-mediaproxy $pkgname-unixodbc $pkgname-mysql $pkgname-sqlite"
+ $pkgname-mediaproxy $pkgname-unixodbc $pkgname-mysql $pkgname-sqlite $pkgname-lua"
source="http://www.kamailio.org/pub/kamailio/$pkgver/src/kamailio-${pkgver}_src.tar.gz
kamailio.cfg
kamailio.initd
- kamailio-3.1-backslash.patch
- sqlite.patch
- 0001-utils-add-sqlite-support-to-kamctl-kamdbctl.patch
- 0001-utils-Install-the-sqlite-scripts.patch
"
_builddir="$srcdir"/$pkgname-$pkgver
_default="carrierroute xmlrpc tm"
-_presence="presence presence_xml presence_mwi pua pua_bla pua_mi pua_usrloc pua_xmpp rls xcap_client presence_dialoginfo pua_dialoginfo"
+_presence="presence presence_xml presence_mwi pua pua_bla pua_mi pua_usrloc pua_xmpp rls xcap_client presence_dialoginfo pua_dialoginfo presence_reginfo"
_pcre="dialplan lcr regex"
_postgres="db_postgres"
_mysql="db_mysql"
_mediaproxy="mediaproxy"
_odbc="db_unixodbc"
+_sqlite="db_sqlite"
+_lua="app_lua"
# Makefile does not handle newline
-_modules="$_default $_postgres $_mediaproxy $_odbc $_presence $_mysql $_pcre"
+_modules="$_default $_postgres $_mediaproxy $_odbc $_presence $_mysql $_pcre $_lua $_sqlite"
prepare() {
@@ -116,6 +114,11 @@ _mv_mod_k() {
}
+lua() {
+ pkgdesc="Lua script support for kamailio"
+ _mv_mod app_lua
+}
+
mysql() {
pkgdesc="MySQL support for kamailio"
depends="kamailio mysql-client"
@@ -149,7 +152,7 @@ sqlite() {
_mv_mod_k db_sqlite || return 1
mkdir -p "$subpkgdir"/usr/share/kamailio \
"$subpkgdir"/usr/lib/kamailio/kamctl
- mv "$pkgdir"/usr/share/kamailio/sqlite \
+ mv "$pkgdir"/usr/share/kamailio/db_sqlite \
"$subpkgdir"/usr/share/kamailio/ || return 1
mv "$pkgdir"/usr/lib/kamailio/kamctl/*.sqlite \
"$subpkgdir"/usr/lib/kamailio/kamctl/ || return 1
@@ -178,10 +181,6 @@ unixodbc() {
_mv_mod_k $_odbc
}
-md5sums="15124e1f09108b63c6929ca97cdbce9a kamailio-3.1.4_src.tar.gz
+md5sums="d2b452e5ec4927b2ec8decdda5966bd9 kamailio-3.2.0_src.tar.gz
a3c959ec568c43a905710e7d25cd8c25 kamailio.cfg
-c0dc4e13d9e57feb99f016d3ee443c0b kamailio.initd
-8454687f047f703c5cb443db3a0003a8 kamailio-3.1-backslash.patch
-199df21eaa4856dcacdcc438f72765f1 sqlite.patch
-9611a1246bc522cbfa5d8d99b3a55ac8 0001-utils-add-sqlite-support-to-kamctl-kamdbctl.patch
-8751c968e57d7c1bd7342d83d5a8d48d 0001-utils-Install-the-sqlite-scripts.patch"
+c0dc4e13d9e57feb99f016d3ee443c0b kamailio.initd"
diff --git a/main/kamailio/kamailio-3.1-backslash.patch b/main/kamailio/kamailio-3.1-backslash.patch
deleted file mode 100644
index 85e0f3fbf0..0000000000
--- a/main/kamailio/kamailio-3.1-backslash.patch
+++ /dev/null
@@ -1,44 +0,0 @@
-diff --git a/utils/kamctl/kamdbctl.base b/utils/kamctl/kamdbctl.base
-index acc7d4a..3a50270 100644
---- a/utils/kamctl/kamdbctl.base
-+++ b/utils/kamctl/kamdbctl.base
-@@ -32,14 +32,14 @@ INSTALL_PRESENCE_TABLES=${INSTALL_PRESENCE_TABLES:-ask}
-
- # Used by dbtext and db_berkeley to define tables to be created, used by
- # postgres to do the grants
--STANDARD_TABLES=${STANDARD_TABLES:-version acc dbaliases domain grp
-- uri speed_dial lcr_gw lcr_rule lcr_rule_target pdt subscriber
-- location re_grp trusted address missed_calls usr_preferences
-+STANDARD_TABLES=${STANDARD_TABLES:-version acc dbaliases domain grp \
-+ uri speed_dial lcr_gw lcr_rule lcr_rule_target pdt subscriber \
-+ location re_grp trusted address missed_calls usr_preferences \
- aliases silo dialog dispatcher dialplan}
--EXTRA_TABLES=${EXTRA_TABLES:-imc_members imc_rooms cpl sip_trace domainpolicy
-- carrierroute carrier_name domain_name carrierfailureroute userblacklist
-+EXTRA_TABLES=${EXTRA_TABLES:-imc_members imc_rooms cpl sip_trace domainpolicy \
-+ carrierroute carrier_name domain_name carrierfailureroute userblacklist \
- globalblacklist htable purplemap uacreg}
--PRESENCE_TABLES=${PRESENCE_TABLES:-presentity active_watchers watchers xcap
-+PRESENCE_TABLES=${PRESENCE_TABLES:-presentity active_watchers watchers xcap \
- pua rls_presentity rls_watchers}
-
- # SQL definitions
-@@ -62,11 +62,11 @@ GREP=${GREP:-grep}
- SED=${SED:-sed}
-
- # define what modules should be installed
--STANDARD_MODULES=${STANDARD_MODULES:-standard acc lcr domain group permissions
-- registrar usrloc msilo alias_db uri_db
-- speeddial avpops auth_db pdt dialog dispatcher
-+STANDARD_MODULES=${STANDARD_MODULES:-standard acc lcr domain group permissions \
-+ registrar usrloc msilo alias_db uri_db \
-+ speeddial avpops auth_db pdt dialog dispatcher \
- dialplan}
--EXTRA_MODULES=${EXTRA_MODULES:-imc cpl siptrace domainpolicy carrierroute
-+EXTRA_MODULES=${EXTRA_MODULES:-imc cpl siptrace domainpolicy carrierroute \
- userblacklist htable purple uac}
-
- ############################################################
---
-1.7.1
-
diff --git a/main/kamailio/sqlite.patch b/main/kamailio/sqlite.patch
deleted file mode 100644
index 38cae2ec90..0000000000
--- a/main/kamailio/sqlite.patch
+++ /dev/null
@@ -1,712 +0,0 @@
-Index: kamailio-3.1.1/modules_k/db_sqlite/Makefile
-===================================================================
---- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ kamailio-3.1.1/modules_k/db_sqlite/Makefile 2011-01-05 14:19:03.000000000 +0200
-@@ -0,0 +1,15 @@
-+# $Id$
-+#
-+# WARNING: do not run this directly, it should be run by the master Makefile
-+
-+include ../../Makefile.defs
-+auto_gen=
-+NAME=db_sqlite.so
-+
-+LIBS +=-lsqlite3
-+
-+DEFS+=-DOPENSER_MOD_INTERFACE
-+
-+SERLIBPATH=../../lib
-+SER_LIBS+=$(SERLIBPATH)/srdb1/srdb1
-+include ../../Makefile.modules
-Index: kamailio-3.1.1/modules_k/db_sqlite/db_sqlite.c
-===================================================================
---- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ kamailio-3.1.1/modules_k/db_sqlite/db_sqlite.c 2011-01-05 14:21:13.000000000 +0200
-@@ -0,0 +1,90 @@
-+/*
-+ * $Id$
-+ *
-+ * SQlite module interface
-+ *
-+ * Copyright (C) 2010 Timo Teräs
-+ *
-+ * This file is part of Kamailio, a free SIP server.
-+ *
-+ * Kamailio is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or
-+ * (at your option) any later version
-+ *
-+ * Kamailio is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU General Public License
-+ * along with this program; if not, write to the Free Software
-+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-+ */
-+
-+#include <sys/time.h>
-+#include <sqlite3.h>
-+
-+#include "../../sr_module.h"
-+#include "../../lib/srdb1/db.h"
-+#include "dbase.h"
-+
-+MODULE_VERSION
-+
-+static int sqlite_bind_api(db_func_t *dbb)
-+{
-+ if(dbb==NULL)
-+ return -1;
-+
-+ memset(dbb, 0, sizeof(db_func_t));
-+
-+ dbb->use_table = db_sqlite_use_table;
-+ dbb->init = db_sqlite_init;
-+ dbb->close = db_sqlite_close;
-+ dbb->free_result = db_sqlite_free_result;
-+ dbb->query = db_sqlite_query;
-+ dbb->insert = db_sqlite_insert;
-+ dbb->delete = db_sqlite_delete;
-+ dbb->update = db_sqlite_update;
-+ dbb->raw_query = db_sqlite_raw_query;
-+
-+ return 0;
-+}
-+
-+static cmd_export_t cmds[] = {
-+ {"db_bind_api", (cmd_function)sqlite_bind_api, 0, 0, 0, 0},
-+ {0, 0, 0, 0, 0, 0}
-+};
-+
-+static int sqlite_mod_init(void)
-+{
-+ sqlite3_initialize();
-+
-+ LM_INFO("SQlite library version %s (compiled using %s)\n",
-+ sqlite3_libversion(),
-+ SQLITE_VERSION);
-+ return 0;
-+}
-+
-+
-+static void sqlite_mod_destroy(void)
-+{
-+ LM_INFO("SQlite terminate\n");
-+
-+ sqlite3_shutdown();
-+}
-+
-+struct module_exports exports = {
-+ "db_sqlite",
-+ DEFAULT_DLFLAGS, /* dlopen flags */
-+ cmds, /* module commands */
-+ 0, /* module parameters */
-+ 0, /* exported statistics */
-+ 0, /* exported MI functions */
-+ 0, /* exported pseudo-variables */
-+ 0, /* extra processes */
-+ sqlite_mod_init, /* module initialization function */
-+ 0, /* response function*/
-+ sqlite_mod_destroy, /* destroy function */
-+ 0 /* per-child init function */
-+};
-Index: kamailio-3.1.1/modules_k/db_sqlite/dbase.c
-===================================================================
---- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ kamailio-3.1.1/modules_k/db_sqlite/dbase.c 2011-01-05 14:20:47.000000000 +0200
-@@ -0,0 +1,515 @@
-+/*
-+ * $Id$
-+ *
-+ * SQlite module core functions
-+ *
-+ * Copyright (C) 2010 Timo Teräs
-+ *
-+ * This file is part of Kamailio, a free SIP server.
-+ *
-+ * Kamailio is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or
-+ * (at your option) any later version
-+ *
-+ * Kamailio is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU General Public License
-+ * along with this program; if not, write to the Free Software
-+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-+ */
-+
-+#include "../../mem/mem.h"
-+#include "../../dprint.h"
-+#include "../../lib/srdb1/db_pool.h"
-+#include "../../lib/srdb1/db_ut.h"
-+#include "../../lib/srdb1/db_res.h"
-+#include "../../lib/srdb1/db_query.h"
-+#include "dbase.h"
-+
-+static time_t sqlite_to_timet(double rT)
-+{
-+ return 86400.0*(rT - 2440587.5) + 0.5;
-+}
-+
-+static double timet_to_sqlite(time_t t)
-+{
-+ return ((((double) t) - 0.5) / 86400.0) + 2440587.5;
-+}
-+
-+/*
-+ * Initialize database module
-+ * No function should be called before this
-+ */
-+
-+static struct sqlite_connection * db_sqlite_new_connection(const struct db_id* id)
-+{
-+ struct sqlite_connection *con;
-+ int rc;
-+
-+ con = pkg_malloc(sizeof(*con));
-+ if (!con) {
-+ LM_ERR("failed to allocate driver connection\n");
-+ return NULL;
-+ }
-+
-+ memset(con, 0, sizeof(*con));
-+ con->hdr.ref = 1;
-+ con->hdr.id = (struct db_id*) id; /* set here - freed on error */
-+
-+ rc = sqlite3_open_v2(id->database, &con->conn,
-+ SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL);
-+ if (rc != SQLITE_OK) {
-+ pkg_free(con);
-+ LM_ERR("failed to open sqlite database '%s'\n", id->database);
-+ return NULL;
-+ }
-+
-+ return con;
-+}
-+
-+db1_con_t* db_sqlite_init(const str* _url)
-+{
-+ return db_do_init(_url, (void *) db_sqlite_new_connection);
-+}
-+
-+
-+/*
-+ * Shut down database module
-+ * No function should be called after this
-+ */
-+
-+static void db_sqlite_free_connection(struct sqlite_connection* con)
-+{
-+ if (!con) return;
-+
-+ sqlite3_close(con->conn);
-+ free_db_id(con->hdr.id);
-+ pkg_free(con);
-+}
-+
-+void db_sqlite_close(db1_con_t* _h)
-+{
-+ db_do_close(_h, db_sqlite_free_connection);
-+}
-+
-+/*
-+ * Release a result set from memory
-+ */
-+int db_sqlite_free_result(db1_con_t* _h, db1_res_t* _r)
-+{
-+ if (!_h || !_r) {
-+ LM_ERR("invalid parameter value\n");
-+ return -1;
-+ }
-+
-+ if (db_free_result(_r) < 0)
-+ {
-+ LM_ERR("failed to free result structure\n");
-+ return -1;
-+ }
-+ return 0;
-+}
-+
-+/*
-+ * Store name of table that will be used by
-+ * subsequent database functions
-+ */
-+int db_sqlite_use_table(db1_con_t* _h, const str* _t)
-+{
-+ return db_use_table(_h, _t);
-+}
-+
-+/*
-+ * Reset query context
-+ */
-+static void db_sqlite_cleanup_query(const db1_con_t* _c)
-+{
-+ struct sqlite_connection *conn = CON_SQLITE(_c);
-+ int rc;
-+
-+ if (conn->stmt != NULL) {
-+ rc = sqlite3_finalize(conn->stmt);
-+ if (rc != SQLITE_OK)
-+ LM_ERR("finalize failed: %s\n",
-+ sqlite3_errmsg(conn->conn));
-+ }
-+
-+ conn->stmt = NULL;
-+ conn->bindpos = 0;
-+}
-+
-+/*
-+ * Convert value to sql-string as db bind index
-+ */
-+static int db_sqlite_val2str(const db1_con_t* _c, const db_val_t* _v, char* _s, int* _len)
-+{
-+ struct sqlite_connection *conn;
-+ int ret;
-+
-+ if (!_c || !_v || !_s || !_len || *_len <= 0) {
-+ LM_ERR("invalid parameter value\n");
-+ return -1;
-+ }
-+
-+ conn = CON_SQLITE(_c);
-+ if (conn->bindpos >= DB_SQLITE_MAX_BINDS) {
-+ LM_ERR("too many bindings, recompile with larger DB_SQLITE_MAX_BINDS\n");
-+ return -2;
-+ }
-+
-+ conn->bindarg[conn->bindpos] = _v;
-+ ret = snprintf(_s, *_len, "?%u", ++conn->bindpos);
-+ if ((unsigned)ret >= (unsigned) *_len)
-+ return -11;
-+
-+ *_len = ret;
-+ return 0;
-+}
-+
-+/*
-+ * Send an SQL query to the server
-+ */
-+static int db_sqlite_submit_query(const db1_con_t* _h, const str* _s)
-+{
-+ struct sqlite_connection *conn = CON_SQLITE(_h);
-+ sqlite3_stmt *stmt;
-+ const db_val_t *val;
-+ int rc, i;
-+
-+ LM_DBG("submit_query: %.*s\n", _s->len, _s->s);
-+
-+ rc = sqlite3_prepare_v2(conn->conn, _s->s, _s->len, &stmt, NULL);
-+ if (rc != SQLITE_OK) {
-+ LM_ERR("failed to prepare statement: %s\n",
-+ sqlite3_errmsg(conn->conn));
-+ return -1;
-+ }
-+ conn->stmt = stmt;
-+
-+ for (i = 1; i <= conn->bindpos; i++) {
-+ val = conn->bindarg[i-1];
-+ if (VAL_NULL(val)) {
-+ rc = sqlite3_bind_null(stmt, i);
-+ } else switch (VAL_TYPE(val)) {
-+ case DB1_INT:
-+ rc = sqlite3_bind_int(stmt, i, VAL_INT(val));
-+ break;
-+ case DB1_BIGINT:
-+ rc = sqlite3_bind_int64(stmt, i, VAL_BIGINT(val));
-+ break;
-+ case DB1_DOUBLE:
-+ rc = sqlite3_bind_double(stmt, i, VAL_DOUBLE(val));
-+ break;
-+ case DB1_STRING:
-+ rc = sqlite3_bind_text(stmt, i,
-+ VAL_STRING(val), -1, NULL);
-+ break;
-+ case DB1_STR:
-+ rc = sqlite3_bind_text(stmt, i,
-+ VAL_STR(val).s, VAL_STR(val).len, NULL);
-+ break;
-+ case DB1_DATETIME:
-+ rc = sqlite3_bind_double(stmt, i, timet_to_sqlite(VAL_TIME(val)));
-+ break;
-+ case DB1_BLOB:
-+ rc = sqlite3_bind_blob(stmt, i,
-+ VAL_BLOB(val).s, VAL_BLOB(val).len,
-+ NULL);
-+ break;
-+ case DB1_BITMAP:
-+ rc = sqlite3_bind_int(stmt, i, VAL_BITMAP(val));
-+ break;
-+ default:
-+ LM_ERR("unknown bind value type %d\n", VAL_TYPE(val));
-+ return -1;
-+ }
-+ if (rc != SQLITE_OK) {
-+ LM_ERR("Parameter bind failed: %s\n",
-+ sqlite3_errmsg(conn->conn));
-+ return -1;
-+ }
-+ }
-+
-+ return 0;
-+}
-+
-+static int decltype_to_dbtype(const char *decltype)
-+{
-+ /* SQlite3 has dynamic typing. It does not store the actual
-+ * exact type, instead it uses 'affinity' depending on the
-+ * value. We have to go through the declaration types to see
-+ * what to return. */
-+ if (strstr(decltype, "INT") != NULL ||
-+ strncasecmp(decltype, "SERIAL", 6) == 0)
-+ return DB1_INT;
-+ if (strstr(decltype, "CHAR") != NULL)
-+ return DB1_STRING;
-+ if (strstr(decltype, "TEXT") != NULL)
-+ return DB1_STR;
-+ if (strstr(decltype, "REAL") != NULL ||
-+ strstr(decltype, "FLOA") != NULL ||
-+ strstr(decltype, "DOUB") != NULL)
-+ return DB1_DOUBLE;
-+ if (strstr(decltype, "BLOB") != NULL)
-+ return DB1_BLOB;
-+ if (strncasecmp(decltype, "TIME", 4) == 0 ||
-+ strncasecmp(decltype, "DATE", 4) == 0)
-+ return DB1_DATETIME;
-+
-+ LM_ERR("sqlite decltype '%s' not recognized, defaulting to int",
-+ decltype);
-+ return DB1_INT;
-+}
-+
-+static str* str_dup(const char *_s)
-+{
-+ str *s;
-+ int len = strlen(_s);
-+
-+ s = (str*) pkg_malloc(sizeof(str)+len+1);
-+ s->len = len;
-+ s->s = ((char*)s) + sizeof(str);
-+ memcpy(s->s, _s, len);
-+ s->s[len] = '\0';
-+
-+ return s;
-+}
-+
-+static void str_assign(str* s, const char *_s, int len)
-+{
-+ s->s = (char *) pkg_malloc(len + 1);
-+ s->len = len;
-+ memcpy(s->s, _s, len);
-+ s->s[len] = 0;
-+}
-+
-+/*
-+ * Read database answer and fill the structure
-+ */
-+int db_sqlite_store_result(const db1_con_t* _h, db1_res_t** _r)
-+{
-+ struct sqlite_connection *conn = CON_SQLITE(_h);
-+ db1_res_t *res;
-+ int i, rc, num_rows = 0, num_alloc = 0;
-+ db_row_t *rows = NULL, *row;
-+ db_val_t *val;
-+
-+ res = db_new_result();
-+ if (res == NULL)
-+ goto no_mem;
-+
-+ while (1) {
-+ rc = sqlite3_step(conn->stmt);
-+ if (rc == SQLITE_DONE) {
-+ *_r = res;
-+ return 0;
-+ }
-+ if (rc != SQLITE_ROW) {
-+ LM_INFO("sqlite3_step failed: %s\n", sqlite3_errmsg(conn->conn));
-+ goto err;
-+ }
-+ if (num_rows == 0) {
-+ /* get column types */
-+ rc = sqlite3_column_count(conn->stmt);
-+ if (db_allocate_columns(res, rc) != 0)
-+ goto err;
-+ RES_COL_N(res) = rc;
-+
-+ for (i = 0; i < RES_COL_N(res); i++) {
-+ RES_NAMES(res)[i] = str_dup(sqlite3_column_name(conn->stmt, i));
-+ RES_TYPES(res)[i] = decltype_to_dbtype(sqlite3_column_decltype(conn->stmt, i));
-+ }
-+ }
-+ if (num_rows >= num_alloc) {
-+ if (num_alloc)
-+ num_alloc *= 2;
-+ else
-+ num_alloc = 8;
-+ rows = pkg_realloc(rows, sizeof(db_row_t) * num_alloc);
-+ if (rows == NULL)
-+ goto no_mem;
-+ RES_ROWS(res) = rows;
-+ }
-+
-+ row = &RES_ROWS(res)[num_rows];
-+ num_rows++;
-+ RES_ROW_N(res) = num_rows; /* rows in this result set */
-+ RES_NUM_ROWS(res) = num_rows; /* rows in total */
-+
-+ if (db_allocate_row(res, row) != 0)
-+ goto no_mem;
-+
-+ for (i = 0, val = ROW_VALUES(row); i < RES_COL_N(res); i++, val++) {
-+ VAL_TYPE(val) = RES_TYPES(res)[i];
-+ VAL_NULL(val) = 0;
-+ VAL_FREE(val) = 0;
-+ if (sqlite3_column_type(conn->stmt, i) == SQLITE_NULL) {
-+ VAL_NULL(val) = 1;
-+ } else switch (VAL_TYPE(val)) {
-+ case DB1_INT:
-+ VAL_INT(val) = sqlite3_column_int(conn->stmt, i);
-+ break;
-+ case DB1_BIGINT:
-+ VAL_BIGINT(val) = sqlite3_column_int64(conn->stmt, i);
-+ break;
-+ case DB1_STRING:
-+ /* first field of struct str* is the char* so we can just
-+ * do whatever DB1_STR case does */
-+ case DB1_STR:
-+ str_assign(&VAL_STR(val),
-+ (const char*) sqlite3_column_text(conn->stmt, i),
-+ sqlite3_column_bytes(conn->stmt, i));
-+ VAL_FREE(val) = 1;
-+ break;
-+ case DB1_DOUBLE:
-+ VAL_DOUBLE(val) = sqlite3_column_double(conn->stmt, i);
-+ break;
-+ case DB1_DATETIME:
-+ VAL_TIME(val) = sqlite_to_timet(sqlite3_column_double(conn->stmt, i));
-+ break;
-+ case DB1_BLOB:
-+ str_assign(&VAL_BLOB(val),
-+ (const char*) sqlite3_column_blob(conn->stmt, i),
-+ sqlite3_column_bytes(conn->stmt, i));
-+ VAL_FREE(val) = 1;
-+ break;
-+ default:
-+ LM_ERR("unhandled db-type\n");
-+ goto err;
-+ }
-+ }
-+ }
-+
-+no_mem:
-+ LM_ERR("no private memory left\n");
-+err:
-+ if (res)
-+ db_free_result(res);
-+ return -1;
-+}
-+
-+/*
-+ * Query table for specified rows
-+ * _h: structure representing database connection
-+ * _k: key names
-+ * _op: operators
-+ * _v: values of the keys that must match
-+ * _c: column names to return
-+ * _n: number of key=values pairs to compare
-+ * _nc: number of columns to return
-+ * _o: order by the specified column
-+ */
-+int db_sqlite_query(const db1_con_t* _h, const db_key_t* _k, const db_op_t* _op,
-+ const db_val_t* _v, const db_key_t* _c, int _n, int _nc,
-+ const db_key_t _o, db1_res_t** _r)
-+{
-+ int rc;
-+
-+ rc = db_do_query(_h, _k, _op, _v, _c, _n, _nc, _o, _r,
-+ db_sqlite_val2str,
-+ db_sqlite_submit_query,
-+ db_sqlite_store_result);
-+ db_sqlite_cleanup_query(_h);
-+
-+ return rc;
-+}
-+
-+static int db_sqlite_commit(const db1_con_t* _h)
-+{
-+ struct sqlite_connection *conn = CON_SQLITE(_h);
-+ int rc;
-+
-+ rc = sqlite3_step(conn->stmt);
-+ if (rc != SQLITE_DONE && rc != SQLITE_OK) {
-+ LM_ERR("sqlite commit failed: %s\n",
-+ sqlite3_errmsg(conn->conn));
-+ return -1;
-+ }
-+
-+ return 0;
-+}
-+
-+/*
-+ * Insert a row into specified table
-+ * _h: structure representing database connection
-+ * _k: key names
-+ * _v: values of the keys
-+ * _n: number of key=value pairs
-+ */
-+int db_sqlite_insert(const db1_con_t* _h, const db_key_t* _k, const db_val_t* _v,
-+ int _n)
-+{
-+ int rc = -1;
-+
-+ rc = db_do_insert(_h, _k, _v, _n,
-+ db_sqlite_val2str,
-+ db_sqlite_submit_query);
-+ if (rc == 0)
-+ rc = db_sqlite_commit(_h);
-+ db_sqlite_cleanup_query(_h);
-+
-+ return rc;
-+}
-+
-+
-+/*
-+ * Delete a row from the specified table
-+ * _h: structure representing database connection
-+ * _k: key names
-+ * _o: operators
-+ * _v: values of the keys that must match
-+ * _n: number of key=value pairs
-+ */
-+int db_sqlite_delete(const db1_con_t* _h, const db_key_t* _k, const db_op_t* _o,
-+ const db_val_t* _v, int _n)
-+{
-+ int rc;
-+
-+ rc = db_do_delete(_h, _k, _o, _v, _n,
-+ db_sqlite_val2str,
-+ db_sqlite_submit_query);
-+ if (rc == 0)
-+ rc = db_sqlite_commit(_h);
-+ db_sqlite_cleanup_query(_h);
-+
-+ return rc;
-+}
-+
-+
-+/*
-+ * Update some rows in the specified table
-+ * _h: structure representing database connection
-+ * _k: key names
-+ * _o: operators
-+ * _v: values of the keys that must match
-+ * _uk: updated columns
-+ * _uv: updated values of the columns
-+ * _n: number of key=value pairs
-+ * _un: number of columns to update
-+ */
-+int db_sqlite_update(const db1_con_t* _h, const db_key_t* _k, const db_op_t* _o,
-+ const db_val_t* _v, const db_key_t* _uk, const db_val_t* _uv,
-+ int _n, int _un)
-+{
-+ int rc;
-+
-+ rc = db_do_update(_h, _k, _o, _v, _uk, _uv, _n, _un,
-+ db_sqlite_val2str,
-+ db_sqlite_submit_query);
-+ if (rc == 0)
-+ rc = db_sqlite_commit(_h);
-+ db_sqlite_cleanup_query(_h);
-+
-+ return rc;
-+}
-+
-+int db_sqlite_raw_query(const db1_con_t* _h, const str* _s, db1_res_t** _r)
-+{
-+ return db_do_raw_query(_h, _s, _r,
-+ db_sqlite_submit_query,
-+ db_sqlite_store_result);
-+}
-Index: kamailio-3.1.1/modules_k/db_sqlite/dbase.h
-===================================================================
---- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ kamailio-3.1.1/modules_k/db_sqlite/dbase.h 2011-01-05 14:20:47.000000000 +0200
-@@ -0,0 +1,72 @@
-+/*
-+ * $Id$
-+ *
-+ * SQlite module core functions
-+ *
-+ * Copyright (C) 2010 Timo Teräs
-+ *
-+ * This file is part of Kamailio, a free SIP server.
-+ *
-+ * Kamailio is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or
-+ * (at your option) any later version
-+ *
-+ * Kamailio is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU General Public License
-+ * along with this program; if not, write to the Free Software
-+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-+ */
-+
-+
-+#ifndef DBASE_H
-+#define DBASE_H
-+
-+#include <sqlite3.h>
-+
-+#include "../../lib/srdb1/db_pool.h"
-+#include "../../lib/srdb1/db_con.h"
-+#include "../../lib/srdb1/db_res.h"
-+#include "../../lib/srdb1/db_key.h"
-+#include "../../lib/srdb1/db_op.h"
-+#include "../../lib/srdb1/db_val.h"
-+
-+#define DB_SQLITE_MAX_BINDS 64
-+
-+struct sqlite_connection {
-+ struct pool_con hdr;
-+
-+ sqlite3 *conn;
-+ int bindpos;
-+
-+ sqlite3_stmt *stmt;
-+ const db_val_t *bindarg[DB_SQLITE_MAX_BINDS];
-+};
-+
-+#define CON_SQLITE(db_con) ((struct sqlite_connection *) db_con->tail)
-+
-+db1_con_t* db_sqlite_init(const str* _sqlurl);
-+void db_sqlite_close(db1_con_t* _h);
-+
-+int db_sqlite_free_result(db1_con_t* _h, db1_res_t* _r);
-+
-+int db_sqlite_query(const db1_con_t* _h, const db_key_t* _k, const db_op_t* _op,
-+ const db_val_t* _v, const db_key_t* _c, int _n, int _nc,
-+ const db_key_t _o, db1_res_t** _r);
-+int db_sqlite_insert(const db1_con_t* _h, const db_key_t* _k, const db_val_t* _v,
-+ int _n);
-+int db_sqlite_delete(const db1_con_t* _h, const db_key_t* _k, const db_op_t* _o,
-+ const db_val_t* _v, int _n);
-+int db_sqlite_update(const db1_con_t* _h, const db_key_t* _k, const db_op_t* _o,
-+ const db_val_t* _v, const db_key_t* _uk, const db_val_t* _uv,
-+ int _n, int _un);
-+int db_sqlite_raw_query(const db1_con_t* _h, const str* _s, db1_res_t** _r);
-+
-+int db_sqlite_use_table(db1_con_t* _h, const str* _t);
-+
-+
-+#endif /* DBASE_H */