Can anyone recommend a PostgreSQL driver for Ruby that supports selecting and inserting bytea types? I'm not looking to write server functions in Ruby, just client applications. Thank you Eric.
on 2010-02-09 16:30
on 2010-02-09 16:51
On 2/9/2010 10:30 AM, CyclingGuy wrote: > Can anyone recommend a PostgreSQL driver for Ruby that supports > selecting and inserting bytea types? > I'm not looking to write server functions in Ruby, just client > applications. > > Thank you > Eric. > Look at ruby-pg. http://bitbucket.org/ged/ruby-pg/overview/ (perhaps in concert with Sequel) http://sequel.rubyforge.org/
on 2010-02-09 16:56
On 2010-02-09, Reid Thompson <reid.thompson@ateb.com> wrote: > On 2/9/2010 10:30 AM, CyclingGuy wrote: >> Can anyone recommend a PostgreSQL driver for Ruby that supports >> selecting and inserting bytea types? >> I'm not looking to write server functions in Ruby, just client >> applications. > Look at ruby-pg. http://bitbucket.org/ged/ruby-pg/overview/ > (perhaps in concert with Sequel) http://sequel.rubyforge.org/ Perhaps more importantly: The subject says "that supports bytea types correctly". Should we infer that you have found a PostgreSQL driver for Ruby that does NOT support selecting and inserting bytea types? If so, which one? What were the symptoms of its incorrect support? -s
on 2010-02-09 17:09
On 2/9/2010 10:43 AM, Reid Thompson wrote: > Look at ruby-pg. http://bitbucket.org/ged/ruby-pg/overview/ > (perhaps in concert with Sequel) http://sequel.rubyforge.org/ > quick test $ irb irb(main):001:0> require 'sequel' => true irb(main):003:0> DB = Sequel.connect('postgres://rthompso@127.0.0.1:5432/test') => #<Sequel::Postgres::Database: "postgres://rthompso@127.0.0.1:5432/test"> irb(main):006:0> DB.create_table :items do irb(main):007:1* primary_key :id irb(main):008:1> String :name irb(main):009:1> Float :price irb(main):010:1> Bytea :mybinary irb(main):011:1> end => [] irb(main):013:0> items = DB[:items] => #<Sequel::Postgres::Dataset: "SELECT * FROM \"items\""> irb(main):017:0> items.insert (:name => 'test', :price => rand * 100, :mybinary => 'djf dfjdslkf fkfhsakfhwe sdaf hdfkhadsf jfasdfj m ^N ^M ') (irb):17: warning: don't put space before argument parentheses => 1 irb(main):022:0> ds = DB[:items] => #<Sequel::Postgres::Dataset: "SELECT * FROM \"items\""> irb(main):023:0> ds.each do |row| irb(main):024:1* p row irb(main):025:1> end {:mybinary=>"djf dfjdslkf fkfhsakfhwe sdaf hdfkhadsf jfasdfj m \016 \r ", :pric e=>45.9518099286502, :name=>"test", :id=>1} => #<Sequel::Postgres::Dataset: "SELECT * FROM \"items\""> irb(main):026:0>
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.