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

Add support for parsing placeholders #145

Closed
mitar opened this issue Nov 22, 2019 · 4 comments
Closed

Add support for parsing placeholders #145

mitar opened this issue Nov 22, 2019 · 4 comments

Comments

@mitar
Copy link

mitar commented Nov 22, 2019

Maybe I missed something, but I think placeholders are not yet supported and cannot be parsed. I would like to ask if this could be added.

Ideally, with few extensions than a regular parser:

  • In regular SQL queries, only SELECT, INSERT, UPDATE queries can have placeholders. But for my use case it would be great if also other statements can have them, like CREATE VIEW which takes a query, and that one could have placeholders, because CREATE VIEW is specially processed in my case. (See Document SQL syntax used mit-pdos/noria#142 for more information.)
  • Common SQL databases support position-based placeholders, I would love it some way of having keyword-based ones could be added. This then maps very well to how one can provide values with a dict structure instead of position.
@benesch
Copy link
Contributor

benesch commented Nov 22, 2019 via email

@mitar
Copy link
Author

mitar commented Nov 22, 2019

Yes, something like $foobar would be awesome to have for placeholders. (Then mapping to/from GraphQL can be made much smoother.)

@schreter
Copy link

I'm also missing parameter placeholder support.

We considered using sqlparser as the parser for a (for now) "demo" Rust-based frontend to our Rust-based data store backend. Ideally, it should become the default frontend. However, to support prepared statements, placeholder support is needed. In our SQL dialect, those are specified with a question mark, as used in most "large" RDBMSs, like MS SQL, Oracle SQL, SAP HANA DB SQL, etc.

Would it be possible to add support for this as well? It should be fairly trivial extension to the patch above (though, it didn't land in the source code yet, so not sure whether it can be even applied).

Thanks.

@alamb
Copy link
Contributor

alamb commented Feb 17, 2022

@gamife has contributed an implementation here: #420

I'll try and cut a new release in the next week or two

@alamb alamb closed this as completed Feb 17, 2022
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

No branches or pull requests

4 participants