diff --git a/lib/mysql2/error.rb b/lib/mysql2/error.rb index c14ae35..e195c2c 100644 --- a/lib/mysql2/error.rb +++ b/lib/mysql2/error.rb @@ -7,5 +7,9 @@ module Mysql2 @error_number = nil @sql_state = nil end + + # Mysql gem compatibility + alias_method :errno, :error_number + alias_method :error, :message end end diff --git a/spec/mysql2/error_spec.rb b/spec/mysql2/error_spec.rb index f321003..9690744 100644 --- a/spec/mysql2/error_spec.rb +++ b/spec/mysql2/error_spec.rb @@ -13,4 +13,13 @@ describe Mysql2::Error do it "should respond to #sql_state" do @error.should respond_to(:sql_state) end + + # Mysql gem compatibility + it "should alias #error_number to #errno" do + @error.should respond_to(:errno) + end + + it "should alias #message to #error" do + @error.should respond_to(:error) + end end