-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5b47284
commit ea1ee2f
Showing
15 changed files
with
164 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
local function operator_not_between(left, right) | ||
-- If the value is null then the result is always null. | ||
if left == cjson.null or right[1] == cjson.null | ||
or right[2] == cjson.null then | ||
return cjson.null | ||
end | ||
|
||
-- We can only deal with numbers. | ||
if type(left) ~= 'number' or type(right[1]) ~= 'number' | ||
or type(right[2]) ~= 'number' then | ||
error(string.format('No such operator %s NOT BETWEEN %s AND %s.', | ||
type(left), type(right[1]), type(right[2]))) | ||
end | ||
|
||
-- Perform comparison. | ||
return left < right[1] or left > right[2] | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
tests: | ||
a_null: | ||
sql: SELECT null NOT BETWEEN 3 AND 7 | ||
result: | ||
- {"col1": null} | ||
|
||
b_null: | ||
sql: SELECT 5 NOT BETWEEN null AND 7 | ||
result: | ||
- {"col1": null} | ||
|
||
c_null: | ||
sql: SELECT 5 NOT BETWEEN 3 AND null | ||
result: | ||
- {"col1": null} | ||
|
||
less_than: | ||
sql: SELECT 2 NOT BETWEEN 3 AND 7 | ||
result: | ||
- {"col1": true} | ||
|
||
bottom: | ||
sql: SELECT 3 NOT BETWEEN 3 AND 7 | ||
result: | ||
- {"col1": false} | ||
|
||
middle: | ||
sql: SELECT 5 NOT BETWEEN 3 AND 7 | ||
result: | ||
- {"col1": false} | ||
|
||
top: | ||
sql: SELECT 7 NOT BETWEEN 3 AND 7 | ||
result: | ||
- {"col1": false} | ||
|
||
greater_than: | ||
sql: SELECT 8 NOT BETWEEN 3 AND 7 | ||
result: | ||
- {"col1": true} | ||
|
||
incompatible_a: | ||
sql: SELECT "foo" NOT BETWEEN 3 AND 7 | ||
error: No such operator string NOT BETWEEN number AND number. | ||
|
||
incompatible_b: | ||
sql: SELECT 123 NOT BETWEEN "foo" AND 7 | ||
error: No such operator number NOT BETWEEN string AND number. | ||
|
||
incompatible_c: | ||
sql: SELECT 123 NOT BETWEEN 3 AND "foo" | ||
error: No such operator number NOT BETWEEN number AND string. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters