1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
5 
6 using DbLinq.Data.Linq.Sugar.Expressions;
7 
8 namespace DbLinq.Firebird
9 {
10     class FirebirdExpressionTranslator : ExpressionTranslator
11     {
OuterExpression(SelectExpression e)12         public override SelectExpression OuterExpression(SelectExpression e)
13         {
14             // Check for (from f in foo orderby f.Field select f).Count() trees
15             // Firebird doesn't support 'ORDER BY' for 'SELECT COUNT(*)'.
16             if (e.Operands.Select(o => o as SpecialExpression)
17                     .Where(o => o != null)
18                     .Where(s => s.SpecialNodeType == SpecialExpressionType.Count)
19                     .Any())
20             {
21                 e.OrderBy.Clear();
22             }
23             return e;
24         }
25     }
26 }
27