From 91179231f027de60b13bad75dd84f545f633d820 Mon Sep 17 00:00:00 2001 From: Roger Pack Date: Thu, 29 Jan 2009 23:53:48 +0000 Subject: [PATCH] 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 --- lib/mysqlplus.rb | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/mysqlplus.rb b/lib/mysqlplus.rb index fe67327..408b72d 100644 --- a/lib/mysqlplus.rb +++ b/lib/mysqlplus.rb @@ -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 def ruby_async_query(sql, timeout = nil) # known to deadlock TODO @@ -8,7 +12,10 @@ class Mysql get_result end - alias_method :async_query, :c_async_query + 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 much come first" + end end -