On Wed, 2009-10-07 at 22:45 -0700, Jim wrote:
> Select Issue
> 
> var q = from planTable in cispDB.Plan
>     where (planTable.PlanNo == "ABC1234" || planTable.PlanNo == "ABC1235")
>     join planLaTable in cispDB.PlanLa on planTable.PlanNo equals 
> planLaTable.PlanNo
>     join localAuthTable in cispDB.LocalAUtH on planLaTable.LaCode equals 
> localAuthTable.LaCode
>     select new { planTable.PlanNo, planLaTable.LaCode, localAuthTable.LaName, 
> planTable.TownCode };
> 
> Investigation showed that the eventual SQL query did not bracket the
> OR at all.

This is odd, because if I take src/DbLinq/Test/Providers/ReadTest.cs and
change C12_SelectEmployee_MultiJoinWithWhere() to use:

        var q = from t in db.Territories
            where (t.RegionID > 3 || t.RegionID > 4)
            join l in db.EmployeeTerritories on t.TerritoryID equals 
l.TerritoryID
            join e in db.Employees on l.EmployeeID equals e.EmployeeID
            select e; 
        // ...
        q.Count()

Then the SqlServer provider generates the SQL:

        SELECT COUNT(*)
        FROM [dbo].[Territories] AS t$, [dbo].[EmployeeTerritories] AS l
        $,
            [dbo].[Employees] AS e$
        WHERE (t$.[TerritoryID] = l$.[TerritoryID]) AND 
            (l$.[EmployeeID] = e$.[EmployeeID]) AND 
            ((t$.[RegionID] > 3) OR (t$.[RegionID] > 4))
        -- Context: SqlServer Model: AttributedMetaModel Build: 0.19.0.0

Which properly encloses all of the OR's in parenthesis.

Since this works for SqlServer, I imagine that this is actually an
Ingres provider bug, so fixing SqlBuilder.cs is the place to fix it.

Part of the problem is that Ingres isn't regularly tested (no regular
developer has access to Ingres & runs/maintains the unit tests for it).

> Update Issue
> 
> I cannot get it to update a field !

This is also odd, and is checked in numerous tests (e.g.
WriteTest.G6_UpdateTableWithStringPK() and
WriteTest.G9_UpdateOnlyChangedProperty() in WriteTest.cs).  This may be
another regression in the Ingres provider.

You should see if those unit tests pass for you (though that will
require "porting" test/instnwnd.SqlServer.sql to Ingres, as has been
done forPostgreSQL, Oracle, and SQLite).

 - Jon



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"DbLinq" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/dblinq?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to