New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fails to load in Ruby1.9 #2
Comments
I've found the issue. In gems/mysqlplus-0.1.1/lib/mysqlplus.rb the first line is:
This is supposed to load "mysql.so" file in same directory (and it does it in Ruby1.8). but in ruby 1.9 it takes the "normal" mysql gem. A workaround would be changing the first line with:
However it seems a bad workaround. A better approach would be ensuring to load the library in the current directory (using FILE and so). |
A better aproach:
|
The problem is that after these two solutions, a new call to "require 'mysql'" would load the "normal" mysql gem! ("require" wouldn't return false) so the class would be replaced by the "normal" one! IMHO mysqlplus should not contain a class called "Mysql" and instead use "MysqlPlus".
so they could use the usual "Mysql" class as usually. |
hmm. Yeah the original thought was to have a fork of "mysql" and submit patches back upstream, so we wanted to stay close to the core. unfortunately the core never accepts patches, so maybe it would be better to head off in that direction. Is it true that if you do a |
Yes, original "mysql" Mysql replaces "mysqlplus" one: Also you check it with this script I've code: |
Hi, is there news about this issue?
And then, users or applications must decide to use "mysql" or "mysqlplus". |
the kicker is that deep in the gute of rails it may have a line like require 'mysql' which will now fail [or override mysqlplus]... I'm almost tempted to leave it as is and tell users "you MUST uninstall the mysql gem or it will conflict" |
Humm, anyhow I see no reason to keep "mysql.so" under GEMS/mysqlplus/lib/ instead of calling it just "mysqlplus_ext.so" (or whatever). The line "require 'mysql'" in GEMS/mysqlplus/lib/mysqlplus.rb would behave randomly under Ruby1.9. IMHO depending on how the LAOD_PATH looks it could load the pure Ruby mysql driver rather than "mysql.so" present in same directory. I agree with your comment, but nothing changes if you rename "mysql.so" to "mysqlplus_ext.so" and change the line "require 'mysql'" with "require 'mysqlplus_ext'". In fact it avoids random conflicts depending on LOAD_PATH. |
maybe we can have a fake empty mysql.rb file in there that just does a 'require mysqlplus' then when rails does a |
It's a good idea. However then "mysql.so" should be renamed to any other anme (as "mysqplus_ext.so"). |
I'm beginning to like the idea :) |
+1 for using a different class name |
I've ruby1.8.7 and 1.9.1 installed. In both I've the gems:
When I require mysqlplus in 1.8 it is correctly loaded.
However in Ruby 1.9 I get this error:
The text was updated successfully, but these errors were encountered: