Skip to content

Commit

Permalink
fix vistior tests and address comment
Browse files Browse the repository at this point in the history
  • Loading branch information
ayman-sigma committed Nov 21, 2024
1 parent a850dac commit 4b4998e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
4 changes: 0 additions & 4 deletions src/ast/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,6 @@ impl Ident {
quote_style: Some(quote),
}
}

pub fn to_object_name_part(&self) -> ObjectNamePart {
ObjectNamePart::Identifier(self.clone())
}
}

impl From<&str> for Ident {
Expand Down
6 changes: 3 additions & 3 deletions src/ast/visitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -403,15 +403,15 @@ where
/// ```
/// # use sqlparser::parser::Parser;
/// # use sqlparser::dialect::GenericDialect;
/// # use sqlparser::ast::{ObjectName, visit_relations_mut};
/// # use sqlparser::ast::{ObjectName, ObjectNamePart, Ident, visit_relations_mut};
/// # use core::ops::ControlFlow;
/// let sql = "SELECT a FROM foo";
/// let mut statements = Parser::parse_sql(&GenericDialect{}, sql)
/// .unwrap();
///
/// // visit statements, renaming table foo to bar
/// visit_relations_mut(&mut statements, |table| {
/// table.0[0].value = table.0[0].value.replace("foo", "bar");
/// table.0[0] = ObjectNamePart::Identifier(Ident::new("bar"));
/// ControlFlow::<()>::Continue(())
/// });
///
Expand Down Expand Up @@ -529,7 +529,7 @@ where
/// if matches!(expr, Expr::Identifier(col_name) if col_name.value == "x") {
/// let old_expr = std::mem::replace(expr, Expr::Value(Value::Null));
/// *expr = Expr::Function(Function {
/// name: ObjectName(vec![Ident::new("f")]),
/// name: ObjectName::from(vec![Ident::new("f")]),
/// args: FunctionArguments::List(FunctionArgumentList {
/// duplicate_treatment: None,
/// args: vec![FunctionArg::Unnamed(FunctionArgExpr::Expr(old_expr))],
Expand Down
2 changes: 1 addition & 1 deletion src/parser/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12601,7 +12601,7 @@ impl<'a> Parser<'a> {
{
parent_name
.0
.insert(0, self.parse_identifier(false)?.to_object_name_part());
.insert(0, ObjectNamePart::Identifier(self.parse_identifier(false)?));
}
(None, Some(parent_name))
}
Expand Down

0 comments on commit 4b4998e

Please sign in to comment.