Trait pgwire::api::query::ExtendedQueryHandler

source ·
pub trait ExtendedQueryHandler: Send + Sync {
    type Statement: Clone + Send + Sync;
    type QueryParser: QueryParser<Statement = Self::Statement> + Send + Sync;

    // Required methods
    fn query_parser(&self) -> Arc<Self::QueryParser>;
    fn do_describe_statement<'life0, 'life1, 'life2, 'async_trait, C>(
        &'life0 self,
        client: &'life1 mut C,
        target: &'life2 StoredStatement<Self::Statement>,
    ) -> Pin<Box<dyn Future<Output = PgWireResult<DescribeStatementResponse>> + Send + 'async_trait>>
       where C: ClientInfo + ClientPortalStore + Sink<PgWireBackendMessage> + Unpin + Send + Sync + 'async_trait,
             C::PortalStore: PortalStore<Statement = Self::Statement>,
             C::Error: Debug,
             PgWireError: From<<C as Sink<PgWireBackendMessage>>::Error>,
             Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn do_describe_portal<'life0, 'life1, 'life2, 'async_trait, C>(
        &'life0 self,
        client: &'life1 mut C,
        target: &'life2 Portal<Self::Statement>,
    ) -> Pin<Box<dyn Future<Output = PgWireResult<DescribePortalResponse>> + Send + 'async_trait>>
       where C: ClientInfo + ClientPortalStore + Sink<PgWireBackendMessage> + Unpin + Send + Sync + 'async_trait,
             C::PortalStore: PortalStore<Statement = Self::Statement>,
             C::Error: Debug,
             PgWireError: From<<C as Sink<PgWireBackendMessage>>::Error>,
             Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn do_query<'a, 'b, 'life0, 'async_trait, C>(
        &'b self,
        client: &'life0 mut C,
        portal: &'a Portal<Self::Statement>,
        max_rows: usize,
    ) -> Pin<Box<dyn Future<Output = PgWireResult<Response<'a>>> + Send + 'async_trait>>
       where C: ClientInfo + ClientPortalStore + Sink<PgWireBackendMessage> + Unpin + Send + Sync + 'async_trait,
             C::PortalStore: PortalStore<Statement = Self::Statement>,
             C::Error: Debug,
             PgWireError: From<<C as Sink<PgWireBackendMessage>>::Error>,
             Self: 'async_trait,
             'a: 'async_trait,
             'b: 'async_trait + 'a,
             'life0: 'async_trait;

    // Provided methods
    fn on_parse<'life0, 'life1, 'async_trait, C>(
        &'life0 self,
        client: &'life1 mut C,
        message: Parse,
    ) -> Pin<Box<dyn Future<Output = PgWireResult<()>> + Send + 'async_trait>>
       where C: ClientInfo + ClientPortalStore + Sink<PgWireBackendMessage> + Unpin + Send + Sync + 'async_trait,
             C::PortalStore: PortalStore<Statement = Self::Statement>,
             C::Error: Debug,
             PgWireError: From<<C as Sink<PgWireBackendMessage>>::Error>,
             Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn on_bind<'life0, 'life1, 'async_trait, C>(
        &'life0 self,
        client: &'life1 mut C,
        message: Bind,
    ) -> Pin<Box<dyn Future<Output = PgWireResult<()>> + Send + 'async_trait>>
       where C: ClientInfo + ClientPortalStore + Sink<PgWireBackendMessage> + Unpin + Send + Sync + 'async_trait,
             C::PortalStore: PortalStore<Statement = Self::Statement>,
             C::Error: Debug,
             PgWireError: From<<C as Sink<PgWireBackendMessage>>::Error>,
             Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn on_execute<'life0, 'life1, 'async_trait, C>(
        &'life0 self,
        client: &'life1 mut C,
        message: Execute,
    ) -> Pin<Box<dyn Future<Output = PgWireResult<()>> + Send + 'async_trait>>
       where C: ClientInfo + ClientPortalStore + Sink<PgWireBackendMessage> + Unpin + Send + Sync + 'async_trait,
             C::PortalStore: PortalStore<Statement = Self::Statement>,
             C::Error: Debug,
             PgWireError: From<<C as Sink<PgWireBackendMessage>>::Error>,
             Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn on_describe<'life0, 'life1, 'async_trait, C>(
        &'life0 self,
        client: &'life1 mut C,
        message: Describe,
    ) -> Pin<Box<dyn Future<Output = PgWireResult<()>> + Send + 'async_trait>>
       where C: ClientInfo + ClientPortalStore + Sink<PgWireBackendMessage> + Unpin + Send + Sync + 'async_trait,
             C::PortalStore: PortalStore<Statement = Self::Statement>,
             C::Error: Debug,
             PgWireError: From<<C as Sink<PgWireBackendMessage>>::Error>,
             Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn on_sync<'life0, 'life1, 'async_trait, C>(
        &'life0 self,
        client: &'life1 mut C,
        _message: PgSync,
    ) -> Pin<Box<dyn Future<Output = PgWireResult<()>> + Send + 'async_trait>>
       where C: ClientInfo + Sink<PgWireBackendMessage> + Unpin + Send + Sync + 'async_trait,
             C::Error: Debug,
             PgWireError: From<<C as Sink<PgWireBackendMessage>>::Error>,
             Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn on_close<'life0, 'life1, 'async_trait, C>(
        &'life0 self,
        client: &'life1 mut C,
        message: Close,
    ) -> Pin<Box<dyn Future<Output = PgWireResult<()>> + Send + 'async_trait>>
       where C: ClientInfo + ClientPortalStore + Sink<PgWireBackendMessage> + Unpin + Send + Sync + 'async_trait,
             C::PortalStore: PortalStore<Statement = Self::Statement>,
             C::Error: Debug,
             PgWireError: From<<C as Sink<PgWireBackendMessage>>::Error>,
             Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
}

Required Associated Types§

Required Methods§

source

fn query_parser(&self) -> Arc<Self::QueryParser>

Get a reference to associated QueryParser implementation

source

fn do_describe_statement<'life0, 'life1, 'life2, 'async_trait, C>( &'life0 self, client: &'life1 mut C, target: &'life2 StoredStatement<Self::Statement>, ) -> Pin<Box<dyn Future<Output = PgWireResult<DescribeStatementResponse>> + Send + 'async_trait>>
where C: ClientInfo + ClientPortalStore + Sink<PgWireBackendMessage> + Unpin + Send + Sync + 'async_trait, C::PortalStore: PortalStore<Statement = Self::Statement>, C::Error: Debug, PgWireError: From<<C as Sink<PgWireBackendMessage>>::Error>, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Return resultset metadata without actually executing statement

source

fn do_describe_portal<'life0, 'life1, 'life2, 'async_trait, C>( &'life0 self, client: &'life1 mut C, target: &'life2 Portal<Self::Statement>, ) -> Pin<Box<dyn Future<Output = PgWireResult<DescribePortalResponse>> + Send + 'async_trait>>
where C: ClientInfo + ClientPortalStore + Sink<PgWireBackendMessage> + Unpin + Send + Sync + 'async_trait, C::PortalStore: PortalStore<Statement = Self::Statement>, C::Error: Debug, PgWireError: From<<C as Sink<PgWireBackendMessage>>::Error>, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Return resultset metadata without actually executing portal

source

fn do_query<'a, 'b, 'life0, 'async_trait, C>( &'b self, client: &'life0 mut C, portal: &'a Portal<Self::Statement>, max_rows: usize, ) -> Pin<Box<dyn Future<Output = PgWireResult<Response<'a>>> + Send + 'async_trait>>
where C: ClientInfo + ClientPortalStore + Sink<PgWireBackendMessage> + Unpin + Send + Sync + 'async_trait, C::PortalStore: PortalStore<Statement = Self::Statement>, C::Error: Debug, PgWireError: From<<C as Sink<PgWireBackendMessage>>::Error>, Self: 'async_trait, 'a: 'async_trait, 'b: 'async_trait + 'a, 'life0: 'async_trait,

This is the main implementation for query execution. Context has been provided:

  • client: Information of the client sending the query
  • portal: Statement and parameters for the query
  • max_rows: Max requested rows of the query

Provided Methods§

source

fn on_parse<'life0, 'life1, 'async_trait, C>( &'life0 self, client: &'life1 mut C, message: Parse, ) -> Pin<Box<dyn Future<Output = PgWireResult<()>> + Send + 'async_trait>>
where C: ClientInfo + ClientPortalStore + Sink<PgWireBackendMessage> + Unpin + Send + Sync + 'async_trait, C::PortalStore: PortalStore<Statement = Self::Statement>, C::Error: Debug, PgWireError: From<<C as Sink<PgWireBackendMessage>>::Error>, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Called when client sends parse command.

The default implementation parsed query with Self::QueryParser and stores it in Self::PortalStore.

source

fn on_bind<'life0, 'life1, 'async_trait, C>( &'life0 self, client: &'life1 mut C, message: Bind, ) -> Pin<Box<dyn Future<Output = PgWireResult<()>> + Send + 'async_trait>>
where C: ClientInfo + ClientPortalStore + Sink<PgWireBackendMessage> + Unpin + Send + Sync + 'async_trait, C::PortalStore: PortalStore<Statement = Self::Statement>, C::Error: Debug, PgWireError: From<<C as Sink<PgWireBackendMessage>>::Error>, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Called when client sends bind command.

The default implementation associate parameters with previous parsed statement and stores in Self::PortalStore as well.

source

fn on_execute<'life0, 'life1, 'async_trait, C>( &'life0 self, client: &'life1 mut C, message: Execute, ) -> Pin<Box<dyn Future<Output = PgWireResult<()>> + Send + 'async_trait>>
where C: ClientInfo + ClientPortalStore + Sink<PgWireBackendMessage> + Unpin + Send + Sync + 'async_trait, C::PortalStore: PortalStore<Statement = Self::Statement>, C::Error: Debug, PgWireError: From<<C as Sink<PgWireBackendMessage>>::Error>, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Called when client sends execute command.

The default implementation delegates the query to self::do_query and sends response messages according to Response from self::do_query.

Note that, different from SimpleQueryHandler, this implementation won’t check empty query because it cannot understand parsed Self::Statement.

source

fn on_describe<'life0, 'life1, 'async_trait, C>( &'life0 self, client: &'life1 mut C, message: Describe, ) -> Pin<Box<dyn Future<Output = PgWireResult<()>> + Send + 'async_trait>>
where C: ClientInfo + ClientPortalStore + Sink<PgWireBackendMessage> + Unpin + Send + Sync + 'async_trait, C::PortalStore: PortalStore<Statement = Self::Statement>, C::Error: Debug, PgWireError: From<<C as Sink<PgWireBackendMessage>>::Error>, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Called when client sends describe command.

The default implementation delegates the call to self::do_describe.

source

fn on_sync<'life0, 'life1, 'async_trait, C>( &'life0 self, client: &'life1 mut C, _message: PgSync, ) -> Pin<Box<dyn Future<Output = PgWireResult<()>> + Send + 'async_trait>>
where C: ClientInfo + Sink<PgWireBackendMessage> + Unpin + Send + Sync + 'async_trait, C::Error: Debug, PgWireError: From<<C as Sink<PgWireBackendMessage>>::Error>, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Called when client sends sync command.

The default implementation flushes client buffer and sends READY_FOR_QUERY response to client

source

fn on_close<'life0, 'life1, 'async_trait, C>( &'life0 self, client: &'life1 mut C, message: Close, ) -> Pin<Box<dyn Future<Output = PgWireResult<()>> + Send + 'async_trait>>
where C: ClientInfo + ClientPortalStore + Sink<PgWireBackendMessage> + Unpin + Send + Sync + 'async_trait, C::PortalStore: PortalStore<Statement = Self::Statement>, C::Error: Debug, PgWireError: From<<C as Sink<PgWireBackendMessage>>::Error>, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Called when client sends close command.

The default implementation closes certain statement or portal.

Object Safety§

This trait is not object safe.

Implementors§