public override VfpExpression Visit(DbApplyExpression expression) { return(new VfpApplyExpression((VfpExpressionKind)expression.ExpressionKind, expression.ResultType, CreateDbExpressionBinding(expression.Input), CreateDbExpressionBinding(expression.Apply))); }
public override object Visit(DbApplyExpression expression) { this.Visit(expression.Input.Expression); this.Visit(expression.Apply.Expression); return(null); }
public override void Visit(DbApplyExpression e) { Begin(e); Dump(e.Input, "Input"); Dump(e.Apply, "Apply"); End(e); }
public override void Visit(DbApplyExpression e) { Check.NotNull <DbApplyExpression>(e, nameof(e)); this.Begin((DbExpression)e); this.Dump(e.Input, "Input"); this.Dump(e.Apply, "Apply"); this.End((DbExpression)e); }
public override void Visit(DbApplyExpression e) { VisitExprKind(e.ExpressionKind); _key.Append('('); VisitBinding(e.Input); VisitBinding(e.Apply); _key.Append(')'); }
public override TreeNode Visit(DbApplyExpression e) { TreeNode retInfo = NodeFromExpression(e); retInfo.Children.Add(this.VisitBinding("Input", e.Input)); retInfo.Children.Add(this.VisitBinding("Apply", e.Apply)); return(retInfo); }
public override TreeNode Visit(DbApplyExpression e) { Check.NotNull <DbApplyExpression>(e, nameof(e)); TreeNode treeNode = ExpressionPrinter.PrinterVisitor.NodeFromExpression((DbExpression)e); treeNode.Children.Add(this.VisitBinding("Input", e.Input)); treeNode.Children.Add(this.VisitBinding("Apply", e.Apply)); return(treeNode); }
public override void Visit(DbApplyExpression e) { Check.NotNull(e, "e"); Begin(e); Dump(e.Input, "Input"); Dump(e.Apply, "Apply"); End(e); }
public override void Visit(DbApplyExpression e) { Check.NotNull <DbApplyExpression>(e, nameof(e)); this.VisitExprKind(e.ExpressionKind); this._key.Append('('); this.VisitBinding(e.Input); this.VisitBinding(e.Apply); this._key.Append(')'); }
/// <summary> /// Implements the visitor pattern for <see cref="T:System.Data.Common.CommandTrees.DbApplyExpression"/>. /// </summary> /// <param name="expression">The <see cref="T:System.Data.Common.CommandTrees.DbApplyExpression"/> that is visited.</param> public override void Visit(DbApplyExpression expression) { if (expression == null) { throw new ArgumentNullException("expression"); } expression.Apply.Expression.Accept(this); expression.Input.Expression.Accept(this); }
public override void Visit(DbApplyExpression expression) { EntityUtils.CheckArgumentNull <DbApplyExpression>(expression, nameof(expression)); this.VisitExpressionBindingPre(expression.Input); if (expression.Apply != null) { this.VisitExpression(expression.Apply.Expression); } this.VisitExpressionBindingPost(expression.Input); }
public override TreeNode Visit(DbApplyExpression e) { Check.NotNull(e, "e"); var retInfo = NodeFromExpression(e); retInfo.Children.Add(VisitBinding("Input", e.Input)); retInfo.Children.Add(VisitBinding("Apply", e.Apply)); return(retInfo); }
public override Expression Visit(DbApplyExpression expression) { bool outer = false; switch (expression.ExpressionKind) { case DbExpressionKind.OuterApply: outer = true; break; case DbExpressionKind.CrossApply: break; default: throw new NotSupportedException(); } Expression input = this.Visit(expression.Input.Expression); Type inputType = TypeHelper.GetElementType(input.Type); ParameterExpression inputParam = Expression.Parameter(inputType, expression.Input.VariableName); using (this.CreateVariable(inputParam, expression.Input.VariableName)) { // Apply expression might contain reference to the Input element, // so do the transformation in the variable scope Expression apply = this.Visit(expression.Apply.Expression); Type applyType = TypeHelper.GetElementType(apply.Type); if (outer) { apply = this.queryMethodExpressionBuilder.DefaultIfEmpty(apply); } // Collection expression for the SelectMany LambdaExpression collectionSelector = Expression.Lambda( Expression.Convert( apply, typeof(IEnumerable <>).MakeGenericType(applyType)), inputParam); // Create the SelectMany expression Expression result = this.CreateCrossJoin( input, collectionSelector, expression.Input.VariableName, expression.Apply.VariableName); return(result); } }
public override SqlFragment Visit(DbApplyExpression expression) { DbExpressionBinding inputBinding = expression.Input; InputFragment input = VisitInputExpression(inputBinding.Expression, inputBinding.VariableName, inputBinding.VariableType); DbExpressionBinding applyBinding = expression.Apply; InputFragment apply = VisitInputExpression(applyBinding.Expression, applyBinding.VariableName, applyBinding.VariableType); SelectStatement select = new SelectStatement(); bool isInputSelect = false; if (!(input is TableFragment)) { input.Wrap(scope); isInputSelect = true; } apply.Wrap(scope); select.From = input; select.Wrap(scope); if (apply is SelectStatement) { SelectStatement applySel = apply as SelectStatement; foreach (ColumnFragment f in applySel.Columns) { SelectStatement newColSelect = new SelectStatement(); newColSelect.From = applySel.From; newColSelect.Where = applySel.Where; if (isInputSelect) { VisitAndReplaceTableName(newColSelect.Where, (input as SelectStatement).From.Name, input.Name); } newColSelect.Limit = applySel.Limit; newColSelect.Columns.Add(f); newColSelect.Wrap(scope); scope.Add(applySel.From.Name, applySel.From); ColumnFragment newCol = new ColumnFragment(apply.Name, f.ColumnName); newCol.Literal = newColSelect; newCol.PushInput(newCol.ColumnName); newCol.PushInput(apply.Name); select.AddColumn(newCol, scope); if (string.IsNullOrEmpty(newCol.ColumnAlias)) { newColSelect.Name = newCol.ColumnName; newCol.ColumnAlias = newCol.ColumnName; } scope.Remove(newColSelect); } scope.Remove(applySel.From); scope.Remove(apply); } return(select); }
public override Expression Visit(DbApplyExpression expression) { bool outer = false; switch (expression.ExpressionKind) { case DbExpressionKind.OuterApply: outer = true; break; case DbExpressionKind.CrossApply: break; default: throw new NotSupportedException(); } Expression input = this.Visit(expression.Input.Expression); Type inputType = TypeHelper.GetElementType(input.Type); ParameterExpression inputParam = Expression.Parameter(inputType, expression.Input.VariableName); using (this.CreateVariable(inputParam, expression.Input.VariableName)) { // Apply expression might contain reference to the Input element, // so do the transformation in the variable scope Expression apply = this.Visit(expression.Apply.Expression); Type applyType = TypeHelper.GetElementType(apply.Type); if (outer) { apply = this.queryMethodExpressionBuilder.DefaultIfEmpty(apply); } // Collection expression for the SelectMany LambdaExpression collectionSelector = Expression.Lambda( Expression.Convert( apply, typeof(IEnumerable<>).MakeGenericType(applyType)), inputParam); // Create the SelectMany expression Expression result = this.CreateCrossJoin( input, collectionSelector, expression.Input.VariableName, expression.Apply.VariableName); return result; } }
public override void Visit(DbApplyExpression expression) { if (expression == null) { throw new ArgumentException("expression"); } VisitExpressionBindingPre(expression.Input); if (expression.Apply != null) { VisitExpression(expression.Apply.Expression); } VisitExpressionBindingPost(expression.Input); }
/// <summary> /// Visitor pattern method for <see cref="DbApplyExpression" />. /// </summary> /// <param name="expression"> The DbApplyExpression that is being visited. </param> /// <exception cref="ArgumentNullException"> /// <paramref name="expression" /> /// is null /// </exception> public override void Visit(DbApplyExpression expression) { // #433613: PreSharp warning 56506: Parameter 'expression' to this public method must be validated: A null-dereference can occur here. Check.NotNull(expression, "expression"); VisitExpressionBindingPre(expression.Input); // #433613: PreSharp warning 56506: Parameter 'expression.Apply' to this public method must be validated: A null-dereference can occur here. if (expression.Apply != null) { VisitExpression(expression.Apply.Expression); } VisitExpressionBindingPost(expression.Input); }
public override SqlFragment Visit(DbApplyExpression expression) { DbExpressionBinding inputBinding = expression.Input; InputFragment input = VisitInputExpression(inputBinding.Expression, inputBinding.VariableName, inputBinding.VariableType); input = WrapJoinInputIfNecessary(input, false); DbExpressionBinding applyBinding = expression.Apply; InputFragment apply = VisitInputExpression(applyBinding.Expression, applyBinding.VariableName, applyBinding.VariableType); apply = WrapJoinInputIfNecessary(apply, true); var outerApplyjoin = new JoinFragment(); outerApplyjoin.JoinType = Metadata.GetOperator(expression.ExpressionKind); if (expression.ExpressionKind == DbExpressionKind.OuterApply) { outerApplyjoin.Condition = new LiteralFragment("1 = 1"); } outerApplyjoin.Left = input; outerApplyjoin.Right = apply; return(outerApplyjoin); }
public override ISqlFragment Visit(DbApplyExpression e) { throw new NotSupportedException("APPLY operator is not supported by Ingres."); }
public override void Visit(DbApplyExpression expression) { throw new NotSupportedException("Visit(\"ApplyExpression\") is not supported."); }
/// <summary> /// Not supported on SQL Server 2000. /// </summary> /// <param name="expression">The DbApplyExpression that is being visited.</param> /// <exception cref="NotSupportedException">Always</exception> public override bool Visit(DbApplyExpression expression) { throw EntityUtil.NotSupported(System.Data.Entity.Strings.SqlGen_ApplyNotSupportedOnSql8); }
public override LegacyCommandTrees.DbExpression Visit(DbApplyExpression expression) { throw new NotImplementedException(); }
public override TReturn Visit(DbApplyExpression expression) { throw ConstructNotSupportedException(expression); }
public override SqlFragment Visit(DbApplyExpression expression) { DbExpressionBinding inputBinding = expression.Input; InputFragment input = VisitInputExpression(inputBinding.Expression, inputBinding.VariableName, inputBinding.VariableType); DbExpressionBinding applyBinding = expression.Apply; InputFragment apply = VisitInputExpression(applyBinding.Expression, applyBinding.VariableName, applyBinding.VariableType); SelectStatement select = new SelectStatement(this); bool isInputSelect = false; if (!(input is TableFragment)) { input.Wrap(scope); isInputSelect = true; } apply.Wrap(scope); select.From = input; select.Wrap(scope); if (apply is SelectStatement) { SelectStatement applySel = apply as SelectStatement; foreach (ColumnFragment f in applySel.Columns) { SelectStatement newColSelect = new SelectStatement(this); newColSelect.From = applySel.From; newColSelect.Where = applySel.Where; if (isInputSelect) { VisitAndReplaceTableName(newColSelect.Where, (input as SelectStatement).From.Name, input.Name, null); } newColSelect.Limit = applySel.Limit; newColSelect.OrderBy = applySel.OrderBy; newColSelect.Skip = applySel.Skip; newColSelect.GroupBy = applySel.GroupBy; newColSelect.IsDistinct = applySel.IsDistinct; newColSelect.Columns.Add(f); newColSelect.Wrap(scope); scope.Add(applySel.From.Name, applySel.From); ColumnFragment newCol = new ColumnFragment(apply.Name, f.ColumnName); newCol.Literal = newColSelect; newCol.PushInput(newCol.ColumnName); newCol.PushInput(apply.Name); select.AddColumn(newCol, scope); if (string.IsNullOrEmpty(newCol.ColumnAlias)) { newColSelect.Name = newCol.ColumnName; newCol.ColumnAlias = newCol.ColumnName; } scope.Remove(newColSelect); } scope.Remove(applySel.From); scope.Remove(apply); } else if (apply is UnionFragment) { UnionFragment uf = apply as UnionFragment; if (uf.Left == null || uf.Right == null) throw new Exception("Union fragment is not properly formed."); var left = uf.Left as SelectStatement; var right = uf.Right as SelectStatement; if (left == null || right == null) throw new NotImplementedException(); var whereleft = left.Where as BinaryFragment; var whereright = right.Where as BinaryFragment; if (whereleft == null || whereright == null) throw new NotImplementedException(); LiteralFragment literalFragmentWhere = null; //checking where left if (whereleft.Left is ColumnFragment && whereleft.Right is ColumnFragment) { // we replace the where part for a dummy one if (whereright.Left is ColumnFragment && whereright.Right is ColumnFragment) { literalFragmentWhere = new LiteralFragment("1 = 1"); } } if (literalFragmentWhere == null) throw new NotImplementedException(); var leftouterjoin = new JoinFragment(); leftouterjoin.JoinType = Metadata.GetOperator(DbExpressionKind.LeftOuterJoin); leftouterjoin.Name = apply.Name; // validating that column fragment on the left matches the name // for the input fragment var leftColumnFragment = whereleft.Left as ColumnFragment; if (leftColumnFragment == null) throw new NotImplementedException(); if (!leftColumnFragment.TableName.Equals(input.Name)) new NotImplementedException(); var conditionJoin = new BinaryFragment(); conditionJoin.Left = whereleft.Left; //update to the new reference var newColumnFragment = whereright.Right as ColumnFragment; if (newColumnFragment != null) { newColumnFragment.TableName = uf.Name; } conditionJoin.Right = newColumnFragment; conditionJoin.Operator = whereleft.Operator; leftouterjoin.Condition = conditionJoin; (uf.Left as SelectStatement).Where = literalFragmentWhere; (uf.Right as SelectStatement).Where = literalFragmentWhere; leftouterjoin.Left = input; leftouterjoin.Right = uf; return leftouterjoin; } return select; }
public override void Visit(DbApplyExpression e) { Begin(e); Dump(e.Input, "Input"); Dump(e.Apply, "Apply"); End(e); }
/// <summary> /// Visitor pattern method for DbApplyExpression. /// </summary> /// <param name="expression"> The DbApplyExpression that is being visited. </param> public abstract void Visit(DbApplyExpression expression);
public override DbExpressionEntitySetInfo Visit(DbApplyExpression expression) { Check.NotNull(expression, "expression"); return(null); }
public override DbExpression Visit(DbApplyExpression expression) { System.Diagnostics.Debug.Print("Visit(DbApplyExpression): {0}", expression); return base.Visit(expression); }
public override void Visit(DbApplyExpression expression) { throw new NotSupportedException("Visit(\"DbApplyExpression\") is not supported."); }
public override bool Visit(DbApplyExpression expression) { throw new NotSupportedException("apply expression"); }
/// <summary> /// Visitor pattern method for <see cref="DbApplyExpression" />. /// </summary> /// <param name="expression"> The DbApplyExpression that is being visited. </param> /// <exception cref="ArgumentNullException"> /// <paramref name="expression" /> /// is null /// </exception> public override void Visit(DbApplyExpression expression) { // #433613: PreSharp warning 56506: Parameter 'expression' to this public method must be validated: A null-dereference can occur here. Check.NotNull(expression, "expression"); VisitExpressionBindingPre(expression.Input); // #433613: PreSharp warning 56506: Parameter 'expression.Apply' to this public method must be validated: A null-dereference can occur here. if (expression.Apply != null) { VisitExpression(expression.Apply.Expression); } VisitExpressionBindingPost(expression.Input); }
public override void Visit(DbApplyExpression e) { Check.NotNull(e, "e"); Begin(e); Dump(e.Input, "Input"); Dump(e.Apply, "Apply"); End(e); }
public override SqlFragment Visit(DbApplyExpression expression) { throw new NotSupportedException(); }
public override void Visit(DbApplyExpression expression) { Contract.Requires(expression != null); }
public override bool Visit(DbApplyExpression expression) { Check.NotNull <DbApplyExpression>(expression, nameof(expression)); throw new NotSupportedException(Strings.SqlGen_ApplyNotSupportedOnSql8); }
public override SqlFragment Visit(DbApplyExpression expression) { DbExpressionBinding inputBinding = expression.Input; InputFragment input = VisitInputExpression(inputBinding.Expression, inputBinding.VariableName, inputBinding.VariableType); DbExpressionBinding applyBinding = expression.Apply; InputFragment apply = VisitInputExpression(applyBinding.Expression, applyBinding.VariableName, applyBinding.VariableType); SelectStatement select = new SelectStatement(this); bool isInputSelect = false; if (!(input is TableFragment)) { input.Wrap(scope); isInputSelect = true; } apply.Wrap(scope); select.From = input; select.Wrap(scope); if (apply is SelectStatement) { SelectStatement applySel = apply as SelectStatement; foreach (ColumnFragment f in applySel.Columns) { SelectStatement newColSelect = new SelectStatement(this); newColSelect.From = applySel.From; newColSelect.Where = applySel.Where; if (isInputSelect) { VisitAndReplaceTableName(newColSelect.Where, (input as SelectStatement).From.Name, input.Name); } newColSelect.Limit = applySel.Limit; newColSelect.Columns.Add( f ); newColSelect.Wrap(scope); scope.Add(applySel.From.Name, applySel.From); ColumnFragment newCol = new ColumnFragment(apply.Name, f.ColumnName); newCol.Literal = newColSelect; newCol.PushInput(newCol.ColumnName); newCol.PushInput(apply.Name); select.AddColumn( newCol, scope); if (string.IsNullOrEmpty(newCol.ColumnAlias)) { newColSelect.Name = newCol.ColumnName; newCol.ColumnAlias = newCol.ColumnName; } scope.Remove(newColSelect); } scope.Remove(applySel.From); scope.Remove(apply); } return select; }
public override void Visit(DbApplyExpression e) { VisitExprKind(e.ExpressionKind); _key.Append('('); VisitBinding(e.Input); VisitBinding(e.Apply); _key.Append(')'); }
public override SqlFragment Visit(DbApplyExpression expression) { DbExpressionBinding inputBinding = expression.Input; InputFragment input = VisitInputExpression(inputBinding.Expression, inputBinding.VariableName, inputBinding.VariableType); DbExpressionBinding applyBinding = expression.Apply; InputFragment apply = VisitInputExpression(applyBinding.Expression, applyBinding.VariableName, applyBinding.VariableType); SelectStatement select = new SelectStatement(this); bool isInputSelect = false; if (!(input is TableFragment)) { input.Wrap(scope); isInputSelect = true; } apply.Wrap(scope); select.From = input; select.Wrap(scope); if (apply is SelectStatement) { SelectStatement applySel = apply as SelectStatement; foreach (ColumnFragment f in applySel.Columns) { SelectStatement newColSelect = new SelectStatement(this); newColSelect.From = applySel.From; newColSelect.Where = applySel.Where; if (isInputSelect) { VisitAndReplaceTableName(newColSelect.Where, (input as SelectStatement).From.Name, input.Name, null); } newColSelect.Limit = applySel.Limit; newColSelect.OrderBy = applySel.OrderBy; newColSelect.Skip = applySel.Skip; newColSelect.GroupBy = applySel.GroupBy; newColSelect.IsDistinct = applySel.IsDistinct; newColSelect.Columns.Add(f); newColSelect.Wrap(scope); scope.Add(applySel.From.Name, applySel.From); ColumnFragment newCol = new ColumnFragment(apply.Name, f.ColumnName); newCol.Literal = newColSelect; newCol.PushInput(newCol.ColumnName); newCol.PushInput(apply.Name); select.AddColumn(newCol, scope); if (string.IsNullOrEmpty(newCol.ColumnAlias)) { newColSelect.Name = newCol.ColumnName; newCol.ColumnAlias = newCol.ColumnName; } scope.Remove(newColSelect); } scope.Remove(applySel.From); scope.Remove(apply); } else if (apply is UnionFragment) { UnionFragment uf = apply as UnionFragment; if (uf.Left == null || uf.Right == null) { throw new Exception("Union fragment is not properly formed."); } var left = uf.Left as SelectStatement; var right = uf.Right as SelectStatement; if (left == null || right == null) { throw new NotImplementedException(); } var whereleft = left.Where as BinaryFragment; var whereright = right.Where as BinaryFragment; if (whereleft == null || whereright == null) { throw new NotImplementedException(); } LiteralFragment literalFragmentWhere = null; //checking where left if (whereleft.Left is ColumnFragment && whereleft.Right is ColumnFragment) { // we replace the where part for a dummy one if (whereright.Left is ColumnFragment && whereright.Right is ColumnFragment) { literalFragmentWhere = new LiteralFragment("1 = 1"); } } if (literalFragmentWhere == null) { throw new NotImplementedException(); } var leftouterjoin = new JoinFragment(); leftouterjoin.JoinType = Metadata.GetOperator(DbExpressionKind.LeftOuterJoin); leftouterjoin.Name = apply.Name; // validating that column fragment on the left matches the name // for the input fragment var leftColumnFragment = whereleft.Left as ColumnFragment; if (leftColumnFragment == null) { throw new NotImplementedException(); } if (!leftColumnFragment.TableName.Equals(input.Name)) { new NotImplementedException(); } var conditionJoin = new BinaryFragment(); conditionJoin.Left = whereleft.Left; //update to the new reference var newColumnFragment = whereright.Right as ColumnFragment; if (newColumnFragment != null) { newColumnFragment.TableName = uf.Name; } conditionJoin.Right = newColumnFragment; conditionJoin.Operator = whereleft.Operator; leftouterjoin.Condition = conditionJoin; (uf.Left as SelectStatement).Where = literalFragmentWhere; (uf.Right as SelectStatement).Where = literalFragmentWhere; leftouterjoin.Left = input; leftouterjoin.Right = uf; return(leftouterjoin); } return(select); }
/// <summary> /// Implements the visitor pattern for <see cref="T:System.Data.Common.CommandTrees.DbApplyExpression"/>. /// </summary> /// <param name="expression">The <see cref="T:System.Data.Common.CommandTrees.DbApplyExpression"/> that is visited.</param> public override void Visit(DbApplyExpression expression) { if (expression == null) { throw new ArgumentNullException("expression"); } expression.Apply.Expression.Accept(this); expression.Input.Expression.Accept(this); }
public override DbExpression Visit(DbApplyExpression expression) { System.Diagnostics.Debug.Print("Visit(DbApplyExpression): {0}", expression); return(base.Visit(expression)); }
public override void Visit(DbApplyExpression expression) { if (expression == null) throw new ArgumentException("expression"); VisitExpressionBindingPre(expression.Input); if (expression.Apply != null) { VisitExpression(expression.Apply.Expression); } VisitExpressionBindingPost(expression.Input); }
public override void Visit(DbApplyExpression expression) { }
public override DbExpressionEntitySetInfo Visit(DbApplyExpression expression) { return(null); }
/// <summary> /// Visitor pattern method for DbApplyExpression. /// </summary> /// <param name="expression"> The DbApplyExpression that is being visited. </param> public abstract void Visit(DbApplyExpression expression);