odata-v4-sql icon indicating copy to clipboard operation
odata-v4-sql copied to clipboard

filter not generated properly

Open AxelUlmestig opened this issue 7 years ago • 2 comments

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?

AxelUlmestig avatar Jun 04 '18 09:06 AxelUlmestig

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

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

lazarv avatar Jun 04 '18 15:06 lazarv

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 ?

metehansenol avatar Aug 22 '19 08:08 metehansenol