File tree Expand file tree Collapse file tree 2 files changed +10
-18
lines changed Expand file tree Collapse file tree 2 files changed +10
-18
lines changed Original file line number Diff line number Diff line change @@ -3611,21 +3611,13 @@ impl<'a> Parser<'a> {
3611
3611
3612
3612
/// Parse a UNCACHE TABLE statement
3613
3613
pub fn parse_uncache_table ( & mut self ) -> Result < Statement , ParserError > {
3614
- let has_table = self . parse_keyword ( Keyword :: TABLE ) ;
3615
- if has_table {
3616
- let if_exists = self . parse_keywords ( & [ Keyword :: IF , Keyword :: EXISTS ] ) ;
3617
- let table_name = self . parse_object_name ( false ) ?;
3618
- if self . peek_token ( ) . token == Token :: EOF {
3619
- Ok ( Statement :: UNCache {
3620
- table_name,
3621
- if_exists,
3622
- } )
3623
- } else {
3624
- self . expected ( "an `EOF`" , self . peek_token ( ) )
3625
- }
3626
- } else {
3627
- self . expected ( "a `TABLE` keyword" , self . peek_token ( ) )
3628
- }
3614
+ self . expect_keyword ( Keyword :: TABLE ) ?;
3615
+ let if_exists = self . parse_keywords ( & [ Keyword :: IF , Keyword :: EXISTS ] ) ;
3616
+ let table_name = self . parse_object_name ( false ) ?;
3617
+ Ok ( Statement :: UNCache {
3618
+ table_name,
3619
+ if_exists,
3620
+ } )
3629
3621
}
3630
3622
3631
3623
/// SQLite-specific `CREATE VIRTUAL TABLE`
Original file line number Diff line number Diff line change @@ -8465,19 +8465,19 @@ fn parse_uncache_table() {
8465
8465
8466
8466
let res = parse_sql_statements ( "UNCACHE TABLE 'table_name' foo" ) ;
8467
8467
assert_eq ! (
8468
- ParserError :: ParserError ( "Expected: an `EOF` , found: foo" . to_string( ) ) ,
8468
+ ParserError :: ParserError ( "Expected: end of statement , found: foo" . to_string( ) ) ,
8469
8469
res. unwrap_err( )
8470
8470
) ;
8471
8471
8472
8472
let res = parse_sql_statements ( "UNCACHE 'table_name' foo" ) ;
8473
8473
assert_eq ! (
8474
- ParserError :: ParserError ( "Expected: a ` TABLE` keyword , found: 'table_name'" . to_string( ) ) ,
8474
+ ParserError :: ParserError ( "Expected: TABLE, found: 'table_name'" . to_string( ) ) ,
8475
8475
res. unwrap_err( )
8476
8476
) ;
8477
8477
8478
8478
let res = parse_sql_statements ( "UNCACHE IF EXISTS 'table_name' foo" ) ;
8479
8479
assert_eq ! (
8480
- ParserError :: ParserError ( "Expected: a ` TABLE` keyword , found: IF" . to_string( ) ) ,
8480
+ ParserError :: ParserError ( "Expected: TABLE, found: IF" . to_string( ) ) ,
8481
8481
res. unwrap_err( )
8482
8482
) ;
8483
8483
}
You can’t perform that action at this time.
0 commit comments