snapshot of https://github.com/sqlc-dev/sqlc.git (main, 2026-09-16; blobs > 131072B omitted)
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
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
This commit is contained in:
63
examples/booktest/mysql/query.sql
Normal file
63
examples/booktest/mysql/query.sql
Normal file
@@ -0,0 +1,63 @@
|
||||
/* name: GetAuthor :one */
|
||||
SELECT * FROM authors
|
||||
WHERE author_id = ?;
|
||||
|
||||
/* name: GetBook :one */
|
||||
SELECT * FROM books
|
||||
WHERE book_id = ?;
|
||||
|
||||
/* name: DeleteBook :exec */
|
||||
DELETE FROM books
|
||||
WHERE book_id = ?;
|
||||
|
||||
/* name: BooksByTitleYear :many */
|
||||
SELECT * FROM books
|
||||
WHERE title = ? AND yr = ?;
|
||||
|
||||
/* name: BooksByTags :many */
|
||||
SELECT
|
||||
book_id,
|
||||
title,
|
||||
name,
|
||||
isbn,
|
||||
tags
|
||||
FROM books
|
||||
LEFT JOIN authors ON books.author_id = authors.author_id
|
||||
WHERE tags = ?;
|
||||
|
||||
/* name: CreateAuthor :execresult */
|
||||
INSERT INTO authors (name) VALUES (?);
|
||||
|
||||
/* name: CreateBook :execresult */
|
||||
INSERT INTO books (
|
||||
author_id,
|
||||
isbn,
|
||||
book_type,
|
||||
title,
|
||||
yr,
|
||||
available,
|
||||
tags
|
||||
) VALUES (
|
||||
?,
|
||||
?,
|
||||
?,
|
||||
?,
|
||||
?,
|
||||
?,
|
||||
?
|
||||
);
|
||||
|
||||
/* name: UpdateBook :exec */
|
||||
UPDATE books
|
||||
SET title = ?, tags = ?
|
||||
WHERE book_id = ?;
|
||||
|
||||
/* name: UpdateBookISBN :exec */
|
||||
UPDATE books
|
||||
SET title = ?, tags = ?, isbn = ?
|
||||
WHERE book_id = ?;
|
||||
|
||||
/* name: DeleteAuthorBeforeYear :exec */
|
||||
DELETE FROM books
|
||||
WHERE yr < ? AND author_id = ?;
|
||||
-- WHERE yr < sqlc.arg(min_publish_year) AND author_id = ?;
|
||||
Reference in New Issue
Block a user