Compare commits

..

2 Commits

3 changed files with 4 additions and 4 deletions

View File

@ -528,8 +528,8 @@ WHERE
var subsql = sql.Split(';'); var subsql = sql.Split(';');
#region #region
// 正则表达式 // 正则表达式
string pattern = @"(?<=ALTER\s+TABLE\s+`)[^`]+"; string pattern = @"(?i)\balter\s+table\s+[`']?([a-zA-Z0-9_]+)[`']?";
string pattern2 = @"(?<=CREATE\s+TABLE\s+`)[^`]+"; string pattern2 = @"(?i)\bcreate\s+table\s+[`']?([a-zA-Z0-9_]+)[`']?";
int patternType;//1是create0是update int patternType;//1是create0是update
foreach (var sqlstr in subsql) foreach (var sqlstr in subsql)
{ {
@ -554,7 +554,7 @@ WHERE
if (match.Length == 0 ) if (match.Length == 0 )
{ {
//无效的sql //无效的sql
LogInfo(baseDirectory + logFileName, $"无法从{SQLFILENAME}.sql文件中解析出正确的create table 或 update table。确保是有效的sql。文本为 {sqlstr}"); LogInfo(baseDirectory + logFileName, $"无法从{SQLFILENAME}文件中解析出正确的create table 或 update table。确保是有效的sql。文本为 {sqlstr}");
continue; continue;
} }
var groupMatch = Regex.Matches(sqlstr, pattern); var groupMatch = Regex.Matches(sqlstr, pattern);

View File

@ -20,7 +20,7 @@
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType> <DebugType>full</DebugType>
<Optimize>false</Optimize> <Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath> <OutputPath>..\..\..\..\IIS\SWS\UpgradeTool\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants> <DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>