add small documentation, also raise with a useful message if they require mysqlplus after mysql--don't know if that works with 1.9 but it does with 1.8.x

This commit is contained in:
Roger Pack 2009-01-29 23:53:48 +00:00
parent bb63b9d78c
commit 91179231f0

View File

@ -1,5 +1,9 @@
require 'mysql' require 'mysql' # this should load the mysqlplus version of mysql.so, as we assume the user has installed mysql as a gem and have not done any previous "require 'mysql'" to have loaded the other
#
# Mysqlplus library gives you a [slightly modified] version of the Mysql class
# See http://www.kitebird.com/articles/ruby-mysql.html for details, as well as the test directory within the library
#
class Mysql class Mysql
def ruby_async_query(sql, timeout = nil) # known to deadlock TODO def ruby_async_query(sql, timeout = nil) # known to deadlock TODO
@ -8,7 +12,10 @@ class Mysql
get_result get_result
end end
begin
alias_method :async_query, :c_async_query alias_method :async_query, :c_async_query
rescue NameError => e
raise LoadError.new "error loading mysqlplus--this may mean you ran a require 'mysql' before a require 'mysqplus', which much come first"
end end
end