本文整理汇总了C#中SqlNode类的典型用法代码示例。如果您正苦于以下问题:C# SqlNode类的具体用法?C# SqlNode怎么用?C# SqlNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SqlNode类属于命名空间,在下文中一共展示了SqlNode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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;
}
}
示例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);
}
示例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;
}
示例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();
}
示例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);
}
示例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;
}
示例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);
}
示例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);
}
}
}
示例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);
}
}
示例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;
}
示例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);
}
示例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;
}
示例14: Multiplex
internal SqlNode Multiplex(SqlNode node) {
return this.visitor.Visit(node);
}
示例15: Reorder
internal SqlNode Reorder(SqlNode node) {
return new Visitor(this.typeProvider, this.sql).Visit(node);
}