FS-11989: [Core] Fix database module interface not returning statuses of some operations.

This commit is contained in:
Andrey Volk 2019-08-10 02:01:33 +04:00
parent b8ad860a54
commit f74036cd1c
1 changed files with 17 additions and 20 deletions

View File

@ -818,6 +818,7 @@ SWITCH_DECLARE(int) switch_cache_db_affected_rows(switch_cache_db_handle_t *dbh)
switch_database_interface_t *database_interface = dbh->native_handle.database_interface_dbh->connection_options.database_interface;
int affected_rows = 0;
database_interface->affected_rows(dbh->native_handle.database_interface_dbh, &affected_rows);
return affected_rows;
}
break;
}
@ -1188,11 +1189,10 @@ SWITCH_DECLARE(switch_status_t) switch_cache_db_execute_sql_event_callback(switc
case SCDB_TYPE_DATABASE_INTERFACE:
{
switch_database_interface_t *database_interface = dbh->native_handle.database_interface_dbh->connection_options.database_interface;
switch_status_t result;
if ((result = database_interface_handle_callback_exec(database_interface, dbh->native_handle.database_interface_dbh, sql, helper_callback, &h, err)) != SWITCH_STATUS_SUCCESS) {
if ((status = database_interface_handle_callback_exec(database_interface, dbh->native_handle.database_interface_dbh, sql, helper_callback, &h, err)) != SWITCH_STATUS_SUCCESS) {
char tmp[100];
switch_snprintfv(tmp, sizeof(tmp), "%q-%i", "Unable to execute_sql_event_callback", result);
switch_snprintfv(tmp, sizeof(tmp), "%q-%i", "Unable to execute_sql_event_callback", status);
}
}
break;
@ -1249,15 +1249,14 @@ SWITCH_DECLARE(switch_status_t) switch_cache_db_execute_sql_event_callback_err(s
case SCDB_TYPE_DATABASE_INTERFACE:
{
switch_database_interface_t *database_interface = dbh->native_handle.database_interface_dbh->connection_options.database_interface;
switch_status_t result;
if ((result = database_interface_handle_callback_exec(database_interface, dbh->native_handle.database_interface_dbh, sql, helper_callback, &h, err)) != SWITCH_STATUS_SUCCESS) {
if ((status = database_interface_handle_callback_exec(database_interface, dbh->native_handle.database_interface_dbh, sql, helper_callback, &h, err)) != SWITCH_STATUS_SUCCESS) {
char tmp[100];
switch_snprintfv(tmp, sizeof(tmp), "%q-%i", "Unable to execute_sql_event_callback_err", result);
} else {
if (err && *err) {
(*err_callback)(pdata, (const char*)*err);
}
switch_snprintfv(tmp, sizeof(tmp), "%q-%i", "Unable to execute_sql_event_callback_err", status);
}
if (err && *err) {
(*err_callback)(pdata, (const char*)*err);
}
}
break;
@ -1316,11 +1315,10 @@ SWITCH_DECLARE(switch_status_t) switch_cache_db_execute_sql_callback(switch_cach
case SCDB_TYPE_DATABASE_INTERFACE:
{
switch_database_interface_t *database_interface = dbh->native_handle.database_interface_dbh->connection_options.database_interface;
switch_status_t result;
if ((result = database_interface_handle_callback_exec(database_interface, dbh->native_handle.database_interface_dbh, sql, callback, pdata, err)) != SWITCH_STATUS_SUCCESS) {
if ((status = database_interface_handle_callback_exec(database_interface, dbh->native_handle.database_interface_dbh, sql, callback, pdata, err)) != SWITCH_STATUS_SUCCESS) {
char tmp[100];
switch_snprintfv(tmp, sizeof(tmp), "%q-%i", "Unable to execute_sql_callback", result);
switch_snprintfv(tmp, sizeof(tmp), "%q-%i", "Unable to execute_sql_callback", status);
}
}
break;
@ -1372,15 +1370,14 @@ SWITCH_DECLARE(switch_status_t) switch_cache_db_execute_sql_callback_err(switch_
case SCDB_TYPE_DATABASE_INTERFACE:
{
switch_database_interface_t *database_interface = dbh->native_handle.database_interface_dbh->connection_options.database_interface;
switch_status_t result;
if ((result = database_interface_handle_callback_exec(database_interface, dbh->native_handle.database_interface_dbh, sql, callback, pdata, err)) != SWITCH_STATUS_SUCCESS) {
if ((status = database_interface_handle_callback_exec(database_interface, dbh->native_handle.database_interface_dbh, sql, callback, pdata, err)) != SWITCH_STATUS_SUCCESS) {
char tmp[100];
switch_snprintfv(tmp, sizeof(tmp), "%q-%i", "Unable to execute_sql_callback_err", result);
} else {
if (err && *err) {
(*err_callback)(pdata, (const char*)*err);
}
switch_snprintfv(tmp, sizeof(tmp), "%q-%i", "Unable to execute_sql_callback_err", status);
}
if (err && *err) {
(*err_callback)(pdata, (const char*)*err);
}
}
break;