Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parameters used together with quotes are ignored #6

Open
mariuszrak opened this issue Apr 11, 2017 · 0 comments
Open

Parameters used together with quotes are ignored #6

mariuszrak opened this issue Apr 11, 2017 · 0 comments

Comments

@mariuszrak
Copy link

runQuery_ $ sqlSelect "users" $ do
  sqlWhere $ "name = "<?> "Jonathan" 
  sqlResult "id"

will execute a query select id from users where name='Jonathan'

runQuery_ $ sqlSelect "users" $ do
  sqlWhere $ "name = '"<?> "Jonathan" <+> "'"
  sqlResult "id"

will execute a query select id from users where name='$1'
'Jonathan' part will not be used at all. But I'll get id of user with name '$1' if there is one.

Probably no one would use strings like that - but we actually hit this issue with filtering on time:

sqlWhere $ "time >= (NOW() - interval '"<?> durationSecs <+>" seconds'"

@mariuszrak mariuszrak changed the title Parameters used together with quotes are not used Parameters used together with quotes ignored Apr 11, 2017
@mariuszrak mariuszrak changed the title Parameters used together with quotes ignored Parameters used together with quotes are ignored Apr 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant