GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — fix(sqlite): keep parameter in LIKE ... ESCAPE ? by manuelschoene · Pull Request #4675 · sqlc-dev/sqlc ConversationFixes #4668 ProblemWith the SQLite engine, a parameter in the -- name: SearchName :many SELECT id FROM t WHERE name LIKE ? ESCAPE ?; // before func (q *Queries) SearchName(ctx context.Context, name string) ([]int64, error) { rows, err := q.db.QueryContext(ctx, searchName, name) What happens at runtime depends on how the parameters are written:
Both the default analyzer and the core analyzer ( CauseThe SQLite parser reads the escape into Changes
After the fix: type SearchNameParams struct { Name string Escape string } type SearchThenWhereParams struct { Name string Escape string Score int64 } TestsTwo new end-to-end cases share the same schema and queries:
Both paths generate identical code. The cases cover:
I ran the test suite without databases (
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactionsAdded a escape field to the AST expression struct. This field now stores the node for the ESCAPE clause and gets walked. The SQLite converter fills in the field. Both the default and core analyzer got a new case for recording the ESCAPE parameters. Added end-to-end tests with different combinations of parameters inside the ESCAPE clause. like_escape uses the default analyzer while like_escape_core uses the core analyzer. Both tests contain the same test cases but use the different analyzers.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ReviewersNo reviewsUh oh!
There was an error while loading. Please reload this page. AssigneesNo one assignedLabels
None yet
ProjectsMilestoneNo milestoneDevelopmentSuccessfully merging this pull request may close these issues. SQLite: parameter in LIKE ... ESCAPE ? is dropped from generated codeUh oh!
There was an error while loading. Please reload this page. Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later. |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |