Files
upstream-mirror 0f4df23290
Some checks failed
kotlin / test (push) Has been skipped
python / test (push) Has been skipped
typescript / test (push) Has been skipped
go / build darwin/amd64 (push) Has been cancelled
go / build linux/amd64 (push) Has been cancelled
go / build windows/amd64 (push) Has been cancelled
go / build darwin/arm64 (push) Has been cancelled
go / build linux/arm64 (push) Has been cancelled
go / build windows/arm64 (push) Has been cancelled
go / test (push) Has been cancelled
go / vuln_check (push) Has been cancelled
snapshot of https://github.com/sqlc-dev/sqlc.git (main, 2026-09-16; blobs > 131072B omitted)
2026-09-16 02:17:34 +05:00

85 lines
2.1 KiB
Plaintext

--- a/query.sql
+++ b/query.sql
@@ -1,12 +1,15 @@
-- name: GetAuthor :one
+SELECT id, name, bio
+FROM authors
+WHERE id = ?
+LIMIT 1;
-select id,name , bio from authors
-where id = ? limit 1;
-- name: PickyQuery :many
+SELECT
+ id, -- the primary key
+ name,
+ -- computed downstream
+ bio
-SELECT id, -- the primary key
- name,
- -- computed downstream
- bio
FROM authors
-- soft-deleted rows are filtered
WHERE bio IS NOT NULL
@@ -16,7 +19,8 @@
SELECT /* inline note */ id, name FROM authors ORDER BY name;
-- name: ListAuthors :many
+SELECT id, name, bio
+FROM authors
-SELECT id, name, bio FROM authors
ORDER BY name;
-- name: GetEvent :one
@@ -23,8 +27,11 @@
SELECT "EventName", "order"
+FROM "Events"
+WHERE id = ?
+LIMIT 1;
-FROM "Events" WHERE id = ? LIMIT 1;
-- name: CountSigils :one
+SELECT count(*)
+FROM authors
-SELECT count(*) FROM authors
WHERE id <> @at_param AND id <> :colon_param AND id <> $dollar_param;
-- name: TopAuthors :many
@@ -46,7 +53,7 @@
-- name: MakeMeasurements :exec
CREATE TABLE IF NOT EXISTS measurements (
id INTEGER PRIMARY KEY,
+ label VARYING CHARACTER(120),
- label VARYING CHARACTER(120),
ratio DECIMAL(10,5),
note
);
@@ -58,7 +65,7 @@
SELECT CAST(bio AS VARYING CHARACTER(120)) FROM authors LIMIT 1;
-- name: MakeSearchIndex :exec
+CREATE VIRTUAL TABLE IF NOT EXISTS notes_fts USING fts5(body, tag UNINDEXED, tokenize = 'porter');
-CREATE VIRTUAL TABLE IF NOT EXISTS notes_fts USING fts5(body, tag UNINDEXED, tokenize = 'porter');
-- name: MakeRecipeIndex :exec
CREATE VIRTUAL TABLE recipes_fts USING fts5(
@@ -67,7 +74,7 @@
);
-- name: LoginName :one
+SELECT coalesce(bio, '') AS login FROM authors WHERE id = ? LIMIT 1;
-SELECT COALESCE(bio, '') AS login FROM authors WHERE id = ? LIMIT 1;
-- name: SpelledJoins :many
SELECT a.id
@@ -74,6 +81,6 @@
FROM authors AS a
+JOIN authors AS b ON a.id = b.id
+LEFT JOIN authors AS c ON a.id = c.id
-INNER JOIN authors AS b ON a.id = b.id
-LEFT OUTER JOIN authors AS c ON a.id = c.id
WHERE a.id != ? AND b.id == ? AND c.id <> ?;
-- name: CommaJoin :one