Skip to content

Commit

Permalink
[#142] from 없는 select 파싱 버그 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
myyrakle committed Jul 28, 2024
1 parent c2da97a commit 40a6614
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/parser/implements/dml/select.rs
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,11 @@ impl Parser {
// 현재 select_item은 종료된 것으로 판단.
Ok(select_item.build())
}
Token::SemiColon => {
self.unget_next_token(current_token);
// 현재 select_item은 종료된 것으로 판단.
Ok(select_item.build())
}
_ => Err(ParsingError::wrap(format!(
"E0308 expected expression. but your input word is '{:?}'",
current_token
Expand Down
12 changes: 12 additions & 0 deletions src/parser/test/select.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1432,6 +1432,18 @@ fn test_select_query() {
expected: Default::default(),
want_error: true,
},
TestCase {
name: r#"SELECT 1;"#.into(),
input: vec![Token::Select, Token::Integer(1), Token::SemiColon],
expected: SelectQuery::builder()
.add_select_item(
SelectItem::builder()
.set_item(SQLExpression::Integer(1))
.build(),
)
.build(),
want_error: false,
},
];

for t in test_cases {
Expand Down

0 comments on commit 40a6614

Please sign in to comment.