schema工具更新了正则表达式逻辑
This commit is contained in:
parent
0a1f2c458d
commit
b1045def04
@ -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是create,0是update
|
int patternType;//1是create,0是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);
|
||||||
|
@ -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>
|
||||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user