Modified: freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c (17135 => 17136)
--- freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c 2010-03-30 02:09:08 UTC (rev 17135)
+++ freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c 2010-03-30 03:13:49 UTC (rev 17136)
@@ -3232,7 +3232,10 @@
switch_core_flag_t cflags = switch_core_flags();
switch_status_t status = SWITCH_STATUS_SUCCESS;
- switch_core_db_handle(&db);
+ if (switch_core_db_handle(&db) != SWITCH_STATUS_SUCCESS) {
+ stream->write_function(stream, "%s", "-ERR Databse Error!\n");
+ return SWITCH_STATUS_SUCCESS;
+ }
holder.justcount = 0;
Modified: freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c (17135 => 17136)
--- freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c 2010-03-30 02:09:08 UTC (rev 17135)
+++ freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c 2010-03-30 03:13:49 UTC (rev 17136)
@@ -358,7 +358,9 @@
char terminator;
switch_status_t status;
- switch_core_db_handle(&db);
+ if (switch_core_db_handle(&db) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Database Error!\n");
+ }
while (switch_channel_ready(channel)) {
for (x = 0; x < MAX_SPY; x++) {
Modified: freeswitch/trunk/src/mod/formats/mod_shout/mod_shout.c (17135 => 17136)
--- freeswitch/trunk/src/mod/formats/mod_shout/mod_shout.c 2010-03-30 02:09:08 UTC (rev 17135)
+++ freeswitch/trunk/src/mod/formats/mod_shout/mod_shout.c 2010-03-30 03:13:49 UTC (rev 17136)
@@ -1356,7 +1356,9 @@
struct holder holder;
char *errmsg;
- switch_core_db_handle(&db);
+ if (switch_core_db_handle(&db) != SWITCH_STATUS_SUCCESS) {
+ return;
+ }
holder.host = switch_event_get_header(stream->param_event, "http-host");
holder.port = switch_event_get_header(stream->param_event, "http-port");
Modified: freeswitch/trunk/src/switch_console.c (17135 => 17136)
--- freeswitch/trunk/src/switch_console.c 2010-03-30 02:09:08 UTC (rev 17135)
+++ freeswitch/trunk/src/switch_console.c 2010-03-30 03:13:49 UTC (rev 17136)
@@ -240,10 +240,13 @@
switch_cache_db_handle_t *db = NULL;
int full = 0;
+
+ if (switch_core_db_handle(&db) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Database Error\n");
+ return NULL;
+ }
- switch_core_db_handle(&db);
-
if (db->type == SCDB_TYPE_CORE_DB) {
sql = switch_mprintf("select command from aliases where alias='%q'", cmd);
} else {
@@ -563,8 +566,12 @@
switch_status_t status = SWITCH_STATUS_FALSE;
char *errmsg;
- switch_core_db_handle(&db);
+ if (switch_core_db_handle(&db) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Database Error\n");
+ return SWITCH_STATUS_GENERR;
+ }
+
if (!zstr(cursor)) {
sql = switch_mprintf("select distinct uuid from channels where uuid like '%q%%' and hostname='%q' order by uuid",
cursor, switch_core_get_variable("hostname"));
@@ -609,7 +616,10 @@
#endif
#endif
- switch_core_db_handle(&db);
+ if (switch_core_db_handle(&db) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Database Error\n");
+ return CC_ERROR;
+ }
if (!zstr(cursor) && !zstr(line)) {
pos = (cursor - line);
@@ -1688,8 +1698,15 @@
switch_stream_handle_t mystream = { 0 };
SWITCH_STANDARD_STREAM(mystream);
- switch_core_db_handle(&db);
+ if (switch_core_db_handle(&db) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Database Error\n");
+ free(mystream.data);
+ free(mydata);
+ return SWITCH_STATUS_FALSE;
+ }
+
+
if (!strcasecmp(argv[0], "stickyadd")) {
mystream.write_function(&mystream, "insert into complete values (1,");
for (x = 0; x < 10; x++) {
@@ -1765,8 +1782,12 @@
switch_cache_db_handle_t *db = NULL;
char *sql = NULL;
- switch_core_db_handle(&db);
-
+ if (switch_core_db_handle(&db) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Database Error\n");
+ free(mydata);
+ return SWITCH_STATUS_FALSE;
+ }
+
if (!strcasecmp(argv[0], "stickyadd") && argc == 3) {
sql = switch_mprintf("delete from aliases where alias='%q' and hostname='%q'", argv[1], switch_core_get_variable("hostname"));
switch_cache_db_persistant_execute(db, sql, 5);