risingwave_frontend/handler/
close_cursor.rs1use pgwire::pg_response::{PgResponse, StatementType};
16use risingwave_sqlparser::ast::CloseCursorStatement;
17
18use super::RwPgResponse;
19use crate::error::Result;
20use crate::handler::HandlerArgs;
21
22pub async fn handle_close_cursor(
23 handle_args: HandlerArgs,
24 stmt: CloseCursorStatement,
25) -> Result<RwPgResponse> {
26 let session = handle_args.session.clone();
27 let cursor_manager = session.get_cursor_manager();
28 if let Some(cursor_name) = stmt.cursor_name {
29 cursor_manager
30 .remove_cursor(&cursor_name.real_value())
31 .await?;
32 } else {
33 cursor_manager.remove_all_cursor().await;
34 }
35 Ok(PgResponse::empty_result(StatementType::CLOSE_CURSOR))
36}