Return-Path: X-Original-To: apmail-openjpa-commits-archive@www.apache.org Delivered-To: apmail-openjpa-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 30B1E9D8D for ; Fri, 25 May 2012 14:31:11 +0000 (UTC) Received: (qmail 42445 invoked by uid 500); 25 May 2012 14:31:11 -0000 Delivered-To: apmail-openjpa-commits-archive@openjpa.apache.org Received: (qmail 42395 invoked by uid 500); 25 May 2012 14:31:10 -0000 Mailing-List: contact commits-help@openjpa.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@openjpa.apache.org Delivered-To: mailing list commits@openjpa.apache.org Received: (qmail 42379 invoked by uid 99); 25 May 2012 14:31:10 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 25 May 2012 14:31:10 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 25 May 2012 14:31:09 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 06C0423889E3 for ; Fri, 25 May 2012 14:30:49 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1342639 - /openjpa/branches/2.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java Date: Fri, 25 May 2012 14:30:48 -0000 To: commits@openjpa.apache.org From: curtisr7@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120525143049.06C0423889E3@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: curtisr7 Date: Fri May 25 14:30:48 2012 New Revision: 1342639 URL: http://svn.apache.org/viewvc?rev=1342639&view=rev Log: OPENJPA-2162: Allow the setting of the DBDictionary property supportsDelimitedIdentifiers to false to skip the extra overhead of processing delimited identifiers when they will not exist for a given application or usage. Modified: openjpa/branches/2.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java Modified: openjpa/branches/2.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java URL: http://svn.apache.org/viewvc/openjpa/branches/2.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java?rev=1342639&r1=1342638&r2=1342639&view=diff ============================================================================== --- openjpa/branches/2.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java (original) +++ openjpa/branches/2.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java Fri May 25 14:30:48 2012 @@ -394,7 +394,7 @@ public class DBDictionary // NamingConfiguration properties private boolean delimitIdentifiers = false; - public boolean supportsDelimitedIdentifiers = true; + public Boolean supportsDelimitedIdentifiers = null; public String leadingDelimiter = "\""; public String trailingDelimiter = "\""; public String nameConcatenator = "_"; @@ -476,7 +476,8 @@ public class DBDictionary } // Configure the naming utility - configureNamingUtil(metaData); + if (supportsDelimitedIdentifiers == null) // not explicitly set + configureNamingUtil(metaData); // Auto-detect generated keys retrieval support // unless user specified it. @@ -5396,20 +5397,27 @@ public class DBDictionary * @return the supportsDelimitedIds */ public boolean getSupportsDelimitedIdentifiers() { - return supportsDelimitedIdentifiers; + return (supportsDelimitedIdentifiers == null ? false : supportsDelimitedIdentifiers); } - + /** * @param supportsDelimitedIds the supportsDelimitedIds to set */ - public void setSupportsDelimitedIdentifiers(DatabaseMetaData metaData) { + public void setSupportsDelimitedIdentifiers(boolean supportsDelimitedIds) { + supportsDelimitedIdentifiers = Boolean.valueOf(supportsDelimitedIds); + } + + /** + * @param metadata the DatabaseMetaData to use to determine whether delimiters can be supported + */ + private void setSupportsDelimitedIdentifiers(DatabaseMetaData metaData) { try { - supportsDelimitedIdentifiers = + supportsDelimitedIdentifiers = Boolean.valueOf( metaData.supportsMixedCaseQuotedIdentifiers() || metaData.storesLowerCaseQuotedIdentifiers() || - metaData.storesUpperCaseQuotedIdentifiers(); + metaData.storesUpperCaseQuotedIdentifiers()); } catch (SQLException e) { - supportsDelimitedIdentifiers = false; + supportsDelimitedIdentifiers = Boolean.valueOf(false); getLog().warn(_loc.get("unknown-delim-support", e)); } } @@ -5524,11 +5532,17 @@ public class DBDictionary } public String toDBName(DBIdentifier name) { - return getNamingUtil().toDBName(name); + if (!getSupportsDelimitedIdentifiers()) + return name.getName(); + else + return getNamingUtil().toDBName(name); } public String toDBName(DBIdentifier name, boolean delimit) { - return getNamingUtil().toDBName(name, delimit); + if (!getSupportsDelimitedIdentifiers()) + return name.getName(); + else + return getNamingUtil().toDBName(name, delimit); } public DBIdentifier fromDBName(String name, DBIdentifierType id) {