2009-01-29 23:53:48 +00:00
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
2008-08-27 12:09:39 +00:00
2009-01-29 23:53:48 +00:00
#
# 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
#
2008-08-27 12:09:39 +00:00
class Mysql
2008-09-08 00:48:47 +00:00
2009-01-12 18:18:33 +00:00
def ruby_async_query ( sql , timeout = nil ) # known to deadlock TODO
2008-08-27 12:09:39 +00:00
send_query ( sql )
2008-08-27 23:11:58 +00:00
select [ ( @sockets || = { } ) [ socket ] || = IO . new ( socket ) ] , nil , nil , nil
2008-08-27 12:09:39 +00:00
get_result
end
2009-01-12 18:18:33 +00:00
2009-01-29 23:53:48 +00:00
begin
alias_method :async_query , :c_async_query
rescue NameError = > e
2009-04-18 22:36:55 +00:00
raise LoadError . new ( " error loading mysqlplus--this may mean you ran a require 'mysql' before a require 'mysqplus', which much come first " )
2009-01-29 23:53:48 +00:00
end
2008-09-06 16:17:06 +00:00
2008-08-27 12:09:39 +00:00
end