Skip to content

Commit

Permalink
update: 完善解析器严格校验
Browse files Browse the repository at this point in the history
  • Loading branch information
hanchuanchuan committed Jan 6, 2020
1 parent 4548bac commit 99f5c7e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion session/session_inception.go
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,8 @@ func (s *session) executeInc(ctx context.Context, sql string) (recordSets []sqle
if err == nil && len(stmtNodes) == 0 {
tmpSQL := strings.TrimSpace(s1)
// 未成功解析时,添加异常判断
if !strings.HasPrefix(tmpSQL, "#") &&
if tmpSQL != "" &&
!strings.HasPrefix(tmpSQL, "#") &&
!strings.HasPrefix(tmpSQL, "--") &&
!strings.HasPrefix(tmpSQL, "/*") {
err = errors.New("解析失败! 可能是解析器bug,请联系作者.")
Expand Down

0 comments on commit 99f5c7e

Please sign in to comment.