mysqlplus/lib/mysqlplus.rb

22 lines
873 B
Ruby
Raw Normal View History

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
2009-01-12 18:18:33 +00:00
def ruby_async_query(sql, timeout = nil) # known to deadlock TODO
send_query(sql)
select [ (@sockets ||= {})[socket] ||= IO.new(socket) ], nil, nil, nil
get_result
end
2009-01-12 18:18:33 +00:00
begin
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 must come first -- possibly also run gem uninstall mysql")
end
end