I found a problem with SQlite on NETMF and Gadgeteer Package 2014 R2.
When I try to read a sqlite table register that contains a null value, it triggers the following message:
“Row must contain exactly as many members as the number of columns in this result set”
To replicate the issue, the following code can be used:
GHI.SQLite.Database db = new Database(); db.ExecuteNonQuery("CREATE TABLE [Samples] ( [IdField] integer PRIMARY KEY NOT NULL, [Datafield1] text, [Datafield2] text )"); db.ExecuteNonQuery("INSERT INTO Samples (IdField, Datafield1, Datafield2) VALUES (1, 'DATA 1', 'DATA 2')"); db.ExecuteNonQuery("INSERT INTO Samples (IdField, Datafield1) VALUES (2, 'DATA 1')"); GHI.SQLite.ResultSet qry1Res = db.ExecuteQuery("SELECT * FROM Samples WHERE IdField = 1"); //this is ok, because no null values on result set GHI.SQLite.ResultSet qry2Res = db.ExecuteQuery("SELECT * FROM Samples WHERE IdField = 2"); //this throws the error, because DataField2 contains a null value on result set
Is this a bug from GHI Sqlite implementation or did i miss something? Is there a workaround so I can keep with product development?