Skip to content
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

[POC] Support numbered parameters #444

Closed
wants to merge 2 commits into from

Conversation

zerg000000
Copy link

@zerg000000 zerg000000 commented Nov 27, 2022

POC #405

Approach

Change the internal presentation of sql from string to nested vector of sql fragments.
Convert back to SQL string only on public consumer API sql/format, sql/format-expr.

  • Replace all (str ...) and (str/join ...) to vector/interpose.
  • Replace hardcoded "?" to marker :parameter-marker
  • Convert parameter marker to '?' or '$1' when convert sql fragments to string.
Good
  • No impact on user that only use helper or format
  • Minimum changes in current code base
Bad
  • Breaking changes in extension API
  • Internal Presentation become a forest of vectors

Checklist

  • workable implementation for discussion
  • Pass all tests
  • Update documentation

Thoughts

  • Align all internal/extend fn to output [sqls params], all external fn to output [sql param1 param2 ...] may help to make code even more concise.
  • Separate user api/extension api. e.g. format-expr separate into format-expr and -format-expr.
  • Standardize the intermediate presentation format.

@seancorfield
Copy link
Owner

Breaking the representation is not acceptable.

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