amd64 mostly stable gentoo: Trying to use sample test below leads to module loading failure: $ ruby a.rb /usr/lib64/ruby/site_ruby/1.8/dbi.rb:368:in `load_driver': Could not load driver (no such file to load -- pg) (DBI::InterfaceError) from /usr/lib64/ruby/site_ruby/1.8/dbi.rb:233:in `_get_full_driver' from /usr/lib64/ruby/site_ruby/1.8/dbi.rb:219:in `connect' from a.rb:19:in `with_db' from a.rb:35 Emerging ~arch 'dev-ruby/pg' helps the situation. Sample test a.rb: #!/usr/bin/ruby require 'dbi' module DB_CONF DRIVER = 'Pg' HOST = 'foo_host' DB = 'foo_DB' USER = 'foo_USER' PASS = 'foo_pas' end def with_db(*block) if ! block_given? raise "no block given" end result = nil DBI.connect("dbi:#{DB_CONF::DRIVER}:#{DB_CONF::DB}:#{DB_CONF::HOST}", DB_CONF::USER, DB_CONF::PASS) {|dbh| #$log.info("connected to db") dbh['AutoCommit'] = false begin result = yield dbh dbh.commit rescue => e dbh.rollback #log_exception("with_db", e) raise e end } result end with_db{|dbh| query = dbh.prepare("SELECT * FROM foo") query.execute row = query.fetch() }
Okay we need a newer version that uses ruby-ng, since this one is still old style...
I'm closing this as WONTFIX since ruby-dbi-0.4.3 does depend on dev-ruby/pg and is stable on most arches now.