src/ORM/Connect/DBConnector.php
protected function databaseError($msg, $errorLevel = E_USER_ERROR, $sql = null, $parameters = array())
    {
        // Prevent errors when error checking is set at zero level
        if (empty($errorLevel)) {
            return;
        }

        // Format query if given
        if (!empty($sql)) {
            $formatter = new SQLFormatter();
            $formattedSQL = $formatter->formatPlain($sql);
            $msg = "Couldn't run query:\n\n{$formattedSQL}\n\n{$msg}";
        }

        if ($errorLevel === E_USER_ERROR) {
            // Treating errors as exceptions better allows for responding to errors
            // in code, such as credential checking during installation
            throw new DatabaseException($msg, 0, null, $sql, $parameters);
        } else {
            user_error($msg, $errorLevel);
        }
    }
protected function databaseError($msg, $errorLevel = E_USER_ERROR, $sql = null, $parameters = array())
    {
        // Prevent errors when error checking is set at zero level
        if (empty($errorLevel)) {
            return;
        }

        // Format query if given
        if (!empty($sql)) {
            $formatter = new SQLFormatter();
            $formattedSQL = $formatter->formatPlain($sql);
            $msg = "Couldn't run query:\n\n{$formattedSQL}\n\n{$msg}";
        }

        if ($errorLevel === E_USER_ERROR) {
            // Treating errors as exceptions better allows for responding to errors
            // in code, such as credential checking during installation
            throw new DatabaseException($msg, 0, null, $sql, $parameters);
        } else {
            user_error($msg, $errorLevel);
        }
    }
protected function databaseError ( $ msg , $ errorLevel = E_USER_ERROR , $ sql = null , $ parameters = array ( ) ) { // Prevent errors when error checking is set at zero level if ( empty ( $ errorLevel ) ) { return ; } // Format query if given if ( ! empty ( $ sql ) ) { $ formatter = new SQLFormatter ( ) ; $ formattedSQL = $ formatter -> formatPlain ( $ sql ) ; $ msg = "Couldn't run query:\n\n{$formattedSQL}\n\n{$msg}" ; } if ( $ errorLevel === E_USER_ERROR ) { // Treating errors as exceptions better allows for responding to errors // in code, such as credential checking during installation throw new DatabaseException ( $ msg , 0 , null , $ sql , $ parameters ) ; } else { user_error ( $ msg , $ errorLevel ) ; } }
Error handler for database errors.
All database errors will call this function to report the error.  It isn't a static function;
it will be called on the object itself and as such can be overridden in a subclass.
Subclasses should run all errors through this function.

@todo hook this into a more well-structured error handling system.
@param string $msg The error message.
@param integer $errorLevel The level of the error to throw.
@param string $sql The SQL related to this query
@param array $parameters Parameters passed to the query
@throws DatabaseException
Error handler for database errors . All database errors will call this function to report the error . It isn t a static function ; it will be called on the object itself and as such can be overridden in a subclass . Subclasses should run all errors through this function .