[asterisk-commits] russell: trunk r82679 - in /trunk: doc/ res/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Sep 17 15:24:50 CDT 2007


Author: russell
Date: Mon Sep 17 15:24:50 2007
New Revision: 82679

URL: http://svn.digium.com/view/asterisk?view=rev&rev=82679
Log:
Add support for #include, var_metric, and cat_metric in res_config_sqlite
(closes issue #10738, rbraun_proformatique)

Modified:
    trunk/doc/res_config_sqlite.txt
    trunk/res/res_config_sqlite.c

Modified: trunk/doc/res_config_sqlite.txt
URL: http://svn.digium.com/view/asterisk/trunk/doc/res_config_sqlite.txt?view=diff&rev=82679&r1=82678&r2=82679
==============================================================================
--- trunk/doc/res_config_sqlite.txt (original)
+++ trunk/doc/res_config_sqlite.txt Mon Sep 17 15:24:50 2007
@@ -15,6 +15,8 @@
  */
 CREATE TABLE ast_config (
 	id		INTEGER,
+	cat_metric	INT(11)		NOT NULL	DEFAULT 0,
+	var_metric	INT(11)		NOT NULL	DEFAULT 0,
 	commented	TINYINT(1)	NOT NULL	DEFAULT 0,
 	filename	VARCHAR(128)	NOT NULL	DEFAULT '',
 	category	VARCHAR(128)	NOT NULL	DEFAULT 'default',
@@ -23,8 +25,9 @@
 	PRIMARY KEY	(id)
 );
 
+CREATE INDEX ast_config__idx__cat_metric		ON ast_config(cat_metric);
+CREATE INDEX ast_config__idx__var_metric		ON ast_config(var_metric);
 CREATE INDEX ast_config__idx__filename_commented	ON ast_config(filename, commented);
-CREATE INDEX ast_config__idx__category			ON ast_config(category);
 
 /*
  * CDR table (this table is automatically created if non existent).

Modified: trunk/res/res_config_sqlite.c
URL: http://svn.digium.com/view/asterisk/trunk/res/res_config_sqlite.c?view=diff&rev=82679&r1=82678&r2=82679
==============================================================================
--- trunk/res/res_config_sqlite.c (original)
+++ trunk/res/res_config_sqlite.c Mon Sep 17 15:24:50 2007
@@ -113,6 +113,8 @@
 
 enum {
 	RES_CONFIG_SQLITE_CONFIG_ID,
+	RES_CONFIG_SQLITE_CONFIG_CAT_METRIC,
+	RES_CONFIG_SQLITE_CONFIG_VAR_METRIC,
 	RES_CONFIG_SQLITE_CONFIG_COMMENTED,
 	RES_CONFIG_SQLITE_CONFIG_FILENAME,
 	RES_CONFIG_SQLITE_CONFIG_CATEGORY,
@@ -184,6 +186,7 @@
 	struct ast_config *cfg;
 	struct ast_category *cat;
 	char *cat_name;
+	struct ast_flags flags;
 };
 
 /*!
@@ -589,7 +592,7 @@
 "SELECT *"
 "	FROM '%q'"
 "	WHERE filename = '%q' AND commented = 0"
-"	ORDER BY category;";
+"	ORDER BY cat_metric ASC, var_metric ASC;";
 
 static int set_var(char **var, char *name, char *value)
 {
@@ -715,6 +718,22 @@
 
 	args = arg;
 
+	if (!strcmp(argv[RES_CONFIG_SQLITE_CONFIG_VAR_NAME], "#include")) {
+		struct ast_config *cfg;
+		char *val;
+
+		val = argv[RES_CONFIG_SQLITE_CONFIG_VAR_VAL];
+		cfg = ast_config_internal_load(val, args->cfg, args->flags, "");
+
+		if (!cfg) {
+			ast_log(LOG_WARNING, "Unable to include %s\n", val);
+			return 1;
+		} else {
+			args->cfg = cfg;
+			return 0;
+		}
+	}
+
 	if (!args->cat_name || strcmp(args->cat_name, argv[RES_CONFIG_SQLITE_CONFIG_CATEGORY])) {
 		args->cat = ast_category_new(argv[RES_CONFIG_SQLITE_CONFIG_CATEGORY], "", 99999);
 
@@ -772,6 +791,7 @@
 	args.cfg = cfg;
 	args.cat = NULL;
 	args.cat_name = NULL;
+	args.flags = flags;
 
 	ast_mutex_lock(&mutex);
 




More information about the asterisk-commits mailing list