I confirmed that it does not exhibit the behavior in jdbc-sqllite3 3.7.2.1 
(so it isn't a JRuby/Java JDK issue), and the DB.type_converter_map works 
in 3.8.7.

Thank you!
Rohit

On Wednesday, April 29, 2015 at 5:48:59 PM UTC-5, Jeremy Evans wrote:
>
> On Wednesday, April 29, 2015 at 3:17:32 PM UTC-7, Rohit Amarnath wrote:
>>
>> Running it directly in jdbc-sqlite3:
>>
>> [1] pry(#<Dragonfly::Routes>)> rs.getString(5)
>> => "55.366667"
>> [2] pry(#<Dragonfly::Routes>)> rs.getFloat(5)
>> => 55.366668701171875
>> [3] pry(#<Dragonfly::Routes>)> rs.getDouble(5)
>> => 55.366667
>>
>> Is there a way in Sequel to have return the Double and not the Float?
>>
>
> I tried to replicate this on jdbc/sqlite, but I wasn't able to:
>
> $ jruby bin/sequel -E jdbc:sqlite::memory:
> I, [2015-04-29T15:47:30.641000 #10462]  INFO -- : (0.002000s) PRAGMA 
> foreign_keys = 1
> I, [2015-04-29T15:47:30.842000 #10462]  INFO -- : (0.002000s) PRAGMA 
> case_sensitive_like = 1
> Your database is stored in DB...
> irb(main):001:0> DB.create_table(:a){real :a}
> I, [2015-04-29T15:47:35.167000 #10462]  INFO -- : (0.022000s) CREATE TABLE 
> `a` (`a` real)
> => nil
> irb(main):002:0> DB[:a].insert 55.366667
> I, [2015-04-29T15:47:39.487000 #10462]  INFO -- : (0.016000s) SELECT 
> sqlite_version()
> I, [2015-04-29T15:47:39.499000 #10462]  INFO -- : (0.005000s) INSERT INTO 
> `a` VALUES (55.366667)
> => 1
> irb(main):003:0> DB[:a].all
> I, [2015-04-29T15:47:43.373000 #10462]  INFO -- : (0.003000s) SELECT * 
> FROM `a`
> => [{:a=>55.366667}]
>
> However, I am using jdbc-sqlite3 3.7.2.1, maybe this is a regression in 
> later jdbc-sqlite3 versions.
>
> You can try the following, it may work:
>
> DB.type_convertor_map[Java::JavaSQL::Types::REAL] = 
> Sequel::JDBC::TypeConvertor::INSTANCE.method(:Double)
>
> Thanks,
> Jeremy
>

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to