|
@@ -1172,6 +1172,7 @@ namespace OTSPartA_STDEditor
|
|
|
InitForms(STDDBAddress);
|
|
|
this.Text = this.Text.Split(' ')[0] + " " + STDDBAddress;
|
|
|
IsModified = false;
|
|
|
+ CheckAccuracyofZeroRules();
|
|
|
}
|
|
|
catch(Exception ex)
|
|
|
{
|
|
@@ -1385,5 +1386,49 @@ namespace OTSPartA_STDEditor
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ void CheckAccuracyofZeroRules()
|
|
|
+ {
|
|
|
+ System.Data.SQLite.SQLiteConnection m_dbConnection = new System.Data.SQLite.SQLiteConnection("data source='" + STDDBAddress + "'");
|
|
|
+ m_dbConnection.Open();
|
|
|
+ System.Data.SQLite.SQLiteDataAdapter m_dataAdapter = new System.Data.SQLite.SQLiteDataAdapter("select * from ZeroElementRules", m_dbConnection);
|
|
|
+ DataSet ds = new DataSet();
|
|
|
+ m_dataAdapter.Fill(ds);
|
|
|
+ DataTable dt = ds.Tables[0];
|
|
|
+ DataTable dt2 = dt.Copy();
|
|
|
+ if (dt != null)
|
|
|
+ {
|
|
|
+ if (dt.Columns[dt.Columns.Count - 1].ColumnName != "Expression")
|
|
|
+ {
|
|
|
+ System.Data.SQLite.SQLiteCommand cmm = m_dbConnection.CreateCommand();
|
|
|
+
|
|
|
+
|
|
|
+ cmm.CommandText = "CREATE TABLE sqlitestudio_temp_table AS SELECT * FROM ZeroElementRules";
|
|
|
+ cmm.ExecuteNonQuery();
|
|
|
+ cmm.CommandText = "DROP TABLE ZeroElementRules";
|
|
|
+ cmm.ExecuteNonQuery();
|
|
|
+ cmm.CommandText = "CREATE TABLE ZeroElementRules (ZeroElement TEXT,UsingElementList TEXT,UsingImgPropertyList TEXT,UsingOtherPropertyList TEXT,expression TEXT)";
|
|
|
+ cmm.ExecuteNonQuery();
|
|
|
+ cmm.CommandText = @"INSERT INTO ZeroElementRules (
|
|
|
+ ZeroElement,
|
|
|
+ UsingElementList,
|
|
|
+ UsingImgPropertyList,
|
|
|
+ UsingOtherPropertyList,
|
|
|
+ expression
|
|
|
+ )
|
|
|
+ SELECT ZeroElement,
|
|
|
+ UsingElementList,
|
|
|
+ UsingImgPropertyList,
|
|
|
+ UsingOtherPropertyList,
|
|
|
+ expression
|
|
|
+ FROM sqlitestudio_temp_table; ";
|
|
|
+ cmm.ExecuteNonQuery();
|
|
|
+ cmm.CommandText = "DROP TABLE sqlitestudio_temp_table";
|
|
|
+ cmm.ExecuteNonQuery();
|
|
|
+ m_dbConnection.Close();
|
|
|
+ MessageBox.Show("检测到该数据库零元素规则格式错误,已进行修正!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|