aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2007-05-21 02:05:23 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2007-05-21 02:05:23 +0000
commit464272c769fbea8842da8825f1000e4dc96f9440 (patch)
tree01715454e03c86ad6eb91cd7bd86541a02f1b127
parentf66fe3062c5d0598cdeecbfd1297f5283b0b67a3 (diff)
Comment a few more things, and remove an unnecessary db connection check
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@65283 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--cdr/cdr_adaptive_odbc.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/cdr/cdr_adaptive_odbc.c b/cdr/cdr_adaptive_odbc.c
index 474d7fce7..092aa14dd 100644
--- a/cdr/cdr_adaptive_odbc.c
+++ b/cdr/cdr_adaptive_odbc.c
@@ -114,6 +114,7 @@ static int load_config(void)
ast_copy_string(connection, tmp, sizeof(connection));
lenconnection = strlen(connection);
+ /* When loading, we want to be sure we can connect. */
obj = ast_odbc_request_obj(connection, 1);
if (!obj) {
ast_log(LOG_WARNING, "No such connection '%s' in the '%s' section of " CONFIG ". Check res_odbc.conf.\n", connection, catg);
@@ -154,6 +155,9 @@ static int load_config(void)
ast_copy_string(tableptr->connection, connection, lenconnection + 1);
ast_copy_string(tableptr->table, table, lentable + 1);
+ if (option_verbose > 2)
+ ast_verbose(VERBOSE_PREFIX_3 "Found adaptive CDR table %s@%s.\n", tableptr->table, tableptr->connection);
+
while ((res = SQLFetch(stmt)) != SQL_NO_DATA && res != SQL_ERROR) {
char *cdrvar = "";
@@ -169,7 +173,8 @@ static int load_config(void)
if (strcasecmp(var->value, columnname) == 0) {
char *tmp = ast_strdupa(var->name + 5);
cdrvar = ast_strip(tmp);
- ast_verbose(VERBOSE_PREFIX_4 "Found alias %s for column %s\n", cdrvar, columnname);
+ if (option_verbose > 2)
+ ast_verbose(VERBOSE_PREFIX_3 "Found alias %s for column %s in %s@%s\n", cdrvar, columnname, tableptr->table, tableptr->connection);
break;
}
}
@@ -537,7 +542,8 @@ static int odbc_log(struct ast_cdr *cdr)
if (option_verbose > 10)
ast_verbose(VERBOSE_PREFIX_4 "[%s]\n", sql);
- obj = ast_odbc_request_obj(tableptr->connection, 1);
+ /* No need to check the connection now; we'll handle any failure in prepare_and_execute */
+ obj = ast_odbc_request_obj(tableptr->connection, 0);
if (obj) {
stmt = ast_odbc_prepare_and_execute(obj, generic_prepare, sql);
if (stmt) {