public override SqlStatement VisitCreateSequenceStatement(PlSqlParser.CreateSequenceStatementContext context) { return(SequenceStatements.Create(context)); }
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); }