Skip to content

Fix placeholder sequence#1

Open
ycalansy wants to merge 4 commits into
tnissen375:masterfrom
ycalansy:fix-placeholder-sequence
Open

Fix placeholder sequence#1
ycalansy wants to merge 4 commits into
tnissen375:masterfrom
ycalansy:fix-placeholder-sequence

Conversation

@ycalansy

@ycalansy ycalansy commented Oct 12, 2022

Copy link
Copy Markdown

This pull request fixes the issue of incorrect positional arguments.

Example:

StatementBuilder = StatementBuilder.PlaceholderFormat(Dollar)
cteBuilder := Select("*").From("users").Where("id = ?", 1)
queryBuilder := Select("*").From("base").Where("name = ?", "John Doe").With("base", cteBuilder)
sql, args, err := queryBuilder.ToSql()

When there are placeholders in both the CTE and the main query, the current master branch renders the above query as follows, which incorrectly reuses position number 1.

WITH base AS (SELECT * FROM users WHERE id = $1) SELECT * FROM base WHERE name = $1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant