> Unfortunately, this is not true for SQLite3. If you execute the following SQL 
> commands
> 
>   CREATE TABLE t (a REAL, b REAL);
>   INSERT INTO t VALUES (5, 2);
>
> both values are stored as INTEGER and not as REAL as one would expect
> by the column affinity. In fact, this behaviour is intentional and is
> stated in the help as a feature to minimize storage space for INTEGER
> numbers.

I think, it can be fixed by introducing special internal data type:
REAL_STORED_AS_INTEGER

If table column have REAL type, but inserted value is INTEGER, then
inserted type becomes REAL_STORED_AS_INTEGER and binary representation
keep small. When column value is extracted from SQLite or used in
SQL expression, then value dynamically converted to REAL.

That is, the user of database never see values of this type directly.
Such values stored as INTEGER, but can be seen only as REAL.


Best regards,
 Alexander                            mailto:[EMAIL PROTECTED]

Reply via email to