提交 91573339 authored 作者: Leon de Rooij's avatar Leon de Rooij

Try printing out SQL error - queries don't work anymore - what happened ?

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk/contrib@15507 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 bf3b3a0b
......@@ -167,6 +167,7 @@ SWITCH_STANDARD_APP(odbc_query_app_function)
char *expanded_query = NULL;
switch_channel_t *channel = switch_core_session_get_channel(session);
switch_memory_pool_t *pool = switch_core_session_get_pool(session);
char *errmsg;
if (!channel) {
return;
......@@ -190,8 +191,10 @@ SWITCH_STANDARD_APP(odbc_query_app_function)
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Performing query: [%s]\n", expanded_query);
if (switch_odbc_handle_callback_exec(globals.odbc_handle, expanded_query, odbc_query_callback, channel, NULL) != SWITCH_ODBC_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error running this query: [%s]\n", expanded_query);
if (switch_odbc_handle_callback_exec(globals.odbc_handle, expanded_query, odbc_query_callback, channel, &errmsg) != SWITCH_ODBC_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "SQL error [%s] while doing query: [%s]\n", switch_str_nil(errmsg), expanded_query);
switch_core_db_free(errmsg);
errmsg = NULL;
}
}
......
......@@ -232,6 +232,7 @@ static switch_status_t xml_odbc_do_query(xml_odbc_session_helper_t *helper)
char *value = (char *) switch_xml_attr_soft(helper->xml_in_cur, "value");
char *empty_result_break_to = (char *) switch_xml_attr_soft(helper->xml_in_cur, "on-empty-result-break-to");
char *new_value = switch_event_expand_headers_by_pool(helper->pool, helper->event, value);
char *errmsg;
switch_status_t status = SWITCH_STATUS_FALSE;
if (globals.debug == SWITCH_TRUE) {
......@@ -240,8 +241,10 @@ static switch_status_t xml_odbc_do_query(xml_odbc_session_helper_t *helper)
helper->rowcount = 0;
if (switch_odbc_handle_callback_exec(globals.master_odbc, new_value, xml_odbc_query_callback, helper, NULL) != SWITCH_ODBC_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error running this query: [%s]\n", new_value);
if (switch_odbc_handle_callback_exec(globals.master_odbc, new_value, xml_odbc_query_callback, helper, &errmsg) != SWITCH_ODBC_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "SQL error [%s] while doing query [%s]\n", switch_str_nil(errmsg), new_value);
switch_core_db_free(errmsg);
errmsg = NULL;
goto done;
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论