@@ -770,6 +770,11 @@ pub enum Statement {
770770 /// VALUES a vector of values to be copied
771771 values : Vec < Option < String > > ,
772772 } ,
773+ /// Close - closes the portal underlying an open cursor.
774+ Close {
775+ /// Cursor name
776+ cursor : CloseCursor ,
777+ } ,
773778 /// UPDATE
774779 Update {
775780 /// TABLE
@@ -1363,6 +1368,11 @@ impl fmt::Display for Statement {
13631368 }
13641369 Ok ( ( ) )
13651370 }
1371+ Statement :: Close { cursor } => {
1372+ write ! ( f, "CLOSE {}" , cursor) ?;
1373+
1374+ Ok ( ( ) )
1375+ }
13661376 Statement :: CreateDatabase {
13671377 db_name,
13681378 if_not_exists,
@@ -2178,6 +2188,22 @@ impl fmt::Display for FunctionArg {
21782188 }
21792189}
21802190
2191+ #[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
2192+ #[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
2193+ pub enum CloseCursor {
2194+ All ,
2195+ Specific { name : Ident } ,
2196+ }
2197+
2198+ impl fmt:: Display for CloseCursor {
2199+ fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
2200+ match self {
2201+ CloseCursor :: All => write ! ( f, "ALL" ) ,
2202+ CloseCursor :: Specific { name } => write ! ( f, "{}" , name) ,
2203+ }
2204+ }
2205+ }
2206+
21812207/// A function call
21822208#[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
21832209#[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
0 commit comments