public void WriteVersion(DatabaseVersion value) { using (this.Connection.OpenWrapper()) { using (var cmd = new SQLiteCommand("SELECT COUNT(*) FROM " + TableName, this.Connection)) { if ((Int64)cmd.ExecuteScalar() == 0) { using (SQLiteCommand cmd2 = new SQLiteCommand( "INSERT INTO " + TableName + " DEFAULT VALUES", this.Connection ) ) { cmd2.ExecuteNonQuery(); } } } } string sql = string.Format( "UPDATE {0} SET" + " {1} = {2}" + " ,{3} = {4}" + " WHERE (" + " ({1} IS NULL OR {1} != {2})" + " OR" + " ({3} IS NULL OR {3} != {4})" + " );", TableName, DbSchemaVersionMajorFn, value.Major, DbSchemaVersionMinorFn, value.Minor ); using (this.Connection.OpenWrapper()) { using (SQLiteCommand cmd = new SQLiteCommand(sql, this.Connection)) { cmd.ExecuteNonQuery(); } } }
public bool MinorChangedOver(DatabaseVersion another) { return(this.MajorChangedOver(another) || this.Minor != another.Minor); }
public bool IsOlderOrSameAs(DatabaseVersion another) { return(this.Major < another.Major || this.Major == another.Major && this.Minor <= another.Minor); }
public bool MinorChangedOver(DatabaseVersion another) { return this.MajorChangedOver(another) || this.Minor != another.Minor; }
public bool IsOlderOrSameAs(DatabaseVersion another) { return this.Major < another.Major || this.Major == another.Major && this.Minor <= another.Minor; }