hiddentao / squel

:office: SQL query string builder for Javascript
https://hiddentao.github.io/squel
MIT License
1.56k stars 231 forks source link

Feature request: Placeholders in the squel.case(...) expression? #362

Open papandreou opened 6 years ago

papandreou commented 6 years ago

I'm trying to use a placeholder with a case expression, but it leaves the ? there:

> require('squel').case('"column" = ?', 'abc').when('true').then(123).toString()
'CASE "column" = ? WHEN (true) THEN 123 ELSE NULL END'

The docs say that the second parameter is an options object, so I also tried passing the placeholder value as the 3rd and 4th, neither of which made a difference.

It works fine in when (except for the auto-quoting, which is already covered in #330):

> require('squel').case('column').when('?', 'abc').then(123).toString()
'CASE column WHEN (\'abc\') THEN 123 ELSE NULL END'