[Haskell-cafe] How to store Fixed data type in the database with persistent ?

Michael Snoyman michael at snoyman.com
Sat Jan 26 18:16:19 CET 2013


Very nice to see, I'm happy to stand corrected here. We'll definitely get
some support for fixed into the next major release.

On Saturday, January 26, 2013, wrote:

> > According to the documentation, SQLite stores whatever you give it,
> > paying very little heed to the declared type.  If you get SQLite to
> > *compare* two numbers, it will at that point *convert* them to doubles
> > in order to carry out the comparison.  This is quite separate from the
> > question of what it can store.
>
> CREATE TABLE t1(val);
> sqlite> insert into t1 values ('24.24242424')
>    ...> ;
> sqlite> insert into t1 values ('24.24242423')
>    ...> ;
> sqlite> select * from t1 order by val;
> 24.24242423
> 24.24242424
> sqlite> select * from t1 order by val desc;
> 24.24242424
> 24.24242423
> sqlite> select sum(val) from t1;
> 48.48484847
>
> it seems Sqlite can work with arbitrary percission data, very good !
> Persistent must have ability to store Fixed.
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org <javascript:;>
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20130126/87b82f07/attachment.htm>


More information about the Haskell-Cafe mailing list