Content-Length: 277992 | pFad | http://github.com/googleapis/go-sql-spanner/pull/427

EE chore: create statementParser struct and make it dialect-aware by olavloite · Pull Request #427 · googleapis/go-sql-spanner · GitHub
Skip to content

chore: create statementParser struct and make it dialect-aware #427

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: add-statement-cache
Choose a base branch
from

Conversation

olavloite
Copy link
Collaborator

Refactors the statement parser into a struct that contains a field for the database dialect that is being used. This dialect field will be used in follow-up pull request to implement dialect-specific parsing.

Refactors the statement parser into a struct that contains a field for the database
dialect that is being used. This dialect field will be used in follow-up pull request
to implement dialect-specific parsing.
@olavloite olavloite requested a review from a team as a code owner May 21, 2025 14:08
@olavloite olavloite requested review from rahul2393, aakashanandg and bhatt4982 and removed request for rahul2393 and aakashanandg May 21, 2025 14:09
if err != nil {
return "", nil, err
}
info := detectStatementType(sql)
statementsCache.Add(sql, &statementsCacheEntry{sql: namedParamsSql, params: params, info: info})
info := p.detectStatementType(sql)
Copy link
Collaborator

@rahul2393 rahul2393 May 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: params here if modified later will modify the cache entry also, if we don't want it we may want to
Return a defensive copy:

paramsCopy := append([]string(nil), res.params...)
return res.sql, paramsCopy, nil

Example: https://go.dev/play/p/L69JoBslaWl

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.

2 participants








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/googleapis/go-sql-spanner/pull/427

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy