Unneeded FLOOR in automated query

Discussion of open issues, suggestions and bugs regarding Entity Framework support in ADO.NET Data providers
Post Reply
IceMan68
Posts: 1
Joined: Sun 14 Mar 2010 12:45

Unneeded FLOOR in automated query

Post by IceMan68 » Sun 14 Mar 2010 12:56

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.

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Mon 15 Mar 2010 16:00

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.

gcuquemelle
Posts: 2
Joined: Fri 26 Aug 2011 12:41

Unneeded FLOOR in automated query

Post by gcuquemelle » Fri 26 Aug 2011 12:51

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

Shalex
Site Admin
Posts: 8247
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Wed 31 Aug 2011 13:43

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.

gcuquemelle
Posts: 2
Joined: Fri 26 Aug 2011 12:41

Post by gcuquemelle » Wed 31 Aug 2011 13:50

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

Post Reply