@@ -4764,6 +4764,10 @@ pub enum Statement {
47644764 ///
47654765 /// See: <https://learn.microsoft.com/en-us/sql/t-sql/statements/print-transact-sql>
47664766 Print ( PrintStatement ) ,
4767+ /// MSSQL `WAITFOR` statement.
4768+ ///
4769+ /// See: <https://learn.microsoft.com/en-us/sql/t-sql/language-elements/waitfor-transact-sql>
4770+ WaitFor ( WaitForStatement ) ,
47674771 /// ```sql
47684772 /// RETURN [ expression ]
47694773 /// ```
@@ -6217,6 +6221,7 @@ impl fmt::Display for Statement {
62176221 }
62186222 Statement :: Throw ( s) => write ! ( f, "{s}" ) ,
62196223 Statement :: Print ( s) => write ! ( f, "{s}" ) ,
6224+ Statement :: WaitFor ( s) => write ! ( f, "{s}" ) ,
62206225 Statement :: Return ( r) => write ! ( f, "{r}" ) ,
62216226 Statement :: List ( command) => write ! ( f, "LIST {command}" ) ,
62226227 Statement :: Remove ( command) => write ! ( f, "REMOVE {command}" ) ,
@@ -10964,6 +10969,47 @@ impl fmt::Display for PrintStatement {
1096410969 }
1096510970}
1096610971
10972+ /// The type of `WAITFOR` statement (MSSQL).
10973+ ///
10974+ /// See: <https://learn.microsoft.com/en-us/sql/t-sql/language-elements/waitfor-transact-sql>
10975+ #[ derive( Debug , Clone , PartialEq , PartialOrd , Eq , Ord , Hash ) ]
10976+ #[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
10977+ #[ cfg_attr( feature = "visitor" , derive( Visit , VisitMut ) ) ]
10978+ pub enum WaitForType {
10979+ /// `WAITFOR DELAY 'time_to_pass'`
10980+ Delay ,
10981+ /// `WAITFOR TIME 'time_to_execute'`
10982+ Time ,
10983+ }
10984+
10985+ impl fmt:: Display for WaitForType {
10986+ fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
10987+ match self {
10988+ WaitForType :: Delay => write ! ( f, "DELAY" ) ,
10989+ WaitForType :: Time => write ! ( f, "TIME" ) ,
10990+ }
10991+ }
10992+ }
10993+
10994+ /// MSSQL `WAITFOR` statement.
10995+ ///
10996+ /// See: <https://learn.microsoft.com/en-us/sql/t-sql/language-elements/waitfor-transact-sql>
10997+ #[ derive( Debug , Clone , PartialEq , PartialOrd , Eq , Ord , Hash ) ]
10998+ #[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
10999+ #[ cfg_attr( feature = "visitor" , derive( Visit , VisitMut ) ) ]
11000+ pub struct WaitForStatement {
11001+ /// `DELAY` or `TIME`.
11002+ pub wait_type : WaitForType ,
11003+ /// The time expression.
11004+ pub expr : Expr ,
11005+ }
11006+
11007+ impl fmt:: Display for WaitForStatement {
11008+ fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
11009+ write ! ( f, "WAITFOR {} {}" , self . wait_type, self . expr)
11010+ }
11011+ }
11012+
1096711013/// Represents a `Return` statement.
1096811014///
1096911015/// [MsSql triggers](https://learn.microsoft.com/en-us/sql/t-sql/statements/create-trigger-transact-sql)
0 commit comments