openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Roger Keays (JIRA)" <j...@apache.org>
Subject [jira] Commented: (OPENJPA-84) Escape sql reserved words in column names
Date Wed, 29 Nov 2006 04:21:21 GMT
    [ http://issues.apache.org/jira/browse/OPENJPA-84?page=comments#action_12454232 ] 
            
Roger Keays commented on OPENJPA-84:
------------------------------------

A simple way to implement this would be to quote all identifiers. That would also mean less
work maintaining a list of reserved words.

> Escape sql reserved words in column names
> -----------------------------------------
>
>                 Key: OPENJPA-84
>                 URL: http://issues.apache.org/jira/browse/OPENJPA-84
>             Project: OpenJPA
>          Issue Type: Improvement
>          Components: sql
>            Reporter: Roger Keays
>            Priority: Minor
>
> OpenJPA does not escape reserved words in SQL queries when they are used as column names.
To escape a reserved name you just put it in quotes:
> INSERT INTO FB_PRIVILEGES (comment, inheritable, level, role, type, username, item_uuid)
...
> on oracle, becomes 
> INSERT INTO FB_PRIVILEGES ("comment", inheritable, "level", role, "type", username, item_uuid)
...
> Looking at the code in DBDictionary, it appears that the escaping is done for table and
sequence names by appending a numeral to the name. There isn't really any good reason to do
this instead of quoting the identifier.
> table.name identifiers would have to be escaped as "table"."name" if both table and name
were reserved words.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message