Procházet zdrojové kódy

新增零元素数据库列顺序错误提示行为

cxs před 9 měsíci
rodič
revize
23eb27334a

+ 9 - 3
OTSCPP/OTSSQLiteDll/SQLiteDB.cpp

@@ -75,7 +75,6 @@ namespace OTSSQLITE
 		{
 			return CDBQueryBasePtr();
 		}
-
 		auto query = datastorePtr->QueryByTableName(sTableName, a_sOrderColumnName);
 		ASSERT(query);
 		if (!query || !query->IsValid())
@@ -83,7 +82,6 @@ namespace OTSSQLITE
 			LogErrorTrace(__FILE__, __LINE__, _T("Invalid table(%s) query command."), (LPCTSTR)tableInfoPtr->GetTableName());
 			return CDBQueryBasePtr();
 		}
-
 		// do the table related valid checking
 		auto cols1 = query->GetColCount();
 		auto cols2 = tableInfoPtr->GetColumnCount();
@@ -91,7 +89,15 @@ namespace OTSSQLITE
 		{
 			LogErrorTrace(__FILE__, __LINE__, _T(sTableName+":Invalid table columns(%d): should be %d"), query->GetColCount(), tableInfoPtr->GetColumnCount());
 		}
-		
+		for (int i = 0; i < cols1; i++)
+		{
+			if (query->GetColName(i) != tableInfoPtr->GetColumnName(i))
+			{
+				AfxMessageBox(_T("The format of the zero element rule is incorrect. Please use the standard library editor to adjust and try again!"));
+				LogErrorTrace(__FILE__, __LINE__, _T("The format of the zero element rule is incorrect."));
+				break;
+			}
+		}
 		return query;
 	}
 	CDBQueryBasePtr	CSQLiteDB::GetCommandStringQuery(LPCTSTR a_commandStr /*= nullptr*/)

+ 3 - 3
OTSPartA_STDEditor/UI/Form_Main.cs

@@ -1407,20 +1407,20 @@ namespace OTSPartA_STDEditor
                     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.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
+                                 Expression
                              )
                              SELECT ZeroElement,
                                     UsingElementList,
                                     UsingImgPropertyList,
                                     UsingOtherPropertyList,
-                                    expression
+                                    Expression
                                FROM sqlitestudio_temp_table; ";
                     cmm.ExecuteNonQuery();
                     cmm.CommandText = "DROP TABLE sqlitestudio_temp_table";