Page 1 of 1

Bug with datatype char(8) ?

Posted: Thu 12 Nov 2009 16:12
by Holger_CP
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()

Posted: Fri 13 Nov 2009 12:04
by AndreyR
Thank you for the report, we are investigating the problem.
I will let you know about the results of our investigation.

Posted: Mon 16 Nov 2009 15:03
by AndreyR
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

Posted: Wed 18 Nov 2009 16:09
by Holger_CP
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.