File tree 2 files changed +10
-20
lines changed
2 files changed +10
-20
lines changed Original file line number Diff line number Diff line change @@ -3611,23 +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
- match self . peek_token ( ) {
3619
- TokenWithLocation {
3620
- token : Token :: EOF | Token :: SemiColon ,
3621
- ..
3622
- } => Ok ( Statement :: UNCache {
3623
- table_name,
3624
- if_exists,
3625
- } ) ,
3626
- token_loc => self . expected ( "`EOF` or `;`" , token_loc) ,
3627
- }
3628
- } else {
3629
- self . expected ( "a `TABLE` keyword" , self . peek_token ( ) )
3630
- }
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
+ } )
3631
3621
}
3632
3622
3633
3623
/// SQLite-specific `CREATE VIRTUAL TABLE`
Original file line number Diff line number Diff line change @@ -8451,19 +8451,19 @@ fn parse_uncache_table() {
8451
8451
8452
8452
let res = parse_sql_statements ( "UNCACHE TABLE 'table_name' foo" ) ;
8453
8453
assert_eq ! (
8454
- ParserError :: ParserError ( "Expected `EOF` or `;` , found: foo" . to_string( ) ) ,
8454
+ ParserError :: ParserError ( "Expected end of statement , found: foo" . to_string( ) ) ,
8455
8455
res. unwrap_err( )
8456
8456
) ;
8457
8457
8458
8458
let res = parse_sql_statements ( "UNCACHE 'table_name' foo" ) ;
8459
8459
assert_eq ! (
8460
- ParserError :: ParserError ( "Expected a ` TABLE` keyword , found: 'table_name'" . to_string( ) ) ,
8460
+ ParserError :: ParserError ( "Expected TABLE, found: 'table_name'" . to_string( ) ) ,
8461
8461
res. unwrap_err( )
8462
8462
) ;
8463
8463
8464
8464
let res = parse_sql_statements ( "UNCACHE IF EXISTS 'table_name' foo" ) ;
8465
8465
assert_eq ! (
8466
- ParserError :: ParserError ( "Expected a ` TABLE` keyword , found: IF" . to_string( ) ) ,
8466
+ ParserError :: ParserError ( "Expected TABLE, found: IF" . to_string( ) ) ,
8467
8467
res. unwrap_err( )
8468
8468
) ;
8469
8469
}
You can’t perform that action at this time.
0 commit comments