Re: R: [sqlite] Proposed 3.3.0 changes. Was: 5/2==2

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Re: R: [sqlite] Proposed 3.3.0 changes. Was: 5/2==2

D. Richard Hipp
Zibetti Paolo <[hidden email]> wrote:

> Insert into foo values(5.34);
> Insert into foo values(3.0);
> Table foo will contain two rows that both contain a real-type number, so, to
> read the values back from the DB, I can always use sqlite3_column_double().
> With your proposed change it appears to me that for each row I will have to
> first test for the type of the field and then decide whether to use
> sqlite3_column_double() or sqlite3_column_int().


SQLite has always allowed values to be extracted in any
datatype you want.  You can use sqlite3_column_double() to
retrieve an integer value and it will convert the integer
to a double for you automatically.  Likewise, you can do
sqlite3_column_int64() on a double and it will automatically
do the conversion.  Or you can do sqlite3_column_text() and
it will convert the value to a string and return the string.

This has always been the case and it will not change.
D. Richard Hipp <[hidden email]>