Skip to content
This repository has been archived by the owner on Nov 9, 2021. It is now read-only.

dontQuote doesn't apply in case statements #330

Open
ryanscottaudio opened this issue Sep 6, 2017 · 4 comments
Open

dontQuote doesn't apply in case statements #330

ryanscottaudio opened this issue Sep 6, 2017 · 4 comments
Labels

Comments

@ryanscottaudio
Copy link

ryanscottaudio commented Sep 6, 2017

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.

@b4dnewz
Copy link

b4dnewz commented Sep 15, 2017

Apprently then and else methods doesn't support options docs

@ryanscottaudio
Copy link
Author

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

@b4dnewz
Copy link

b4dnewz commented Sep 15, 2017

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.

@FrancescoBorzi
Copy link

Confirmed

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants