switch_cache_db_handle_t *db = NULL;
int full = 0;
-
- 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 NULL;
+ }
if (db->type == SCDB_TYPE_CORE_DB) {
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",
#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);
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,");
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);