Skip to content
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

Merged
merged 4 commits into from
Dec 1, 2021
Merged

修复oracle审核正则匹配问题 #1169 #1194

merged 4 commits into from
Dec 1, 2021

Conversation

nick2wang
Copy link
Collaborator

@nick2wang nick2wang commented Oct 15, 2021

正则匹配问题 #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)

@request-info
Copy link

request-info bot commented Oct 15, 2021

你好!感谢你反馈的问题/bug,但是你的描述好像是空的,我们需要你完整的信息,这样才能帮你解决问题 如果不知道怎么写,在新建issue的时候有若干个模板可供选择,祝好!

@LeoQuote
Copy link
Collaborator

不知道咋回事 CI 没有跑起来, 有空我看看

@hhyo
Copy link
Owner

hhyo commented Oct 17, 2021

ci应该坏了,看咋改成action

@codecov
Copy link

codecov bot commented Oct 18, 2021

Codecov Report

Merging #1194 (c4962d0) into master (b1d48cf) will not change coverage.
The diff coverage is 0.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1194   +/-   ##
=======================================
  Coverage   77.91%   77.91%           
=======================================
  Files          76       76           
  Lines       11973    11973           
=======================================
  Hits         9329     9329           
  Misses       2644     2644           
Impacted Files Coverage Δ
sql/engines/oracle.py 50.19% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b1d48cf...c4962d0. Read the comment docs.

hhyo
hhyo previously approved these changes Oct 19, 2021
@@ -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)
Copy link
Owner

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* 是不是更合适

Copy link
Collaborator Author

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* 测试了下应该没问题了

@hhyo hhyo merged commit b090240 into hhyo:master Dec 1, 2021
@nick2wang nick2wang deleted the nick-patch branch December 27, 2021 08:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants