[eluser]gon[/eluser]
Hi,
How do you guys keep a log of possible failed queries?
When setting db_debug to true, they get logged, but an error screen is also shown.
Also, tables get locked when using transactions.
So what I do is modify the display_error function, on DB_driver.php:
Code:
function display_error($error = '', $swap = '', $native = FALSE)
{
return false;
// $LANG = new CI_Lang();
$LANG = new CI_Language();
$LANG->load('db');
$heading = 'Database Error';
if ($native == TRUE)
{
$message = $error;
}
else
{
$message = ( ! is_array($error)) ? array(str_replace('%s', $swap, $LANG->line($error))) : $error;
}
if ( ! class_exists('CI_Exceptions'))
{
// include(BASEPATH.'core/Exceptions'.EXT);
include(BASEPATH.'libraries/Exceptions'.EXT);
}
$error = new CI_Exceptions();
echo $error->show_error('An Error Was Encountered', $message, 'error_db');
exit;
}
Is there another way to do this without touching inside CI?
I would suggest to add a different database config param for logging and displaying errors.
Regards.