Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions src/api/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ pub trait SimpleQueryHandler: Send + Sync {
send_ready_for_query(client, transaction_status).await?;
};

self.done_query(client).await?;

Ok(())
}

Expand All @@ -126,6 +128,16 @@ pub trait SimpleQueryHandler: Send + Sync {
C: ClientInfo + ClientPortalStore + Sink<PgWireBackendMessage> + Unpin + Send + Sync,
C::Error: Debug,
PgWireError: From<<C as Sink<PgWireBackendMessage>>::Error>;

/// Called after the query has been completed
async fn done_query<C>(&self, _client: &mut C) -> PgWireResult<()>
where
C: ClientInfo + ClientPortalStore + Sink<PgWireBackendMessage> + Unpin + Send + Sync,
C::Error: Debug,
PgWireError: From<<C as Sink<PgWireBackendMessage>>::Error>,
{
Ok(())
}
}

#[async_trait]
Expand Down Expand Up @@ -256,6 +268,8 @@ pub trait ExtendedQueryHandler: Send + Sync {
client.set_transaction_status(transaction_status);
};

self.done_query(client).await?;

Ok(())
} else {
Err(PgWireError::PortalNotFound(portal_name.to_owned()))
Expand Down Expand Up @@ -395,6 +409,17 @@ pub trait ExtendedQueryHandler: Send + Sync {
C::PortalStore: PortalStore<Statement = Self::Statement>,
C::Error: Debug,
PgWireError: From<<C as Sink<PgWireBackendMessage>>::Error>;

/// Called after the query has been completed
async fn done_query<C>(&self, _client: &mut C) -> PgWireResult<()>
where
C: ClientInfo + ClientPortalStore + Sink<PgWireBackendMessage> + Unpin + Send + Sync,
C::PortalStore: PortalStore<Statement = Self::Statement>,
C::Error: Debug,
PgWireError: From<<C as Sink<PgWireBackendMessage>>::Error>,
{
Ok(())
}
}

/// Helper function to send `QueryResponse` and optional `RowDescription` to client
Expand Down
Loading