Skip to content

Parameter binding does not work as portrayed on readme #951

Open
@pedrolcn

Description

@pedrolcn

In the readme there doesn't seem to be a consensus as to what character should the parameter placeholder on prepared queries be. Some examples use ? while some examples use $1, $2, $3, .... Let`s enumerate them by section:

Quickstart

  • SELECT $1

Querying

  • SELECT * FROM users WHERE email = ?
  • SELECT * FROM users WHERE email = ? OR name = ?

Compile-time verification

  • SELECT country, COUNT(*) as count FROM users GROUP BY country WHERE organization = ?

I'm using v0.4.2 and tried following these examples, and although it did compile the generated queries did not substitute the parameter placeholder for the bound value when using ?. It only worked (both when query and query_as as well as the macros) when using the $1 placeholders.

I'd be happy to submit a PR correcting the examples as soon as the correct usage is established.

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