Testing SqLite version

Here is a simple code example for this SO question.

Prior to version 3.6.19, SQLite did not support foreign key constraints.

After running the following code in debug mode, you should see the current library version from the debug output. Replace it with another log as you prefer.



SQLiteConnection dbConnection = new SQLiteConnection(@"New.db");
string Head_Create = @"CREATE TABLE IF NOT EXISTS Head
                                                    (ID INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
                                                    , A TEXT
                                                    , B TEXT
                                                    , C TEXT
                                                    , D TEXT
                                                    , E TEXT

ISQLiteStatement cnStatement_Head1 = dbConnection.Prepare(Head_Create);

string check_version = "select sqlite_version()";
ISQLiteStatement check_stmnt = dbConnection.Prepare(check_version);
string out_version = check_stmnt.GetText(0);
Debug.WriteLine("sqlite vers: " + out_version);

string SQLite_Metrados_Head_Pragma = "PRAGMA foreign_keys = ON";
ISQLiteStatement cnStatement_Head2 = dbConnection.Prepare(SQLite_Metrados_Head_Pragma);

One thought on “Testing SqLite version

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s