Skip to content

Function Database.SQLite.Simple.bind Rejects Numbered Parameters #117

Description

@julmb

The check for named parameters in the bind function might be too restrictive:

main :: IO ()
main = withConnection mempty $ \ connection -> do
    result <- query connection "SELECT ?2, ?1, ?2" (16, 42)
    print (result :: [(Int, Int, Int)])

This works just fine and prints [(42,16,42)] when the errorCheckParamName check in bind is removed. That is, the variables are bound according to their ?<index> rather than in order of occurrence in the statement.

This would be useful when a value is needed in multiple places in the same query.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions