parseAlterSequenceStatement parses: ALTER SEQUENCE [IF EXISTS] name [options...] The caller has already consumed ALTER and SEQUENCE.
()
| 120 | // parseAlterSequenceStatement parses: ALTER SEQUENCE [IF EXISTS] name [options...] |
| 121 | // The caller has already consumed ALTER and SEQUENCE. |
| 122 | func (p *Parser) parseAlterSequenceStatement() (*ast.AlterSequenceStatement, error) { |
| 123 | stmt := ast.NewAlterSequenceStatement() |
| 124 | |
| 125 | if strings.EqualFold(p.currentToken.Token.Value, "IF") { |
| 126 | p.advance() |
| 127 | if !strings.EqualFold(p.currentToken.Token.Value, "EXISTS") { |
| 128 | return nil, p.expectedError("EXISTS") |
| 129 | } |
| 130 | p.advance() |
| 131 | stmt.IfExists = true |
| 132 | } |
| 133 | |
| 134 | name := p.parseIdent() |
| 135 | if name == nil || name.Name == "" { |
| 136 | return nil, p.expectedError("sequence name") |
| 137 | } |
| 138 | stmt.Name = name |
| 139 | |
| 140 | opts, err := p.parseSequenceOptions() |
| 141 | if err != nil { |
| 142 | return nil, err |
| 143 | } |
| 144 | stmt.Options = opts |
| 145 | return stmt, nil |
| 146 | } |
| 147 | |
| 148 | // parseSequenceOptions parses sequence option keywords until no more are found. |
| 149 | func (p *Parser) parseSequenceOptions() (ast.SequenceOptions, error) { |
no test coverage detected