Skip to content

[FEATURE] Support for question marks (?) as parameter placeholders #522

Description

@mem

Feature Description

Some database engines and drivers support using ? as a parameter placeholder, notably MySQL/MariaDB (Go driver) and SQLite (engine). It would be useful to have support for them.

Problem Statement

I'm trying to use gosqlx with queries written against MySQL and SQLite using Go drivers. Because the common ground for those two engines in terms of parameter placeholders is ?, that's what I use in my queries (even if SQLite support various forms of named parameters).

Proposed Solution

Extend the parameter placeholder support to include ?. Since PostgreSQL uses a single ? for something else, this would have to be dialect-specific.

Example Usage

I don't have one right now. Basically being able to parse SELECT * FROM t WHERE x = ?

Alternatives Considered

Preprocessing queries to replace ? with something else. Or replacing ? with named parameters and preprocessing to produce the version MySQL accepts.

Benefits

  • Better support for existing queries
  • Users of MySQL/MariaDB/SQLite might use the library with their existing queries

Additional Context

Not at the moment.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions