Menu

#18 Avoid double quoting of table and column in UPDATE

2.0.8
closed
None
1
2014-12-03
2014-12-01
No

Hi,

thanks for the quick reply on the previous patch.

Here is another one (probably the last one for now, since I can now parse all the queries in the legacy database I'm currently working on.)

It prevents some double quoting in the SET clause of an UPDATE statement.

E.g. instead of

SET [[a table]].column1 = [column2]

I now get

SET [a table].column1 = [column2]

To be honest I wouldn't expect column2 to be quoted either, but that doesn't harm, while the double quoting in confusing the parser I'm currently working on ( http://github.com/favalex/sql-parser ).

By the way, would you consider moving the project to github, for a better workflow?

1 Attachments

Discussion

  • James Ahlborn

    James Ahlborn - 2014-12-02

    So, when i tested an update query in a 2010 access database, the table and column names with spaces in them were saved unquoted. how did you end up with a quoted table/column name? can you attach an example database?

     
  • Gabriele Favalessa

    Hi James,

    I'm working with a legacy database in .mdb format. I managed to reproduce the double quoting problem with the attached sample database Quoting.mdb generated using Access 97. I couldn't reproduce the problem using Access 2010.

    The output of a simple program printing toSQLString() of the query "Update query" before and after the patch:

    Database: Quoting.mdb
    Charset: UTF-8
    File format: V1997 [VERSION_3]

    Update query
    UPDATE [Name with spaces]
    SET [[Name with spaces]].Number = [Number]+"1";

    Database: Quoting.mdb
    Charset: UTF-8
    File format: V1997 [VERSION_3]

    Update query
    UPDATE [Name with spaces]
    SET [Name with spaces].Number = [Number]+"1";

     
  • James Ahlborn

    James Ahlborn - 2014-12-03
    • status: open --> closed
    • assigned_to: James Ahlborn
    • Group: Unassigned --> 2.0.8
     
  • James Ahlborn

    James Ahlborn - 2014-12-03

    Fixed in trunk, will be in the 2.0.8 release.

    As for github, people rarely contribute patches, so it doesn't seem worth the hassle to move.

     

Log in to post a comment.