The log of our product started showing SQLite warnings. We ignored them to focus on the release. Now it was time to repro and fix the warnings.
After reading the verbose log we found the issue. Unknown datatypes are allowed when creating SQLite database, but log a warning when the check database routine would call GetSchema.
WARNING: Type mapping failed, returning default type Object for name “LARGEINT”.
WARNING: Type mapping failed, returning default name “” for type Object.
See the repro code below. System.Data.SQLite can be downloaded from here.
static void Main(string[] args) { // Trace to see SQLite warning Trace.Listeners.Add(new ConsoleTraceListener()); // Use in-memory database var connectionString = "Data Source=:memory:;Version=3;"; using(var connection = new SQLiteConnection(connectionString)) { connection.Open(); // Create table with unknown datatype column using (var createTableOne = connection.CreateCommand()) { createTableOne.CommandText = "CREATE TABLE One (Id LARGEINT NOT NULL);"; createTableOne.ExecuteNonQuery(); } // Table is created, no exceptions, only warning on GetSchema var schema = connection.GetSchema("Columns", null); var result = schema.Select("TABLE_NAME = 'One'"); if (result.Length > 0) Console.WriteLine("One exists"); else Console.WriteLine("One not exists"); } Console.ReadLine(); }
We edited the create database scripts to use known SQLite types and the issue was resolved.