Hi,
I'm using LINQPad & Entity Framework 3.5 with Firebird 2.5.2 and trying to 
learn Linq.
I've converted the NorthwindEF.mdf database to Firebird 2.5 and I have a
problem with the OrderDetail, UnitPrice (money) field. By definition the
field is defined as decimal(18,4) which is the highest value allowed in
firebird. When using the sample below an error is raised because the sql
created uses a cast to decimal(19,0) (highlight in red). If I cut and paste in 
ibexpert
and test with a change to (18,0) everything works.  I wrote the author (Joe 
Albahari <m...@albahari.com>)  of linqpad http://www.linqpad.net/ and he 
suggested that it's a Firebird provider issue.
TIA
John



Linq:
from p in Products
let spanishOrders = p.OrderDetails.Where (o => o.Order.ShipCountry ==
"Spain")
where spanishOrders.Any()
orderby p.ProductName
select new
{
        p.ProductName,

        Orders = spanishOrders.Count(), 
        TotalValue = spanishOrders.Sum (o =>o.UnitPrice *  o.Quantity)
}
LinqPad
Result:
Fail: decimalPrecision must be less than or equal to 18
Command:
SELECT 
"Project4"."C1" AS "C1", 
"Project4"."ProductName" AS "ProductName", 
"Project4"."C2" AS "C2", 
"Project4"."C3" AS "C3"
FROM ( SELECT 
        "Project3"."ProductName" AS "ProductName", 
        1 AS "C1", 
        "Project3"."C1" AS "C2", 
        "Project3"."C2" AS "C3"
        FROM ( SELECT 
                "Project2"."ProductName" AS "ProductName", 
                "Project2"."C1" AS "C1", 
                (SELECT 
                        Sum("Filter4"."A1") AS "A1"
                        FROM ( SELECT 
                                "Extent6"."UnitPrice" * 
(CAST("Extent6"."Quantity" AS DECIMAL(19,0))) AS "A1"
                                FROM  "OrderDetails" AS "Extent6"
                                INNER JOIN "Orders" AS "Extent7" ON 
"Extent6"."OrderID" = "Extent7"."OrderID"
                                WHERE ("Project2"."ProductID" = 
"Extent6"."ProductID") AND (_UTF8'Spain' = "Extent7"."ShipCountry")
                        )  AS "Filter4") AS "C2"
                FROM ( SELECT 
                        "Extent1"."ProductID" AS "ProductID", 
                        "Extent1"."ProductName" AS "ProductName", 
                        (SELECT 
                                Count("Filter3"."A1") AS "A1"
                                FROM ( SELECT 
                                        CAST(1 AS SMALLINT) AS "A1"
                                        FROM  "OrderDetails" AS "Extent4"
                                        INNER JOIN "Orders" AS "Extent5" ON 
"Extent4"."OrderID" = "Extent5"."OrderID"
                                        WHERE ("Extent1"."ProductID" = 
"Extent4"."ProductID") AND (_UTF8'Spain' = "Extent5"."ShipCountry")
                                )  AS "Filter3") AS "C1"
                        FROM "Products" AS "Extent1"
                        WHERE  EXISTS (SELECT 
                                CAST(1 AS SMALLINT) AS "C1"
                                FROM  "OrderDetails" AS "Extent2"
                                INNER JOIN "Orders" AS "Extent3" ON 
"Extent2"."OrderID" = "Extent3"."OrderID"
                                WHERE ("Extent1"."ProductID" = 
"Extent2"."ProductID") AND (_UTF8'Spain' = "Extent3"."ShipCountry")
                        )
                )  AS "Project2"
        )  AS "Project3"
)  AS "Project4"
ORDER BY "Project4"."ProductName" ASC

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Firebird-net-provider mailing list
Firebird-net-provider@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider

Reply via email to