Sander Jansen wrote:
> I need to store NaNs in my database and able to retrieve them as well.
>
> Since sqlite will give me back 0.0 when I call sqlite3_column_double
> and a result contains a NAN,
> I was wondering what the best way is to retrieve a NAN from the database.
>
> Here's what I currently do in peudo code:
>
> if (sqlite3_column_type(column)==SQLITE_FLOAT)
>    value = sqlite3_column_double(column);
> else
>    value = NAN;
>
> Now, the doc says that
>
> "The value returned by sqlite3_column_type() is only meaningful if no
> type conversions have occurred as described below."
>
> Am I correctly assuming the "no type conversions have occurred"  means
> "no type conversions on that (row,column) of the result set"? I mean
> next time I call sqlite3_column_type() on the same column but on the
> next row of the result set, it will still give the correct answer?
>
> Thanks,
>
> Sander
>   
That sounds correct, yes.

One suggestion--if the column will always have either a float or NAN, 
why not just not insert anything if you have NAN, and then test for NULL?

HTH,


Gerry
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to