-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding NULL values and constraints (#10)
- NULL can now be used as a value. - Specifying a `NOT NULL` constraint on table columns will ensure that NULL values will not be added to the table. `NULL` can also be explicitely provided to allow for `NULL`s. - New expressions in the form of `X IS NULL` and `X IS NOT NULL` can be used in both `SELECT` expressions and all `WHERE` clauses. - A new SQLSTATE 23502 violates non-null constraint has been added. As a consequence, also: - TRUE, FALSE and UNKNOWN (boolean values) can now be used in expressions. - SELECT statements support multiple expressions (not just a single value or `*`). However, the `*` is still not actually implemented. - The version stored in the databse file will now start to increment and be enforced for compatibility when opening a database.
- Loading branch information
1 parent
5aed64d
commit 27f7c38
Showing
25 changed files
with
454 additions
and
138 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,8 @@ | ||
SELECT TRUE | ||
-- COL1: TRUE | ||
|
||
SELECT FALSE | ||
-- COL1: FALSE | ||
|
||
SELECT UNKNOWN | ||
-- COL1: UNKNOWN |
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,44 @@ | ||
SELECT NULL | ||
-- COL1: NULL | ||
|
||
SELECT 'a' IS NULL | ||
-- COL1: FALSE | ||
|
||
SELECT 'a' IS NOT NULL | ||
-- COL1: TRUE | ||
|
||
SELECT 1.23 IS NULL | ||
-- COL1: FALSE | ||
|
||
SELECT 1.23 IS NOT NULL | ||
-- COL1: TRUE | ||
|
||
SELECT 123 IS NULL | ||
-- COL1: FALSE | ||
|
||
SELECT 123 IS NOT NULL | ||
-- COL1: TRUE | ||
|
||
SELECT NULL IS NULL | ||
-- COL1: TRUE | ||
|
||
SELECT NULL IS NOT NULL | ||
-- COL1: FALSE | ||
|
||
CREATE TABLE foo (num FLOAT) | ||
INSERT INTO foo (num) VALUES (13) | ||
INSERT INTO foo (num) VALUES (NULL) | ||
INSERT INTO foo (num) VALUES (35) | ||
SELECT 'is null' | ||
SELECT * FROM foo WHERE num IS NULL | ||
SELECT 'is not null' | ||
SELECT * FROM foo WHERE num IS NOT NULL | ||
-- msg: CREATE TABLE 1 | ||
-- msg: INSERT 1 | ||
-- msg: INSERT 1 | ||
-- msg: INSERT 1 | ||
-- COL1: is null | ||
-- NUM: NULL | ||
-- COL1: is not null | ||
-- NUM: 13 | ||
-- NUM: 35 |
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 |
---|---|---|
|
@@ -9,3 +9,6 @@ select 789 | |
|
||
Select 'hello' | ||
-- COL1: hello | ||
|
||
SELECT 123, 456 | ||
-- COL1: 123 COL2: 456 |
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
Oops, something went wrong.