diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 7657488933..85c08099df 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -6292,6 +6292,7 @@ int sofia_glue_init_sql(sofia_profile_t *profile) switch_cache_db_handle_t *dbh = sofia_glue_get_db_handle(profile); char *test2; + char *err; if (!dbh) { return 0; @@ -6309,14 +6310,20 @@ int sofia_glue_init_sql(sofia_profile_t *profile) test2 = switch_mprintf("%s;%s", test_sql, test_sql); - if (switch_cache_db_execute_sql(dbh, test2, NULL) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "GREAT SCOTT!!! Cannot execute batched statements!\n" - "If you are using mysql, make sure you are using MYODBC 3.51.18 or higher and enable FLAG_MULTI_STATEMENTS\n"); - - switch_cache_db_release_db_handle(&dbh); - free(test2); - free(test_sql); - return 0; + if (switch_cache_db_execute_sql(dbh, test2, &err) != SWITCH_STATUS_SUCCESS) { + + if (switch_stristr("read-only", err)) { + free(err); + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "GREAT SCOTT!!! Cannot execute batched statements! [%s]\n" + "If you are using mysql, make sure you are using MYODBC 3.51.18 or higher and enable FLAG_MULTI_STATEMENTS\n", err); + + switch_cache_db_release_db_handle(&dbh); + free(test2); + free(test_sql); + free(err); + return 0; + } } free(test2);