openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Evan Ireland" <eirel...@sybase.com>
Subject RE: [jira] Updated: (OPENJPA-84) Escape sql reserved words in column names
Date Thu, 01 Mar 2007 19:31:54 GMT
Patrick,

Can you ask OpenJPA to quote ALL identifiers for a particular
data source?

You might have an identifier (with some databases) that is 
declared as "a", but if you access it without quotes in a query
it will be auto-uppercased to A and won't match.

Rather than a special case for SQL reserved words, the ability
to quote all identifiers or quote none is generally more useful.

> -----Original Message-----
> From: Patrick Linskey (JIRA) [mailto:jira@apache.org] 
> Sent: Thursday, 1 March 2007 2:19 p.m.
> To: open-jpa-dev@incubator.apache.org
> Subject: [jira] Updated: (OPENJPA-84) Escape sql reserved 
> words in column names
> 
> 
>      [ 
> https://issues.apache.org/jira/browse/OPENJPA-84?page=com.atla
> ssian.jira.plugin.system.issuetabpanels:all-tabpanel ]
> 
> Patrick Linskey updated OPENJPA-84:
> -----------------------------------
> 
>     Fix Version/s: 1.0.0
> 
> > Escape sql reserved words in column names
> > -----------------------------------------
> >
> >                 Key: OPENJPA-84
> >                 URL: 
> https://issues.apache.org/jira/browse/OPENJPA-84
> >             Project: OpenJPA
> >          Issue Type: Improvement
> >          Components: sql
> >            Reporter: Roger Keays
> >             Fix For: 1.0.0
> >
> >
> > 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.
> -
> You can reply to this email to add a comment to the issue online.
> 
> 


Mime
View raw message