-
Notifications
You must be signed in to change notification settings - Fork 833
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generate valid code for MySQL named parameters (#805)
- Loading branch information
1 parent
db397b7
commit 3d23cd9
Showing
5 changed files
with
61 additions
and
12 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
57 changes: 49 additions & 8 deletions
57
internal/endtoend/testdata/params_duplicate/mysql/go/query.sql.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,7 +1,13 @@ | ||
/* name: SelectUserArg :many */ | ||
/* name: SelectUserByID :many */ | ||
SELECT first_name from | ||
users where (sqlc.arg(id) = id OR sqlc.arg(id) = 0); | ||
|
||
/* name: SelectUserByName :many */ | ||
SELECT first_name | ||
FROM users | ||
WHERE first_name = sqlc.arg(name) | ||
OR last_name = sqlc.arg(name); | ||
|
||
/* name: SelectUserQuestion :many */ | ||
SELECT first_name from | ||
users where (? = id OR ? = 0); |
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
CREATE TABLE users ( | ||
id integer NOT NULL AUTO_INCREMENT PRIMARY KEY, | ||
first_name varchar(255) NOT NULL, | ||
first_name varchar(255), | ||
last_name varchar(255) | ||
) ENGINE=InnoDB; |
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