-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
修复oracle审核正则匹配问题 #1169 #1194
修复oracle审核正则匹配问题 #1169 #1194
Conversation
你好!感谢你反馈的问题/bug,但是你的描述好像是空的,我们需要你完整的信息,这样才能帮你解决问题 如果不知道怎么写,在新建issue的时候有若干个模板可供选择,祝好! |
不知道咋回事 CI 没有跑起来, 有空我看看 |
ci应该坏了,看咋改成action |
Codecov Report
@@ Coverage Diff @@
## master #1194 +/- ##
=======================================
Coverage 77.91% 77.91%
=======================================
Files 76 76
Lines 11973 11973
=======================================
Hits 9329 9329
Misses 2644 2644
Continue to review full report at Codecov.
|
sql/engines/oracle.py
Outdated
@@ -225,15 +225,15 @@ def get_dml_table(sql='', object_name_list=None, db_name=''): | |||
else: | |||
return False | |||
elif re.match(r"^delete", sql): | |||
table_name = re.match(r"^delete\s+from\s(.+?)\s", sql, re.M).group(1) | |||
table_name = re.match(r"^delete\s+from\s(.+?)", sql, re.M).group(1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个正则没有考虑存在where条件的场景,调整为delete\s+from\s(.+?)\s*
是不是更合适
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个正则没有考虑存在where条件的场景,调整为
delete\s+from\s(.+?)\s*
是不是更合适
delete\s+from\s(.+?)\s*
的话只能匹配到表名的第一个字符,改成 delete\s+from\s+([\w-]+)\s*
测试了下应该没问题了
正则匹配问题 #1169
1.delete语句没有where条件时匹配不到最后一个空格
table_name = re.match(r"^delete\s+from\s(.+?)", sql, re.M).group(1)
2.同时发现insert语句漏匹配insert all when... into这种情况
table_name = re.match(r"^insert\s+((into)|(all\s+into)|(all\s+when\s(.+?)into))\s(.+?)((|\s)", sql, re.M).group(6)