[asterisk-commits] mnicholson: trunk r223136 - /trunk/cdr/cdr_sqlite3_custom.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Oct 9 12:14:42 CDT 2009
Author: mnicholson
Date: Fri Oct 9 12:14:38 2009
New Revision: 223136
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=223136
Log:
Don't close the sqlite database when reloading. Only close the database when unloading.
(closes issue #15953)
Reported by: frawd
Patches:
sqlite3_rev220097.diff uploaded by frawd (license 610)
Tested by: frawd
Modified:
trunk/cdr/cdr_sqlite3_custom.c
Modified: trunk/cdr/cdr_sqlite3_custom.c
URL: http://svnview.digium.com/svn/asterisk/trunk/cdr/cdr_sqlite3_custom.c?view=diff&rev=223136&r1=223135&r2=223136
==============================================================================
--- trunk/cdr/cdr_sqlite3_custom.c (original)
+++ trunk/cdr/cdr_sqlite3_custom.c Fri Oct 9 12:14:38 2009
@@ -70,7 +70,7 @@
static AST_LIST_HEAD_STATIC(sql_values, values);
-static void free_config(void);
+static void free_config(int reload);
static int load_column_config(const char *tmp)
{
@@ -163,7 +163,7 @@
}
if (reload) {
- free_config();
+ free_config(1);
}
if (!(mappingvar = ast_variable_browse(cfg, "master"))) {
@@ -183,14 +183,14 @@
/* Columns */
if (load_column_config(ast_variable_retrieve(cfg, "master", "columns"))) {
ast_config_destroy(cfg);
- free_config();
+ free_config(0);
return -1;
}
/* Values */
if (load_values_config(ast_variable_retrieve(cfg, "master", "values"))) {
ast_config_destroy(cfg);
- free_config();
+ free_config(0);
return -1;
}
@@ -201,11 +201,11 @@
return 0;
}
-static void free_config(void)
+static void free_config(int reload)
{
struct values *value;
- if (db) {
+ if (!reload && db) {
sqlite3_close(db);
db = NULL;
}
@@ -288,7 +288,7 @@
{
ast_cdr_unregister(name);
- free_config();
+ free_config(0);
return 0;
}
@@ -309,7 +309,7 @@
res = sqlite3_open(filename, &db);
if (res != SQLITE_OK) {
ast_log(LOG_ERROR, "Could not open database %s.\n", filename);
- free_config();
+ free_config(0);
return AST_MODULE_LOAD_DECLINE;
}
@@ -325,7 +325,7 @@
if (res != SQLITE_OK) {
ast_log(LOG_WARNING, "Unable to create table '%s': %s.\n", table, error);
sqlite3_free(error);
- free_config();
+ free_config(0);
return AST_MODULE_LOAD_DECLINE;
}
}
@@ -333,7 +333,7 @@
res = ast_cdr_register(name, desc, sqlite3_log);
if (res) {
ast_log(LOG_ERROR, "Unable to register custom SQLite3 CDR handling\n");
- free_config();
+ free_config(0);
return AST_MODULE_LOAD_DECLINE;
}
More information about the asterisk-commits
mailing list