Yup, I am aware of the reason for this.
I believe the reason you probably are not seeing the issue is because I am
running this under JRuby (apologies for not throwing these details up
before):
jruby 1.7.19 (1.9.3p551) 2015-01-29 20786bd on Java HotSpot(TM) 64-Bit
Server VM 1.7.0_60-b19 +jit [darwin-x86_64]
sequel (4.21.0)
jdbc-sqlite3 (3.8.7)
On Wednesday, April 29, 2015 at 9:54:38 AM UTC-5, Jeremy Evans wrote:
>
> On Wednesday, April 29, 2015 at 6:56:48 AM UTC-7, Rohit Amarnath wrote:
>>
>> I have a SQLite table that is defined as:
>>
>> DB.create_table :airport_codes do
>> column :airport_code, :text
>> column :airport_latitude, :real
>> column :airport_longitude, :real
>> end
>>
>> The row stored is:
>>
>> {:airport_code=>"DXB",
>> :airport_latitude=>25.25,
>> :airport_longitude=>55.366667
>> }
>>
>> Row returned by Sequel is:
>>
>> {:airport_code=>"DXB",
>> :airport_latitude=>25.25,
>> :airport_longitude=>55.366668701171875
>> }
>>
>> How can I have it return exactly what is in the database without the
>> precision change?
>>
>
> I can't replicate this issue:
>
> $ ruby bin/sequel -E sqlite:/
> I, [2015-04-29T07:53:04.352789 #4109] INFO -- : (0.001867s) PRAGMA
> foreign_keys = 1
> I, [2015-04-29T07:53:04.352996 #4109] INFO -- : (0.000055s) PRAGMA
> case_sensitive_like = 1
> Your database is stored in DB...
> irb(main):001:0> DB.create_table :airport_codes do
> irb(main):002:1* column :airport_code, :text
> irb(main):003:1> column :airport_latitude, :real
> irb(main):004:1> column :airport_longitude, :real
> irb(main):005:1> end
> I, [2015-04-29T07:53:09.174162 #4109] INFO -- : (0.001155s) CREATE TABLE
> `airport_codes` (`airport_code` text, `airport_latitude` real,
> `airport_longitude` real)
> => nil
> irb(main):006:0> DB[:airport_codes].insert(
> irb(main):007:1* {:airport_code=>"DXB",
> irb(main):008:2* :airport_latitude=>25.25,
> irb(main):009:2* :airport_longitude=>55.366667
> irb(main):010:2> })
> I, [2015-04-29T07:53:32.311542 #4109] INFO -- : (0.000511s) SELECT
> sqlite_version()
> I, [2015-04-29T07:53:32.312180 #4109] INFO -- : (0.000291s) INSERT INTO
> `airport_codes` (`airport_code`, `airport_latitude`, `airport_longitude`)
> VALUES ('DXB', 25.25, 55.366667)
> => 1
> irb(main):011:0> DB[:airport_codes].all
> I, [2015-04-29T07:53:39.567679 #4109] INFO -- : (0.000283s) SELECT * FROM
> `airport_codes`
> => [{:airport_code=>"DXB", :airport_latitude=>25.25,
> :airport_longitude=>55.366667}]
>
> 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.