Skip to content

Add support for parsing placeholders #145

Closed

Description

@mitar

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.

Activity

  1. benesch commented on Nov 22, 2019

    @benesch
    Contributor
  2. mitar commented on Nov 22, 2019

    @mitar
    Author

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

  3. schreter commented on Jan 13, 2022

    @schreter

    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.

  4. alamb commented on Feb 17, 2022

    @alamb
    Contributor

    @gamife has contributed an implementation here: #420

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions