private string[] sqlKeyWord = new string[9] { "INSERT", "UPDATE", "DELETE", "DROP", "CREATE", "ALTER", "TRUNCATE", "GRANT", "REVOKE" };
// 检查特殊字符
if (!string.IsNullOrEmpty(inputPanel.SiteSql.Sql))
{
Match match;
foreach (var key in sqlKeyWord)
{
match = Regex.Match(inputPanel.SiteSql.Sql, $@"(?<![\w\d]){key}(?![\w\d])", RegexOptions.IgnoreCase);
if (match.Success)
{
throw new Exception($"{inputPanel.SiteSql.Type}不能包含关键字{key}");
}
}
}