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:
31
internal/endtoend/testdata/table_name_case_sensitivity/sqlite/go/db.go
vendored
Normal file
31
internal/endtoend/testdata/table_name_case_sensitivity/sqlite/go/db.go
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
// Code generated by sqlc. DO NOT EDIT.
|
||||
// versions:
|
||||
// sqlc v1.31.1
|
||||
|
||||
package querytest
|
||||
|
||||
import (
|
||||
"context"
|
||||
"database/sql"
|
||||
)
|
||||
|
||||
type DBTX interface {
|
||||
ExecContext(context.Context, string, ...any) (sql.Result, error)
|
||||
PrepareContext(context.Context, string) (*sql.Stmt, error)
|
||||
QueryContext(context.Context, string, ...any) (*sql.Rows, error)
|
||||
QueryRowContext(context.Context, string, ...any) *sql.Row
|
||||
}
|
||||
|
||||
func New(db DBTX) *Queries {
|
||||
return &Queries{db: db}
|
||||
}
|
||||
|
||||
type Queries struct {
|
||||
db DBTX
|
||||
}
|
||||
|
||||
func (q *Queries) WithTx(tx *sql.Tx) *Queries {
|
||||
return &Queries{
|
||||
db: tx,
|
||||
}
|
||||
}
|
||||
24
internal/endtoend/testdata/table_name_case_sensitivity/sqlite/go/models.go
vendored
Normal file
24
internal/endtoend/testdata/table_name_case_sensitivity/sqlite/go/models.go
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
// Code generated by sqlc. DO NOT EDIT.
|
||||
// versions:
|
||||
// sqlc v1.31.1
|
||||
|
||||
package querytest
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
)
|
||||
|
||||
type Author struct {
|
||||
ID int64
|
||||
Name sql.NullString
|
||||
}
|
||||
|
||||
type Book struct {
|
||||
ID int64
|
||||
Title sql.NullString
|
||||
}
|
||||
|
||||
type User struct {
|
||||
ID int64
|
||||
Name sql.NullString
|
||||
}
|
||||
183
internal/endtoend/testdata/table_name_case_sensitivity/sqlite/go/query.sql.go
vendored
Normal file
183
internal/endtoend/testdata/table_name_case_sensitivity/sqlite/go/query.sql.go
vendored
Normal file
@@ -0,0 +1,183 @@
|
||||
// Code generated by sqlc. DO NOT EDIT.
|
||||
// versions:
|
||||
// sqlc v1.31.1
|
||||
// source: query.sql
|
||||
|
||||
package querytest
|
||||
|
||||
import (
|
||||
"context"
|
||||
"database/sql"
|
||||
)
|
||||
|
||||
const deleteAuthor = `-- name: DeleteAuthor :exec
|
||||
DELETE FROM "Authors" WHERE id = ?
|
||||
`
|
||||
|
||||
func (q *Queries) DeleteAuthor(ctx context.Context, id int64) error {
|
||||
_, err := q.db.ExecContext(ctx, deleteAuthor, id)
|
||||
return err
|
||||
}
|
||||
|
||||
const deleteBook = `-- name: DeleteBook :exec
|
||||
DELETE FROM books WHERE id = ?
|
||||
`
|
||||
|
||||
func (q *Queries) DeleteBook(ctx context.Context, id int64) error {
|
||||
_, err := q.db.ExecContext(ctx, deleteBook, id)
|
||||
return err
|
||||
}
|
||||
|
||||
const deleteUser = `-- name: DeleteUser :exec
|
||||
DELETE FROM users WHERE id = ?
|
||||
`
|
||||
|
||||
func (q *Queries) DeleteUser(ctx context.Context, id int64) error {
|
||||
_, err := q.db.ExecContext(ctx, deleteUser, id)
|
||||
return err
|
||||
}
|
||||
|
||||
const deleteUserMixedCase = `-- name: DeleteUserMixedCase :exec
|
||||
DELETE FROM users WHERE id = ?
|
||||
`
|
||||
|
||||
func (q *Queries) DeleteUserMixedCase(ctx context.Context, id int64) error {
|
||||
_, err := q.db.ExecContext(ctx, deleteUserMixedCase, id)
|
||||
return err
|
||||
}
|
||||
|
||||
const getAuthor = `-- name: GetAuthor :one
|
||||
SELECT id, name FROM "Authors" WHERE id = ?
|
||||
`
|
||||
|
||||
func (q *Queries) GetAuthor(ctx context.Context, id int64) (Author, error) {
|
||||
row := q.db.QueryRowContext(ctx, getAuthor, id)
|
||||
var i Author
|
||||
err := row.Scan(&i.ID, &i.Name)
|
||||
return i, err
|
||||
}
|
||||
|
||||
const getBook = `-- name: GetBook :one
|
||||
SELECT id, title FROM books WHERE id = ?
|
||||
`
|
||||
|
||||
func (q *Queries) GetBook(ctx context.Context, id int64) (Book, error) {
|
||||
row := q.db.QueryRowContext(ctx, getBook, id)
|
||||
var i Book
|
||||
err := row.Scan(&i.ID, &i.Title)
|
||||
return i, err
|
||||
}
|
||||
|
||||
const getUser = `-- name: GetUser :one
|
||||
SELECT id, name FROM users WHERE id = ?
|
||||
`
|
||||
|
||||
func (q *Queries) GetUser(ctx context.Context, id int64) (User, error) {
|
||||
row := q.db.QueryRowContext(ctx, getUser, id)
|
||||
var i User
|
||||
err := row.Scan(&i.ID, &i.Name)
|
||||
return i, err
|
||||
}
|
||||
|
||||
const getUserMixedCase = `-- name: GetUserMixedCase :one
|
||||
SELECT id, name FROM users WHERE id = ?
|
||||
`
|
||||
|
||||
func (q *Queries) GetUserMixedCase(ctx context.Context, id int64) (User, error) {
|
||||
row := q.db.QueryRowContext(ctx, getUserMixedCase, id)
|
||||
var i User
|
||||
err := row.Scan(&i.ID, &i.Name)
|
||||
return i, err
|
||||
}
|
||||
|
||||
const insertAuthor = `-- name: InsertAuthor :exec
|
||||
INSERT INTO "Authors" (name) VALUES (?)
|
||||
`
|
||||
|
||||
func (q *Queries) InsertAuthor(ctx context.Context, name sql.NullString) error {
|
||||
_, err := q.db.ExecContext(ctx, insertAuthor, name)
|
||||
return err
|
||||
}
|
||||
|
||||
const insertBook = `-- name: InsertBook :exec
|
||||
INSERT INTO books (title) VALUES (?)
|
||||
`
|
||||
|
||||
func (q *Queries) InsertBook(ctx context.Context, title sql.NullString) error {
|
||||
_, err := q.db.ExecContext(ctx, insertBook, title)
|
||||
return err
|
||||
}
|
||||
|
||||
const insertUser = `-- name: InsertUser :exec
|
||||
INSERT INTO users (name) VALUES (?)
|
||||
`
|
||||
|
||||
func (q *Queries) InsertUser(ctx context.Context, name sql.NullString) error {
|
||||
_, err := q.db.ExecContext(ctx, insertUser, name)
|
||||
return err
|
||||
}
|
||||
|
||||
const insertUserMixedCase = `-- name: InsertUserMixedCase :exec
|
||||
INSERT INTO users (name) VALUES (?)
|
||||
`
|
||||
|
||||
func (q *Queries) InsertUserMixedCase(ctx context.Context, name sql.NullString) error {
|
||||
_, err := q.db.ExecContext(ctx, insertUserMixedCase, name)
|
||||
return err
|
||||
}
|
||||
|
||||
const updateAuthor = `-- name: UpdateAuthor :exec
|
||||
UPDATE "Authors" SET name = ? WHERE id = ?
|
||||
`
|
||||
|
||||
type UpdateAuthorParams struct {
|
||||
Name sql.NullString
|
||||
ID int64
|
||||
}
|
||||
|
||||
func (q *Queries) UpdateAuthor(ctx context.Context, arg UpdateAuthorParams) error {
|
||||
_, err := q.db.ExecContext(ctx, updateAuthor, arg.Name, arg.ID)
|
||||
return err
|
||||
}
|
||||
|
||||
const updateBook = `-- name: UpdateBook :exec
|
||||
UPDATE books SET title = ? WHERE id = ?
|
||||
`
|
||||
|
||||
type UpdateBookParams struct {
|
||||
Title sql.NullString
|
||||
ID int64
|
||||
}
|
||||
|
||||
func (q *Queries) UpdateBook(ctx context.Context, arg UpdateBookParams) error {
|
||||
_, err := q.db.ExecContext(ctx, updateBook, arg.Title, arg.ID)
|
||||
return err
|
||||
}
|
||||
|
||||
const updateUser = `-- name: UpdateUser :exec
|
||||
UPDATE users SET name = ? WHERE id = ?
|
||||
`
|
||||
|
||||
type UpdateUserParams struct {
|
||||
Name sql.NullString
|
||||
ID int64
|
||||
}
|
||||
|
||||
func (q *Queries) UpdateUser(ctx context.Context, arg UpdateUserParams) error {
|
||||
_, err := q.db.ExecContext(ctx, updateUser, arg.Name, arg.ID)
|
||||
return err
|
||||
}
|
||||
|
||||
const updateUserMixedCase = `-- name: UpdateUserMixedCase :exec
|
||||
UPDATE users SET name = ? WHERE id = ?
|
||||
`
|
||||
|
||||
type UpdateUserMixedCaseParams struct {
|
||||
Name sql.NullString
|
||||
ID int64
|
||||
}
|
||||
|
||||
func (q *Queries) UpdateUserMixedCase(ctx context.Context, arg UpdateUserMixedCaseParams) error {
|
||||
_, err := q.db.ExecContext(ctx, updateUserMixedCase, arg.Name, arg.ID)
|
||||
return err
|
||||
}
|
||||
47
internal/endtoend/testdata/table_name_case_sensitivity/sqlite/query.sql
vendored
Normal file
47
internal/endtoend/testdata/table_name_case_sensitivity/sqlite/query.sql
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
-- name: InsertUser :exec
|
||||
INSERT INTO users (name) VALUES (?);
|
||||
|
||||
-- name: InsertUserMixedCase :exec
|
||||
INSERT INTO users (name) VALUES (?);
|
||||
|
||||
-- name: InsertAuthor :exec
|
||||
INSERT INTO "Authors" (name) VALUES (?);
|
||||
|
||||
-- name: InsertBook :exec
|
||||
INSERT INTO books (title) VALUES (?);
|
||||
|
||||
-- name: UpdateUser :exec
|
||||
UPDATE users SET name = ? WHERE id = ?;
|
||||
|
||||
-- name: UpdateUserMixedCase :exec
|
||||
UPDATE users SET name = ? WHERE id = ?;
|
||||
|
||||
-- name: UpdateAuthor :exec
|
||||
UPDATE "Authors" SET name = ? WHERE id = ?;
|
||||
|
||||
-- name: UpdateBook :exec
|
||||
UPDATE books SET title = ? WHERE id = ?;
|
||||
|
||||
-- name: DeleteUser :exec
|
||||
DELETE FROM users WHERE id = ?;
|
||||
|
||||
-- name: DeleteUserMixedCase :exec
|
||||
DELETE FROM users WHERE id = ?;
|
||||
|
||||
-- name: DeleteAuthor :exec
|
||||
DELETE FROM "Authors" WHERE id = ?;
|
||||
|
||||
-- name: DeleteBook :exec
|
||||
DELETE FROM books WHERE id = ?;
|
||||
|
||||
-- name: GetUser :one
|
||||
SELECT * FROM users WHERE id = ?;
|
||||
|
||||
-- name: GetUserMixedCase :one
|
||||
SELECT * FROM users WHERE id = ?;
|
||||
|
||||
-- name: GetAuthor :one
|
||||
SELECT * FROM "Authors" WHERE id = ?;
|
||||
|
||||
-- name: GetBook :one
|
||||
SELECT * FROM books WHERE id = ?;
|
||||
13
internal/endtoend/testdata/table_name_case_sensitivity/sqlite/schema.sql
vendored
Normal file
13
internal/endtoend/testdata/table_name_case_sensitivity/sqlite/schema.sql
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
-- Test table name case sensitivity handling across different SQLite operations
|
||||
-- Create tables with different case patterns to verify consistent name resolution
|
||||
CREATE TABLE users (id integer primary key, name text);
|
||||
CREATE TABLE "Authors" (id integer primary key, name text);
|
||||
CREATE TABLE Books (id integer primary key, title text);
|
||||
|
||||
-- Create a temporary table to test drop operations
|
||||
CREATE TABLE temp_orders (id integer primary key);
|
||||
DROP TABLE temp_orders;
|
||||
|
||||
-- Create another temp table with quoted identifier
|
||||
CREATE TABLE "temp_products" (id integer primary key);
|
||||
DROP TABLE "temp_products";
|
||||
12
internal/endtoend/testdata/table_name_case_sensitivity/sqlite/sqlc.json
vendored
Normal file
12
internal/endtoend/testdata/table_name_case_sensitivity/sqlite/sqlc.json
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"version": "1",
|
||||
"packages": [
|
||||
{
|
||||
"path": "go",
|
||||
"engine": "sqlite",
|
||||
"name": "querytest",
|
||||
"schema": "schema.sql",
|
||||
"queries": "query.sql"
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user