(
&mut self,
mut required: bool,
)
| 8801 | } |
| 8802 | |
| 8803 | fn parse_transaction_modes( |
| 8804 | &mut self, |
| 8805 | mut required: bool, |
| 8806 | ) -> Result<Vec<TransactionMode>, ParserError> { |
| 8807 | let mut modes = vec![]; |
| 8808 | loop { |
| 8809 | let mode = if self.parse_keywords(&[ISOLATION, LEVEL]) { |
| 8810 | let iso_level = if self.parse_keywords(&[READ, UNCOMMITTED]) { |
| 8811 | TransactionIsolationLevel::ReadUncommitted |
| 8812 | } else if self.parse_keywords(&[READ, COMMITTED]) { |
| 8813 | TransactionIsolationLevel::ReadCommitted |
| 8814 | } else if self.parse_keywords(&[REPEATABLE, READ]) { |
| 8815 | TransactionIsolationLevel::RepeatableRead |
| 8816 | } else if self.parse_keyword(SERIALIZABLE) { |
| 8817 | TransactionIsolationLevel::Serializable |
| 8818 | } else if self.parse_keywords(&[STRONG, SESSION, SERIALIZABLE]) { |
| 8819 | TransactionIsolationLevel::StrongSessionSerializable |
| 8820 | } else if self.parse_keywords(&[STRICT, SERIALIZABLE]) { |
| 8821 | TransactionIsolationLevel::StrictSerializable |
| 8822 | } else { |
| 8823 | self.expected(self.peek_pos(), "isolation level", self.peek_token())? |
| 8824 | }; |
| 8825 | TransactionMode::IsolationLevel(iso_level) |
| 8826 | } else if self.parse_keywords(&[READ, ONLY]) { |
| 8827 | TransactionMode::AccessMode(TransactionAccessMode::ReadOnly) |
| 8828 | } else if self.parse_keywords(&[READ, WRITE]) { |
| 8829 | TransactionMode::AccessMode(TransactionAccessMode::ReadWrite) |
| 8830 | } else if required { |
| 8831 | self.expected(self.peek_pos(), "transaction mode", self.peek_token())? |
| 8832 | } else { |
| 8833 | break; |
| 8834 | }; |
| 8835 | modes.push(mode); |
| 8836 | // ANSI requires a comma after each transaction mode, but |
| 8837 | // PostgreSQL, for historical reasons, does not. We follow |
| 8838 | // PostgreSQL in making the comma optional, since that is strictly |
| 8839 | // more general. |
| 8840 | required = self.consume_token(&Token::Comma); |
| 8841 | } |
| 8842 | Ok(modes) |
| 8843 | } |
| 8844 | |
| 8845 | fn parse_commit(&mut self) -> Result<Statement<Raw>, ParserError> { |
| 8846 | Ok(Statement::Commit(CommitStatement { |
no test coverage detected