Page 1 of 1

Unneeded FLOOR in automated query

Posted: Sun 14 Mar 2010 12:56
by IceMan68
Hi,

I'm using an Oracle DB with Entity Framework.
I have a Table with a column named "Type" (can be a number 1-200). I put a condition on what value it sets. I looked at the ToTraceString() When using linq for a simple query and actually in every query it generates:

Code: Select all

select... "Extent1".TYPE AS TYPE....
from ....
where ("Extent1".TYPE = (FLOOR(CAST('1' AS NUMBER)))) OR
 ("Extent1".TYPE = (FLOOR(CAST('2' AS NUMBER)))) OR
 ("Extent1".TYPE = (FLOOR(CAST('3' AS NUMBER)))) OR .....
and so on with all the possible types.

How can I tune it so It won't do that?

Thank you.

Posted: Mon 15 Mar 2010 16:00
by AndreyR
Could you please send me (andreyr * devart * com, subject "EF: Unecessary FLOOR")
a small test project illustrating this problem?
Please include the script of database objects used in it.

Unneeded FLOOR in automated query

Posted: Fri 26 Aug 2011 12:51
by gcuquemelle
Hi,

I have the same generated code :

[code]
INNER JOIN ([huge select on a view]) "Extent4" ON (( FLOOR(CAST( FLOOR(CAST("Extent4".SCC1_FLD AS NUMBER)) AS NUMBER))) = 1)
[/code]

In the view, SCC1_FLD is declared a NUMBER(1,0) and is mapped in EntityFramework to a short value. I tried to use a specific short value in the where clause of the linq request to avoid any conversion problem, but I get the same result.

It is not really a problem, but it is a little bit strange...

I'm using Devart.Data.Oracle 5.70.152.0 and EntityFramework 4

Regards,
Gautier

Posted: Wed 31 Aug 2011 13:43
by Shalex
This behaviour was improved since the 5.70.152 version: there are no unnecessary FLOORs and CASTs in the current version. Please upgrade to dotConnect for Oracle v 6.30.202 and notify us about the results.

Posted: Wed 31 Aug 2011 13:50
by gcuquemelle
Hi,

Thank you for your answer. We will have to do a lot of validation work if we want to upgrade the dotConnect version, and since it is not a blocking issue I think we will keep the double FLOOR/CAST for some times :D

If I can test with the latest version be sure I will notify you the results.

Regards,
Gautier