protected virtual void ProcessOffsetOrLimit(SQLProcessorAggregator aggregator, StringBuilder builder, NonBooleanExpression expr, Boolean isOffset) { var prefix = isOffset ? this.GetOffsetPrefix(aggregator.SQLVendor) : this.GetLimitPrefix(aggregator.SQLVendor); if (prefix != null) { builder.Append(prefix).Append(SQLConstants.TOKEN_SEPARATOR); } var isComplex = !(expr is LiteralExpression); if (isComplex) { builder.Append(SQLConstants.OPEN_PARENTHESIS + SQLConstants.NEWLINE); } aggregator.Process(expr, builder); if (isComplex) { builder.Append(SQLConstants.CLOSE_PARENTHESIS); } var postfix = isOffset ? this.GetOffsetPostfix(aggregator.SQLVendor) : this.GetLimitPostfix(aggregator.SQLVendor); if (postfix != null) { builder.Append(SQLConstants.TOKEN_SEPARATOR).Append(postfix); } }
protected override void DoProcessJoinedTable(SQLProcessorAggregator aggregator, NaturalJoinedTable obj, StringBuilder builder) { builder.Append(" NATURAL "); this.ProcessJoinType(obj.JoinType, builder); builder.Append(SQLConstants.TOKEN_SEPARATOR); aggregator.Process(obj.Right, builder); }
protected override void DoProcess(SQLProcessorAggregator aggregator, RegularViewSpecification obj, StringBuilder builder) { if (obj.Columns != null) { aggregator.Process(obj.Columns, builder); } }
protected override void DoProcess(SQLProcessorAggregator aggregator, MultiPredicate obj, StringBuilder builder, Boolean negationActive) { aggregator.Process(obj.Left, builder); builder.Append(SQLConstants.TOKEN_SEPARATOR).Append(negationActive ? this._negatedOperator : this._operator).Append(SQLConstants.TOKEN_SEPARATOR); if (this._needParenthesis) { builder.Append(SQLConstants.OPEN_PARENTHESIS); } ProcessorUtils.AppendEnumerable(aggregator, builder, obj.Rights, this._separator, (agg, b, exp) => { var isQuery = exp is QueryExpression; if (isQuery) { b.Append(SQLConstants.OPEN_PARENTHESIS); } agg.Process(exp, b); if (isQuery) { b.Append(SQLConstants.CLOSE_PARENTHESIS); } }); if (this._needParenthesis) { builder.Append(SQLConstants.CLOSE_PARENTHESIS); } }
protected override void DoProcess(SQLProcessorAggregator aggregator, UnaryPredicate <ValueExpression> obj, StringBuilder builder, Boolean negationActive) { var op = negationActive ? this._negatedOperator : this._operator; if (UnaryOperatorOrientation.BeforeExpression == this._orientation) { builder.Append(op).Append(SQLConstants.TOKEN_SEPARATOR); } var exp = obj.Expression; var isQuery = exp is QueryExpression; if (isQuery) { builder.Append(SQLConstants.OPEN_PARENTHESIS); } aggregator.Process(exp, builder); if (isQuery) { builder.Append(SQLConstants.CLOSE_PARENTHESIS); } if (UnaryOperatorOrientation.AfterExpression == this._orientation) { builder.Append(SQLConstants.TOKEN_SEPARATOR).Append(op); } }
protected override void DoProcess(SQLProcessorAggregator aggregator, UnaryArithmeticExpression obj, StringBuilder builder) { this.ProcessArithmeticExpression(obj, builder); builder.Append(SQLConstants.OPEN_PARENTHESIS); aggregator.Process(obj.Expression, builder); builder.Append(SQLConstants.CLOSE_PARENTHESIS); }
protected override void DoProcess(SQLProcessorAggregator aggregator, Negation obj, StringBuilder builder, Boolean negationActive) { if (!obj.NegatedExpression.IsEmpty()) { aggregator.Process(obj.NegatedExpression, builder, !negationActive); } }
protected override void DoProcess(SQLProcessorAggregator aggregator, T obj, StringBuilder builder) { if (obj.ColumnNames != null) { aggregator.Process(obj.ColumnNames, builder); } this.DoProcessColumnSource(aggregator, obj, builder); }
protected override void DoProcess(SQLProcessorAggregator aggregator, UpdateBySearch obj, StringBuilder builder) { builder.Append("UPDATE "); aggregator.Process(obj.TargetTable, builder); builder.Append(SQLConstants.NEWLINE).Append("SET "); ProcessorUtils.AppendEnumerable(aggregator, builder, obj.SetClauses, SQLConstants.COMMA + SQLConstants.TOKEN_SEPARATOR); ProcessorUtils.ProcessOptionalBooleanExpresssion(aggregator, builder, obj.Condition, SQLConstants.NEWLINE, SQLConstants.WHERE); }
protected virtual void ProcessTableAlias(SQLProcessorAggregator aggregator, TableAlias alias, StringBuilder builder) { builder.Append(SQLConstants.TOKEN_SEPARATOR + SQLConstants.ALIAS_DEFINER + SQLConstants.TOKEN_SEPARATOR).Append(alias.TableAlias); if (alias.ColumnAliases != null) { aggregator.Process(alias.ColumnAliases, builder); } }
protected void ProcessSchemaElements(SQLProcessorAggregator aggregator, SchemaDefinition obj, StringBuilder builder) { builder.Append(SQLConstants.NEWLINE); foreach (var el in obj.SchemaElements) { aggregator.Process(el, builder); builder.Append(SQLConstants.NEWLINE); } }
public static void ProcessNonOptional(SQLProcessorAggregator aggregator, ObjectWithVendor obj, StringBuilder builder, String prefix, String name) { builder.Append(prefix); if (name != null) { builder.Append(name).Append(SQLConstants.TOKEN_SEPARATOR); } aggregator.Process(obj, builder); }
protected override void DoProcess(SQLProcessorAggregator aggregator, CorrespondingSpec obj, StringBuilder builder) { builder.Append("CORRESPONDING"); if (obj.ColumnNames != null) { builder.Append(SQLConstants.TOKEN_SEPARATOR + "BY" + SQLConstants.TOKEN_SEPARATOR); aggregator.Process(obj.ColumnNames, builder); } }
protected override void DoProcess(SQLProcessorAggregator aggregator, ViewDefinition obj, StringBuilder builder) { builder.Append(SQLConstants.CREATE); if (obj.IsRecursive) { builder.Append("RECURSIVE "); } builder.Append(SQLConstants.VIEW); aggregator.Process(obj.ViewName, builder); aggregator.Process(obj.ViewSpecification, builder); builder.Append(SQLConstants.ALIAS_DEFINER).Append(SQLConstants.NEWLINE); aggregator.Process(obj.ViewQuery, builder); if (obj.ViewCheckOption.HasValue) { builder.Append(SQLConstants.NEWLINE).Append(SQLConstants.WITH).Append(this._viewCheckOptions[obj.ViewCheckOption.Value]).Append(" CHECK OPTION"); } }
protected override void DoProcess(SQLProcessorAggregator aggregator, TableDefinition obj, StringBuilder builder) { builder.Append(SQLConstants.CREATE); if (obj.TableScope.HasValue) { builder.Append(this._tableScopes[obj.TableScope.Value]).Append(SQLConstants.TOKEN_SEPARATOR); } builder.Append(SQLConstants.TABLE); aggregator.Process(obj.TableName, builder); builder.Append(SQLConstants.NEWLINE); aggregator.Process(obj.Contents, builder); builder.Append(SQLConstants.NEWLINE); if (obj.CommitAction.HasValue) { builder.Append("ON COMMIT ").Append(this._commitActions[obj.CommitAction.Value]); } }
protected override void DoProcess(SQLProcessorAggregator aggregator, BooleanTest obj, StringBuilder builder, Boolean negationActive) { builder.Append(SQLConstants.OPEN_PARENTHESIS); aggregator.Process(obj.Expression, builder); builder.Append(SQLConstants.CLOSE_PARENTHESIS).Append(SQLConstants.TOKEN_SEPARATOR).Append(SQLConstants.IS).Append(SQLConstants.TOKEN_SEPARATOR); if (negationActive) { builder.Append(SQLConstants.NOT).Append(SQLConstants.TOKEN_SEPARATOR); } builder.Append(obj.TruthValue.HasValue ? (obj.TruthValue.Value ? SQLConstants.TRUE : SQLConstants.FALSE) : SQLConstants.UNKNOWN); }
protected override void DoProcess(SQLProcessorAggregator aggregator, TableConstraintDefinition obj, StringBuilder builder) { if (obj.ConstraintName != null) { builder.Append("CONSTRAINT ").Append(obj.ConstraintName).Append(SQLConstants.TOKEN_SEPARATOR); } aggregator.Process(obj.Constraint, builder); if (obj.ConstraintCharacteristics.HasValue) { builder.Append(SQLConstants.TOKEN_SEPARATOR).Append(this._characteristics[obj.ConstraintCharacteristics.Value]); } }
protected override void DoProcess(SQLProcessorAggregator aggregator, ForeignKeyConstraint obj, StringBuilder builder) { builder.Append("FOREIGN KEY"); aggregator.Process(obj.SourceColumns, builder); builder.Append(SQLConstants.NEWLINE).Append("REFERENCES "); aggregator.Process(obj.TargetTable, builder); if (obj.TargetColumns != null) { aggregator.Process(obj.TargetColumns, builder); } if (obj.MatchType.HasValue) { builder.Append(" MATCH ").Append(this._matchTypes[obj.MatchType.Value]); } builder.Append(SQLConstants.NEWLINE); this.HandleReferentialAction("ON UPDATE ", obj.OnUpdate, builder); builder.Append(SQLConstants.TOKEN_SEPARATOR); this.HandleReferentialAction("ON DELETE ", obj.OnDelete, builder); }
protected override void DoProcess(SQLProcessorAggregator aggregator, TargetTable obj, StringBuilder builder) { var isOnly = obj.IsOnly; if (isOnly) { builder.Append("ONLY").Append(SQLConstants.OPEN_PARENTHESIS); } aggregator.Process(obj.TableName, builder); if (isOnly) { builder.Append(SQLConstants.CLOSE_PARENTHESIS); } }
public static void AppendEnumerable <U>(SQLProcessorAggregator aggregator, StringBuilder builder, ImmutableArray <U> aq, String separator) where U : ObjectWithVendor { var array = aq.ArrayObject; for (var idx = 0; idx < array.Length; ++idx) { aggregator.Process(array[idx], builder); if (idx + 1 < array.Length) { builder.Append(separator); } } }
protected override void DoProcess(SQLProcessorAggregator aggregator, DropTableOrViewStatement obj, StringBuilder builder) { builder.Append(SQLConstants.DROP + SQLConstants.TOKEN_SEPARATOR); switch (obj.WhatToDrop) { case ObjectType.Table: builder.Append(SQLConstants.TABLE); break; case ObjectType.View: builder.Append(SQLConstants.VIEW); break; } builder.Append(SQLConstants.TOKEN_SEPARATOR); this.BeforeTableName(aggregator, obj, builder); aggregator.Process(obj.TableName, builder); this.ProcessDropBehaviour(obj.DropBehaviour, builder); }
protected override void DoProcessActually(SQLProcessorAggregator aggregator, RowSubQuery obj, StringBuilder builder) { aggregator.Process(obj.Query, builder); }
protected override void DoProcessTableName(SQLProcessorAggregator aggregator, TableNameFunction obj, StringBuilder builder) { aggregator.Process(obj.Function, builder); }
protected override void DoProcess(SQLProcessorAggregator aggregator, JoinCondition obj, StringBuilder builder) { builder.Append(" ON "); aggregator.Process(obj.SearchCondition, builder); }
protected override void DoProcess(SQLProcessorAggregator aggregator, NamedColumnsJoin obj, StringBuilder builder) { builder.Append(" USING "); aggregator.Process(obj.ColumnNames, builder); }
protected override void DoProcessJoinedTable(SQLProcessorAggregator aggregator, UnionJoinedTable obj, StringBuilder builder) { builder.Append(" UNION JOIN "); aggregator.Process(obj.Right, builder); }
protected override void DoProcessJoinedTable(SQLProcessorAggregator aggregator, QualifiedJoinedTable obj, StringBuilder builder) { this.ProcessJoinType(obj.JoinType, builder); aggregator.Process(obj.Right, builder); aggregator.Process(obj.JoinSpecification, builder); }
protected override void DoProcessTableReferencePrimary(SQLProcessorAggregator aggregator, TableReferenceByName tRef, StringBuilder builder) { aggregator.Process(tRef.TableName, builder); }
protected override void DoProcess(SQLProcessorAggregator aggregator, T obj, StringBuilder builder) { aggregator.Process(obj.Left, builder); builder.Append(SQLConstants.NEWLINE); this.DoProcessJoinedTable(aggregator, obj, builder); }
protected override void DoProcessTableReferencePrimary(SQLProcessorAggregator aggregator, TableReferenceByQuery tRef, StringBuilder builder) { builder.Append(SQLConstants.OPEN_PARENTHESIS); aggregator.Process(tRef.Query, builder); builder.Append(SQLConstants.CLOSE_PARENTHESIS); }