Trait servers::interceptor::SqlQueryInterceptor

source ·
pub trait SqlQueryInterceptor {
    type Error: ErrorExt;

    // Provided methods
    fn pre_parsing<'a>(
        &self,
        query: &'a str,
        _query_ctx: QueryContextRef,
    ) -> Result<Cow<'a, str>, Self::Error> { ... }
    fn post_parsing(
        &self,
        statements: Vec<Statement>,
        _query_ctx: QueryContextRef,
    ) -> Result<Vec<Statement>, Self::Error> { ... }
    fn pre_execute(
        &self,
        _statement: &Statement,
        _plan: Option<&LogicalPlan>,
        _query_ctx: QueryContextRef,
    ) -> Result<(), Self::Error> { ... }
    fn post_execute(
        &self,
        output: Output,
        _query_ctx: QueryContextRef,
    ) -> Result<Output, Self::Error> { ... }
}
Expand description

SqlQueryInterceptor can track life cycle of a sql query and customize or abort its execution at given point.

Required Associated Types§

source

type Error: ErrorExt

Provided Methods§

source

fn pre_parsing<'a>( &self, query: &'a str, _query_ctx: QueryContextRef, ) -> Result<Cow<'a, str>, Self::Error>

Called before a query string is parsed into sql statements. The implementation is allowed to change the sql string if needed.

source

fn post_parsing( &self, statements: Vec<Statement>, _query_ctx: QueryContextRef, ) -> Result<Vec<Statement>, Self::Error>

Called after sql is parsed into statements. This interceptor is called on each statement and the implementation can alter the statement or abort execution by raising an error.

source

fn pre_execute( &self, _statement: &Statement, _plan: Option<&LogicalPlan>, _query_ctx: QueryContextRef, ) -> Result<(), Self::Error>

Called before sql is actually executed. This hook is not called at the moment.

source

fn post_execute( &self, output: Output, _query_ctx: QueryContextRef, ) -> Result<Output, Self::Error>

Called after execution finished. The implementation can modify the output if needed.

Implementations on Foreign Types§

source§

impl<E> SqlQueryInterceptor for Option<&SqlQueryInterceptorRef<E>>
where E: ErrorExt,

§

type Error = E

source§

fn pre_parsing<'a>( &self, query: &'a str, query_ctx: QueryContextRef, ) -> Result<Cow<'a, str>, Self::Error>

source§

fn post_parsing( &self, statements: Vec<Statement>, query_ctx: QueryContextRef, ) -> Result<Vec<Statement>, Self::Error>

source§

fn pre_execute( &self, statement: &Statement, plan: Option<&LogicalPlan>, query_ctx: QueryContextRef, ) -> Result<(), Self::Error>

source§

fn post_execute( &self, output: Output, query_ctx: QueryContextRef, ) -> Result<Output, Self::Error>

Implementors§