System.Data.SQLite

Login
This project makes use of Eagle, provided by Mistachkin Systems.
Eagle: Secure Software Automation
Ticket Hash: 192bd3b5b24665d123751484c1d58ae4a8558200
Title: GetDouble handling of NaN
Status: Closed Type: Incident
Severity: Important Priority: Medium
Subsystem: Data_Reader Resolution: Works_As_Designed
Last Modified: 2013-06-25 22:22:44
Version Found In: 1.0.86.0
User Comments:
anonymous added on 2013-06-25 12:51:58:

If a field of a column of type REAL, is filled with NaN, the method VerifyType(i, DbType.Double); called by GetDouble(int i) in SQLiteDataReader.cs throws an InvalidCastException.

   
CREATE TABLE dummy(
   id            integer PRIMARY KEY AUTOINCREMENT NOT NULL, 
   val           integer NOT NULL,
   val_critical  real  
);

SQLiteDataReader reader = command.ExecuteReader();
  while (reader.Read())
    Console.WriteLine(reader.GetDouble(2)); //throws an exception if it reads NaN

possible solution:
Add following line to SQLiteDataReader.cs at line:353 in method VerifyType(int i, DbType typ):
if (typ == DbType.Double) return affinity;


mistachkin added on 2013-06-25 20:57:05:
Also see ticket [e06c4caff3].

mistachkin added on 2013-06-25 22:22:44:
The type affinity for NaN is NULL, according to the SQLite core library.