uqa_sql/plan/
optimization.rs1use super::UnifiedPlan;
10use crate::{binding::statements::AnalyzedResult, SQLError, SQLParam};
11
12pub trait ExecutablePlanOptimizer {
14 fn plan_with_cached_analysis(
16 &self,
17 plan: UnifiedPlan,
18 params: &[SQLParam],
19 _cached: Option<std::sync::Arc<crate::binding::statements::AnalyzedStatement>>,
20 ) -> Result<
21 (
22 UnifiedPlan,
23 Option<std::sync::Arc<crate::binding::statements::AnalyzedStatement>>,
24 ),
25 SQLError,
26 > {
27 self.plan_for_execution(plan, params)
28 .map(|plan| (plan, None))
29 }
30
31 fn plan_for_statement_cache(
34 &self,
35 plan: UnifiedPlan,
36 params: &[SQLParam],
37 ) -> Result<(UnifiedPlan, bool), SQLError> {
38 self.plan_for_execution(plan, params)
39 .map(|plan| (plan, false))
40 }
41
42 fn plan_for_execution(
43 &self,
44 plan: UnifiedPlan,
45 params: &[SQLParam],
46 ) -> Result<UnifiedPlan, SQLError>;
47
48 fn plan_with_result(
50 &self,
51 plan: UnifiedPlan,
52 params: &[SQLParam],
53 ) -> Result<(UnifiedPlan, AnalyzedResult), SQLError>;
54}