@@ -4686,6 +4686,10 @@ pub enum Statement {
46864686 ///
46874687 /// See: <https://learn.microsoft.com/en-us/sql/t-sql/statements/print-transact-sql>
46884688 Print ( PrintStatement ) ,
4689+ /// MSSQL `WAITFOR` statement.
4690+ ///
4691+ /// See: <https://learn.microsoft.com/en-us/sql/t-sql/language-elements/waitfor-transact-sql>
4692+ WaitFor ( WaitForStatement ) ,
46894693 /// ```sql
46904694 /// RETURN [ expression ]
46914695 /// ```
@@ -6125,6 +6129,7 @@ impl fmt::Display for Statement {
61256129 Ok ( ( ) )
61266130 }
61276131 Statement :: Print ( s) => write ! ( f, "{s}" ) ,
6132+ Statement :: WaitFor ( s) => write ! ( f, "{s}" ) ,
61286133 Statement :: Return ( r) => write ! ( f, "{r}" ) ,
61296134 Statement :: List ( command) => write ! ( f, "LIST {command}" ) ,
61306135 Statement :: Remove ( command) => write ! ( f, "REMOVE {command}" ) ,
@@ -10868,6 +10873,47 @@ impl fmt::Display for PrintStatement {
1086810873 }
1086910874}
1087010875
10876+ /// The type of `WAITFOR` statement (MSSQL).
10877+ ///
10878+ /// See: <https://learn.microsoft.com/en-us/sql/t-sql/language-elements/waitfor-transact-sql>
10879+ #[ derive( Debug , Clone , PartialEq , PartialOrd , Eq , Ord , Hash ) ]
10880+ #[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
10881+ #[ cfg_attr( feature = "visitor" , derive( Visit , VisitMut ) ) ]
10882+ pub enum WaitForType {
10883+ /// `WAITFOR DELAY 'time_to_pass'`
10884+ Delay ,
10885+ /// `WAITFOR TIME 'time_to_execute'`
10886+ Time ,
10887+ }
10888+
10889+ impl fmt:: Display for WaitForType {
10890+ fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
10891+ match self {
10892+ WaitForType :: Delay => write ! ( f, "DELAY" ) ,
10893+ WaitForType :: Time => write ! ( f, "TIME" ) ,
10894+ }
10895+ }
10896+ }
10897+
10898+ /// MSSQL `WAITFOR` statement.
10899+ ///
10900+ /// See: <https://learn.microsoft.com/en-us/sql/t-sql/language-elements/waitfor-transact-sql>
10901+ #[ derive( Debug , Clone , PartialEq , PartialOrd , Eq , Ord , Hash ) ]
10902+ #[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
10903+ #[ cfg_attr( feature = "visitor" , derive( Visit , VisitMut ) ) ]
10904+ pub struct WaitForStatement {
10905+ /// `DELAY` or `TIME`.
10906+ pub wait_type : WaitForType ,
10907+ /// The time expression.
10908+ pub expr : Expr ,
10909+ }
10910+
10911+ impl fmt:: Display for WaitForStatement {
10912+ fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
10913+ write ! ( f, "WAITFOR {} {}" , self . wait_type, self . expr)
10914+ }
10915+ }
10916+
1087110917/// Represents a `Return` statement.
1087210918///
1087310919/// [MsSql triggers](https://learn.microsoft.com/en-us/sql/t-sql/statements/create-trigger-transact-sql)
0 commit comments