@@ -3437,6 +3437,10 @@ pub enum Statement {
34373437 /// Snowflake `REMOVE`
34383438 /// See: <https://docs.snowflake.com/en/sql-reference/sql/remove>
34393439 Remove ( FileStagingCommand ) ,
3440+ /// MS-SQL session
3441+ ///
3442+ /// See <https://learn.microsoft.com/en-us/sql/t-sql/statements/set-statements-transact-sql>
3443+ SetSessionParam ( SetSessionParamKind ) ,
34403444}
34413445
34423446impl fmt:: Display for Statement {
@@ -5024,6 +5028,7 @@ impl fmt::Display for Statement {
50245028 }
50255029 Statement :: List ( command) => write ! ( f, "LIST {command}" ) ,
50265030 Statement :: Remove ( command) => write ! ( f, "REMOVE {command}" ) ,
5031+ Statement :: SetSessionParam ( kind) => write ! ( f, "SET {kind}" ) ,
50275032 }
50285033 }
50295034}
@@ -6441,6 +6446,7 @@ pub enum TransactionIsolationLevel {
64416446 ReadCommitted ,
64426447 RepeatableRead ,
64436448 Serializable ,
6449+ Snapshot ,
64446450}
64456451
64466452impl fmt:: Display for TransactionIsolationLevel {
@@ -6451,6 +6457,7 @@ impl fmt::Display for TransactionIsolationLevel {
64516457 ReadCommitted => "READ COMMITTED" ,
64526458 RepeatableRead => "REPEATABLE READ" ,
64536459 Serializable => "SERIALIZABLE" ,
6460+ Snapshot => "SNAPSHOT" ,
64546461 } )
64556462 }
64566463}
@@ -7937,6 +7944,126 @@ impl fmt::Display for TableObject {
79377944 }
79387945}
79397946
7947+ #[ derive( Debug , Clone , PartialEq , PartialOrd , Eq , Ord , Hash ) ]
7948+ #[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
7949+ #[ cfg_attr( feature = "visitor" , derive( Visit , VisitMut ) ) ]
7950+ pub enum SetSessionParamKind {
7951+ Generic ( SetSessionParamGeneric ) ,
7952+ IdentityInsert ( SetSessionParamIdentityInsert ) ,
7953+ Offsets ( SetSessionParamOffsets ) ,
7954+ Statistics ( SetSessionParamStatistics ) ,
7955+ }
7956+
7957+ impl fmt:: Display for SetSessionParamKind {
7958+ fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
7959+ match self {
7960+ SetSessionParamKind :: Generic ( x) => write ! ( f, "{x}" ) ,
7961+ SetSessionParamKind :: IdentityInsert ( x) => write ! ( f, "{x}" ) ,
7962+ SetSessionParamKind :: Offsets ( x) => write ! ( f, "{x}" ) ,
7963+ SetSessionParamKind :: Statistics ( x) => write ! ( f, "{x}" ) ,
7964+ }
7965+ }
7966+ }
7967+
7968+ #[ derive( Debug , Clone , PartialEq , PartialOrd , Eq , Ord , Hash ) ]
7969+ #[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
7970+ #[ cfg_attr( feature = "visitor" , derive( Visit , VisitMut ) ) ]
7971+ pub struct SetSessionParamGeneric {
7972+ pub names : Vec < String > ,
7973+ pub value : String ,
7974+ }
7975+
7976+ impl fmt:: Display for SetSessionParamGeneric {
7977+ fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
7978+ write ! ( f, "{} {}" , display_comma_separated( & self . names) , self . value)
7979+ }
7980+ }
7981+
7982+ #[ derive( Debug , Clone , PartialEq , PartialOrd , Eq , Ord , Hash ) ]
7983+ #[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
7984+ #[ cfg_attr( feature = "visitor" , derive( Visit , VisitMut ) ) ]
7985+ pub struct SetSessionParamIdentityInsert {
7986+ pub obj : ObjectName ,
7987+ pub value : SessionParamValue ,
7988+ }
7989+
7990+ impl fmt:: Display for SetSessionParamIdentityInsert {
7991+ fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
7992+ write ! ( f, "IDENTITY_INSERT {} {}" , self . obj, self . value)
7993+ }
7994+ }
7995+
7996+ #[ derive( Debug , Clone , PartialEq , PartialOrd , Eq , Ord , Hash ) ]
7997+ #[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
7998+ #[ cfg_attr( feature = "visitor" , derive( Visit , VisitMut ) ) ]
7999+ pub struct SetSessionParamOffsets {
8000+ pub keywords : Vec < String > ,
8001+ pub value : SessionParamValue ,
8002+ }
8003+
8004+ impl fmt:: Display for SetSessionParamOffsets {
8005+ fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
8006+ write ! (
8007+ f,
8008+ "OFFSETS {} {}" ,
8009+ display_comma_separated( & self . keywords) ,
8010+ self . value
8011+ )
8012+ }
8013+ }
8014+
8015+ #[ derive( Debug , Clone , PartialEq , PartialOrd , Eq , Ord , Hash ) ]
8016+ #[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
8017+ #[ cfg_attr( feature = "visitor" , derive( Visit , VisitMut ) ) ]
8018+ pub struct SetSessionParamStatistics {
8019+ pub topic : SessionParamStatsTopic ,
8020+ pub value : SessionParamValue ,
8021+ }
8022+
8023+ impl fmt:: Display for SetSessionParamStatistics {
8024+ fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
8025+ write ! ( f, "STATISTICS {} {}" , self . topic, self . value)
8026+ }
8027+ }
8028+
8029+ #[ derive( Debug , Clone , PartialEq , PartialOrd , Eq , Ord , Hash ) ]
8030+ #[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
8031+ #[ cfg_attr( feature = "visitor" , derive( Visit , VisitMut ) ) ]
8032+ pub enum SessionParamStatsTopic {
8033+ IO ,
8034+ Profile ,
8035+ Time ,
8036+ Xml ,
8037+ }
8038+
8039+ impl fmt:: Display for SessionParamStatsTopic {
8040+ fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
8041+ match self {
8042+ SessionParamStatsTopic :: IO => write ! ( f, "IO" ) ,
8043+ SessionParamStatsTopic :: Profile => write ! ( f, "PROFILE" ) ,
8044+ SessionParamStatsTopic :: Time => write ! ( f, "TIME" ) ,
8045+ SessionParamStatsTopic :: Xml => write ! ( f, "XML" ) ,
8046+ }
8047+ }
8048+ }
8049+
8050+ #[ derive( Debug , Clone , PartialEq , PartialOrd , Eq , Ord , Hash ) ]
8051+ #[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
8052+ #[ cfg_attr( feature = "visitor" , derive( Visit , VisitMut ) ) ]
8053+ pub enum SessionParamValue {
8054+ On ,
8055+ Off ,
8056+ }
8057+
8058+ impl fmt:: Display for SessionParamValue {
8059+ fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
8060+ match self {
8061+ SessionParamValue :: On => write ! ( f, "ON" ) ,
8062+ SessionParamValue :: Off => write ! ( f, "OFF" ) ,
8063+ }
8064+ }
8065+ }
8066+
79408067#[ cfg( test) ]
79418068mod tests {
79428069 use super :: * ;
0 commit comments