crud icon indicating copy to clipboard operation
crud copied to clipboard

Nested filters on Oracle don't work

Open steeu opened this issue 5 years ago • 1 comments

When executing a nested filter query (https://github.com/nestjsx/crud/wiki/Requests#filter) on a oracle database i get the following error:

Error: ORA-22806: not an object or REF

The reason is the dot notation "boss.name" from the filter, that ist used in the SQL reference as "andWhereboss.name5388566708706500"

Example:

WHERE ("boss"."ENAME" = :andWhereboss.name5388566708706500) ORDER BY "EmployeeEntity"."ENAME" A
SC -- PARAMETERS: ["SCOTT"]

Unfortunately Oracle is not happy with the "." in the reference.

A possible solution, that in my case works could be to remove the "." from the reference with ${i.replace(/\./g,'')}.

See file: https://github.com/nestjsx/crud/blob/master/packages/crud-typeorm/src/typeorm-crud.service.ts Line: 531

setAndWhere(cond, i, builder) {
    const { str, params } = this.mapOperatorsToQuery(cond, `andWhere${i.replace(/\./g,'')}`);
    builder.andWhere(str, params);
}

Please let me know what you think about this.

steeu avatar Jan 22 '20 15:01 steeu

I'm still having the same issue, have you found a solution @steeu ?

hanza93 avatar Nov 12 '21 22:11 hanza93