Revision
14859
Author
ledr
Date
2009-09-14 18:16:01 -0500 (Mon, 14 Sep 2009)

Log Message

Removed unnecessary if() and modified some comments

Modified Paths

Diff

Modified: freeswitch/trunk/contrib/ledr/c/mod_odbc_query/mod_odbc_query.c (14858 => 14859)


--- freeswitch/trunk/contrib/ledr/c/mod_odbc_query/mod_odbc_query.c	2009-09-14 23:09:10 UTC (rev 14858)
+++ freeswitch/trunk/contrib/ledr/c/mod_odbc_query/mod_odbc_query.c	2009-09-14 23:16:01 UTC (rev 14859)
@@ -136,20 +136,18 @@
 
 	/* make odbc connection */
 	if (!reload) {
-		if (switch_odbc_available() && globals.odbc_dsn) {
 
-			if (!(globals.odbc_handle = switch_odbc_handle_new(globals.odbc_dsn, odbc_user, odbc_pass))) {
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot Open ODBC Database!\n");
-				goto done;
-			}
+		if (!(globals.odbc_handle = switch_odbc_handle_new(globals.odbc_dsn, odbc_user, odbc_pass))) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot Open ODBC Database!\n");
+			goto done;
+		}
 
-			if (switch_odbc_handle_connect(globals.odbc_handle) != SWITCH_ODBC_SUCCESS) {
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot Open ODBC Database!\n");
-				goto done;
-			}
-
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Connected ODBC DSN: [%s]\n", globals.odbc_dsn);
+		if (switch_odbc_handle_connect(globals.odbc_handle) != SWITCH_ODBC_SUCCESS) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot Open ODBC Database!\n");
+			goto done;
 		}
+
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Connected ODBC DSN: [%s]\n", globals.odbc_dsn);
 	}
 
 	status = SWITCH_STATUS_SUCCESS;
@@ -210,7 +208,6 @@
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "ODBC Query module loading...\n");
 
   /* allocate the queries hash */
-  //if (switch_core_hash_init(&globals->queries_hash, globals.pool) != SWITCH_STATUS_SUCCESS) {
   if (switch_core_hash_init(&globals.queries_hash, globals.pool) != SWITCH_STATUS_SUCCESS) {
     switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error initializing the queries hash\n");
     return SWITCH_STATUS_GENERR;
@@ -218,7 +215,7 @@
 
 	if (do_config(SWITCH_FALSE) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to load xml_odbc config file\n");
-		/* TODO what about freeing queries_hash and pool here ? */
+		/* TODO what about freeing queries_hash here ? */
 		return SWITCH_STATUS_FALSE;
 	}
 	
@@ -228,7 +225,7 @@
 	/* subscribe to reloadxml event, and hook it to reload_event_handler */
 	if ((switch_event_bind_removable(modname, SWITCH_EVENT_RELOADXML, NULL, reload_event_handler, NULL, &NODE) != SWITCH_STATUS_SUCCESS)) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind event!\n");
-		/* TODO what about freeing queries_hash and pool here ? */
+		/* TODO what about freeing queries_hash here ? */
 		return SWITCH_STATUS_TERM;
 	}