[plt-scheme] storing exact values in sqlite3?

From: Thomas Chust (chust at web.de)
Date: Tue Jul 14 10:57:24 EDT 2009

2009/7/13 Mike Eggleston <mikeegg1 at mac.com>:
> [...]
> sqlite> insert into data values (3);
> sqlite> insert into data values (7/5);
> sqlite> select * from data;
> 3
> 1
> [...]

Hello,

the documentation of SQLite3 states that the database engine knows
about integral, floating point, string, binary blob and null types. To
store an exact fraction you have to encode it as an object of one of
the supported types.

I would suggest to store the numerator and denominator as integers in
separate columns, to encode the fractions as strings if speed doesn't
matter that much or to store inexact floating point numbers instead if
precision doesn't matter that much.

cu,
Thomas


-- 
When C++ is your hammer, every problem looks like your thumb.


Posted on the users mailing list.