Skip to content

Commit

Permalink
Add '<>' as not equal to in where clause
Browse files Browse the repository at this point in the history
  • Loading branch information
jsixface committed Nov 1, 2017
1 parent 21e7a8a commit f0d7b3b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
3 changes: 3 additions & 0 deletions lexical/lexical.go
Expand Up @@ -142,6 +142,9 @@ func Token() (uint8, *TokenError) {
if lexeme == "=" {
state = S_SMALLER_OR_EQUAL
break
} else if lexeme == ">" {
char = nextChar()
return T_NOT_EQUAL, nil
}
return T_SMALLER, nil
case S_SMALLER_OR_EQUAL:
Expand Down
12 changes: 11 additions & 1 deletion runtime/commits_test.go
Expand Up @@ -84,13 +84,23 @@ func TestSelectedFieldsCount(t *testing.T) {
}
}

func TestNotEqualsInWhereLTGT(t *testing.T) {
queryData := "select committer, hash from commits limit 1"
table := getTableForQuery(queryData, "../", t)
firstCommitter := table.rows[0]["committer"].(string)
query := fmt.Sprintf("select committer, hash from commits where committer <> '%s' limit 1", firstCommitter)
table = getTableForQuery(query, "../", t)
if firstCommitter == table.rows[0]["committer"].(string) {
t.Errorf("Still got the same committer as the first one. - %s", firstCommitter)
}
}
func TestNotEqualsInWhere(t *testing.T) {
queryData := "select committer, hash from commits limit 1"
table := getTableForQuery(queryData, "../", t)
firstCommitter := table.rows[0]["committer"].(string)
query := fmt.Sprintf("select committer, hash from commits where committer != '%s' limit 1", firstCommitter)
table = getTableForQuery(query, "../", t)
if firstCommitter == table.rows[0]["committer"].(string) {
t.Errorf("Strill got the same committer as the first one. - %s", firstCommitter)
t.Errorf("Still got the same committer as the first one. - %s", firstCommitter)
}
}

0 comments on commit f0d7b3b

Please sign in to comment.