Uploaded image for project: 'Cayenne'
  1. Cayenne
  2. CAY-289

Implement Quoting of identifiers

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.0M5
    • 3.0M6, 3.0
    • Core Library
    • None
    • Linux, Sun JDK1.5, MS SQL Server 2000, jtds-1.0, Croatian locale

    Description

      Say a table "t0" has an attribute "my attrib 0".
      You correct the obj-attribute to, for instance, "my_attrib_0", but the db-attribute is still "my attrib 0".
      When you try to run a query on "t0", the generated query looks like:
      SELECT ..., t0.my attrib 0, ... FROM dbo.t0 AS t0

      This, obviously, can't possibly work.
      The correct SQL would be:
      SELECT ..., t0.[my attrib 0], ... FROM dbo.[t0] AS t0

      Notice the square brackets arround the attributes and table names: that makes the string a valid attribute or table name valid.
      A further improvement might be to add the database name:
      SELECT ..., t0.[my attrib 0], ... FROM [dbname].dbo.[t0] AS t0

      I mention it because I use the quantum plugin as a database access plugin and it complained about a table called "dbo.tablename" (as I believe it should) and all was well when I used mydbname.dbo.tablename.

      Attachments

        1. SelectTranslatorTest.txt
          28 kB
          Olga Tkacheva
        2. postgres.txt
          27 kB
          Olga Tkacheva
        3. postgres.txt
          33 kB
          Olga Tkacheva
        4. patchForH2.txt
          2 kB
          Olga Tkacheva
        5. migratePatch.txt
          26 kB
          Olga Tkacheva
        6. InsertUpdateDeleteSelect.txt
          52 kB
          Olga Tkacheva
        7. InsertUpdateDeleteSelect.txt
          51 kB
          Olga Tkacheva
        8. InsertUpdateDelete.txt
          23 kB
          Olga Tkacheva
        9. h2Faild.txt
          1 kB
          Olga Tkacheva
        10. forWorkTrim.txt
          2 kB
          Olga Tkacheva
        11. ErrorInOracle.txt
          2 kB
          Olga Tkacheva
        12. diffQuoteSqlIdentifiers.txt
          89 kB
          Olga Tkacheva

        Issue Links

          Activity

            People

              andrus Andrus Adamchik
              tnakic Tomislav Nakic-Alfirevic
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: