Skip to content

Commit

Permalink
should use strings.Contains() instead of strings.Index() (pingcap#4447)
Browse files Browse the repository at this point in the history
  • Loading branch information
wgliang authored and winkyao committed Sep 6, 2017
1 parent a8af813 commit 9a2fa13
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion distsql/xeval/eval_compare_ops.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ func (e *Evaluator) evalLike(expr *tipb.Expr) (types.Datum, error) {
case matchSuffix:
matched = strings.HasSuffix(targetStr, trimmedPattern)
case matchMiddle:
matched = strings.Index(targetStr, trimmedPattern) != -1
matched = strings.Contains(targetStr, trimmedPattern)
}
if matched {
return types.NewIntDatum(1), nil
Expand Down
2 changes: 1 addition & 1 deletion expression/builtin_time.go
Original file line number Diff line number Diff line change
Expand Up @@ -1288,7 +1288,7 @@ func (c *strToDateFunctionClass) getRetTp(arg Expression, ctx context.Context) (
} else if !isDuration && isDate {
tp = mysql.TypeDate
}
if strings.Index(format, "%f") >= 0 {
if strings.Contains(format, "%f") {
fsp = types.MaxFsp
}
return
Expand Down

0 comments on commit 9a2fa13

Please sign in to comment.