add aliases for Mysql compatibility

This commit is contained in:
Brian Lopez 2010-09-01 11:42:16 -07:00
parent ae6c33a13f
commit 98fbeb6f64
2 changed files with 13 additions and 0 deletions

View File

@ -7,5 +7,9 @@ module Mysql2
@error_number = nil @error_number = nil
@sql_state = nil @sql_state = nil
end end
# Mysql gem compatibility
alias_method :errno, :error_number
alias_method :error, :message
end end
end end

View File

@ -13,4 +13,13 @@ describe Mysql2::Error do
it "should respond to #sql_state" do it "should respond to #sql_state" do
@error.should respond_to(:sql_state) @error.should respond_to(:sql_state)
end 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 end