Creates a description of the purified statement `stmt`. See the documentation of [`StatementDesc`] for details.
(
pcx: &PlanContext,
catalog: &dyn SessionCatalog,
stmt: Statement<Aug>,
param_types_in: &[Option<SqlScalarType>],
)
| 101 | /// |
| 102 | /// See the documentation of [`StatementDesc`] for details. |
| 103 | pub fn describe( |
| 104 | pcx: &PlanContext, |
| 105 | catalog: &dyn SessionCatalog, |
| 106 | stmt: Statement<Aug>, |
| 107 | param_types_in: &[Option<SqlScalarType>], |
| 108 | ) -> Result<StatementDesc, PlanError> { |
| 109 | let mut param_types = BTreeMap::new(); |
| 110 | for (i, ty) in param_types_in.iter().enumerate() { |
| 111 | if let Some(ty) = ty { |
| 112 | param_types.insert(i + 1, ty.clone()); |
| 113 | } |
| 114 | } |
| 115 | |
| 116 | let scx = StatementContext { |
| 117 | pcx: Some(pcx), |
| 118 | catalog, |
| 119 | param_types: RefCell::new(param_types), |
| 120 | ambiguous_columns: RefCell::new(false), |
| 121 | sql_impl_resolved_ids: Arc::new(Mutex::new(ResolvedIds::empty())), |
| 122 | }; |
| 123 | |
| 124 | let desc = match stmt { |
| 125 | // DDL statements. |
| 126 | Statement::AlterCluster(stmt) => ddl::describe_alter_cluster_set_options(&scx, stmt)?, |
| 127 | Statement::AlterConnection(stmt) => ddl::describe_alter_connection(&scx, stmt)?, |
| 128 | Statement::AlterIndex(stmt) => ddl::describe_alter_index_options(&scx, stmt)?, |
| 129 | Statement::AlterMaterializedViewApplyReplacement(stmt) => { |
| 130 | ddl::describe_alter_materialized_view_apply_replacement(&scx, stmt)? |
| 131 | } |
| 132 | Statement::AlterObjectRename(stmt) => ddl::describe_alter_object_rename(&scx, stmt)?, |
| 133 | Statement::AlterObjectSwap(stmt) => ddl::describe_alter_object_swap(&scx, stmt)?, |
| 134 | Statement::AlterRetainHistory(stmt) => ddl::describe_alter_retain_history(&scx, stmt)?, |
| 135 | Statement::AlterRole(stmt) => ddl::describe_alter_role(&scx, stmt)?, |
| 136 | Statement::AlterSecret(stmt) => ddl::describe_alter_secret_options(&scx, stmt)?, |
| 137 | Statement::AlterSetCluster(stmt) => ddl::describe_alter_set_cluster(&scx, stmt)?, |
| 138 | Statement::AlterSink(stmt) => ddl::describe_alter_sink(&scx, stmt)?, |
| 139 | Statement::AlterSource(stmt) => ddl::describe_alter_source(&scx, stmt)?, |
| 140 | Statement::AlterSystemSet(stmt) => ddl::describe_alter_system_set(&scx, stmt)?, |
| 141 | Statement::AlterSystemReset(stmt) => ddl::describe_alter_system_reset(&scx, stmt)?, |
| 142 | Statement::AlterSystemResetAll(stmt) => ddl::describe_alter_system_reset_all(&scx, stmt)?, |
| 143 | Statement::AlterTableAddColumn(stmt) => ddl::describe_alter_table_add_column(&scx, stmt)?, |
| 144 | Statement::AlterNetworkPolicy(stmt) => ddl::describe_alter_network_policy(&scx, stmt)?, |
| 145 | Statement::Comment(stmt) => ddl::describe_comment(&scx, stmt)?, |
| 146 | Statement::CreateCluster(stmt) => ddl::describe_create_cluster(&scx, stmt)?, |
| 147 | Statement::CreateClusterReplica(stmt) => ddl::describe_create_cluster_replica(&scx, stmt)?, |
| 148 | Statement::CreateConnection(stmt) => ddl::describe_create_connection(&scx, stmt)?, |
| 149 | Statement::CreateDatabase(stmt) => ddl::describe_create_database(&scx, stmt)?, |
| 150 | Statement::CreateIndex(stmt) => ddl::describe_create_index(&scx, stmt)?, |
| 151 | Statement::CreateRole(stmt) => ddl::describe_create_role(&scx, stmt)?, |
| 152 | Statement::CreateSchema(stmt) => ddl::describe_create_schema(&scx, stmt)?, |
| 153 | Statement::CreateSecret(stmt) => ddl::describe_create_secret(&scx, stmt)?, |
| 154 | Statement::CreateSink(stmt) => ddl::describe_create_sink(&scx, stmt)?, |
| 155 | Statement::CreateWebhookSource(stmt) => ddl::describe_create_webhook_source(&scx, stmt)?, |
| 156 | Statement::CreateSource(stmt) => ddl::describe_create_source(&scx, stmt)?, |
| 157 | Statement::CreateSubsource(stmt) => ddl::describe_create_subsource(&scx, stmt)?, |
| 158 | Statement::CreateTable(stmt) => ddl::describe_create_table(&scx, stmt)?, |
| 159 | Statement::CreateTableFromSource(stmt) => { |
| 160 | ddl::describe_create_table_from_source(&scx, stmt)? |
no test coverage detected