Problem with comparision of char fields
Posted: Thu 12 Jul 2012 13:45
If we execute the following linq query with dotConnect for oracle v.7.0.25.0 we get an empty result. With previous versions there were no problems.
type of entity.STATE is String
type of criteria.State is String
value of criteria.State is "A"
connection string contains Unicode = true
The field STATE in database view TESTVIEW is defined as Char.
DbMonitor shows that the generated sql statement is equal with the generated sql statement of previous versions.
The curious thing is if we change the order of parameters in the where clause we get a result:
DbMonitor shows that now the p__linq__0 parameter is of type VarChar instead of Char.
Why the order in the where clause is important now or is it a bug?
Code: Select all
var entities = from entity in context.TESTVIEW
where entity.STATE == criteria.State
select entity;type of criteria.State is String
value of criteria.State is "A"
connection string contains Unicode = true
The field STATE in database view TESTVIEW is defined as Char.
DbMonitor shows that the generated sql statement is equal with the generated sql statement of previous versions.
Code: Select all
SELECT
1 AS C1,
"Extent1".DESIGNER,
"Extent1".INFO,
"Extent1".SPKEY,
"Extent1".STATE
FROM (SELECT
TESTVIEW.DESIGNER,
TESTVIEW.INFO,
TESTVIEW.SPKEY,
TESTVIEW.STATE
FROM TESTVIEW) "Extent1"
WHERE :p__linq__0 = "Extent1".STATECode: Select all
var entities = (from entity in context.TESTVIEW
where criteria.State == entity.STATE
select entity);Why the order in the where clause is important now or is it a bug?