You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
In the meantime you can apply this patch:
https://github.com/MaterializeInc/sqlparser/pull/17/files
I’ll look into getting it merged here. It works as you suggest with regards
to CREATE VIEW et al supporting expressions with placeholders. It does not
presently accept named placeholders, however.
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).
Activity
benesch commentedon Nov 22, 2019
mitar commentedon Nov 22, 2019
Yes, something like
$foobarwould be awesome to have for placeholders. (Then mapping to/from GraphQL can be made much smoother.)schreter commentedon Jan 13, 2022
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 commentedon Feb 17, 2022
@gamife has contributed an implementation here: #420
I'll try and cut a new release in the next week or two