Bug with datatype char(8) ?

Discussion of open issues, suggestions and bugs regarding Entity Framework support in ADO.NET Data providers
Post Reply
Holger_CP
Posts: 3
Joined: Mon 13 Jul 2009 10:05

Bug with datatype char(8) ?

Post by Holger_CP » Thu 12 Nov 2009 16:12

Hi,

i have a problem with DevartProvider 5.25.49, EntityFramework and Oracle 10i

Lets assume there is a table "Families" with a column "FamilyName" of type char(8).

Now, i want query (in c#) the family name with following statement, which works great.

Example1:
var result = (from table in familyEntities.Families
where table.FAMILYNAME == "Meier"
select table).FirstOrDefault();


But now, if i use a parameter, the result will be null.

Example2:
string name = "Meier";
var result = (from table in familyEntities.Families
where table.FAMILYNAME == name
select table).FirstOrDefault();


the only difference in the generated sql syntax is:
Example 1: ... WHERE 'Meier' = "Extent1".FAMILYNAME
Example 2: ... WHERE "Extent1".FAMILYNAME = :p__linq__1

.. but that should be ok.

Iam not sure if this a problem with entity framework or devart provider.
Any ideas?

regards, Holger
PS. both examples works well if the colum type is varchar()

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

Post by AndreyR » Fri 13 Nov 2009 12:04

Thank you for the report, we are investigating the problem.
I will let you know about the results of our investigation.

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

Post by AndreyR » Mon 16 Nov 2009 15:03

The SQL query executed using pure ADO.NET code (OracleCommand) gives the same result.
We recommend using the explicit Trim() call in case one is using the char columns and parameter comparison,
like in the following example:

Code: Select all

where table.FAMILYNAME.Trim() == name

Holger_CP
Posts: 3
Joined: Mon 13 Jul 2009 10:05

Post by Holger_CP » Wed 18 Nov 2009 16:09

Hi, thanks a lot.

It is not the Solution i hoped for, because not all of our developers knows the database field types (our project contains more than 200 tables).

But at least it works.

Post Reply