Skip to content

Commit

Permalink
add aliases for Mysql compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
brianmario committed Sep 1, 2010
1 parent ae6c33a commit 98fbeb6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/mysql2/error.rb
Expand Up @@ -7,5 +7,9 @@ def initialize msg
@error_number = nil
@sql_state = nil
end

# Mysql gem compatibility
alias_method :errno, :error_number
alias_method :error, :message
end
end
9 changes: 9 additions & 0 deletions spec/mysql2/error_spec.rb
Expand Up @@ -13,4 +13,13 @@
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

0 comments on commit 98fbeb6

Please sign in to comment.