mirror of
https://github.com/BepInEx/mono.git
synced 2026-11-19 01:31:17 -10:00
Adding reference source for System.Data System.Data.DataSetExtensions System.Data.Entity System.Data.Entity.Design System.Data.Linq System.Data.SqlXml System.ServiceModel System.ServiceModel.Activation System.ServiceModel.Activities System.ServiceModel.Channels System.ServiceModel.Discovery System.ServiceModel.Internals System.ServiceModel.Routing System.ServiceModel.WasHosting System.ServiceModel.Web System.Web System.Web.ApplicationServices System.Web.DynamicData System.Web.Entity System.Web.Entity.Design System.Web.Extensions System.Web.Mobile System.Web.Routing System.Web.Services System.Xml System.Xml.Linq
50 lines
1.4 KiB
C#
50 lines
1.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq.Expressions;
|
|
using System.Data.Linq;
|
|
|
|
namespace System.Data.Linq.SqlClient {
|
|
|
|
internal class SqlAggregateChecker {
|
|
Visitor visitor;
|
|
|
|
internal SqlAggregateChecker() {
|
|
this.visitor = new Visitor();
|
|
}
|
|
|
|
internal bool HasAggregates(SqlNode node) {
|
|
visitor.hasAggregates = false;
|
|
visitor.Visit(node);
|
|
return visitor.hasAggregates;
|
|
}
|
|
|
|
class Visitor : SqlVisitor {
|
|
internal bool hasAggregates;
|
|
|
|
internal Visitor() {
|
|
}
|
|
|
|
internal override SqlExpression VisitSubSelect(SqlSubSelect ss) {
|
|
return ss;
|
|
}
|
|
internal override SqlSource VisitSource(SqlSource source) {
|
|
return source;
|
|
}
|
|
internal override SqlExpression VisitUnaryOperator(SqlUnary uo) {
|
|
switch (uo.NodeType) {
|
|
case SqlNodeType.Min:
|
|
case SqlNodeType.Max:
|
|
case SqlNodeType.Avg:
|
|
case SqlNodeType.Sum:
|
|
case SqlNodeType.Count:
|
|
case SqlNodeType.LongCount:
|
|
this.hasAggregates = true;
|
|
return uo;
|
|
default:
|
|
return base.VisitUnaryOperator(uo);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|