You are here

public static function cf_error::on_query_execution in Common Functionality 7.2

Reports query execution failures.

@see: watchdog() @see: watchdog_severity_levels()

Parameters

object $exception: The query exception object.

int $severity: (optional) The severity of the message, as per RFC 3164. Possible values are WATCHDOG_ERROR, WATCHDOG_WARNING, etc.

Return value

cf_error_code A object containing the processed error, with specified backtrace.

7 calls to cf_error::on_query_execution()
cf_db_options_get_options in modules/cf_db_options/cf_db_options.module
Get an array of supported options for a given option type.
cf_db_options_id_to_machine_name in modules/cf_db_options/cf_db_options.module
Returns the machine_name for a given option numeric id.
cf_db_options_machine_name_to_id in modules/cf_db_options/cf_db_options.module
Returns the numeric id for a given option machine_name.
cf_error_on_query_execution in modules/cf_1x_compatibility/cf_1x_compatibility.module
This is a compatibility function for cf-1.x.
cf_settings_modules_uninstalled in modules/cf_settings/cf_settings.module
Implements hook_modules_uninstalled().

... See full list

File

modules/cf_error/classes/cf_error.php, line 453
Provides the derror exception class.

Class

cf_error

Code

public static function on_query_execution($exception, $severity = WATCHDOG_ERROR) {
  $error = new cf_error_code();
  if (is_object($exception)) {
    $exception_message = $exception
      ->getMessage();
    $query_string = $exception->query_string;
    $query_arguments = print_r($exception->args, TRUE);
  }
  else {
    if (version_compare(PHP_VERSION, '5.4.0', '>=')) {
      $backtrace = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT, self::p_backtrace_limit());
    }
    else {
      $backtrace = debug_backtrace();
    }
    self::p_report_invalid_argument_object('exception', $backtrace);
    unset($backtrace);
    $exception_message = "";
    $query_string = "";
    $query_arguments = "";
  }
  $error
    ->set_severity($severity);
  $error
    ->set_type('sql');
  self::p_load_backtrace($error);
  self::p_on_query_execution($error, $exception_message, $query_string, $query_arguments);
  return $error;
}