hiddentao/squel

dontQuote doesn't apply in case statements

Opened this issue · 4 comments

squel.case().when('published_at <= NOW()').then('test').else('column_name', { dontQuote: true }) will set values matching published_at > NOW() to the string 'column_name' instead of the value in the column column_name.

Apprently then and else methods doesn't support options docs

agreed; this isn't really a bug as much as it is a feature request

I see from the docs you can pass cls.DefaultQueryBuilderOptions to the case builder, so I guess something like this: squel.case({ }) with one of theese options:

autoQuoteAliasNames Boolean
If true then alias names will be rendered inside quotes. The quote character used is configurable via the tableAliasQuoteCharacter and fieldAliasQuoteCharacter options. Default: (false).

autoQuoteFieldNames Boolean
If true then field names will be rendered inside quotes. The quote character used is configurable via the 

nameQuoteCharacter option. Default: (false).

autoQuoteTableNames Boolean
If true then table names will be rendered inside quotes. The quote character used is configurable via the nameQuoteCharacter option. Default: (false).

fieldAliasQuoteCharacter String
The quote character used when quoting field alias names. Default: (").

nameQuoteCharacter String
The quote character used when quoting table and field names. Default: (`).

maybe you can find here the good combination of options. hope this helps.

Confirmed