Add support for MySQL auto_increment offset (#950)

This commit is contained in:
ehoeve 2023-08-21 22:25:32 +02:00 committed by GitHub
parent 41e47cc013
commit 9500649c35
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 52 additions and 0 deletions

View file

@ -3550,6 +3550,17 @@ impl<'a> Parser<'a> {
None
};
let auto_increment_offset = if self.parse_keyword(Keyword::AUTO_INCREMENT) {
let _ = self.consume_token(&Token::Eq);
let next_token = self.next_token();
match next_token.token {
Token::Number(s, _) => Some(s.parse::<u32>().expect("literal int")),
_ => self.expected("literal int", next_token)?,
}
} else {
None
};
let order_by = if self.parse_keywords(&[Keyword::ORDER, Keyword::BY]) {
if self.consume_token(&Token::LParen) {
let columns = if self.peek_token() != Token::RParen {
@ -3631,6 +3642,7 @@ impl<'a> Parser<'a> {
.clone_clause(clone)
.engine(engine)
.comment(comment)
.auto_increment_offset(auto_increment_offset)
.order_by(order_by)
.default_charset(default_charset)
.collation(collation)