Skip to content

Commit

Permalink
expression/expressions: address comment.
Browse files Browse the repository at this point in the history
  • Loading branch information
qiuyesuifeng committed Sep 14, 2015
1 parent 82f6523 commit 002b2a3
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions expression/expressions/cmp_subquery.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,15 @@ func (cs *CompareSubQuery) Eval(ctx context.Context, args map[interface{}]interf
return cs.checkResult(lv, cs.R.Value.([]interface{}))
}

func (cs *CompareSubQuery) checkAllResult(in interface{}, result []interface{}) (interface{}, error) {
func (cs *CompareSubQuery) checkAllResult(lv interface{}, result []interface{}) (interface{}, error) {
hasNull := false
for _, v := range result {
if v == nil {
hasNull = true
continue
}

comRes, err := types.Compare(in, v)
comRes, err := types.Compare(lv, v)
if err != nil {
return nil, errors.Trace(err)
}
Expand All @@ -140,15 +140,15 @@ func (cs *CompareSubQuery) checkAllResult(in interface{}, result []interface{})
return true, nil
}

func (cs *CompareSubQuery) checkAnyResult(in interface{}, result []interface{}) (interface{}, error) {
func (cs *CompareSubQuery) checkAnyResult(lv interface{}, result []interface{}) (interface{}, error) {
hasNull := false
for _, v := range result {
if v == nil {
hasNull = true
continue
}

comRes, err := types.Compare(in, v)
comRes, err := types.Compare(lv, v)
if err != nil {
return nil, errors.Trace(err)
}
Expand All @@ -172,12 +172,12 @@ func (cs *CompareSubQuery) checkAnyResult(in interface{}, result []interface{})
return false, nil
}

func (cs *CompareSubQuery) checkResult(in interface{}, result []interface{}) (interface{}, error) {
func (cs *CompareSubQuery) checkResult(lv interface{}, result []interface{}) (interface{}, error) {
if cs.All {
return cs.checkAllResult(in, result)
return cs.checkAllResult(lv, result)
}

return cs.checkAnyResult(in, result)
return cs.checkAnyResult(lv, result)
}

// NewCompareSubQuery creates a CompareSubQuery object.
Expand Down

0 comments on commit 002b2a3

Please sign in to comment.