Last Modified
2015-03-17 12:43:23 -0400
Requires

Description

The error_sql extension adds a DatabaseError#sql method that you can use to get the sql that caused the error to be raised.

begin
  DB.run "Invalid SQL"
rescue => e
  puts e.sql # "Invalid SQL"
end

On some databases, the error message contains part or all of the SQL used, but on other databases, none of the SQL used is displayed in the error message, so it can be difficult to track down what is causing the error without using a logger. This extension should hopefully make debugging easier on databases that have bad error messages.

This extension may not work correctly in the following cases:

To load the extension into the database:

DB.extension :error_sql