2009-05-13 00:23:47 +00:00
require File . dirname ( __FILE__ ) + '/mysql' # load our version of mysql--note
# if someone does a require 'mysql' after a require 'mysqlplus' then their screen will be littered with warnings
# and the "old" mysql will override the "new" mysqlplus, so be careful.
2008-08-27 12:09:39 +00:00
2009-01-29 23:53:48 +00:00
#
2009-05-13 00:23:47 +00:00
# The mysqlplus library is a [slightly updated] fork of the Mysql class, with asynchronous capability added
# See http://www.kitebird.com/articles/ruby-mysql.html for details, as well as the test directory within the gem
2009-01-29 23:53:48 +00:00
#
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-21 01:41:06 +00:00
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 " )
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