-
Notifications
You must be signed in to change notification settings - Fork 515
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bind arguments with SqlBinaryExpr (#4604)
- Loading branch information
Showing
4 changed files
with
240 additions
and
1 deletion.
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
35 changes: 35 additions & 0 deletions
35
...tgresql/src/main/sqldelight/app/cash/sqldelight/postgresql/integration/BinaryArguments.sq
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,35 @@ | ||
import java.time.Instant; | ||
|
||
CREATE TABLE data ( | ||
datum INTEGER NOT NULL, | ||
point INTEGER NOT NULL, | ||
created_at TIMESTAMP AS Instant NOT NULL, | ||
updated_at TIMESTAMP AS Instant NOT NULL | ||
); | ||
|
||
insertData: | ||
INSERT INTO data(datum, point, created_at, updated_at) | ||
VALUES(?, ?, ?, ?); | ||
|
||
selectDataBinaryComparison: | ||
SELECT * | ||
FROM data | ||
WHERE datum > :datum1 - 2.5 AND datum < :datum2 + 2.5; | ||
|
||
selectDataBinaryCast1: | ||
SELECT *, (datum + CAST(:datum1 AS REAL) * point) AS expected_datum | ||
FROM data; | ||
|
||
selectDataBinaryCast2: | ||
SELECT CAST(:datum1 AS REAL) + CAST(:datum2 AS INTEGER) - 10.5 AS expected_datum | ||
FROM data; | ||
|
||
selectDataBinaryIntervalComparison1: | ||
SELECT * | ||
FROM data | ||
WHERE created_at = :createdAt - INTERVAL '2 days' OR updated_at = :updatedAt + INTERVAL '2 days'; | ||
|
||
selectDataBinaryIntervalComparison2: | ||
SELECT * | ||
FROM data | ||
WHERE created_at BETWEEN :createdAt - INTERVAL '2 days' AND :createdAt + INTERVAL '2 days'; |
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