本文整理汇总了C#中SqlNode类的典型用法代码示例。如果您正苦于以下问题:C# SqlNode类的具体用法?C# SqlNode怎么用?C# SqlNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SqlNode类属于命名空间,在下文中一共展示了SqlNode类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Visit
internal override SqlNode Visit(SqlNode node) {
// Short-circuit when the answer is alreading known
if (this.referencesAnyMatchingAliases) {
return node;
}
return base.Visit(node);
}
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:7,代码来源:SqlAliasesReferenced.cs
示例2: VisitWithParens
internal virtual void VisitWithParens(SqlNode node, SqlNode outer) {
if (node == null)
return;
switch (node.NodeType) {
case SqlNodeType.ColumnRef:
case SqlNodeType.Value:
case SqlNodeType.Member:
case SqlNodeType.Parameter:
case SqlNodeType.FunctionCall:
case SqlNodeType.TableValuedFunctionCall:
case SqlNodeType.OuterJoinedValue:
this.Visit(node);
break;
case SqlNodeType.Add:
case SqlNodeType.Mul:
case SqlNodeType.And:
case SqlNodeType.Or:
case SqlNodeType.Not:
case SqlNodeType.Not2V:
case SqlNodeType.BitAnd:
case SqlNodeType.BitOr:
case SqlNodeType.BitXor:
case SqlNodeType.BitNot:
if (outer.NodeType != node.NodeType)
goto default;
this.Visit(node);
break;
default:
this.sb.Append("(");
this.Visit(node);
this.sb.Append(")");
break;
}
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:35,代码来源:SqlFormatter.cs
示例3: Visit
internal override SqlNode Visit(SqlNode node) {
if (node == null)
return null;
sourceExpression = node as SqlExpression;
if (sourceExpression != null) {
Type type = sourceExpression.ClrType;
UnwrapStack unwrap = this.UnwrapSequences;
while (unwrap != null) {
if (unwrap.Unwrap) {
type = TypeSystem.GetElementType(type);
}
unwrap = unwrap.Last;
}
sourceType = type;
}
if (sourceType != null && TypeSystem.GetNonNullableType(sourceType).IsValueType) {
return node; // Value types can't also have a dynamic type.
}
if (sourceType != null && TypeSystem.HasIEnumerable(sourceType)) {
return node; // Sequences can't be polymorphic.
}
switch (node.NodeType) {
case SqlNodeType.ScalarSubSelect:
case SqlNodeType.Multiset:
case SqlNodeType.Element:
case SqlNodeType.SearchedCase:
case SqlNodeType.ClientCase:
case SqlNodeType.SimpleCase:
case SqlNodeType.Member:
case SqlNodeType.DiscriminatedType:
case SqlNodeType.New:
case SqlNodeType.FunctionCall:
case SqlNodeType.MethodCall:
case SqlNodeType.Convert: // Object identity does not survive convert. It does survive Cast.
// Dig no further.
return node;
case SqlNodeType.TypeCase:
sourceType = ((SqlTypeCase)node).RowType.Type;
return node;
case SqlNodeType.Link:
sourceType = ((SqlLink)node).RowType.Type;
return node;
case SqlNodeType.Table:
sourceType = ((SqlTable)node).RowType.Type;
return node;
case SqlNodeType.Value:
SqlValue val = (SqlValue)node;
if (val.Value != null) {
// In some cases the ClrType of a Value node may
// differ from the actual runtime type of the value.
// Therefore, we ensure here that the correct type is set.
sourceType = val.Value.GetType();
}
return node;
}
return base.Visit(node);
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:59,代码来源:TypeSource.cs
示例4: Deflate
internal SqlNode Deflate(SqlNode node) {
node = this.vDeflator.Visit(node);
node = this.cDeflator.Visit(node);
node = this.aDeflator.Visit(node);
node = this.tsDeflator.Visit(node);
node = this.dupColumnDeflator.Visit(node);
return node;
}
开发者ID:uQr,项目名称:referencesource,代码行数:8,代码来源:SqlDeflator.cs
示例5: Format
internal string Format(SqlNode node, bool isDebug) {
this.sb = new StringBuilder();
this.isDebugMode = isDebug;
this.aliasMap.Clear();
if (isDebug) {
new AliasMapper(this.aliasMap).Visit(node);
}
this.Visit(node);
return this.sb.ToString();
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:10,代码来源:SqlFormatter.cs
示例6: Visit
internal override SqlNode Visit(SqlNode node) {
if (annotations.NodeIsAnnotated(node)) {
foreach (SqlNodeAnnotation annotation in annotations.Get(node)) {
SqlServerCompatibilityAnnotation ssca = annotation as SqlServerCompatibilityAnnotation;
if (ssca != null && ssca.AppliesTo(provider)) {
reasons.Add(annotation.Message);
}
}
}
return base.Visit(node);
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:11,代码来源:SqlServer2KCompatibilityCheck.cs
示例7: Visit
internal override SqlNode Visit(SqlNode node) {
if (node == null) {
return null;
}
SqlNode result = null;
if (this.nodeMap.TryGetValue(node, out result)) {
return result;
}
result = base.Visit(node);
this.nodeMap[node] = result;
return result;
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:12,代码来源:SqlDuplicator.cs
示例8: Add
/// <summary>
/// Add an annotation to the given node.
/// </summary>
internal void Add(SqlNode node, SqlNodeAnnotation annotation) {
List<SqlNodeAnnotation> list = null;
if (!this.annotationMap.TryGetValue(node, out list)) {
list = new List<SqlNodeAnnotation>();
this.annotationMap[node]=list;
}
uniqueTypes[annotation.GetType()] = String.Empty;
list.Add(annotation);
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:15,代码来源:SqlNodeAnnotations.cs
示例9: ThrowIfUnsupported
/// <summary>
/// Checks whether the given node is supported on the given server.
/// </summary>
internal static void ThrowIfUnsupported(SqlNode node, SqlNodeAnnotations annotations, SqlProvider.ProviderMode provider) {
// Check to see whether there's at least one SqlServerCompatibilityAnnotation.
if (annotations.HasAnnotationType(typeof(SqlServerCompatibilityAnnotation))) {
Visitor visitor = new Visitor(provider);
visitor.annotations = annotations;
visitor.Visit(node);
// If any messages were recorded, then throw an exception.
if (visitor.reasons.Count > 0) {
throw Error.ExpressionNotSupportedForSqlServerVersion(visitor.reasons);
}
}
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:16,代码来源:SqlServer2KCompatibilityCheck.cs
示例10: Copy
internal static SqlNode Copy(SqlNode node) {
if (node == null)
return null;
switch (node.NodeType) {
case SqlNodeType.ColumnRef:
case SqlNodeType.Value:
case SqlNodeType.Parameter:
case SqlNodeType.Variable:
return node;
default:
return new SqlDuplicator().Duplicate(node);
}
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:13,代码来源:SqlDuplicator.cs
示例11: CanConvert
internal static bool CanConvert(SqlNode node) {
SqlBinary bo = node as SqlBinary;
if (bo != null && (IsCompareToValue(bo) || IsVbCompareStringEqualsValue(bo))) {
return true;
}
SqlMember sm = node as SqlMember;
if (sm != null && IsSupportedMember(sm)) {
return true;
}
SqlMethodCall mc = node as SqlMethodCall;
if (mc != null && (IsSupportedMethod(mc) || IsSupportedVbHelperMethod(mc))) {
return true;
}
return false;
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:15,代码来源:MethodCallConverter.cs
示例12: Visit
internal override SqlNode Visit(SqlNode node) {
SqlExpression expr = node as SqlExpression;
if (expr != null) {
if (this.candidates.Contains(expr)) {
if (expr.NodeType == SqlNodeType.Column ||
expr.NodeType == SqlNodeType.ColumnRef) {
return expr;
}
else {
return new SqlColumn(expr.ClrType, expr.SqlType, null, null, expr, expr.SourceExpression);
}
}
}
return base.Visit(node);
}
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:15,代码来源:SqlColumnizer.cs
示例13: CanConvert
internal static bool CanConvert(SqlNode node) {
SqlUnary su = node as SqlUnary;
if (su != null && IsSupportedUnary(su)) {
return true;
}
SqlNew sn = node as SqlNew;
if (sn != null && IsSupportedNew(sn)) {
return true;
}
SqlMember sm = node as SqlMember;
if (sm != null && IsSupportedMember(sm)) {
return true;
}
SqlMethodCall mc = node as SqlMethodCall;
if (mc != null && (GetMethodSupport(mc) == MethodSupport.Method)) {
return true;
}
return false;
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:19,代码来源:SqlMethodCallConverter.cs
示例14: Multiplex
internal SqlNode Multiplex(SqlNode node) {
return this.visitor.Visit(node);
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:3,代码来源:SqlMultiplexer.cs
示例15: Reorder
internal SqlNode Reorder(SqlNode node) {
return new Visitor(this.typeProvider, this.sql).Visit(node);
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:3,代码来源:SqlReorderer.cs
示例16: FindGroupInfo
private GroupInfo FindGroupInfo(SqlNode source) {
GroupInfo info = null;
this.gmap.TryGetValue(source, out info);
if (info != null) {
return info;
}
SqlAlias alias = source as SqlAlias;
if (alias != null) {
SqlSelect select = alias.Node as SqlSelect;
if (select != null) {
return this.FindGroupInfo(select.Selection);
}
// it might be an expression (not yet fully resolved)
source = alias.Node;
}
SqlExpression expr = source as SqlExpression;
if (expr != null) {
switch (expr.NodeType) {
case SqlNodeType.AliasRef:
return this.FindGroupInfo(((SqlAliasRef)expr).Alias);
case SqlNodeType.Member:
return this.FindGroupInfo(((SqlMember)expr).Expression);
default:
this.gmap.TryGetValue(expr, out info);
return info;
}
}
return null;
}
开发者ID:uQr,项目名称:referencesource,代码行数:29,代码来源:QueryConverter.cs
示例17: Flatten
internal SqlNode Flatten(SqlNode node) {
node = this.visitor.Visit(node);
return node;
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:4,代码来源:SqlFlattener.cs
示例18: Simplify
internal static SqlNode Simplify(SqlNode node, SqlFactory sql) {
return new Visitor(sql).Visit(node);
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:3,代码来源:SqlCaseSimplifier.cs
示例19: VisitCrossJoinList
internal virtual void VisitCrossJoinList(SqlNode node) {
SqlJoin join = node as SqlJoin;
if (join != null) {
this.VisitCrossJoinList(join.Left);
sb.Append(", ");
this.VisitCrossJoinList(join.Right);
} else {
this.Visit(node);
}
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:10,代码来源:SqlFormatter.cs
示例20: CoerceToSequence
private SqlSelect CoerceToSequence(SqlNode node) {
SqlSelect select = node as SqlSelect;
if (select == null) {
if (node.NodeType == SqlNodeType.Value) {
SqlValue sv = (SqlValue)node;
// Check for ITables.
ITable t = sv.Value as ITable;
if (t != null) {
return this.CoerceToSequence(this.TranslateConstantTable(t, null));
}
// Check for IQueryable.
IQueryable query = sv.Value as IQueryable;
if (query != null) {
Expression fex = Funcletizer.Funcletize(query.Expression);
// IQueryables that return self-referencing Constant expressions cause infinite recursion
if (fex.NodeType != ExpressionType.Constant ||
((ConstantExpression)fex).Value != query) {
return this.VisitSequence(fex);
}
throw Error.IQueryableCannotReturnSelfReferencingConstantExpression();
}
throw Error.CapturedValuesCannotBeSequences();
}
else if (node.NodeType == SqlNodeType.Multiset || node.NodeType == SqlNodeType.Element) {
return ((SqlSubSelect)node).Select;
}
else if (node.NodeType == SqlNodeType.ClientArray) {
throw Error.ConstructedArraysNotSupported();
}
else if (node.NodeType == SqlNodeType.ClientParameter) {
throw Error.ParametersCannotBeSequences();
}
// this needs to be a sequence expression!
SqlExpression sqlExpr = (SqlExpression)node;
SqlAlias sa = new SqlAlias(sqlExpr);
SqlAliasRef aref = new SqlAliasRef(sa);
return new SqlSelect(aref, sa, this.dominatingExpression);
}
return select;
}
开发者ID:uQr,项目名称:referencesource,代码行数:40,代码来源:QueryConverter.cs
注:本文中的SqlNode类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论