コード例 #1
0
        protected override void BuildStatement(SqlCodeObjectBuilder builder)
        {
            var seqName   = ObjectName.Parse(SequenceName);
            var statement = new CreateSequenceStatement(seqName);

            if (IncrementBy != null)
            {
                statement.IncrementBy = ExpressionBuilder.Build(IncrementBy);
            }
            if (Cache != null)
            {
                statement.Cache = ExpressionBuilder.Build(Cache);
            }
            if (StartWith != null)
            {
                statement.StartWith = ExpressionBuilder.Build(StartWith);
            }
            if (MinValue != null)
            {
                statement.MinValue = ExpressionBuilder.Build(MinValue);
            }
            if (MaxValue != null)
            {
                statement.MaxValue = ExpressionBuilder.Build(MaxValue);
            }

            statement.Cycle = Cycle;

            builder.AddObject(statement);
        }
コード例 #2
0
        public static void CreateSequence(this IQuery query, ObjectName name, SqlExpression start, SqlExpression increment,
                                          SqlExpression min, SqlExpression max, SqlExpression cache, bool cycle)
        {
            var statement = new CreateSequenceStatement(name)
            {
                StartWith   = start,
                IncrementBy = increment,
                MinValue    = min,
                MaxValue    = max,
                Cache       = cache,
                Cycle       = cycle
            };

            query.ExecuteStatement(statement);
        }
コード例 #3
0
ファイル: AllNodesVisitor.cs プロジェクト: yaakoviyun/sqlskim
 public override void Visit(CreateSequenceStatement node) { this.action(node); }
コード例 #4
0
 public override void ExplicitVisit(CreateSequenceStatement fragment)
 {
     _fragments.Add(fragment);
 }
コード例 #5
0
        public static SqlStatement Create(PlSqlParser.CreateSequenceStatementContext context)
        {
            var seqName = Name.Object(context.objectName());

            var statement = new CreateSequenceStatement(seqName);

            var startWith = context.sequenceStartClause();

            if (startWith != null)
            {
                statement.StartWith = SqlExpression.Constant(Number.PositiveInteger(startWith.UNSIGNED_INTEGER()));
            }

            var specs = context.sequenceSpec();

            if (specs != null && specs.Length > 0)
            {
                foreach (var spec in specs)
                {
                    if (spec.INCREMENT() != null &&
                        spec.BY() != null)
                    {
                        statement.IncrementBy = SqlExpression.Constant(Number.PositiveInteger(spec.UNSIGNED_INTEGER()));
                    }
                    else if (spec.MAXVALUE() != null)
                    {
                        statement.MaxValue = SqlExpression.Constant(Number.PositiveInteger(spec.UNSIGNED_INTEGER()));
                    }
                    else if (spec.NOMAXVALUE() != null)
                    {
                        statement.MaxValue = SqlExpression.Constant(null);
                    }
                    else if (spec.MINVALUE() != null)
                    {
                        statement.MinValue = SqlExpression.Constant(Number.PositiveInteger(spec.UNSIGNED_INTEGER()));
                    }
                    else if (spec.NOMINVALUE() != null)
                    {
                        statement.MinValue = SqlExpression.Constant(null);
                    }
                    else if (spec.CACHE() != null)
                    {
                        statement.Cache = SqlExpression.Constant(Number.PositiveInteger(spec.UNSIGNED_INTEGER()));
                    }
                    else if (spec.NOCACHE() != null)
                    {
                        statement.Cache = SqlExpression.Constant(null);
                    }
                    else if (spec.CYCLE() != null)
                    {
                        statement.Cycle = true;
                    }
                    else if (spec.NOCYCLE() != null)
                    {
                        statement.Cycle = false;
                    }
                }
            }

            return(statement);
        }
コード例 #6
0
 public override void ExplicitVisit(CreateSequenceStatement node)
 {
 }