More info on the DateTime problem... Resolved by reverting back to Sequel 3.3.0. The Mac now handles the DateTime column as expected.
The negative string size ArgumentError still manifests in 3.3.0. It occurs whenever there is an actual error being returned from the Sql Server (syntax error in SQL, bad table name, etc.). Michael On Fri, Jan 15, 2010 at 12:49 AM, mwlang88 <[email protected]> wrote: > I'm connecting to MSDE 2000 via ODBC Driver from Actual Technologies > using Sequel 3.8.0 > > When there is an error condition, I seem to be getting an error from > Sequel not properly handling that error condition: > > irb(main):006:0> DB.execute("use [Database That Exists]") > => nil > irb(main):007:0> DB.execute("use [Database That Does Not Exist]") > ArgumentError: negative string size (or size too big) > from /opt/local/lib/ruby/gems/1.8/gems/sequel-3.8.0/lib/sequel/ > adapters/odbc.rb:51:in `run' > from /opt/local/lib/ruby/gems/1.8/gems/sequel-3.8.0/lib/sequel/ > adapters/odbc.rb:51:in `execute' > from /opt/local/lib/ruby/gems/1.8/gems/sequel-3.8.0/lib/sequel/ > connection_pool.rb:149:in `hold' > from /opt/local/lib/ruby/gems/1.8/gems/sequel-3.8.0/lib/sequel/ > database.rb:532:in `synchronize' > from /opt/local/lib/ruby/gems/1.8/gems/sequel-3.8.0/lib/sequel/ > adapters/odbc.rb:49:in `execute' > from (irb):7 > irb(main):008:0> DB.execute("use [Database That Exists]") > => nil > irb(main):009:0> DB[:patient].count > => 109816 > irb(main):010:0> DB[:patients].count > ArgumentError: negative string size (or size too big) > from /opt/local/lib/ruby/gems/1.8/gems/sequel-3.8.0/lib/sequel/ > adapters/odbc.rb:51:in `run' > from /opt/local/lib/ruby/gems/1.8/gems/sequel-3.8.0/lib/sequel/ > adapters/odbc.rb:51:in `execute' > from /opt/local/lib/ruby/gems/1.8/gems/sequel-3.8.0/lib/sequel/ > connection_pool.rb:149:in `hold' > from /opt/local/lib/ruby/gems/1.8/gems/sequel-3.8.0/lib/sequel/ > database.rb:532:in `synchronize' > from /opt/local/lib/ruby/gems/1.8/gems/sequel-3.8.0/lib/sequel/ > adapters/odbc.rb:49:in `execute' > from /opt/local/lib/ruby/gems/1.8/gems/sequel-3.8.0/lib/sequel/ > dataset/actions.rb:100:in `execute' > from /opt/local/lib/ruby/gems/1.8/gems/sequel-3.8.0/lib/sequel/ > adapters/odbc.rb:96:in `fetch_rows' > from /opt/local/lib/ruby/gems/1.8/gems/sequel-3.8.0/lib/sequel/ > adapters/shared/mssql.rb:223:in `fetch_rows' > from /opt/local/lib/ruby/gems/1.8/gems/sequel-3.8.0/lib/sequel/ > dataset/actions.rb:61:in `each' > from /opt/local/lib/ruby/gems/1.8/gems/sequel-3.8.0/lib/sequel/ > dataset/convenience.rb:232:in `single_record' > from /opt/local/lib/ruby/gems/1.8/gems/sequel-3.8.0/lib/sequel/ > dataset/convenience.rb:239:in `single_value' > from /opt/local/lib/ruby/gems/1.8/gems/sequel-3.8.0/lib/sequel/ > dataset/convenience.rb:79:in `get' > from /opt/local/lib/ruby/gems/1.8/gems/sequel-3.8.0/lib/sequel/ > dataset/sql.rb:122:in `count' > from (irb):10 > > HINT: patient table exists, but patients table does not exist. > > Secondly, a date column doesn't seem to be correctly handled. > > On Linux through unixODBC and FreeTDS: > > irb(main):003:0> d = DB["SELECT TOP 1 [NEW PATIENT DATE] FROM > [PATIENT] WHERE ([CHART NUMBER] = N'09123')"].first[:'new patient > date'] > => #<DateTime: 4910401/2,0,2299161> > irb(main):004:0> > > DB.schema says: [:"new patient date", > {:type=>:datetime, :allow_null=>true, :ruby_default=>nil, :max_chars=>nil, > :db_type=>"datetime",:default=>nil}] > > > But on the Mac, the column comes back as a Time object: > > irb(main):010:0> d = DB["SELECT TOP 1 [NEW PATIENT DATE] FROM > [PATIENT] WHERE ([CHART NUMBER] = N'09123')"].first[:'new patient > date'] > => Mon Jan 04 00:00:00 -0500 2010 > irb(main):011:0> d.class > => Time > irb(main):012:0> > > DB.schema says: [:"new patient date", > {:type=>:datetime, :default=>nil, :max_chars=>nil, :ruby_default=>nil, > :allow_null=>true, :db_type=>"datetime"}] > > Mac's Ruby version: ruby 1.8.7 (2009-06-12 patchlevel 174) [i686- > darwin9] > Linux's Ruby version: ruby 1.8.7 (2008-08-11 patchlevel 72) [i486- > linux] > > Michael > > -- > You received this message because you are subscribed to the Google Groups > "sequel-talk" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/sequel-talk?hl=en. > > > > -- http://codeconnoisseur.org
-- You received this message because you are subscribed to the Google Groups "sequel-talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sequel-talk?hl=en.
