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:
1
internal/sql/preprocess/testdata/mysql/arg/input.sql
vendored
Normal file
1
internal/sql/preprocess/testdata/mysql/arg/input.sql
vendored
Normal file
@@ -0,0 +1 @@
|
||||
SELECT id FROM users WHERE a = sqlc.arg(x) AND b = sqlc.arg(x);
|
||||
1
internal/sql/preprocess/testdata/mysql/arg/output.sql
vendored
Normal file
1
internal/sql/preprocess/testdata/mysql/arg/output.sql
vendored
Normal file
@@ -0,0 +1 @@
|
||||
SELECT id FROM users WHERE a = ? AND b = ?;
|
||||
23
internal/sql/preprocess/testdata/mysql/arg/side_table.json
vendored
Normal file
23
internal/sql/preprocess/testdata/mysql/arg/side_table.json
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
[
|
||||
{
|
||||
"start": 0,
|
||||
"end": 43,
|
||||
"dollar": true,
|
||||
"params": [
|
||||
{
|
||||
"number": 1,
|
||||
"location": 31,
|
||||
"origin": 31,
|
||||
"name": "x",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"number": 2,
|
||||
"location": 41,
|
||||
"origin": 51,
|
||||
"name": "x",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
1
internal/sql/preprocess/testdata/mysql/dollar_number_is_not_a_placeholder/input.sql
vendored
Normal file
1
internal/sql/preprocess/testdata/mysql/dollar_number_is_not_a_placeholder/input.sql
vendored
Normal file
@@ -0,0 +1 @@
|
||||
SELECT * FROM second_view WHERE val2 = $1;
|
||||
1
internal/sql/preprocess/testdata/mysql/dollar_number_is_not_a_placeholder/output.sql
vendored
Normal file
1
internal/sql/preprocess/testdata/mysql/dollar_number_is_not_a_placeholder/output.sql
vendored
Normal file
@@ -0,0 +1 @@
|
||||
SELECT * FROM second_view WHERE val2 = $1;
|
||||
7
internal/sql/preprocess/testdata/mysql/dollar_number_is_not_a_placeholder/side_table.json
vendored
Normal file
7
internal/sql/preprocess/testdata/mysql/dollar_number_is_not_a_placeholder/side_table.json
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
[
|
||||
{
|
||||
"start": 0,
|
||||
"end": 42,
|
||||
"dollar": true
|
||||
}
|
||||
]
|
||||
4
internal/sql/preprocess/testdata/mysql/double_quoted_argument/input.sql
vendored
Normal file
4
internal/sql/preprocess/testdata/mysql/double_quoted_argument/input.sql
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
SELECT
|
||||
(CASE WHEN sqlc.arg("Timezone") = "calendar" THEN cal.Timezone ELSE sqlc.arg("Timezone") END),
|
||||
COALESCE(sqlc.narg("calName"), "")
|
||||
FROM Calendar cal;
|
||||
4
internal/sql/preprocess/testdata/mysql/double_quoted_argument/output.sql
vendored
Normal file
4
internal/sql/preprocess/testdata/mysql/double_quoted_argument/output.sql
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
SELECT
|
||||
(CASE WHEN ? = "calendar" THEN cal.Timezone ELSE ? END),
|
||||
COALESCE(?, "")
|
||||
FROM Calendar cal;
|
||||
31
internal/sql/preprocess/testdata/mysql/double_quoted_argument/side_table.json
vendored
Normal file
31
internal/sql/preprocess/testdata/mysql/double_quoted_argument/side_table.json
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
[
|
||||
{
|
||||
"start": 0,
|
||||
"end": 106,
|
||||
"dollar": true,
|
||||
"params": [
|
||||
{
|
||||
"number": 1,
|
||||
"location": 22,
|
||||
"origin": 22,
|
||||
"name": "Timezone",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"number": 2,
|
||||
"location": 60,
|
||||
"origin": 79,
|
||||
"name": "Timezone",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"number": 3,
|
||||
"location": 81,
|
||||
"origin": 119,
|
||||
"name": "calName",
|
||||
"named": true,
|
||||
"nullable": true
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
1
internal/sql/preprocess/testdata/mysql/embed/input.sql
vendored
Normal file
1
internal/sql/preprocess/testdata/mysql/embed/input.sql
vendored
Normal file
@@ -0,0 +1 @@
|
||||
SELECT sqlc.embed(users) FROM users;
|
||||
1
internal/sql/preprocess/testdata/mysql/embed/output.sql
vendored
Normal file
1
internal/sql/preprocess/testdata/mysql/embed/output.sql
vendored
Normal file
@@ -0,0 +1 @@
|
||||
SELECT users.* FROM users;
|
||||
15
internal/sql/preprocess/testdata/mysql/embed/side_table.json
vendored
Normal file
15
internal/sql/preprocess/testdata/mysql/embed/side_table.json
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
[
|
||||
{
|
||||
"start": 0,
|
||||
"end": 26,
|
||||
"dollar": true,
|
||||
"embeds": [
|
||||
{
|
||||
"table": "users",
|
||||
"location": 7,
|
||||
"origin": 7,
|
||||
"orig": "sqlc.embed(users)"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
11
internal/sql/preprocess/testdata/mysql/error_invalid_calls/input.sql
vendored
Normal file
11
internal/sql/preprocess/testdata/mysql/error_invalid_calls/input.sql
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
-- name: WrongFunc :one
|
||||
SELECT id FROM users WHERE id = sqlc.argh(target_id);
|
||||
|
||||
-- name: TooManyArgs :one
|
||||
SELECT id FROM users WHERE id = sqlc.arg('foo', 'bar');
|
||||
|
||||
-- name: TooFewArgs :one
|
||||
SELECT id FROM users WHERE id = sqlc.arg();
|
||||
|
||||
-- name: InvalidArgPlaceholder :one
|
||||
SELECT id FROM users WHERE id = sqlc.arg(?);
|
||||
11
internal/sql/preprocess/testdata/mysql/error_invalid_calls/output.sql
vendored
Normal file
11
internal/sql/preprocess/testdata/mysql/error_invalid_calls/output.sql
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
-- name: WrongFunc :one
|
||||
SELECT id FROM users WHERE id = sqlc.argh(target_id);
|
||||
|
||||
-- name: TooManyArgs :one
|
||||
SELECT id FROM users WHERE id = sqlc.arg('foo', 'bar');
|
||||
|
||||
-- name: TooFewArgs :one
|
||||
SELECT id FROM users WHERE id = sqlc.arg();
|
||||
|
||||
-- name: InvalidArgPlaceholder :one
|
||||
SELECT id FROM users WHERE id = sqlc.arg(?);
|
||||
30
internal/sql/preprocess/testdata/mysql/error_invalid_calls/side_table.json
vendored
Normal file
30
internal/sql/preprocess/testdata/mysql/error_invalid_calls/side_table.json
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
[
|
||||
{
|
||||
"start": 0,
|
||||
"end": 77,
|
||||
"dollar": true,
|
||||
"error": "function \"sqlc.argh\" does not exist",
|
||||
"error_at": 56
|
||||
},
|
||||
{
|
||||
"start": 77,
|
||||
"end": 160,
|
||||
"dollar": true,
|
||||
"error": "expected 1 parameter to sqlc.arg; got 2",
|
||||
"error_at": 137
|
||||
},
|
||||
{
|
||||
"start": 160,
|
||||
"end": 230,
|
||||
"dollar": true,
|
||||
"error": "expected 1 parameter to sqlc.arg; got 0",
|
||||
"error_at": 219
|
||||
},
|
||||
{
|
||||
"start": 230,
|
||||
"end": 312,
|
||||
"dollar": true,
|
||||
"error": "expected parameter to sqlc.arg to be string or reference; got \"?\"",
|
||||
"error_at": 300
|
||||
}
|
||||
]
|
||||
4
internal/sql/preprocess/testdata/mysql/error_invalid_calls/stderr.txt
vendored
Normal file
4
internal/sql/preprocess/testdata/mysql/error_invalid_calls/stderr.txt
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
2:33: function "sqlc.argh" does not exist
|
||||
5:33: expected 1 parameter to sqlc.arg; got 2
|
||||
8:33: expected 1 parameter to sqlc.arg; got 0
|
||||
11:33: expected parameter to sqlc.arg to be string or reference; got "?"
|
||||
1
internal/sql/preprocess/testdata/mysql/existing_placeholders_are_numbered_together/input.sql
vendored
Normal file
1
internal/sql/preprocess/testdata/mysql/existing_placeholders_are_numbered_together/input.sql
vendored
Normal file
@@ -0,0 +1 @@
|
||||
SELECT id FROM users WHERE a = ? AND b = sqlc.arg(x) AND c = ?;
|
||||
@@ -0,0 +1 @@
|
||||
SELECT id FROM users WHERE a = ? AND b = ? AND c = ?;
|
||||
@@ -0,0 +1,28 @@
|
||||
[
|
||||
{
|
||||
"start": 0,
|
||||
"end": 53,
|
||||
"dollar": false,
|
||||
"params": [
|
||||
{
|
||||
"number": 1,
|
||||
"location": 31,
|
||||
"origin": 31,
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
"number": 2,
|
||||
"location": 41,
|
||||
"origin": 41,
|
||||
"name": "x",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"number": 3,
|
||||
"location": 51,
|
||||
"origin": 61,
|
||||
"named": false
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
1
internal/sql/preprocess/testdata/mysql/narg_identifier/input.sql
vendored
Normal file
1
internal/sql/preprocess/testdata/mysql/narg_identifier/input.sql
vendored
Normal file
@@ -0,0 +1 @@
|
||||
SELECT * FROM users WHERE name = sqlc.narg(name);
|
||||
1
internal/sql/preprocess/testdata/mysql/narg_identifier/output.sql
vendored
Normal file
1
internal/sql/preprocess/testdata/mysql/narg_identifier/output.sql
vendored
Normal file
@@ -0,0 +1 @@
|
||||
SELECT * FROM users WHERE name = ?;
|
||||
17
internal/sql/preprocess/testdata/mysql/narg_identifier/side_table.json
vendored
Normal file
17
internal/sql/preprocess/testdata/mysql/narg_identifier/side_table.json
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
[
|
||||
{
|
||||
"start": 0,
|
||||
"end": 35,
|
||||
"dollar": true,
|
||||
"params": [
|
||||
{
|
||||
"number": 1,
|
||||
"location": 33,
|
||||
"origin": 33,
|
||||
"name": "name",
|
||||
"named": true,
|
||||
"nullable": true
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
2
internal/sql/preprocess/testdata/mysql/on_duplicate_key_update/input.sql
vendored
Normal file
2
internal/sql/preprocess/testdata/mysql/on_duplicate_key_update/input.sql
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
INSERT INTO t (a) VALUES (sqlc.arg(val))
|
||||
ON DUPLICATE KEY UPDATE a = sqlc.arg(new_val);
|
||||
2
internal/sql/preprocess/testdata/mysql/on_duplicate_key_update/output.sql
vendored
Normal file
2
internal/sql/preprocess/testdata/mysql/on_duplicate_key_update/output.sql
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
INSERT INTO t (a) VALUES (?)
|
||||
ON DUPLICATE KEY UPDATE a = ?;
|
||||
23
internal/sql/preprocess/testdata/mysql/on_duplicate_key_update/side_table.json
vendored
Normal file
23
internal/sql/preprocess/testdata/mysql/on_duplicate_key_update/side_table.json
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
[
|
||||
{
|
||||
"start": 0,
|
||||
"end": 59,
|
||||
"dollar": true,
|
||||
"params": [
|
||||
{
|
||||
"number": 1,
|
||||
"location": 26,
|
||||
"origin": 26,
|
||||
"name": "val",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"number": 2,
|
||||
"location": 57,
|
||||
"origin": 69,
|
||||
"name": "new_val",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
1
internal/sql/preprocess/testdata/mysql/skip_backslash_escape/input.sql
vendored
Normal file
1
internal/sql/preprocess/testdata/mysql/skip_backslash_escape/input.sql
vendored
Normal file
@@ -0,0 +1 @@
|
||||
SELECT 'a\' sqlc.arg(nope)';
|
||||
1
internal/sql/preprocess/testdata/mysql/skip_backslash_escape/output.sql
vendored
Normal file
1
internal/sql/preprocess/testdata/mysql/skip_backslash_escape/output.sql
vendored
Normal file
@@ -0,0 +1 @@
|
||||
SELECT 'a\' sqlc.arg(nope)';
|
||||
7
internal/sql/preprocess/testdata/mysql/skip_backslash_escape/side_table.json
vendored
Normal file
7
internal/sql/preprocess/testdata/mysql/skip_backslash_escape/side_table.json
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
[
|
||||
{
|
||||
"start": 0,
|
||||
"end": 28,
|
||||
"dollar": true
|
||||
}
|
||||
]
|
||||
1
internal/sql/preprocess/testdata/mysql/skip_backtick_identifier/input.sql
vendored
Normal file
1
internal/sql/preprocess/testdata/mysql/skip_backtick_identifier/input.sql
vendored
Normal file
@@ -0,0 +1 @@
|
||||
SELECT `sqlc.arg(nope)` FROM t;
|
||||
1
internal/sql/preprocess/testdata/mysql/skip_backtick_identifier/output.sql
vendored
Normal file
1
internal/sql/preprocess/testdata/mysql/skip_backtick_identifier/output.sql
vendored
Normal file
@@ -0,0 +1 @@
|
||||
SELECT `sqlc.arg(nope)` FROM t;
|
||||
7
internal/sql/preprocess/testdata/mysql/skip_backtick_identifier/side_table.json
vendored
Normal file
7
internal/sql/preprocess/testdata/mysql/skip_backtick_identifier/side_table.json
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
[
|
||||
{
|
||||
"start": 0,
|
||||
"end": 31,
|
||||
"dollar": true
|
||||
}
|
||||
]
|
||||
1
internal/sql/preprocess/testdata/mysql/skip_double_quoted_string/input.sql
vendored
Normal file
1
internal/sql/preprocess/testdata/mysql/skip_double_quoted_string/input.sql
vendored
Normal file
@@ -0,0 +1 @@
|
||||
SELECT "sqlc.arg(nope)" FROM t;
|
||||
1
internal/sql/preprocess/testdata/mysql/skip_double_quoted_string/output.sql
vendored
Normal file
1
internal/sql/preprocess/testdata/mysql/skip_double_quoted_string/output.sql
vendored
Normal file
@@ -0,0 +1 @@
|
||||
SELECT "sqlc.arg(nope)" FROM t;
|
||||
7
internal/sql/preprocess/testdata/mysql/skip_double_quoted_string/side_table.json
vendored
Normal file
7
internal/sql/preprocess/testdata/mysql/skip_double_quoted_string/side_table.json
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
[
|
||||
{
|
||||
"start": 0,
|
||||
"end": 31,
|
||||
"dollar": true
|
||||
}
|
||||
]
|
||||
2
internal/sql/preprocess/testdata/mysql/skip_hash_comment/input.sql
vendored
Normal file
2
internal/sql/preprocess/testdata/mysql/skip_hash_comment/input.sql
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
# sqlc.arg(nope)
|
||||
SELECT 1;
|
||||
2
internal/sql/preprocess/testdata/mysql/skip_hash_comment/output.sql
vendored
Normal file
2
internal/sql/preprocess/testdata/mysql/skip_hash_comment/output.sql
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
# sqlc.arg(nope)
|
||||
SELECT 1;
|
||||
7
internal/sql/preprocess/testdata/mysql/skip_hash_comment/side_table.json
vendored
Normal file
7
internal/sql/preprocess/testdata/mysql/skip_hash_comment/side_table.json
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
[
|
||||
{
|
||||
"start": 0,
|
||||
"end": 26,
|
||||
"dollar": true
|
||||
}
|
||||
]
|
||||
1
internal/sql/preprocess/testdata/mysql/slice/input.sql
vendored
Normal file
1
internal/sql/preprocess/testdata/mysql/slice/input.sql
vendored
Normal file
@@ -0,0 +1 @@
|
||||
SELECT id FROM users WHERE id IN (sqlc.slice(ids));
|
||||
1
internal/sql/preprocess/testdata/mysql/slice/output.sql
vendored
Normal file
1
internal/sql/preprocess/testdata/mysql/slice/output.sql
vendored
Normal file
@@ -0,0 +1 @@
|
||||
SELECT id FROM users WHERE id IN (/*SLICE:ids*/?);
|
||||
17
internal/sql/preprocess/testdata/mysql/slice/side_table.json
vendored
Normal file
17
internal/sql/preprocess/testdata/mysql/slice/side_table.json
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
[
|
||||
{
|
||||
"start": 0,
|
||||
"end": 50,
|
||||
"dollar": true,
|
||||
"params": [
|
||||
{
|
||||
"number": 1,
|
||||
"location": 47,
|
||||
"origin": 34,
|
||||
"name": "ids",
|
||||
"named": true,
|
||||
"slice": true
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
1
internal/sql/preprocess/testdata/mysql/slice_folds_identifier/input.sql
vendored
Normal file
1
internal/sql/preprocess/testdata/mysql/slice_folds_identifier/input.sql
vendored
Normal file
@@ -0,0 +1 @@
|
||||
SELECT * FROM foo WHERE retyped IN (sqlc.slice(paramName));
|
||||
1
internal/sql/preprocess/testdata/mysql/slice_folds_identifier/output.sql
vendored
Normal file
1
internal/sql/preprocess/testdata/mysql/slice_folds_identifier/output.sql
vendored
Normal file
@@ -0,0 +1 @@
|
||||
SELECT * FROM foo WHERE retyped IN (/*SLICE:paramname*/?);
|
||||
17
internal/sql/preprocess/testdata/mysql/slice_folds_identifier/side_table.json
vendored
Normal file
17
internal/sql/preprocess/testdata/mysql/slice_folds_identifier/side_table.json
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
[
|
||||
{
|
||||
"start": 0,
|
||||
"end": 58,
|
||||
"dollar": true,
|
||||
"params": [
|
||||
{
|
||||
"number": 1,
|
||||
"location": 55,
|
||||
"origin": 36,
|
||||
"name": "paramname",
|
||||
"named": true,
|
||||
"slice": true
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
1
internal/sql/preprocess/testdata/mysql/string_constant/input.sql
vendored
Normal file
1
internal/sql/preprocess/testdata/mysql/string_constant/input.sql
vendored
Normal file
@@ -0,0 +1 @@
|
||||
SELECT id FROM users WHERE a = sqlc.arg('x') AND b = sqlc.narg('y') AND c IN (sqlc.slice('ids'));
|
||||
1
internal/sql/preprocess/testdata/mysql/string_constant/output.sql
vendored
Normal file
1
internal/sql/preprocess/testdata/mysql/string_constant/output.sql
vendored
Normal file
@@ -0,0 +1 @@
|
||||
SELECT id FROM users WHERE a = ? AND b = ? AND c IN (/*SLICE:ids*/?);
|
||||
32
internal/sql/preprocess/testdata/mysql/string_constant/side_table.json
vendored
Normal file
32
internal/sql/preprocess/testdata/mysql/string_constant/side_table.json
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
[
|
||||
{
|
||||
"start": 0,
|
||||
"end": 69,
|
||||
"dollar": true,
|
||||
"params": [
|
||||
{
|
||||
"number": 1,
|
||||
"location": 31,
|
||||
"origin": 31,
|
||||
"name": "x",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"number": 2,
|
||||
"location": 41,
|
||||
"origin": 53,
|
||||
"name": "y",
|
||||
"named": true,
|
||||
"nullable": true
|
||||
},
|
||||
{
|
||||
"number": 3,
|
||||
"location": 66,
|
||||
"origin": 78,
|
||||
"name": "ids",
|
||||
"named": true,
|
||||
"slice": true
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
1
internal/sql/preprocess/testdata/mysql/string_constant_keeps_case/input.sql
vendored
Normal file
1
internal/sql/preprocess/testdata/mysql/string_constant_keeps_case/input.sql
vendored
Normal file
@@ -0,0 +1 @@
|
||||
SELECT sqlc.arg('MixedCase'), sqlc.arg(MixedCase);
|
||||
1
internal/sql/preprocess/testdata/mysql/string_constant_keeps_case/output.sql
vendored
Normal file
1
internal/sql/preprocess/testdata/mysql/string_constant_keeps_case/output.sql
vendored
Normal file
@@ -0,0 +1 @@
|
||||
SELECT ?, ?;
|
||||
23
internal/sql/preprocess/testdata/mysql/string_constant_keeps_case/side_table.json
vendored
Normal file
23
internal/sql/preprocess/testdata/mysql/string_constant_keeps_case/side_table.json
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
[
|
||||
{
|
||||
"start": 0,
|
||||
"end": 12,
|
||||
"dollar": true,
|
||||
"params": [
|
||||
{
|
||||
"number": 1,
|
||||
"location": 7,
|
||||
"origin": 7,
|
||||
"name": "MixedCase",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"number": 2,
|
||||
"location": 10,
|
||||
"origin": 30,
|
||||
"name": "mixedcase",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
1
internal/sql/preprocess/testdata/mysql/user_variables_are_not_parameters/input.sql
vendored
Normal file
1
internal/sql/preprocess/testdata/mysql/user_variables_are_not_parameters/input.sql
vendored
Normal file
@@ -0,0 +1 @@
|
||||
SELECT @row := @row + 1 FROM users WHERE id = sqlc.arg(id);
|
||||
1
internal/sql/preprocess/testdata/mysql/user_variables_are_not_parameters/output.sql
vendored
Normal file
1
internal/sql/preprocess/testdata/mysql/user_variables_are_not_parameters/output.sql
vendored
Normal file
@@ -0,0 +1 @@
|
||||
SELECT @row := @row + 1 FROM users WHERE id = ?;
|
||||
16
internal/sql/preprocess/testdata/mysql/user_variables_are_not_parameters/side_table.json
vendored
Normal file
16
internal/sql/preprocess/testdata/mysql/user_variables_are_not_parameters/side_table.json
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
[
|
||||
{
|
||||
"start": 0,
|
||||
"end": 48,
|
||||
"dollar": true,
|
||||
"params": [
|
||||
{
|
||||
"number": 1,
|
||||
"location": 46,
|
||||
"origin": 46,
|
||||
"name": "id",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
2
internal/sql/preprocess/testdata/postgresql/arg/input.sql
vendored
Normal file
2
internal/sql/preprocess/testdata/postgresql/arg/input.sql
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
-- name: GetUser :one
|
||||
SELECT id FROM users WHERE name = sqlc.arg(name);
|
||||
2
internal/sql/preprocess/testdata/postgresql/arg/output.sql
vendored
Normal file
2
internal/sql/preprocess/testdata/postgresql/arg/output.sql
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
-- name: GetUser :one
|
||||
SELECT id FROM users WHERE name = $1;
|
||||
16
internal/sql/preprocess/testdata/postgresql/arg/side_table.json
vendored
Normal file
16
internal/sql/preprocess/testdata/postgresql/arg/side_table.json
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
[
|
||||
{
|
||||
"start": 0,
|
||||
"end": 59,
|
||||
"dollar": true,
|
||||
"params": [
|
||||
{
|
||||
"number": 1,
|
||||
"location": 56,
|
||||
"origin": 56,
|
||||
"name": "name",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
1
internal/sql/preprocess/testdata/postgresql/at_sign/input.sql
vendored
Normal file
1
internal/sql/preprocess/testdata/postgresql/at_sign/input.sql
vendored
Normal file
@@ -0,0 +1 @@
|
||||
SELECT id FROM users WHERE name = @name AND age = @age;
|
||||
1
internal/sql/preprocess/testdata/postgresql/at_sign/output.sql
vendored
Normal file
1
internal/sql/preprocess/testdata/postgresql/at_sign/output.sql
vendored
Normal file
@@ -0,0 +1 @@
|
||||
SELECT id FROM users WHERE name = $1 AND age = $2;
|
||||
23
internal/sql/preprocess/testdata/postgresql/at_sign/side_table.json
vendored
Normal file
23
internal/sql/preprocess/testdata/postgresql/at_sign/side_table.json
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
[
|
||||
{
|
||||
"start": 0,
|
||||
"end": 50,
|
||||
"dollar": true,
|
||||
"params": [
|
||||
{
|
||||
"number": 1,
|
||||
"location": 34,
|
||||
"origin": 34,
|
||||
"name": "name",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"number": 2,
|
||||
"location": 47,
|
||||
"origin": 50,
|
||||
"name": "age",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
1
internal/sql/preprocess/testdata/postgresql/at_sign_cast/input.sql
vendored
Normal file
1
internal/sql/preprocess/testdata/postgresql/at_sign_cast/input.sql
vendored
Normal file
@@ -0,0 +1 @@
|
||||
SELECT id FROM users WHERE ok = @flag::bool;
|
||||
1
internal/sql/preprocess/testdata/postgresql/at_sign_cast/output.sql
vendored
Normal file
1
internal/sql/preprocess/testdata/postgresql/at_sign_cast/output.sql
vendored
Normal file
@@ -0,0 +1 @@
|
||||
SELECT id FROM users WHERE ok = $1::bool;
|
||||
16
internal/sql/preprocess/testdata/postgresql/at_sign_cast/side_table.json
vendored
Normal file
16
internal/sql/preprocess/testdata/postgresql/at_sign_cast/side_table.json
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
[
|
||||
{
|
||||
"start": 0,
|
||||
"end": 41,
|
||||
"dollar": true,
|
||||
"params": [
|
||||
{
|
||||
"number": 1,
|
||||
"location": 32,
|
||||
"origin": 32,
|
||||
"name": "flag",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
3
internal/sql/preprocess/testdata/postgresql/at_sign_in_vet_directive/input.sql
vendored
Normal file
3
internal/sql/preprocess/testdata/postgresql/at_sign_in_vet_directive/input.sql
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
-- name: SkipVetAll :exec
|
||||
-- @sqlc-vet-disable always-fail no-exec
|
||||
SELECT true FROM users WHERE id = sqlc.arg(id);
|
||||
3
internal/sql/preprocess/testdata/postgresql/at_sign_in_vet_directive/output.sql
vendored
Normal file
3
internal/sql/preprocess/testdata/postgresql/at_sign_in_vet_directive/output.sql
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
-- name: SkipVetAll :exec
|
||||
-- @sqlc-vet-disable always-fail no-exec
|
||||
SELECT true FROM users WHERE id = $1;
|
||||
16
internal/sql/preprocess/testdata/postgresql/at_sign_in_vet_directive/side_table.json
vendored
Normal file
16
internal/sql/preprocess/testdata/postgresql/at_sign_in_vet_directive/side_table.json
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
[
|
||||
{
|
||||
"start": 0,
|
||||
"end": 104,
|
||||
"dollar": true,
|
||||
"params": [
|
||||
{
|
||||
"number": 1,
|
||||
"location": 101,
|
||||
"origin": 101,
|
||||
"name": "id",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
1
internal/sql/preprocess/testdata/postgresql/comment_inside_call/input.sql
vendored
Normal file
1
internal/sql/preprocess/testdata/postgresql/comment_inside_call/input.sql
vendored
Normal file
@@ -0,0 +1 @@
|
||||
SELECT sqlc.arg/* here */(name);
|
||||
1
internal/sql/preprocess/testdata/postgresql/comment_inside_call/output.sql
vendored
Normal file
1
internal/sql/preprocess/testdata/postgresql/comment_inside_call/output.sql
vendored
Normal file
@@ -0,0 +1 @@
|
||||
SELECT $1;
|
||||
16
internal/sql/preprocess/testdata/postgresql/comment_inside_call/side_table.json
vendored
Normal file
16
internal/sql/preprocess/testdata/postgresql/comment_inside_call/side_table.json
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
[
|
||||
{
|
||||
"start": 0,
|
||||
"end": 10,
|
||||
"dollar": true,
|
||||
"params": [
|
||||
{
|
||||
"number": 1,
|
||||
"location": 7,
|
||||
"origin": 7,
|
||||
"name": "name",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
1
internal/sql/preprocess/testdata/postgresql/embed/input.sql
vendored
Normal file
1
internal/sql/preprocess/testdata/postgresql/embed/input.sql
vendored
Normal file
@@ -0,0 +1 @@
|
||||
SELECT sqlc.embed(users), sqlc.embed(pets) FROM users JOIN pets ON true;
|
||||
1
internal/sql/preprocess/testdata/postgresql/embed/output.sql
vendored
Normal file
1
internal/sql/preprocess/testdata/postgresql/embed/output.sql
vendored
Normal file
@@ -0,0 +1 @@
|
||||
SELECT users.*, pets.* FROM users JOIN pets ON true;
|
||||
21
internal/sql/preprocess/testdata/postgresql/embed/side_table.json
vendored
Normal file
21
internal/sql/preprocess/testdata/postgresql/embed/side_table.json
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
[
|
||||
{
|
||||
"start": 0,
|
||||
"end": 52,
|
||||
"dollar": true,
|
||||
"embeds": [
|
||||
{
|
||||
"table": "users",
|
||||
"location": 7,
|
||||
"origin": 7,
|
||||
"orig": "sqlc.embed(users)"
|
||||
},
|
||||
{
|
||||
"table": "pets",
|
||||
"location": 16,
|
||||
"origin": 26,
|
||||
"orig": "sqlc.embed(pets)"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
1
internal/sql/preprocess/testdata/postgresql/embed_and_user_star/input.sql
vendored
Normal file
1
internal/sql/preprocess/testdata/postgresql/embed_and_user_star/input.sql
vendored
Normal file
@@ -0,0 +1 @@
|
||||
SELECT sqlc.embed(a), b.* FROM a, b;
|
||||
1
internal/sql/preprocess/testdata/postgresql/embed_and_user_star/output.sql
vendored
Normal file
1
internal/sql/preprocess/testdata/postgresql/embed_and_user_star/output.sql
vendored
Normal file
@@ -0,0 +1 @@
|
||||
SELECT a.*, b.* FROM a, b;
|
||||
15
internal/sql/preprocess/testdata/postgresql/embed_and_user_star/side_table.json
vendored
Normal file
15
internal/sql/preprocess/testdata/postgresql/embed_and_user_star/side_table.json
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
[
|
||||
{
|
||||
"start": 0,
|
||||
"end": 26,
|
||||
"dollar": true,
|
||||
"embeds": [
|
||||
{
|
||||
"table": "a",
|
||||
"location": 7,
|
||||
"origin": 7,
|
||||
"orig": "sqlc.embed(a)"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
1
internal/sql/preprocess/testdata/postgresql/embed_quoted_identifier/input.sql
vendored
Normal file
1
internal/sql/preprocess/testdata/postgresql/embed_quoted_identifier/input.sql
vendored
Normal file
@@ -0,0 +1 @@
|
||||
SELECT sqlc.embed("Users") FROM "Users";
|
||||
1
internal/sql/preprocess/testdata/postgresql/embed_quoted_identifier/output.sql
vendored
Normal file
1
internal/sql/preprocess/testdata/postgresql/embed_quoted_identifier/output.sql
vendored
Normal file
@@ -0,0 +1 @@
|
||||
SELECT "Users".* FROM "Users";
|
||||
15
internal/sql/preprocess/testdata/postgresql/embed_quoted_identifier/side_table.json
vendored
Normal file
15
internal/sql/preprocess/testdata/postgresql/embed_quoted_identifier/side_table.json
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
[
|
||||
{
|
||||
"start": 0,
|
||||
"end": 30,
|
||||
"dollar": true,
|
||||
"embeds": [
|
||||
{
|
||||
"table": "Users",
|
||||
"location": 7,
|
||||
"origin": 7,
|
||||
"orig": "sqlc.embed(\"Users\")"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
1
internal/sql/preprocess/testdata/postgresql/embed_string_constant/input.sql
vendored
Normal file
1
internal/sql/preprocess/testdata/postgresql/embed_string_constant/input.sql
vendored
Normal file
@@ -0,0 +1 @@
|
||||
SELECT sqlc.embed('t') FROM t;
|
||||
1
internal/sql/preprocess/testdata/postgresql/embed_string_constant/output.sql
vendored
Normal file
1
internal/sql/preprocess/testdata/postgresql/embed_string_constant/output.sql
vendored
Normal file
@@ -0,0 +1 @@
|
||||
SELECT t.* FROM t;
|
||||
15
internal/sql/preprocess/testdata/postgresql/embed_string_constant/side_table.json
vendored
Normal file
15
internal/sql/preprocess/testdata/postgresql/embed_string_constant/side_table.json
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
[
|
||||
{
|
||||
"start": 0,
|
||||
"end": 18,
|
||||
"dollar": true,
|
||||
"embeds": [
|
||||
{
|
||||
"table": "t",
|
||||
"location": 7,
|
||||
"origin": 7,
|
||||
"orig": "sqlc.embed(t)"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
1
internal/sql/preprocess/testdata/postgresql/embed_with_args/input.sql
vendored
Normal file
1
internal/sql/preprocess/testdata/postgresql/embed_with_args/input.sql
vendored
Normal file
@@ -0,0 +1 @@
|
||||
SELECT sqlc.embed(a), b.name FROM a JOIN b ON b.id = a.b_id WHERE a.id = sqlc.arg(id);
|
||||
1
internal/sql/preprocess/testdata/postgresql/embed_with_args/output.sql
vendored
Normal file
1
internal/sql/preprocess/testdata/postgresql/embed_with_args/output.sql
vendored
Normal file
@@ -0,0 +1 @@
|
||||
SELECT a.*, b.name FROM a JOIN b ON b.id = a.b_id WHERE a.id = $1;
|
||||
24
internal/sql/preprocess/testdata/postgresql/embed_with_args/side_table.json
vendored
Normal file
24
internal/sql/preprocess/testdata/postgresql/embed_with_args/side_table.json
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
[
|
||||
{
|
||||
"start": 0,
|
||||
"end": 66,
|
||||
"dollar": true,
|
||||
"params": [
|
||||
{
|
||||
"number": 1,
|
||||
"location": 63,
|
||||
"origin": 73,
|
||||
"name": "id",
|
||||
"named": true
|
||||
}
|
||||
],
|
||||
"embeds": [
|
||||
{
|
||||
"table": "a",
|
||||
"location": 7,
|
||||
"origin": 7,
|
||||
"orig": "sqlc.embed(a)"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
2
internal/sql/preprocess/testdata/postgresql/error_is_per_statement/input.sql
vendored
Normal file
2
internal/sql/preprocess/testdata/postgresql/error_is_per_statement/input.sql
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
SELECT sqlc.argh(a);
|
||||
SELECT sqlc.arg(b);
|
||||
2
internal/sql/preprocess/testdata/postgresql/error_is_per_statement/output.sql
vendored
Normal file
2
internal/sql/preprocess/testdata/postgresql/error_is_per_statement/output.sql
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
SELECT sqlc.argh(a);
|
||||
SELECT $1;
|
||||
23
internal/sql/preprocess/testdata/postgresql/error_is_per_statement/side_table.json
vendored
Normal file
23
internal/sql/preprocess/testdata/postgresql/error_is_per_statement/side_table.json
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
[
|
||||
{
|
||||
"start": 0,
|
||||
"end": 20,
|
||||
"dollar": true,
|
||||
"error": "function \"sqlc.argh\" does not exist",
|
||||
"error_at": 7
|
||||
},
|
||||
{
|
||||
"start": 20,
|
||||
"end": 31,
|
||||
"dollar": true,
|
||||
"params": [
|
||||
{
|
||||
"number": 1,
|
||||
"location": 28,
|
||||
"origin": 28,
|
||||
"name": "b",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
1
internal/sql/preprocess/testdata/postgresql/error_is_per_statement/stderr.txt
vendored
Normal file
1
internal/sql/preprocess/testdata/postgresql/error_is_per_statement/stderr.txt
vendored
Normal file
@@ -0,0 +1 @@
|
||||
1:8: function "sqlc.argh" does not exist
|
||||
1
internal/sql/preprocess/testdata/postgresql/error_nested_call/input.sql
vendored
Normal file
1
internal/sql/preprocess/testdata/postgresql/error_nested_call/input.sql
vendored
Normal file
@@ -0,0 +1 @@
|
||||
SELECT sqlc.arg(sqlc.arg(a));
|
||||
1
internal/sql/preprocess/testdata/postgresql/error_nested_call/output.sql
vendored
Normal file
1
internal/sql/preprocess/testdata/postgresql/error_nested_call/output.sql
vendored
Normal file
@@ -0,0 +1 @@
|
||||
SELECT sqlc.arg(sqlc.arg(a));
|
||||
9
internal/sql/preprocess/testdata/postgresql/error_nested_call/side_table.json
vendored
Normal file
9
internal/sql/preprocess/testdata/postgresql/error_nested_call/side_table.json
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
[
|
||||
{
|
||||
"start": 0,
|
||||
"end": 29,
|
||||
"dollar": true,
|
||||
"error": "expected parameter to sqlc.arg to be string or reference; got \"sqlc.arg(a)\"",
|
||||
"error_at": 7
|
||||
}
|
||||
]
|
||||
1
internal/sql/preprocess/testdata/postgresql/error_nested_call/stderr.txt
vendored
Normal file
1
internal/sql/preprocess/testdata/postgresql/error_nested_call/stderr.txt
vendored
Normal file
@@ -0,0 +1 @@
|
||||
1:8: expected parameter to sqlc.arg to be string or reference; got "sqlc.arg(a)"
|
||||
1
internal/sql/preprocess/testdata/postgresql/error_no_arguments/input.sql
vendored
Normal file
1
internal/sql/preprocess/testdata/postgresql/error_no_arguments/input.sql
vendored
Normal file
@@ -0,0 +1 @@
|
||||
SELECT sqlc.arg();
|
||||
1
internal/sql/preprocess/testdata/postgresql/error_no_arguments/output.sql
vendored
Normal file
1
internal/sql/preprocess/testdata/postgresql/error_no_arguments/output.sql
vendored
Normal file
@@ -0,0 +1 @@
|
||||
SELECT sqlc.arg();
|
||||
9
internal/sql/preprocess/testdata/postgresql/error_no_arguments/side_table.json
vendored
Normal file
9
internal/sql/preprocess/testdata/postgresql/error_no_arguments/side_table.json
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
[
|
||||
{
|
||||
"start": 0,
|
||||
"end": 18,
|
||||
"dollar": true,
|
||||
"error": "expected 1 parameter to sqlc.arg; got 0",
|
||||
"error_at": 7
|
||||
}
|
||||
]
|
||||
1
internal/sql/preprocess/testdata/postgresql/error_no_arguments/stderr.txt
vendored
Normal file
1
internal/sql/preprocess/testdata/postgresql/error_no_arguments/stderr.txt
vendored
Normal file
@@ -0,0 +1 @@
|
||||
1:8: expected 1 parameter to sqlc.arg; got 0
|
||||
1
internal/sql/preprocess/testdata/postgresql/error_numbering_gap/input.sql
vendored
Normal file
1
internal/sql/preprocess/testdata/postgresql/error_numbering_gap/input.sql
vendored
Normal file
@@ -0,0 +1 @@
|
||||
SELECT id FROM users WHERE a = $2 AND b = $3;
|
||||
1
internal/sql/preprocess/testdata/postgresql/error_numbering_gap/output.sql
vendored
Normal file
1
internal/sql/preprocess/testdata/postgresql/error_numbering_gap/output.sql
vendored
Normal file
@@ -0,0 +1 @@
|
||||
SELECT id FROM users WHERE a = $2 AND b = $3;
|
||||
22
internal/sql/preprocess/testdata/postgresql/error_numbering_gap/side_table.json
vendored
Normal file
22
internal/sql/preprocess/testdata/postgresql/error_numbering_gap/side_table.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
[
|
||||
{
|
||||
"start": 0,
|
||||
"end": 45,
|
||||
"dollar": true,
|
||||
"params": [
|
||||
{
|
||||
"number": 2,
|
||||
"location": 31,
|
||||
"origin": 31,
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
"number": 3,
|
||||
"location": 42,
|
||||
"origin": 42,
|
||||
"named": false
|
||||
}
|
||||
],
|
||||
"param_error": "could not determine data type of parameter $1"
|
||||
}
|
||||
]
|
||||
1
internal/sql/preprocess/testdata/postgresql/error_numbering_gap/stderr.txt
vendored
Normal file
1
internal/sql/preprocess/testdata/postgresql/error_numbering_gap/stderr.txt
vendored
Normal file
@@ -0,0 +1 @@
|
||||
1:1: could not determine data type of parameter $1
|
||||
1
internal/sql/preprocess/testdata/postgresql/error_placeholder_argument/input.sql
vendored
Normal file
1
internal/sql/preprocess/testdata/postgresql/error_placeholder_argument/input.sql
vendored
Normal file
@@ -0,0 +1 @@
|
||||
SELECT sqlc.arg($1);
|
||||
1
internal/sql/preprocess/testdata/postgresql/error_placeholder_argument/output.sql
vendored
Normal file
1
internal/sql/preprocess/testdata/postgresql/error_placeholder_argument/output.sql
vendored
Normal file
@@ -0,0 +1 @@
|
||||
SELECT sqlc.arg($1);
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user