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

filter not generated properly #2

Open
AxelUlmestig opened this issue Jun 4, 2018 · 2 comments
Open

filter not generated properly #2

AxelUlmestig opened this issue Jun 4, 2018 · 2 comments

Comments

@AxelUlmestig
Copy link

AxelUlmestig commented Jun 4, 2018

const { createFilter } = require('odata-v4-sql');
const filter = createFilter('Id eq 42');
console.log(filter.where) // == '[Id] = ?';

Shouldn't this result in something like '[Id] = 42'?
Or am I missing something here?

@lazarv
Copy link
Contributor

lazarv commented Jun 4, 2018

Hi @AxelUlmestig,
if you need this behaviour, then use the createFilter as:

const filter = createFilter('Id eq 42', { useParameters: false });

@metehansenol
Copy link

Also filter.asMsSql() solves this issue.

But there is another problem about generated filter.where part.
I use ms sql server and createFilter function generates LCASE function in filter.where query and ms sql server doesn't have LCASE function.

Here is an example about above situation;

'$filter': 'contains(tolower(projectName),'as')',
and
SELECT * FROM Projects WHERE LCASE([projectName]) like @p0
(Error: 'LCASE' is not a recognized built-in function name)

What I should do to fix that ?

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

3 participants