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§
Provided Methods§
sourcefn pre_parsing<'a>(
&self,
query: &'a str,
_query_ctx: QueryContextRef,
) -> Result<Cow<'a, str>, Self::Error>
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.
sourcefn post_parsing(
&self,
statements: Vec<Statement>,
_query_ctx: QueryContextRef,
) -> Result<Vec<Statement>, Self::Error>
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.
sourcefn pre_execute(
&self,
_statement: &Statement,
_plan: Option<&LogicalPlan>,
_query_ctx: QueryContextRef,
) -> Result<(), Self::Error>
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.
sourcefn post_execute(
&self,
output: Output,
_query_ctx: QueryContextRef,
) -> Result<Output, Self::Error>
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.