[MacRuby-devel] Can any kind macruby experts help me get sqlite3 gem working with macruby--please?
Tim Rand
timrandg at gmail.com
Tue Mar 31 01:17:45 PDT 2009
Can any kind macruby experts help me get sqlite3 gem working with macruby?
sqlite3-ruby-1.2.4 ruby gem works in ruby 1.9.0. So I think it should work
in macruby also...
>From macirb I added the path to the gem:
$: << "path/to/the/sqlite3-ruby-1.2.4/lib"
require 'sqlite3.rb' # => true
$db = SQLite3::Database.new("/path/to/x.db.rsd")
RuntimeError: *no driver for sqlite3 found*
the error comes from the load_driver method near line 621 of the
sqlite3/database.rb file.
def load_driver( driver )
case driver
when Class
# do nothing--use what was given
when Symbol, String
require "sqlite3/driver/#{driver.to_s.downcase}/driver"
driver = SQLite3::Driver.const_get( driver )::Driver
else
[ "Native", "DL" ].each do |d|
begin
require "sqlite3/driver/#{d.downcase}/driver"
driver = SQLite3::Driver.const_get( d )::Driver
break
rescue SyntaxError
raise
rescue ScriptError, Exception, NameError
end
end
raise "no driver for sqlite3 found" unless driver
end
@driver = driver.new
end
private :load_driver
Macruby enters the method with driver set to NSNull, and the driver fails to
load. In ruby (1.9.0) the driver loads via the Native driver.
irb19 session:
>> db = SQLite3::Database.new("/Users/Tim/Desktop/newdb")
=> #<SQLite3::Database:0x5cba48
@driver=#<SQLite3::Driver::Native::Driver:0x5c4784 @callback_data={},
@authorizer={}, @busy_handler={}, @trace={}>,
@statement_factory=SQLite3::Statement,
@handle=#<SWIG::TYPE_p_sqlite3:0x5c470c>, @closed=false,
@results_as_hash=false, @type_translation=false, @translator=nil,
@transaction_active=false>
Can anyone offer an idea about how they might try to patch this to work with
macruby? I know an alternative would be CoreData--but it is too cumbersome
for me.
Thanks,
Tim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-devel/attachments/20090331/d7cc0899/attachment-0001.html>
More information about the MacRuby-devel
mailing list