FAQ
[ https://issues.apache.org/cayenne/browse/CAY-289?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12753#action_12753 ]

Tore Halset commented on CAY-289:
---------------------------------

For PostgresSQL (at least) this behavior should be optional.

In our project we do not care about the case of the column and table names. They are upper-case in the model. If cayenne would start using "" around each column and table name, then we would have to change all of our tables and columns to be created with "" as well. And that is a lot of work for nothing! It would not help to change to lowercase in the model as that would break other databases.

Still for PostgreSQL:
"create table A; select * from "A"" does not work as the table name is "a".
Implement Quoting of identifiers
--------------------------------

Key: CAY-289
URL: https://issues.apache.org/cayenne/browse/CAY-289
Project: Cayenne
Issue Type: Improvement
Components: Cayenne Core Library
Affects Versions: 1.2 [STABLE]
Environment: Linux, Sun JDK1.5, MS SQL Server 2000, jtds-1.0, Croatian locale
Reporter: Tomislav Nakic-Alfirevic
Assignee: Andrus Adamchik
Fix For: 3.0


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.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Search Discussions

  • Anonymous at Feb 29, 2008 at 1:40 pm
    [ https://issues.apache.org/cayenne/browse/CAY-289?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12754#action_12754 ]

    Andrus Adamchik commented on CAY-289:
    -------------------------------------

    agreed , it must be optional for all DB's
    Implement Quoting of identifiers
    --------------------------------

    Key: CAY-289
    URL: https://issues.apache.org/cayenne/browse/CAY-289
    Project: Cayenne
    Issue Type: Improvement
    Components: Cayenne Core Library
    Affects Versions: 1.2 [STABLE]
    Environment: Linux, Sun JDK1.5, MS SQL Server 2000, jtds-1.0, Croatian locale
    Reporter: Tomislav Nakic-Alfirevic
    Assignee: Andrus Adamchik
    Fix For: 3.0


    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.
    --
    This message is automatically generated by JIRA.
    -
    You can reply to this email to add a comment to the issue online.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupdev @
categoriescayenne
postedFeb 29, '08 at 1:38p
activeFeb 29, '08 at 1:40p
posts2
users1
websitecayenne.apache.org

1 user in discussion

Anonymous: 2 posts

People

Translate

site design / logo © 2021 Grokbase