Fixed the error management in Oracl€.

This commit is contained in:
mdtrooper 2015-05-29 15:19:32 +02:00
parent 5c7b230e9b
commit 4a36d18fe8
1 changed files with 12 additions and 1 deletions

View File

@ -263,9 +263,14 @@ function oracle_db_process_sql($sql, $rettype = "affected_rows", $dbconnection =
} }
$time = microtime (true) - $start; $time = microtime (true) - $start;
$config['oracle_error_query'] = null;
if ($result === false) { if ($result === false) {
$backtrace = debug_backtrace (); $backtrace = debug_backtrace ();
$e = oci_error($query); $e = oci_error($query);
$config['oracle_error_query'] = $query;
$error = sprintf ('%s (\'%s\') in <strong>%s</strong> on line %d', $error = sprintf ('%s (\'%s\') in <strong>%s</strong> on line %d',
htmlentities($e['message'], ENT_QUOTES), $sql, $backtrace[0]['file'], $backtrace[0]['line']); htmlentities($e['message'], ENT_QUOTES), $sql, $backtrace[0]['file'], $backtrace[0]['line']);
db_add_database_debug_trace ($sql, htmlentities($e['message'], ENT_QUOTES)); db_add_database_debug_trace ($sql, htmlentities($e['message'], ENT_QUOTES));
@ -1356,7 +1361,13 @@ function oracle_safe_sql_string($string) {
* @return string Return the string error. * @return string Return the string error.
*/ */
function oracle_db_get_last_error() { function oracle_db_get_last_error() {
$ora_erno = oci_error(); global $config;
if (empty($config['oracle_error_query'])) {
return null;
}
$ora_erno = oci_error($config['oracle_error_query']);
return $ora_erno['message']; return $ora_erno['message'];
} }