mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-09-26 23:49:10 +00:00
Simplify parse_create() a little
Don't need the duplicate `columns.push()` + we advance the tokenizer, so no need to peek first.
This commit is contained in:
parent
89602dc044
commit
a0f625b949
1 changed files with 10 additions and 21 deletions
|
@ -571,28 +571,17 @@ impl Parser {
|
||||||
};
|
};
|
||||||
debug!("default: {:?}", default);
|
debug!("default: {:?}", default);
|
||||||
|
|
||||||
match self.peek_token() {
|
columns.push(SQLColumnDef {
|
||||||
Some(Token::Comma) => {
|
name: column_name.as_sql_ident(),
|
||||||
self.next_token();
|
data_type: data_type,
|
||||||
columns.push(SQLColumnDef {
|
allow_null,
|
||||||
name: column_name.as_sql_ident(),
|
is_primary,
|
||||||
data_type: data_type,
|
is_unique,
|
||||||
allow_null,
|
default,
|
||||||
is_primary,
|
});
|
||||||
is_unique,
|
match self.next_token() {
|
||||||
default,
|
Some(Token::Comma) => {}
|
||||||
});
|
|
||||||
}
|
|
||||||
Some(Token::RParen) => {
|
Some(Token::RParen) => {
|
||||||
self.next_token();
|
|
||||||
columns.push(SQLColumnDef {
|
|
||||||
name: column_name.as_sql_ident(),
|
|
||||||
data_type: data_type,
|
|
||||||
allow_null,
|
|
||||||
is_primary,
|
|
||||||
is_unique,
|
|
||||||
default,
|
|
||||||
});
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
other => {
|
other => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue