@@ -604,7 +604,7 @@ impl<'a> Parser<'a> {
604604 Keyword::DESC => self.parse_explain(DescribeAlias::Desc),
605605 Keyword::DESCRIBE => self.parse_explain(DescribeAlias::Describe),
606606 Keyword::EXPLAIN => self.parse_explain(DescribeAlias::Explain),
607- Keyword::ANALYZE => self.parse_analyze(),
607+ Keyword::ANALYZE => self.parse_analyze().map(Into::into) ,
608608 Keyword::CASE => {
609609 self.prev_token();
610610 self.parse_case_stmt().map(Into::into)
@@ -623,9 +623,9 @@ impl<'a> Parser<'a> {
623623 }
624624 Keyword::SELECT | Keyword::WITH | Keyword::VALUES | Keyword::FROM => {
625625 self.prev_token();
626- self.parse_query().map(Statement::Query )
626+ self.parse_query().map(Into::into )
627627 }
628- Keyword::TRUNCATE => self.parse_truncate(),
628+ Keyword::TRUNCATE => self.parse_truncate().map(Into::into) ,
629629 Keyword::ATTACH => {
630630 if dialect_of!(self is DuckDbDialect) {
631631 self.parse_attach_duckdb_database()
@@ -636,7 +636,7 @@ impl<'a> Parser<'a> {
636636 Keyword::DETACH if dialect_of!(self is DuckDbDialect | GenericDialect) => {
637637 self.parse_detach_duckdb_database()
638638 }
639- Keyword::MSCK => self.parse_msck(),
639+ Keyword::MSCK => self.parse_msck().map(Into::into) ,
640640 Keyword::CREATE => self.parse_create(),
641641 Keyword::CACHE => self.parse_cache_table(),
642642 Keyword::DROP => self.parse_drop(),
@@ -713,12 +713,12 @@ impl<'a> Parser<'a> {
713713 self.prev_token();
714714 self.parse_vacuum()
715715 }
716- Keyword::RESET => self.parse_reset(),
716+ Keyword::RESET => self.parse_reset().map(Into::into) ,
717717 _ => self.expected("an SQL statement", next_token),
718718 },
719719 Token::LParen => {
720720 self.prev_token();
721- self.parse_query().map(Statement::Query )
721+ self.parse_query().map(Into::into )
722722 }
723723 _ => self.expected("an SQL statement", next_token),
724724 }
@@ -1024,7 +1024,7 @@ impl<'a> Parser<'a> {
10241024 }
10251025
10261026 /// Parse `MSCK` statement.
1027- pub fn parse_msck(&mut self) -> Result<Statement , ParserError> {
1027+ pub fn parse_msck(&mut self) -> Result<Msck , ParserError> {
10281028 let repair = self.parse_keyword(Keyword::REPAIR);
10291029 self.expect_keyword_is(Keyword::TABLE)?;
10301030 let table_name = self.parse_object_name(false)?;
@@ -1048,12 +1048,11 @@ impl<'a> Parser<'a> {
10481048 repair,
10491049 table_name,
10501050 partition_action,
1051- }
1052- .into())
1051+ })
10531052 }
10541053
10551054 /// Parse `TRUNCATE` statement.
1056- pub fn parse_truncate(&mut self) -> Result<Statement , ParserError> {
1055+ pub fn parse_truncate(&mut self) -> Result<Truncate , ParserError> {
10571056 let table = self.parse_keyword(Keyword::TABLE);
10581057
10591058 let table_names = self
@@ -1095,8 +1094,7 @@ impl<'a> Parser<'a> {
10951094 identity,
10961095 cascade,
10971096 on_cluster,
1098- }
1099- .into())
1097+ })
11001098 }
11011099
11021100 fn parse_cascade_option(&mut self) -> Option<CascadeOption> {
@@ -1192,7 +1190,7 @@ impl<'a> Parser<'a> {
11921190 }
11931191
11941192 /// Parse `ANALYZE` statement.
1195- pub fn parse_analyze(&mut self) -> Result<Statement , ParserError> {
1193+ pub fn parse_analyze(&mut self) -> Result<Analyze , ParserError> {
11961194 let has_table_keyword = self.parse_keyword(Keyword::TABLE);
11971195 let table_name = self.parse_object_name(false)?;
11981196 let mut for_columns = false;
@@ -1246,8 +1244,7 @@ impl<'a> Parser<'a> {
12461244 cache_metadata,
12471245 noscan,
12481246 compute_statistics,
1249- }
1250- .into())
1247+ })
12511248 }
12521249
12531250 /// Parse a new expression including wildcard & qualified wildcard.
@@ -4881,6 +4878,7 @@ impl<'a> Parser<'a> {
48814878 || self.peek_keywords(&[Keyword::SECURE, Keyword::VIEW])
48824879 {
48834880 self.parse_create_view(or_alter, or_replace, temporary, create_view_params)
4881+ .map(Into::into)
48844882 } else if self.parse_keyword(Keyword::POLICY) {
48854883 self.parse_create_policy()
48864884 } else if self.parse_keyword(Keyword::EXTERNAL) {
@@ -4891,8 +4889,10 @@ impl<'a> Parser<'a> {
48914889 self.parse_create_domain()
48924890 } else if self.parse_keyword(Keyword::TRIGGER) {
48934891 self.parse_create_trigger(temporary, or_alter, or_replace, false)
4892+ .map(Into::into)
48944893 } else if self.parse_keywords(&[Keyword::CONSTRAINT, Keyword::TRIGGER]) {
48954894 self.parse_create_trigger(temporary, or_alter, or_replace, true)
4895+ .map(Into::into)
48964896 } else if self.parse_keyword(Keyword::MACRO) {
48974897 self.parse_create_macro(or_replace, temporary)
48984898 } else if self.parse_keyword(Keyword::SECRET) {
@@ -4905,7 +4905,7 @@ impl<'a> Parser<'a> {
49054905 self.peek_token(),
49064906 )
49074907 } else if self.parse_keyword(Keyword::EXTENSION) {
4908- self.parse_create_extension()
4908+ self.parse_create_extension().map(Into::into)
49094909 } else if self.parse_keyword(Keyword::INDEX) {
49104910 self.parse_create_index(false)
49114911 } else if self.parse_keywords(&[Keyword::UNIQUE, Keyword::INDEX]) {
@@ -4917,7 +4917,7 @@ impl<'a> Parser<'a> {
49174917 } else if self.parse_keyword(Keyword::DATABASE) {
49184918 self.parse_create_database()
49194919 } else if self.parse_keyword(Keyword::ROLE) {
4920- self.parse_create_role()
4920+ self.parse_create_role().map(Into::into)
49214921 } else if self.parse_keyword(Keyword::SEQUENCE) {
49224922 self.parse_create_sequence(temporary)
49234923 } else if self.parse_keyword(Keyword::TYPE) {
@@ -5782,7 +5782,7 @@ impl<'a> Parser<'a> {
57825782 or_alter: bool,
57835783 or_replace: bool,
57845784 is_constraint: bool,
5785- ) -> Result<Statement , ParserError> {
5785+ ) -> Result<CreateTrigger , ParserError> {
57865786 if !dialect_of!(self is PostgreSqlDialect | SQLiteDialect | GenericDialect | MySqlDialect | MsSqlDialect)
57875787 {
57885788 self.prev_token();
@@ -5864,8 +5864,7 @@ impl<'a> Parser<'a> {
58645864 statements_as: false,
58655865 statements,
58665866 characteristics,
5867- }
5868- .into())
5867+ })
58695868 }
58705869
58715870 /// Parse the period part of a trigger (`BEFORE`, `AFTER`, etc.).
@@ -6098,7 +6097,7 @@ impl<'a> Parser<'a> {
60986097 or_replace: bool,
60996098 temporary: bool,
61006099 create_view_params: Option<CreateViewParams>,
6101- ) -> Result<Statement , ParserError> {
6100+ ) -> Result<CreateView , ParserError> {
61026101 let secure = self.parse_keyword(Keyword::SECURE);
61036102 let materialized = self.parse_keyword(Keyword::MATERIALIZED);
61046103 self.expect_keyword_is(Keyword::VIEW)?;
@@ -6181,8 +6180,7 @@ impl<'a> Parser<'a> {
61816180 to,
61826181 params: create_view_params,
61836182 name_before_not_exists,
6184- }
6185- .into())
6183+ })
61866184 }
61876185
61886186 /// Parse optional parameters for the `CREATE VIEW` statement supported by [MySQL].
@@ -6244,7 +6242,7 @@ impl<'a> Parser<'a> {
62446242 }
62456243
62466244 /// Parse a `CREATE ROLE` statement.
6247- pub fn parse_create_role(&mut self) -> Result<Statement , ParserError> {
6245+ pub fn parse_create_role(&mut self) -> Result<CreateRole , ParserError> {
62486246 let if_not_exists = self.parse_keywords(&[Keyword::IF, Keyword::NOT, Keyword::EXISTS]);
62496247 let names = self.parse_comma_separated(|p| p.parse_object_name(false))?;
62506248
@@ -6465,8 +6463,7 @@ impl<'a> Parser<'a> {
64656463 user,
64666464 admin,
64676465 authorization_owner,
6468- }
6469- .into())
6466+ })
64706467 }
64716468
64726469 /// Parse an `OWNER` clause.
@@ -7695,7 +7692,7 @@ impl<'a> Parser<'a> {
76957692 }
76967693
76977694 /// Parse a `CREATE EXTENSION` statement.
7698- pub fn parse_create_extension(&mut self) -> Result<Statement , ParserError> {
7695+ pub fn parse_create_extension(&mut self) -> Result<CreateExtension , ParserError> {
76997696 let if_not_exists = self.parse_keywords(&[Keyword::IF, Keyword::NOT, Keyword::EXISTS]);
77007697 let name = self.parse_identifier()?;
77017698
@@ -7725,8 +7722,7 @@ impl<'a> Parser<'a> {
77257722 schema,
77267723 version,
77277724 cascade,
7728- }
7729- .into())
7725+ })
77307726 }
77317727
77327728 /// Parse a PostgreSQL-specific [Statement::DropExtension] statement.
@@ -19085,15 +19081,15 @@ impl<'a> Parser<'a> {
1908519081 }
1908619082
1908719083 /// Parses a RESET statement
19088- fn parse_reset(&mut self) -> Result<Statement , ParserError> {
19084+ fn parse_reset(&mut self) -> Result<ResetStatement , ParserError> {
1908919085 if self.parse_keyword(Keyword::ALL) {
19090- return Ok(Statement::Reset( ResetStatement { reset: Reset::ALL }) );
19086+ return Ok(ResetStatement { reset: Reset::ALL });
1909119087 }
1909219088
1909319089 let obj = self.parse_object_name(false)?;
19094- Ok(Statement::Reset( ResetStatement {
19090+ Ok(ResetStatement {
1909519091 reset: Reset::ConfigurationParameter(obj),
19096- }))
19092+ })
1909719093 }
1909819094}
1909919095
0 commit comments