Hello everybody !
First of all I have to say that I'm a fairly new user of SQLite, so be
kind :-)
The problem is with the "round" function: the result have a decimal
point even if the second argument is zero (the default):
sqlite> select round(1.234);
1.0
sqlite> select round(1.234,0);
1.0
I'm not sure if this shouldn't produce '1' instead of '1.0'.
The reason for bringing this up is the resulted storage class in a
statement like this:
INSERT INTO tableint SELECT ROUND(some_expression) FROM other_table;
I know that in theory this shouldn't matter for SQLite, but I suppose
that some queries would be more efficient if the storage class is
INTEGER for the columns involved (please tell me if I'm wrong here).
So, here are the questions:
1. If you feel that round should behave this way, how do I submit a
patch. Not a lot of modifications nor terrible smart (basically some
work done at the end of roundFunc from func.c), but I'm also curios how
one can submit patches (sorry if I missed this info from sqlite.org).
2. Is there a way to find the storage class for a particular field from
a particular row of a table?
I'm not sure for example if the next statements will produce the same
storage class:
create tableint (i integer);
insert into tableint values(1);
insert into tableint values(1.0);
insert into tableint values(round(1));
I'm just getting used with VDBE, but from running these with "explain" I
think everything is clear until reaching "MakeRecord". For example, the
first statement would produce something like:
---- cut -----
5|Integer|1|0|
6|MakeRecord|1|0|d
---- cut -----
And the second:
---- cut -----
5|Real|0|0|1.0
6|MakeRecord|1|0|d
---- cut -----
The 'd' from MakeRecord is just the column affinity, doesn't specify how
the actual record was stored:
sqlite> explain insert into tableint values(1.5);
...
5|Real|0|0|1.5
6|MakeRecord|1|0|d
...
Same code, but obviously 1.5 is stored as real.
Regards,
-Iulian
-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------