Visitar URL original
[BUG] JSQLParser 4.6: RDBMS : SetStatement getName returns Object instead of String or NameExpr · Issue #1746 · JSQLParser/JSqlParser · GitHub
Skip to content

[BUG] JSQLParser 4.6: RDBMS : SetStatement getName returns Object instead of String or NameExpr #1746

Description

@rhuddbiz

Software Information:

  • JSqlParser 4.6

net.sf.jsqlparser.statement.SetStatement.getName() returns Object whereas in 4.5 it returned a String. There is no method that returns a getName method maybe should return NameExpr instead of String, I'm not sure of the expected behavoir, but the Object seems incorrect.

Activity

  1. manticore-projects commented on Mar 15, 2023

    @manticore-projects
    Contributor

    Greetings.

    It is explicitly defined as an Object for making variable assignments possible, such as:

    set @Flag = 1

    or

    SET @@global.time_zone = '01:00'

    Whenever you get an Object, you can use toString() to get your expected String since all Entities de-parse using toString() method.

  2. rhuddbiz commented on Mar 15, 2023

    @rhuddbiz
    Author

    Ok, but why upcast from NameExp to Object ? I'd prefer to work with a NameExp which is the internal variable type .

  3. manticore-projects commented on Mar 17, 2023

    @manticore-projects
    Contributor

    Ok, but why upcast from NameExp to Object ? I'd prefer to work with a NameExp which is the internal variable type .

    The Name of the NameExp can be a UserVariable or a String.
    The method getName returns this Name of the NameExpression, but not the NameExpression itself.

    Although it would make sense to provide a Getter/Setter for the NameExpression:

    setStatement.addKeyValuePairs(
                    new SetStatement.NameExpr("test", Arrays.asList(new StringValue("1")), false));
    setStatement.getKeyValuePairs().get(0).setUseEqual(true);
  4. added a commit that references this issue on Mar 17, 2023
    a6d9e40
  5. rhuddbiz commented on Mar 23, 2023

    @rhuddbiz
    Author

    The commit looks like it will solve my issue, thank you so much !

  6. added a commit that references this issue on Apr 27, 2023
    a312dcd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions