Parse a `FETCH` statement, assuming that the `FETCH` token has already been consumed.
(&mut self)
| 9490 | /// Parse a `FETCH` statement, assuming that the `FETCH` token |
| 9491 | /// has already been consumed. |
| 9492 | fn parse_fetch(&mut self) -> Result<Statement<Raw>, ParserError> { |
| 9493 | let _ = self.parse_keyword(FORWARD); |
| 9494 | let count = if let Some(count) = self.maybe_parse(Parser::parse_literal_uint) { |
| 9495 | Some(FetchDirection::ForwardCount(count)) |
| 9496 | } else if self.parse_keyword(ALL) { |
| 9497 | Some(FetchDirection::ForwardAll) |
| 9498 | } else { |
| 9499 | None |
| 9500 | }; |
| 9501 | let _ = self.parse_keyword(FROM); |
| 9502 | let name = self.parse_identifier()?; |
| 9503 | let options = if self.parse_keyword(WITH) { |
| 9504 | self.expect_token(&Token::LParen)?; |
| 9505 | let options = self.parse_comma_separated(Self::parse_fetch_option)?; |
| 9506 | self.expect_token(&Token::RParen)?; |
| 9507 | options |
| 9508 | } else { |
| 9509 | vec![] |
| 9510 | }; |
| 9511 | Ok(Statement::Fetch(FetchStatement { |
| 9512 | name, |
| 9513 | count, |
| 9514 | options, |
| 9515 | })) |
| 9516 | } |
| 9517 | |
| 9518 | fn parse_fetch_option(&mut self) -> Result<FetchOption<Raw>, ParserError> { |
| 9519 | self.expect_keyword(TIMEOUT)?; |
no test coverage detected