(
ctx: &mut Context,
excluded: HashSet<CId>,
)
| 195 | } |
| 196 | |
| 197 | fn translate_exclude( |
| 198 | ctx: &mut Context, |
| 199 | excluded: HashSet<CId>, |
| 200 | ) -> Option<WildcardAdditionalOptions> { |
| 201 | let excluded = as_col_names(&excluded, &ctx.anchor); |
| 202 | |
| 203 | let Some(supported) = ctx.dialect.column_exclude() else { |
| 204 | // TODO: eventually this should throw an error |
| 205 | // I don't want to do this now, because we have no way around it. |
| 206 | // We could also ask the user to add table definitions. |
| 207 | if log::log_enabled!(log::Level::Warn) { |
| 208 | let excluded = excluded.join(", "); |
| 209 | |
| 210 | log::warn!("Columns {excluded} will be included with *, but were not requested.") |
| 211 | } |
| 212 | return None; |
| 213 | }; |
| 214 | |
| 215 | let mut excluded = excluded |
| 216 | .into_iter() |
| 217 | .map(|name| translate_ident_part(name.to_string(), ctx)) |
| 218 | .collect_vec(); |
| 219 | |
| 220 | Some(match supported { |
| 221 | ColumnExclude::Exclude => { |
| 222 | let excluded_object_names = excluded.into_iter().map(ObjectName::from).collect(); |
| 223 | WildcardAdditionalOptions { |
| 224 | opt_exclude: Some(ExcludeSelectItem::Multiple(excluded_object_names)), |
| 225 | ..Default::default() |
| 226 | } |
| 227 | } |
| 228 | ColumnExclude::Except => WildcardAdditionalOptions { |
| 229 | opt_except: Some(ExceptSelectItem { |
| 230 | first_element: excluded.remove(0), |
| 231 | additional_elements: excluded, |
| 232 | }), |
| 233 | ..Default::default() |
| 234 | }, |
| 235 | }) |
| 236 | } |
| 237 | |
| 238 | fn as_col_names<'a>(cids: &'a HashSet<CId>, ctx: &'a AnchorContext) -> Vec<&'a str> { |
| 239 | cids.iter() |
no test coverage detected