cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r1449462 [2/3] - in /cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src: main/java/org/apache/cayenne/access/ main/java/org/apache/cayenne/access/jdbc/ main/java/org/apache/cayenne/access/trans/ main/java/org/apache/cayenne/dba/ ma...
Date Sun, 24 Feb 2013 11:53:38 GMT
Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/hsqldb/HSQLDBAdapter.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/hsqldb/HSQLDBAdapter.java?rev=1449462&r1=1449461&r2=1449462&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/hsqldb/HSQLDBAdapter.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/hsqldb/HSQLDBAdapter.java Sun Feb 24 11:53:37 2013
@@ -31,7 +31,6 @@ import org.apache.cayenne.access.types.E
 import org.apache.cayenne.configuration.Constants;
 import org.apache.cayenne.configuration.RuntimeProperties;
 import org.apache.cayenne.dba.JdbcAdapter;
-import org.apache.cayenne.dba.QuotingStrategy;
 import org.apache.cayenne.di.Inject;
 import org.apache.cayenne.map.DbAttribute;
 import org.apache.cayenne.map.DbEntity;
@@ -69,8 +68,7 @@ public class HSQLDBAdapter extends JdbcA
      * @since 1.2
      */
     protected String getTableName(DbEntity entity) {
-        QuotingStrategy context = getQuotingStrategy(entity.getDataMap().isQuotingSQLIdentifiers());
-        return context.quotedFullyQualifiedName(entity);
+        return quotingStrategy.quotedFullyQualifiedName(entity);
     }
 
     /**
@@ -100,13 +98,7 @@ public class HSQLDBAdapter extends JdbcA
      */
     @Override
     public String createUniqueConstraint(DbEntity source, Collection<DbAttribute> columns) {
-        boolean status;
-        if (source.getDataMap() != null && source.getDataMap().isQuotingSQLIdentifiers()) {
-            status = true;
-        } else {
-            status = false;
-        }
-        QuotingStrategy context = getQuotingStrategy(status);
+
         if (columns == null || columns.isEmpty()) {
             throw new CayenneRuntimeException("Can't create UNIQUE constraint - no columns specified.");
         }
@@ -119,17 +111,17 @@ public class HSQLDBAdapter extends JdbcA
         buf.append(" ADD CONSTRAINT ");
 
         String name = "U_" + source.getName() + "_" + (long) (System.currentTimeMillis() / (Math.random() * 100000));
-        buf.append(context.quotedIdentifier(source.getSchema(), name));
+        buf.append(quotingStrategy.quotedIdentifier(source, source.getSchema(), name));
         buf.append(" UNIQUE (");
 
         Iterator<DbAttribute> it = columns.iterator();
         DbAttribute first = it.next();
-        buf.append(context.quotedIdentifier(first.getName()));
+        buf.append(quotingStrategy.quotedName(first));
 
         while (it.hasNext()) {
             DbAttribute next = it.next();
             buf.append(", ");
-            buf.append(context.quotedIdentifier(next.getName()));
+            buf.append(quotingStrategy.quotedName(next));
         }
 
         buf.append(")");
@@ -144,14 +136,7 @@ public class HSQLDBAdapter extends JdbcA
      */
     @Override
     public String createFkConstraint(DbRelationship rel) {
-        boolean status;
-        if ((rel.getSourceEntity().getDataMap() != null)
-                && rel.getSourceEntity().getDataMap().isQuotingSQLIdentifiers()) {
-            status = true;
-        } else {
-            status = false;
-        }
-        QuotingStrategy context = getQuotingStrategy(status);
+     
         StringBuilder buf = new StringBuilder();
         StringBuilder refBuf = new StringBuilder();
 
@@ -169,7 +154,7 @@ public class HSQLDBAdapter extends JdbcA
 
         DbEntity sourceEntity = (DbEntity) rel.getSourceEntity();
 
-        buf.append(context.quotedIdentifier(sourceEntity.getSchema(), name));
+        buf.append(quotingStrategy.quotedIdentifier(sourceEntity, sourceEntity.getSchema(), name));
         buf.append(" FOREIGN KEY (");
 
         boolean first = true;
@@ -180,8 +165,8 @@ public class HSQLDBAdapter extends JdbcA
             } else
                 first = false;
 
-            buf.append(context.quotedIdentifier(join.getSourceName()));
-            refBuf.append(context.quotedIdentifier(join.getTargetName()));
+            buf.append(quotingStrategy.quotedSourceName(join));
+            refBuf.append(quotingStrategy.quotedTargetName(join));
         }
 
         buf.append(") REFERENCES ");

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/hsqldb/HSQLDBNoSchemaAdapter.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/hsqldb/HSQLDBNoSchemaAdapter.java?rev=1449462&r1=1449461&r2=1449462&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/hsqldb/HSQLDBNoSchemaAdapter.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/hsqldb/HSQLDBNoSchemaAdapter.java Sun Feb 24 11:53:37 2013
@@ -27,7 +27,6 @@ import org.apache.cayenne.access.types.E
 import org.apache.cayenne.access.types.ExtendedTypeFactory;
 import org.apache.cayenne.configuration.Constants;
 import org.apache.cayenne.configuration.RuntimeProperties;
-import org.apache.cayenne.dba.QuotingStrategy;
 import org.apache.cayenne.di.Inject;
 import org.apache.cayenne.map.DbEntity;
 
@@ -52,8 +51,7 @@ public class HSQLDBNoSchemaAdapter exten
      */
     @Override
     protected String getTableName(DbEntity entity) {
-        QuotingStrategy context = getQuotingStrategy(entity.getDataMap().isQuotingSQLIdentifiers());
-        return context.quotedIdentifier(entity.getName());
+        return quotingStrategy.quotedIdentifier(entity, entity.getName());
     }
 
     /**

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/hsqldb/HSQLMergerFactory.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/hsqldb/HSQLMergerFactory.java?rev=1449462&r1=1449461&r2=1449462&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/hsqldb/HSQLMergerFactory.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/hsqldb/HSQLMergerFactory.java Sun Feb 24 11:53:37 2013
@@ -35,9 +35,7 @@ import org.apache.cayenne.merge.SetPrima
 public class HSQLMergerFactory extends MergerFactory {
 
     @Override
-    public MergerToken createSetColumnTypeToDb(
-            final DbEntity entity,
-            DbAttribute columnOriginal,
+    public MergerToken createSetColumnTypeToDb(final DbEntity entity, DbAttribute columnOriginal,
             final DbAttribute columnNew) {
 
         return new SetColumnTypeToDb(entity, columnOriginal, columnNew) {
@@ -47,7 +45,7 @@ public class HSQLMergerFactory extends M
                 sqlBuffer.append("ALTER TABLE ");
                 sqlBuffer.append(context.quotedFullyQualifiedName(entity));
                 sqlBuffer.append(" ALTER ");
-                sqlBuffer.append(context.quotedIdentifier(columnNew.getName()));
+                sqlBuffer.append(context.quotedName(columnNew));
                 sqlBuffer.append(" ");
             }
         };
@@ -60,13 +58,11 @@ public class HSQLMergerFactory extends M
             @Override
             public List<String> createSql(DbAdapter adapter) {
                 StringBuilder sqlBuffer = new StringBuilder();
-                QuotingStrategy context = adapter.getQuotingStrategy(getEntity()
-                        .getDataMap()
-                        .isQuotingSQLIdentifiers());
+                QuotingStrategy context = adapter.getQuotingStrategy();
                 sqlBuffer.append("ALTER TABLE ");
                 sqlBuffer.append(context.quotedFullyQualifiedName(getEntity()));
                 sqlBuffer.append(" ALTER COLUMN ");
-                sqlBuffer.append(context.quotedIdentifier(getColumn().getName()));
+                sqlBuffer.append(context.quotedName(getColumn()));
                 sqlBuffer.append(" NULL");
 
                 return Collections.singletonList(sqlBuffer.toString());
@@ -76,24 +72,13 @@ public class HSQLMergerFactory extends M
     }
 
     @Override
-    public MergerToken createSetPrimaryKeyToDb(
-            DbEntity entity,
-            Collection<DbAttribute> primaryKeyOriginal,
-            Collection<DbAttribute> primaryKeyNew,
-            String detectedPrimaryKeyName) {
-        return new SetPrimaryKeyToDb(
-                entity,
-                primaryKeyOriginal,
-                primaryKeyNew,
-                detectedPrimaryKeyName) {
+    public MergerToken createSetPrimaryKeyToDb(DbEntity entity, Collection<DbAttribute> primaryKeyOriginal,
+            Collection<DbAttribute> primaryKeyNew, String detectedPrimaryKeyName) {
+        return new SetPrimaryKeyToDb(entity, primaryKeyOriginal, primaryKeyNew, detectedPrimaryKeyName) {
 
             @Override
-            protected void appendDropOriginalPrimaryKeySQL(
-                    DbAdapter adapter,
-                    List<String> sqls) {
-                sqls.add("ALTER TABLE "
-                        + getQuotingStrategy(adapter)
-                                .quotedFullyQualifiedName(getEntity())
+            protected void appendDropOriginalPrimaryKeySQL(DbAdapter adapter, List<String> sqls) {
+                sqls.add("ALTER TABLE " + adapter.getQuotingStrategy().quotedFullyQualifiedName(getEntity())
                         + " DROP PRIMARY KEY");
             }
 

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/ingres/IngresAdapter.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/ingres/IngresAdapter.java?rev=1449462&r1=1449461&r2=1449462&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/ingres/IngresAdapter.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/ingres/IngresAdapter.java Sun Feb 24 11:53:37 2013
@@ -36,7 +36,6 @@ import org.apache.cayenne.configuration.
 import org.apache.cayenne.configuration.RuntimeProperties;
 import org.apache.cayenne.dba.JdbcAdapter;
 import org.apache.cayenne.dba.PkGenerator;
-import org.apache.cayenne.dba.QuotingStrategy;
 import org.apache.cayenne.dba.TypesMapping;
 import org.apache.cayenne.di.Inject;
 import org.apache.cayenne.map.DbAttribute;
@@ -47,8 +46,8 @@ import org.apache.cayenne.query.SQLActio
 
 /**
  * DbAdapter implementation for <a
- * href="http://opensource.ca.com/projects/ingres/">Ingres</a>. Sample connection settings
- * to use with Ingres are shown below:
+ * href="http://opensource.ca.com/projects/ingres/">Ingres</a>. Sample
+ * connection settings to use with Ingres are shown below:
  * 
  * <pre>
  *  ingres.jdbc.username = test
@@ -61,31 +60,23 @@ public class IngresAdapter extends JdbcA
 
     public static final String TRIM_FUNCTION = "TRIM";
 
-    public IngresAdapter(
-            @Inject RuntimeProperties runtimeProperties,
+    public IngresAdapter(@Inject RuntimeProperties runtimeProperties,
             @Inject(Constants.SERVER_DEFAULT_TYPES_LIST) List<ExtendedType> defaultExtendedTypes,
             @Inject(Constants.SERVER_USER_TYPES_LIST) List<ExtendedType> userExtendedTypes,
             @Inject(Constants.SERVER_TYPE_FACTORIES_LIST) List<ExtendedTypeFactory> extendedTypeFactories) {
-        super(
-                runtimeProperties,
-                defaultExtendedTypes,
-                userExtendedTypes,
-                extendedTypeFactories);
+        super(runtimeProperties, defaultExtendedTypes, userExtendedTypes, extendedTypeFactories);
         setSupportsUniqueConstraints(true);
         setSupportsGeneratedKeys(true);
     }
 
     @Override
     public QualifierTranslator getQualifierTranslator(QueryAssembler queryAssembler) {
-        return new TrimmingQualifierTranslator(
-                queryAssembler,
-                IngresAdapter.TRIM_FUNCTION);
+        return new TrimmingQualifierTranslator(queryAssembler, IngresAdapter.TRIM_FUNCTION);
     }
 
     @Override
     public SQLAction getAction(Query query, DataNode node) {
-        return query.createSQLAction(new IngresActionBuilder(this, node
-                .getEntityResolver()));
+        return query.createSQLAction(new IngresActionBuilder(this, node.getEntityResolver()));
     }
 
     @Override
@@ -106,17 +97,12 @@ public class IngresAdapter extends JdbcA
     }
 
     @Override
-    public void bindParameter(
-            PreparedStatement statement,
-            Object object,
-            int pos,
-            int sqlType,
-            int scale) throws SQLException, Exception {
+    public void bindParameter(PreparedStatement statement, Object object, int pos, int sqlType, int scale)
+            throws SQLException, Exception {
 
         if (object == null && (sqlType == Types.BOOLEAN || sqlType == Types.BIT)) {
             statement.setNull(pos, Types.VARCHAR);
-        }
-        else {
+        } else {
             super.bindParameter(statement, object, pos, sqlType, scale);
         }
     }
@@ -128,21 +114,15 @@ public class IngresAdapter extends JdbcA
 
     @Override
     public void createTableAppendColumn(StringBuffer buf, DbAttribute at) {
-        boolean status = (at.getEntity().getDataMap() != null)
-                && at.getEntity().getDataMap().isQuotingSQLIdentifiers();
-        QuotingStrategy context = getQuotingStrategy(status);
+
         String[] types = externalTypesForJdbcType(at.getType());
         if (types == null || types.length == 0) {
             throw new CayenneRuntimeException("Undefined type for attribute '"
-                    + ((DbEntity) at.getEntity()).getFullyQualifiedName()
-                    + "."
-                    + at.getName()
-                    + "': "
-                    + at.getType());
+                    + ((DbEntity) at.getEntity()).getFullyQualifiedName() + "." + at.getName() + "': " + at.getType());
         }
 
         String type = types[0];
-        buf.append(context.quotedIdentifier(at.getName())).append(' ').append(type);
+        buf.append(quotingStrategy.quotedName(at)).append(' ').append(type);
 
         // append size and precision (if applicable)
         if (TypesMapping.supportsLength(at.getType())) {

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/ingres/IngresMergerFactory.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/ingres/IngresMergerFactory.java?rev=1449462&r1=1449461&r2=1449462&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/ingres/IngresMergerFactory.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/ingres/IngresMergerFactory.java Sun Feb 24 11:53:37 2013
@@ -37,13 +37,10 @@ import org.apache.cayenne.merge.SetAllow
 import org.apache.cayenne.merge.SetColumnTypeToDb;
 import org.apache.cayenne.merge.SetNotNullToDb;
 
-
 public class IngresMergerFactory extends MergerFactory {
-    
+
     @Override
-    public MergerToken createSetColumnTypeToDb(
-            final DbEntity entity,
-            DbAttribute columnOriginal,
+    public MergerToken createSetColumnTypeToDb(final DbEntity entity, DbAttribute columnOriginal,
             final DbAttribute columnNew) {
 
         return new SetColumnTypeToDb(entity, columnOriginal, columnNew) {
@@ -53,9 +50,9 @@ public class IngresMergerFactory extends
                 sqlBuffer.append("ALTER TABLE ");
                 sqlBuffer.append(context.quotedFullyQualifiedName(entity));
                 sqlBuffer.append(" ALTER COLUMN ");
-                sqlBuffer.append(context.quotedIdentifier(columnNew.getName()));
+                sqlBuffer.append(context.quotedName(columnNew));
                 sqlBuffer.append(" ");
-           }
+            }
         };
     }
 
@@ -66,13 +63,11 @@ public class IngresMergerFactory extends
             @Override
             public List<String> createSql(DbAdapter adapter) {
                 StringBuilder buf = new StringBuilder();
-                QuotingStrategy context = adapter.getQuotingStrategy(getEntity()
-                        .getDataMap()
-                        .isQuotingSQLIdentifiers());
+                QuotingStrategy context = adapter.getQuotingStrategy();
                 buf.append("ALTER TABLE ");
                 buf.append(context.quotedFullyQualifiedName(getEntity()));
                 buf.append(" DROP COLUMN ");
-                buf.append(context.quotedIdentifier(getColumn().getName()));
+                buf.append(context.quotedName(getColumn()));
                 buf.append(" RESTRICT ");
 
                 return Collections.singletonList(buf.toString());
@@ -80,98 +75,93 @@ public class IngresMergerFactory extends
 
         };
     }
-   
+
     @Override
     public MergerToken createAddRelationshipToDb(DbEntity entity, final DbRelationship rel) {
         return new AddRelationshipToDb(entity, rel) {
             @Override
             public List<String> createSql(DbAdapter adapter) {
-              if (!rel.isToMany() && rel.isToPK() && !rel.isToDependentPK()) {
-                  
-                DbEntity source = (DbEntity) rel.getSourceEntity();
-                boolean status = (source.getDataMap() != null && source.getDataMap().isQuotingSQLIdentifiers());
-                QuotingStrategy context = adapter.getQuotingStrategy(status);
-                StringBuilder buf = new StringBuilder();
-                StringBuilder refBuf = new StringBuilder();
-        
-                buf.append("ALTER TABLE ");
-                buf.append(context.quotedFullyQualifiedName(source));
-        
-                // requires the ADD CONSTRAINT statement
-                buf.append(" ADD CONSTRAINT ");
-                String name = "U_"
-                        + rel.getSourceEntity().getName()
-                        + "_"
-                        + (long) (System.currentTimeMillis() / (Math.random() * 100000));
-        
-                buf.append(context.quotedIdentifier(name));
-                buf.append(" FOREIGN KEY (");
-        
-                boolean first = true;
-                for (DbJoin join : rel.getJoins()) {
-                    if (!first) {
-                        buf.append(", ");
-                        refBuf.append(", ");
+                if (!rel.isToMany() && rel.isToPK() && !rel.isToDependentPK()) {
+
+                    DbEntity source = (DbEntity) rel.getSourceEntity();
+                    QuotingStrategy context = adapter.getQuotingStrategy();
+                    StringBuilder buf = new StringBuilder();
+                    StringBuilder refBuf = new StringBuilder();
+
+                    buf.append("ALTER TABLE ");
+                    buf.append(context.quotedFullyQualifiedName(source));
+
+                    // requires the ADD CONSTRAINT statement
+                    buf.append(" ADD CONSTRAINT ");
+                    String name = "U_" + rel.getSourceEntity().getName() + "_"
+                            + (long) (System.currentTimeMillis() / (Math.random() * 100000));
+
+                    buf.append(context.quotedIdentifier(rel.getSourceEntity(), name));
+                    buf.append(" FOREIGN KEY (");
+
+                    boolean first = true;
+                    for (DbJoin join : rel.getJoins()) {
+                        if (!first) {
+                            buf.append(", ");
+                            refBuf.append(", ");
+                        } else
+                            first = false;
+
+                        buf.append(context.quotedSourceName(join));
+                        refBuf.append(context.quotedTargetName(join));
+                    }
+
+                    buf.append(") REFERENCES ");
+                    buf.append(context.quotedFullyQualifiedName((DbEntity) rel.getTargetEntity()));
+                    buf.append(" (");
+                    buf.append(refBuf.toString());
+                    buf.append(')');
+
+                    // also make sure we delete dependent FKs
+                    buf.append(" ON DELETE CASCADE");
+
+                    String fksql = buf.toString();
+
+                    if (fksql != null) {
+                        return Collections.singletonList(fksql);
                     }
-                    else
-                        first = false;
-        
-                    buf.append(context.quotedIdentifier(join.getSourceName()));
-                    refBuf.append(context.quotedIdentifier(join.getTargetName()));
                 }
-        
-                buf.append(") REFERENCES ");
-                buf.append(context.quotedFullyQualifiedName((DbEntity) rel.getTargetEntity()));
-                buf.append(" (");
-                buf.append(refBuf.toString());
-                buf.append(')');
-                
-                // also make sure we delete dependent FKs
-                buf.append(" ON DELETE CASCADE");
-        
-                String fksql = buf.toString();
-                  
-                  if (fksql != null) {
-                      return Collections.singletonList(fksql);
-                  }
-              }
-             
-              return Collections.emptyList();
-             
+
+                return Collections.emptyList();
+
             }
         };
     }
-    
+
     @Override
     public MergerToken createSetNotNullToDb(DbEntity entity, DbAttribute column) {
         return new SetNotNullToDb(entity, column) {
 
             @Override
             public List<String> createSql(DbAdapter adapter) {
-                
-                /* 
-                 * TODO: we generate this query as in ingres db documentation, but unfortunately ingres don't support it
-                 * 
+
+                /*
+                 * TODO: we generate this query as in ingres db documentation,
+                 * but unfortunately ingres don't support it
                  */
-                
+
                 StringBuilder sqlBuffer = new StringBuilder();
-                
-                boolean status = (getEntity().getDataMap() != null) && getEntity().getDataMap().isQuotingSQLIdentifiers();
-                QuotingStrategy context = adapter.getQuotingStrategy(status);
+
+                QuotingStrategy context = adapter.getQuotingStrategy();
 
                 sqlBuffer.append("ALTER TABLE ");
                 sqlBuffer.append(getEntity().getFullyQualifiedName());
                 sqlBuffer.append(" ALTER COLUMN ");
-                sqlBuffer.append(context.quotedIdentifier(getColumn().getName()));
+                sqlBuffer.append(context.quotedName(getColumn()));
                 sqlBuffer.append(" ");
                 sqlBuffer.append(adapter.externalTypesForJdbcType(getColumn().getType())[0]);
-              
+
                 if (TypesMapping.supportsLength(getColumn().getType()) && getColumn().getMaxLength() > 0) {
                     sqlBuffer.append("(");
                     sqlBuffer.append(getColumn().getMaxLength());
                     sqlBuffer.append(")");
                 }
-                
+
                 sqlBuffer.append(" NOT NULL");
 
                 return Collections.singletonList(sqlBuffer.toString());
@@ -179,7 +169,7 @@ public class IngresMergerFactory extends
 
         };
     }
-    
+
     @Override
     public MergerToken createSetAllowNullToDb(DbEntity entity, DbAttribute column) {
         return new SetAllowNullToDb(entity, column) {
@@ -187,22 +177,20 @@ public class IngresMergerFactory extends
             @Override
             public List<String> createSql(DbAdapter adapter) {
                 StringBuilder sqlBuffer = new StringBuilder();
-                QuotingStrategy context = adapter.getQuotingStrategy(getEntity()
-                        .getDataMap()
-                        .isQuotingSQLIdentifiers());
+                QuotingStrategy context = adapter.getQuotingStrategy();
                 sqlBuffer.append("ALTER TABLE ");
                 sqlBuffer.append(context.quotedFullyQualifiedName(getEntity()));
                 sqlBuffer.append(" ALTER COLUMN ");
-                sqlBuffer.append(context.quotedIdentifier(getColumn().getName()));
+                sqlBuffer.append(context.quotedName(getColumn()));
                 sqlBuffer.append(" ");
                 sqlBuffer.append(adapter.externalTypesForJdbcType(getColumn().getType())[0]);
-              
+
                 if (TypesMapping.supportsLength(getColumn().getType()) && getColumn().getMaxLength() > 0) {
                     sqlBuffer.append("(");
                     sqlBuffer.append(getColumn().getMaxLength());
                     sqlBuffer.append(")");
                 }
-                
+
                 sqlBuffer.append(" WITH NULL");
 
                 return Collections.singletonList(sqlBuffer.toString());
@@ -210,27 +198,23 @@ public class IngresMergerFactory extends
 
         };
     }
-    
+
     @Override
-    public MergerToken createDropRelationshipToDb(
-            final DbEntity entity,
-            DbRelationship rel) {
+    public MergerToken createDropRelationshipToDb(final DbEntity entity, DbRelationship rel) {
 
         return new DropRelationshipToDb(entity, rel) {
 
             @Override
             public List<String> createSql(DbAdapter adapter) {
                 String fkName = getFkName();
-                
+
                 if (fkName == null) {
                     return Collections.emptyList();
                 }
-                QuotingStrategy context = adapter.getQuotingStrategy(getEntity()
-                        .getDataMap()
-                        .isQuotingSQLIdentifiers());
+                
                 StringBuilder buf = new StringBuilder();
                 buf.append("ALTER TABLE ");
-                buf.append(context.quotedFullyQualifiedName(getEntity()));
+                buf.append(adapter.getQuotingStrategy().quotedFullyQualifiedName(getEntity()));
                 buf.append(" DROP CONSTRAINT ");
                 buf.append(fkName);
                 buf.append(" CASCADE ");

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/mysql/MySQLAdapter.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/mysql/MySQLAdapter.java?rev=1449462&r1=1449461&r2=1449462&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/mysql/MySQLAdapter.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/mysql/MySQLAdapter.java Sun Feb 24 11:53:37 2013
@@ -135,7 +135,7 @@ public class MySQLAdapter extends JdbcAd
         // checks
         // statement
         StringBuffer buf = new StringBuffer();
-        QuotingStrategy context = getQuotingStrategy(table.getDataMap().isQuotingSQLIdentifiers());
+        QuotingStrategy context = getQuotingStrategy();
         buf.append(context.quotedFullyQualifiedName(table));
 
         return Arrays.asList("SET FOREIGN_KEY_CHECKS=0", "DROP TABLE IF EXISTS " + buf.toString() + " CASCADE",
@@ -249,13 +249,7 @@ public class MySQLAdapter extends JdbcAd
     // See CAY-358 for details of the InnoDB problem
     @Override
     protected void createTableAppendPKClause(StringBuffer sqlBuffer, DbEntity entity) {
-        boolean status;
-        if (entity.getDataMap() != null && entity.getDataMap().isQuotingSQLIdentifiers()) {
-            status = true;
-        } else {
-            status = false;
-        }
-        QuotingStrategy context = getQuotingStrategy(status);
+
         // must move generated to the front...
         List<DbAttribute> pkList = new ArrayList<DbAttribute>(entity.getPrimaryKeys());
         Collections.sort(pkList, new PKComparator());
@@ -272,7 +266,7 @@ public class MySQLAdapter extends JdbcAd
                     sqlBuffer.append(", ");
 
                 DbAttribute at = pkit.next();
-                sqlBuffer.append(context.quotedIdentifier(at.getName()));
+                sqlBuffer.append(quotingStrategy.quotedName(at));
             }
             sqlBuffer.append(')');
         }
@@ -290,11 +284,11 @@ public class MySQLAdapter extends JdbcAd
 
                     Iterator<DbAttribute> columns = relationship.getSourceAttributes().iterator();
                     DbAttribute column = columns.next();
-                    sqlBuffer.append(context.quotedIdentifier(column.getName()));
+                    sqlBuffer.append(quotingStrategy.quotedName(column));
 
                     while (columns.hasNext()) {
                         column = columns.next();
-                        sqlBuffer.append(", ").append(context.quotedIdentifier(column.getName()));
+                        sqlBuffer.append(", ").append(quotingStrategy.quotedName(column));
                     }
 
                     sqlBuffer.append(")");
@@ -309,13 +303,7 @@ public class MySQLAdapter extends JdbcAd
      */
     @Override
     public void createTableAppendColumn(StringBuffer sqlBuffer, DbAttribute column) {
-        boolean status;
-        if ((column.getEntity().getDataMap() != null) && column.getEntity().getDataMap().isQuotingSQLIdentifiers()) {
-            status = true;
-        } else {
-            status = false;
-        }
-        QuotingStrategy context = getQuotingStrategy(status);
+
         String[] types = externalTypesForJdbcType(column.getType());
         if (types == null || types.length == 0) {
             String entityName = column.getEntity() != null ? ((DbEntity) column.getEntity()).getFullyQualifiedName()
@@ -325,7 +313,7 @@ public class MySQLAdapter extends JdbcAd
         }
 
         String type = types[0];
-        sqlBuffer.append(context.quotedIdentifier(column.getName()));
+        sqlBuffer.append(quotingStrategy.quotedName(column));
         sqlBuffer.append(' ').append(type);
 
         // append size and precision (if applicable)s

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/mysql/MySQLMergerFactory.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/mysql/MySQLMergerFactory.java?rev=1449462&r1=1449461&r2=1449462&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/mysql/MySQLMergerFactory.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/mysql/MySQLMergerFactory.java Sun Feb 24 11:53:37 2013
@@ -47,14 +47,12 @@ public class MySQLMergerFactory extends 
             public List<String> createSql(DbAdapter adapter) {
                 StringBuffer sqlBuffer = new StringBuffer();
 
-                QuotingStrategy context = adapter.getQuotingStrategy(getEntity()
-                        .getDataMap()
-                        .isQuotingSQLIdentifiers());
+                QuotingStrategy context = adapter.getQuotingStrategy();
 
                 sqlBuffer.append("ALTER TABLE ");
                 sqlBuffer.append(context.quotedFullyQualifiedName(getEntity()));
                 sqlBuffer.append(" CHANGE ");
-                sqlBuffer.append(context.quotedIdentifier(getColumn().getName()));
+                sqlBuffer.append(context.quotedName(getColumn()));
                 sqlBuffer.append(" ");
                 adapter.createTableAppendColumn(sqlBuffer, column);
 
@@ -74,14 +72,12 @@ public class MySQLMergerFactory extends 
             public List<String> createSql(DbAdapter adapter) {
                 StringBuffer sqlBuffer = new StringBuffer();
 
-                QuotingStrategy context = adapter.getQuotingStrategy(getEntity()
-                        .getDataMap()
-                        .isQuotingSQLIdentifiers());
+                QuotingStrategy context = adapter.getQuotingStrategy();
 
                 sqlBuffer.append("ALTER TABLE ");
                 sqlBuffer.append(context.quotedFullyQualifiedName(getEntity()));
                 sqlBuffer.append(" CHANGE ");
-                sqlBuffer.append(context.quotedIdentifier(getColumn().getName()));
+                sqlBuffer.append(context.quotedName(getColumn()));
                 sqlBuffer.append(" ");
                 adapter.createTableAppendColumn(sqlBuffer, column);
 
@@ -105,7 +101,7 @@ public class MySQLMergerFactory extends 
                 sqlBuffer.append("ALTER TABLE ");
                 sqlBuffer.append(context.quotedFullyQualifiedName(entity));
                 sqlBuffer.append(" MODIFY ");
-                sqlBuffer.append(context.quotedIdentifier(columnNew.getName()));
+                sqlBuffer.append(context.quotedName(columnNew));
                 sqlBuffer.append(" ");
             }
 
@@ -126,9 +122,7 @@ public class MySQLMergerFactory extends 
                 if (fkName == null) {
                     return Collections.emptyList();
                 }
-                QuotingStrategy context = adapter.getQuotingStrategy(getEntity()
-                        .getDataMap()
-                        .isQuotingSQLIdentifiers());
+                QuotingStrategy context = adapter.getQuotingStrategy();
                 StringBuilder buf = new StringBuilder();
                 // http://dev.mysql.com/tech-resources/articles/mysql-cluster-50.html
                 buf.append("ALTER TABLE ");
@@ -158,7 +152,7 @@ public class MySQLMergerFactory extends 
                     DbAdapter adapter,
                     List<String> sqls) {
                 sqls.add("ALTER TABLE "
-                        + getQuotingStrategy(adapter)
+                        + adapter.getQuotingStrategy()
                                 .quotedFullyQualifiedName(getEntity())
                         + " DROP PRIMARY KEY");
             }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/openbase/OpenBaseAdapter.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/openbase/OpenBaseAdapter.java?rev=1449462&r1=1449461&r2=1449462&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/openbase/OpenBaseAdapter.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/openbase/OpenBaseAdapter.java Sun Feb 24 11:53:37 2013
@@ -39,7 +39,6 @@ import org.apache.cayenne.configuration.
 import org.apache.cayenne.configuration.RuntimeProperties;
 import org.apache.cayenne.dba.JdbcAdapter;
 import org.apache.cayenne.dba.PkGenerator;
-import org.apache.cayenne.dba.QuotingStrategy;
 import org.apache.cayenne.dba.TypesMapping;
 import org.apache.cayenne.di.Inject;
 import org.apache.cayenne.map.DbAttribute;
@@ -161,13 +160,11 @@ public class OpenBaseAdapter extends Jdb
      */
     @Override
     public String createTable(DbEntity ent) {
-        QuotingStrategy context = getQuotingStrategy(ent
-                .getDataMap()
-                .isQuotingSQLIdentifiers());
+
         StringBuilder buf = new StringBuilder();
 
         buf.append("CREATE TABLE ");
-        buf.append(context.quotedFullyQualifiedName(ent));
+        buf.append(quotingStrategy.quotedFullyQualifiedName(ent));
         buf.append(" (");
 
         // columns
@@ -203,7 +200,7 @@ public class OpenBaseAdapter extends Jdb
             }
 
             String type = types[0];
-            buf.append(context.quotedIdentifier(at.getName())).append(' ').append(type);
+            buf.append(quotingStrategy.quotedName(at)).append(' ').append(type);
 
             // append size and precision (if applicable)
             if (TypesMapping.supportsLength(at.getType())) {

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/openbase/OpenBasePkGenerator.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/openbase/OpenBasePkGenerator.java?rev=1449462&r1=1449461&r2=1449462&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/openbase/OpenBasePkGenerator.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/openbase/OpenBasePkGenerator.java Sun Feb 24 11:53:37 2013
@@ -223,16 +223,10 @@ public class OpenBasePkGenerator extends
 
         StringBuilder buffer = new StringBuilder();
         buffer.append("CREATE PRIMARY KEY ");
-        boolean status;
-        if (entity.getDataMap() != null && entity.getDataMap().isQuotingSQLIdentifiers()) {
-            status = true;
-        }
-        else {
-            status = false;
-        }
-        QuotingStrategy context = getAdapter().getQuotingStrategy(status);
+      
+        QuotingStrategy context = getAdapter().getQuotingStrategy();
 
-        buffer.append(context.quotedIdentifier(entity.getName()));
+        buffer.append(context.quotedIdentifier(entity, entity.getName()));
 
         buffer.append(" (");
 
@@ -240,12 +234,12 @@ public class OpenBasePkGenerator extends
 
         // at this point we know that there is at least on PK column
         DbAttribute firstColumn = it.next();
-        buffer.append(context.quotedIdentifier(firstColumn.getName()));
+        buffer.append(context.quotedName(firstColumn));
 
         while (it.hasNext()) {
             DbAttribute column = it.next();
             buffer.append(", ");
-            buffer.append(context.quotedIdentifier(column.getName()));
+            buffer.append(context.quotedName(column));
         }
 
         buffer.append(")");
@@ -258,14 +252,8 @@ public class OpenBasePkGenerator extends
      */
     protected String createUniquePKIndexString(DbEntity entity) {
         Collection<DbAttribute> pk = entity.getPrimaryKeys();
-        boolean status;
-        if (entity.getDataMap() != null && entity.getDataMap().isQuotingSQLIdentifiers()) {
-            status = true;
-        }
-        else {
-            status = false;
-        }
-        QuotingStrategy context = getAdapter().getQuotingStrategy(status);
+
+        QuotingStrategy context = getAdapter().getQuotingStrategy();
         if (pk == null || pk.size() == 0) {
             throw new CayenneRuntimeException("Entity '"
                     + entity.getName()
@@ -278,19 +266,19 @@ public class OpenBasePkGenerator extends
         // create a regular one in this case
         buffer.append(pk.size() == 1 ? "CREATE UNIQUE INDEX " : "CREATE INDEX ");
 
-        buffer.append(context.quotedIdentifier(entity.getName()));
+        buffer.append(context.quotedIdentifier(entity, entity.getName()));
         buffer.append(" (");
 
         Iterator<DbAttribute> it = pk.iterator();
 
         // at this point we know that there is at least on PK column
         DbAttribute firstColumn = it.next();
-        buffer.append(context.quotedIdentifier(firstColumn.getName()));
+        buffer.append(context.quotedName(firstColumn));
 
         while (it.hasNext()) {
             DbAttribute column = it.next();
             buffer.append(", ");
-            buffer.append(context.quotedIdentifier(column.getName()));
+            buffer.append(context.quotedName(column));
         }
         buffer.append(")");
         return buffer.toString();

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/OracleAdapter.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/OracleAdapter.java?rev=1449462&r1=1449461&r2=1449462&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/OracleAdapter.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/OracleAdapter.java Sun Feb 24 11:53:37 2013
@@ -217,9 +217,7 @@ public class OracleAdapter extends JdbcA
      */
     @Override
     public Collection<String> dropTableStatements(DbEntity table) {
-        QuotingStrategy context = getQuotingStrategy(table
-                .getDataMap()
-                .isQuotingSQLIdentifiers());
+        QuotingStrategy context = getQuotingStrategy();
         StringBuffer buf = new StringBuffer("DROP TABLE ");
         buf.append(context.quotedFullyQualifiedName(table));
 

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/OracleMergerFactory.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/OracleMergerFactory.java?rev=1449462&r1=1449461&r2=1449462&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/OracleMergerFactory.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/OracleMergerFactory.java Sun Feb 24 11:53:37 2013
@@ -44,7 +44,7 @@ public class OracleMergerFactory extends
                 sqlBuffer.append("ALTER TABLE ");
                 sqlBuffer.append(context.quotedFullyQualifiedName(entity));
                 sqlBuffer.append(" ADD ");
-                sqlBuffer.append(context.quotedIdentifier(column.getName()));
+                sqlBuffer.append(context.quotedName(column));
                 sqlBuffer.append(" ");
             }
         };
@@ -63,7 +63,7 @@ public class OracleMergerFactory extends
                 sqlBuffer.append("ALTER TABLE ");
                 sqlBuffer.append(context.quotedFullyQualifiedName(entity));
                 sqlBuffer.append(" MODIFY ");
-                sqlBuffer.append(context.quotedIdentifier(columnNew.getName()));
+                sqlBuffer.append(context.quotedName(columnNew));
                 sqlBuffer.append(" ");
             }
         };
@@ -77,12 +77,8 @@ public class OracleMergerFactory extends
             public List<String> createSql(DbAdapter adapter) {
                 StringBuffer sqlBuffer = new StringBuffer();
 
-                QuotingStrategy context = adapter.getQuotingStrategy(getEntity()
-                        .getDataMap()
-                        .isQuotingSQLIdentifiers());
-
                 sqlBuffer.append("ALTER TABLE ");
-                sqlBuffer.append(context.quotedFullyQualifiedName(getEntity()));
+                sqlBuffer.append(adapter.getQuotingStrategy().quotedFullyQualifiedName(getEntity()));
                 sqlBuffer.append(" MODIFY ");
 
                 adapter.createTableAppendColumn(sqlBuffer, column);
@@ -101,11 +97,9 @@ public class OracleMergerFactory extends
             @Override
             public List<String> createSql(DbAdapter adapter) {
                 StringBuffer sqlBuffer = new StringBuffer();
-                QuotingStrategy context = adapter.getQuotingStrategy(getEntity()
-                        .getDataMap()
-                        .isQuotingSQLIdentifiers());
+
                 sqlBuffer.append("ALTER TABLE ");
-                sqlBuffer.append(context.quotedFullyQualifiedName(getEntity()));
+                sqlBuffer.append(adapter.getQuotingStrategy().quotedFullyQualifiedName(getEntity()));
                 sqlBuffer.append(" MODIFY ");
 
                 adapter.createTableAppendColumn(sqlBuffer, column);

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/OraclePkGenerator.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/OraclePkGenerator.java?rev=1449462&r1=1449461&r2=1449462&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/OraclePkGenerator.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/OraclePkGenerator.java Sun Feb 24 11:53:37 2013
@@ -32,7 +32,6 @@ import org.apache.cayenne.CayenneRuntime
 import org.apache.cayenne.access.DataNode;
 import org.apache.cayenne.dba.JdbcAdapter;
 import org.apache.cayenne.dba.JdbcPkGenerator;
-import org.apache.cayenne.dba.QuotingStrategy;
 import org.apache.cayenne.map.DataMap;
 import org.apache.cayenne.map.DbEntity;
 import org.apache.cayenne.map.DbKeyGenerator;
@@ -203,13 +202,6 @@ public class OraclePkGenerator extends J
 
     /** Returns expected primary key sequence name for a DbEntity. */
     protected String sequenceName(DbEntity entity) {
-        boolean status;
-        if (entity.getDataMap() != null && entity.getDataMap().isQuotingSQLIdentifiers()) {
-            status = true;
-        } else {
-            status = false;
-        }
-        QuotingStrategy context = getAdapter().getQuotingStrategy(status);
 
         // use custom generator if possible
         DbKeyGenerator keyGenerator = entity.getPrimaryKeyGenerator();
@@ -221,7 +213,8 @@ public class OraclePkGenerator extends J
             String entName = entity.getName();
             String seqName = _SEQUENCE_PREFIX + entName.toLowerCase();
 
-            return context.quotedIdentifier(entity.getCatalog(), entity.getSchema(), seqName);
+            return adapter.getQuotingStrategy().quotedIdentifier(entity, entity.getCatalog(), entity.getSchema(),
+                    seqName);
         }
     }
 

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/postgres/PostgresAdapter.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/postgres/PostgresAdapter.java?rev=1449462&r1=1449461&r2=1449462&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/postgres/PostgresAdapter.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/postgres/PostgresAdapter.java Sun Feb 24 11:53:37 2013
@@ -47,8 +47,9 @@ import org.apache.cayenne.query.Query;
 import org.apache.cayenne.query.SQLAction;
 
 /**
- * DbAdapter implementation for <a href="http://www.postgresql.org">PostgreSQL RDBMS </a>.
- * Sample connection settings to use with PostgreSQL are shown below:
+ * DbAdapter implementation for <a href="http://www.postgresql.org">PostgreSQL
+ * RDBMS </a>. Sample connection settings to use with PostgreSQL are shown
+ * below:
  * 
  * <pre>
  *      postgres.jdbc.username = test
@@ -59,16 +60,11 @@ import org.apache.cayenne.query.SQLActio
  */
 public class PostgresAdapter extends JdbcAdapter {
 
-    public PostgresAdapter(
-            @Inject RuntimeProperties runtimeProperties,
+    public PostgresAdapter(@Inject RuntimeProperties runtimeProperties,
             @Inject(Constants.SERVER_DEFAULT_TYPES_LIST) List<ExtendedType> defaultExtendedTypes,
             @Inject(Constants.SERVER_USER_TYPES_LIST) List<ExtendedType> userExtendedTypes,
             @Inject(Constants.SERVER_TYPE_FACTORIES_LIST) List<ExtendedTypeFactory> extendedTypeFactories) {
-        super(
-                runtimeProperties,
-                defaultExtendedTypes,
-                userExtendedTypes,
-                extendedTypeFactories);
+        super(runtimeProperties, defaultExtendedTypes, userExtendedTypes, extendedTypeFactories);
         setSupportsBatchUpdates(true);
     }
 
@@ -79,13 +75,12 @@ public class PostgresAdapter extends Jdb
      */
     @Override
     public SQLAction getAction(Query query, DataNode node) {
-        return query.createSQLAction(new PostgresActionBuilder(this, node
-                .getEntityResolver()));
+        return query.createSQLAction(new PostgresActionBuilder(this, node.getEntityResolver()));
     }
 
     /**
-     * Installs appropriate ExtendedTypes as converters for passing values between JDBC
-     * and Java layers.
+     * Installs appropriate ExtendedTypes as converters for passing values
+     * between JDBC and Java layers.
      */
     @Override
     protected void configureExtendedTypes(ExtendedTypeMap map) {
@@ -97,13 +92,7 @@ public class PostgresAdapter extends Jdb
     }
 
     @Override
-    public DbAttribute buildAttribute(
-            String name,
-            String typeName,
-            int type,
-            int size,
-            int scale,
-            boolean allowNulls) {
+    public DbAttribute buildAttribute(String name, String typeName, int type, int size, int scale, boolean allowNulls) {
 
         // "bytea" maps to pretty much any binary type, so
         // it is up to us to select the most sensible default.
@@ -124,22 +113,16 @@ public class PostgresAdapter extends Jdb
     }
 
     /**
-     * Customizes table creating procedure for PostgreSQL. One difference with generic
-     * implementation is that "bytea" type has no explicit length unlike similar binary
-     * types in other databases.
+     * Customizes table creating procedure for PostgreSQL. One difference with
+     * generic implementation is that "bytea" type has no explicit length unlike
+     * similar binary types in other databases.
      * 
      * @since 1.0.2
      */
     @Override
     public String createTable(DbEntity ent) {
-        boolean status;
-        if (ent.getDataMap() != null && ent.getDataMap().isQuotingSQLIdentifiers()) {
-            status = true;
-        }
-        else {
-            status = false;
-        }
-        QuotingStrategy context = getQuotingStrategy(status);
+
+        QuotingStrategy context = getQuotingStrategy();
         StringBuilder buf = new StringBuilder();
         buf.append("CREATE TABLE ");
 
@@ -160,37 +143,25 @@ public class PostgresAdapter extends Jdb
 
             // attribute may not be fully valid, do a simple check
             if (at.getType() == TypesMapping.NOT_DEFINED) {
-                throw new CayenneRuntimeException("Undefined type for attribute '"
-                        + ent.getFullyQualifiedName()
-                        + "."
-                        + at.getName()
-                        + "'.");
+                throw new CayenneRuntimeException("Undefined type for attribute '" + ent.getFullyQualifiedName() + "."
+                        + at.getName() + "'.");
             }
 
             String[] types = externalTypesForJdbcType(at.getType());
             if (types == null || types.length == 0) {
-                throw new CayenneRuntimeException("Undefined type for attribute '"
-                        + ent.getFullyQualifiedName()
-                        + "."
-                        + at.getName()
-                        + "': "
-                        + at.getType());
+                throw new CayenneRuntimeException("Undefined type for attribute '" + ent.getFullyQualifiedName() + "."
+                        + at.getName() + "': " + at.getType());
             }
 
             String type = types[0];
-            buf.append(context.quotedIdentifier(at.getName())).append(' ').append(type);
+            buf.append(context.quotedName(at)).append(' ').append(type);
 
             // append size and precision (if applicable)
             if (typeSupportsLength(at.getType())) {
+
                 int len = at.getMaxLength();
-                int scale = (TypesMapping.isDecimal(at.getType()) && at.getType() != Types.FLOAT) // Postgress
-                                                                                                  // don't
-                                                                                                  // support
-                                                                                                  // notations
-                                                                                                  // float(a,
-                                                                                                  // b)
-                        ? at.getScale()
-                        : -1;
+                // Postgres does not support notation float(a, b)
+                int scale = (TypesMapping.isDecimal(at.getType()) && at.getType() != Types.FLOAT) ? at.getScale() : -1;
 
                 // sanity check
                 if (scale > len) {
@@ -210,8 +181,7 @@ public class PostgresAdapter extends Jdb
 
             if (at.isMandatory()) {
                 buf.append(" NOT NULL");
-            }
-            else {
+            } else {
                 buf.append(" NULL");
             }
         }
@@ -233,7 +203,7 @@ public class PostgresAdapter extends Jdb
                     buf.append(", ");
 
                 DbAttribute at = pkit.next();
-                buf.append(context.quotedIdentifier(at.getName()));
+                buf.append(context.quotedName(at));
             }
             buf.append(')');
         }
@@ -260,9 +230,7 @@ public class PostgresAdapter extends Jdb
      */
     @Override
     public Collection<String> dropTableStatements(DbEntity table) {
-        QuotingStrategy context = getQuotingStrategy(table
-                .getDataMap()
-                .isQuotingSQLIdentifiers());
+        QuotingStrategy context = getQuotingStrategy();
         StringBuffer buf = new StringBuffer("DROP TABLE ");
         buf.append(context.quotedFullyQualifiedName(table));
         buf.append(" CASCADE");

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/postgres/PostgresMergerFactory.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/postgres/PostgresMergerFactory.java?rev=1449462&r1=1449461&r2=1449462&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/postgres/PostgresMergerFactory.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/postgres/PostgresMergerFactory.java Sun Feb 24 11:53:37 2013
@@ -36,12 +36,12 @@ public class PostgresMergerFactory exten
         return new SetColumnTypeToDb(entity, columnOriginal, columnNew) {
 
             @Override
-            protected void appendPrefix(StringBuffer sqlBuffer, QuotingStrategy context) {
+            protected void appendPrefix(StringBuffer sqlBuffer, QuotingStrategy quotingStrategy) {
                 // http://www.postgresql.org/docs/8.2/static/sql-altertable.html
                 sqlBuffer.append("ALTER TABLE ");
-                sqlBuffer.append(context.quotedFullyQualifiedName(entity));
+                sqlBuffer.append(quotingStrategy.quotedFullyQualifiedName(entity));
                 sqlBuffer.append(" ALTER ");
-                sqlBuffer.append(context.quotedIdentifier(columnNew.getName()));
+                sqlBuffer.append(quotingStrategy.quotedName(columnNew));
                 sqlBuffer.append(" TYPE ");
             }
         };

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/postgres/PostgresPkGenerator.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/postgres/PostgresPkGenerator.java?rev=1449462&r1=1449461&r2=1449462&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/postgres/PostgresPkGenerator.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/postgres/PostgresPkGenerator.java Sun Feb 24 11:53:37 2013
@@ -30,7 +30,6 @@ import java.util.List;
 import org.apache.cayenne.CayenneRuntimeException;
 import org.apache.cayenne.access.DataNode;
 import org.apache.cayenne.dba.JdbcAdapter;
-import org.apache.cayenne.dba.QuotingStrategy;
 import org.apache.cayenne.dba.oracle.OraclePkGenerator;
 import org.apache.cayenne.map.DbEntity;
 import org.apache.cayenne.map.DbKeyGenerator;
@@ -46,15 +45,13 @@ public class PostgresPkGenerator extends
 
     @Override
     protected String createSequenceString(DbEntity ent) {
-        // note that PostgreSQL 7.4 and newer supports INCREMENT BY and START WITH
-        // however 7.3 doesn't like BY and WITH, so using older more neutral syntax
+        // note that PostgreSQL 7.4 and newer supports INCREMENT BY and START
+        // WITH
+        // however 7.3 doesn't like BY and WITH, so using older more neutral
+        // syntax
         // that works with all tested versions.
         StringBuilder buf = new StringBuilder();
-        buf
-                .append("CREATE SEQUENCE ")
-                .append(sequenceName(ent))
-                .append(" INCREMENT ")
-                .append(pkCacheSize(ent))
+        buf.append("CREATE SEQUENCE ").append(sequenceName(ent)).append(" INCREMENT ").append(pkCacheSize(ent))
                 .append(" START 200");
         return buf.toString();
     }
@@ -67,8 +64,7 @@ public class PostgresPkGenerator extends
 
         DbKeyGenerator pkGenerator = entity.getPrimaryKeyGenerator();
         String pkGeneratingSequenceName;
-        if (pkGenerator != null
-                && DbKeyGenerator.ORACLE_TYPE.equals(pkGenerator.getGeneratorType())
+        if (pkGenerator != null && DbKeyGenerator.ORACLE_TYPE.equals(pkGenerator.getGeneratorType())
                 && pkGenerator.getGeneratorName() != null)
             pkGeneratingSequenceName = pkGenerator.getGeneratorName();
         else
@@ -84,41 +80,28 @@ public class PostgresPkGenerator extends
                 try {
                     // Object pk = null;
                     if (!rs.next()) {
-                        throw new CayenneRuntimeException(
-                                "Error generating pk for DbEntity " + entity.getName());
+                        throw new CayenneRuntimeException("Error generating pk for DbEntity " + entity.getName());
                     }
                     return rs.getLong(1);
-                }
-                finally {
+                } finally {
                     rs.close();
                 }
-            }
-            finally {
+            } finally {
                 st.close();
             }
-        }
-        finally {
+        } finally {
             con.close();
         }
 
     }
 
     /**
-     * Fetches a list of existing sequences that might match Cayenne generated ones.
+     * Fetches a list of existing sequences that might match Cayenne generated
+     * ones.
      */
     @Override
     protected List<String> getExistingSequences(DataNode node) throws SQLException {
 
-        boolean status;
-        if (node.getDataMap(node.getName()) != null
-                && node.getDataMap(node.getName()).isQuotingSQLIdentifiers()) {
-            status = true;
-        }
-        else {
-            status = false;
-        }
-        QuotingStrategy context = getAdapter().getQuotingStrategy(status);
-
         // check existing sequences
         Connection con = node.getDataSource().getConnection();
 
@@ -131,19 +114,16 @@ public class PostgresPkGenerator extends
                 try {
                     List<String> sequenceList = new ArrayList<String>();
                     while (rs.next()) {
-                        sequenceList.add(context.quotedIdentifier(rs.getString(1)));
+                        sequenceList.add(rs.getString(1));
                     }
                     return sequenceList;
-                }
-                finally {
+                } finally {
                     rs.close();
                 }
-            }
-            finally {
+            } finally {
                 sel.close();
             }
-        }
-        finally {
+        } finally {
             con.close();
         }
     }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/sqlserver/SQLServerMergerFactory.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/sqlserver/SQLServerMergerFactory.java?rev=1449462&r1=1449461&r2=1449462&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/sqlserver/SQLServerMergerFactory.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/sqlserver/SQLServerMergerFactory.java Sun Feb 24 11:53:37 2013
@@ -48,7 +48,7 @@ public class SQLServerMergerFactory exte
                 sqlBuffer.append("ALTER TABLE ");
                 sqlBuffer.append(context.quotedFullyQualifiedName(entity));
                 sqlBuffer.append(" ALTER COLUMN ");
-                sqlBuffer.append(context.quotedIdentifier(columnNew.getName()));
+                sqlBuffer.append(context.quotedName(columnNew));
                 sqlBuffer.append(" ");
             }
         };
@@ -64,7 +64,7 @@ public class SQLServerMergerFactory exte
                 sqlBuffer.append("ALTER TABLE ");
                 sqlBuffer.append(context.quotedFullyQualifiedName(entity));
                 sqlBuffer.append(" ADD ");
-                sqlBuffer.append(context.quotedIdentifier(column.getName()));
+                sqlBuffer.append(context.quotedName(column));
                 sqlBuffer.append(" ");
             }
         };
@@ -78,12 +78,8 @@ public class SQLServerMergerFactory exte
             public List<String> createSql(DbAdapter adapter) {
                 StringBuffer sqlBuffer = new StringBuffer();
 
-                QuotingStrategy context = adapter.getQuotingStrategy(getEntity()
-                        .getDataMap()
-                        .isQuotingSQLIdentifiers());
-
                 sqlBuffer.append("ALTER TABLE ");
-                sqlBuffer.append(context.quotedFullyQualifiedName(getEntity()));
+                sqlBuffer.append(adapter.getQuotingStrategy().quotedFullyQualifiedName(getEntity()));
                 sqlBuffer.append(" ALTER COLUMN ");
 
                 adapter.createTableAppendColumn(sqlBuffer, column);
@@ -102,11 +98,9 @@ public class SQLServerMergerFactory exte
             @Override
             public List<String> createSql(DbAdapter adapter) {
                 StringBuffer sqlBuffer = new StringBuffer();
-                QuotingStrategy context = adapter.getQuotingStrategy(getEntity()
-                        .getDataMap()
-                        .isQuotingSQLIdentifiers());
+
                 sqlBuffer.append("ALTER TABLE ");
-                sqlBuffer.append(context.quotedFullyQualifiedName(getEntity()));
+                sqlBuffer.append(adapter.getQuotingStrategy().quotedFullyQualifiedName(getEntity()));
                 sqlBuffer.append(" ALTER COLUMN ");
 
                 adapter.createTableAppendColumn(sqlBuffer, column);

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/sybase/SybaseMergerFactory.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/sybase/SybaseMergerFactory.java?rev=1449462&r1=1449461&r2=1449462&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/sybase/SybaseMergerFactory.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/sybase/SybaseMergerFactory.java Sun Feb 24 11:53:37 2013
@@ -49,9 +49,7 @@ public class SybaseMergerFactory extends
             public List<String> createSql(DbAdapter adapter) {
 
                 StringBuffer sqlBuffer = new StringBuffer();
-                QuotingStrategy context = adapter.getQuotingStrategy(getEntity()
-                        .getDataMap()
-                        .isQuotingSQLIdentifiers());
+                QuotingStrategy context = adapter.getQuotingStrategy();
                 sqlBuffer.append("ALTER TABLE ");
                 sqlBuffer.append(context.quotedFullyQualifiedName(getEntity()));
                 sqlBuffer.append(" ADD ");
@@ -77,13 +75,11 @@ public class SybaseMergerFactory extends
             @Override
             public List<String> createSql(DbAdapter adapter) {
                 StringBuilder sqlBuffer = new StringBuilder();
-                QuotingStrategy context = adapter.getQuotingStrategy(getEntity()
-                        .getDataMap()
-                        .isQuotingSQLIdentifiers());
+                QuotingStrategy context = adapter.getQuotingStrategy();
                 sqlBuffer.append("ALTER TABLE ");
                 sqlBuffer.append(context.quotedFullyQualifiedName(getEntity()));
                 sqlBuffer.append(" DROP ");
-                sqlBuffer.append(context.quotedIdentifier(getColumn().getName()));
+                sqlBuffer.append(context.quotedName(getColumn()));
 
                 return Collections.singletonList(sqlBuffer.toString());
             }
@@ -147,7 +143,7 @@ public class SybaseMergerFactory extends
                 sqlBuffer.append("ALTER TABLE ");
                 sqlBuffer.append(context.quotedFullyQualifiedName(entity));
                 sqlBuffer.append(" MODIFY ");
-                sqlBuffer.append(context.quotedIdentifier(columnNew.getName()));
+                sqlBuffer.append(context.quotedName(columnNew));
                 sqlBuffer.append(" ");
             }
 
@@ -159,9 +155,7 @@ public class SybaseMergerFactory extends
             DbEntity entity,
             DbAttribute column) {
         StringBuffer sqlBuffer = new StringBuffer();
-        QuotingStrategy context = adapter.getQuotingStrategy(entity
-                .getDataMap()
-                .isQuotingSQLIdentifiers());
+        QuotingStrategy context = adapter.getQuotingStrategy();
         sqlBuffer.append("ALTER TABLE ");
         sqlBuffer.append(context.quotedFullyQualifiedName(entity));
         sqlBuffer.append(" MODIFY ");

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/merge/AbstractToDbToken.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/merge/AbstractToDbToken.java?rev=1449462&r1=1449461&r2=1449462&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/merge/AbstractToDbToken.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/merge/AbstractToDbToken.java Sun Feb 24 11:53:37 2013
@@ -24,7 +24,6 @@ import java.sql.Statement;
 import java.util.List;
 
 import org.apache.cayenne.dba.DbAdapter;
-import org.apache.cayenne.dba.QuotingStrategy;
 import org.apache.cayenne.log.JdbcEventLogger;
 import org.apache.cayenne.map.DbAttribute;
 import org.apache.cayenne.map.DbEntity;
@@ -108,12 +107,6 @@ public abstract class AbstractToDbToken 
             return getEntity().getName();
         }
 
-        protected QuotingStrategy getQuotingStrategy(DbAdapter adapter) {
-            return adapter.getQuotingStrategy(getEntity()
-                    .getDataMap()
-                    .isQuotingSQLIdentifiers());
-        }
-
         public int compareTo(MergerToken o) {
             // default order as tokens are created
             return 0;

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/merge/AddColumnToDb.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/merge/AddColumnToDb.java?rev=1449462&r1=1449461&r2=1449462&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/merge/AddColumnToDb.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/merge/AddColumnToDb.java Sun Feb 24 11:53:37 2013
@@ -42,16 +42,14 @@ public class AddColumnToDb extends Abstr
         sqlBuffer.append("ALTER TABLE ");
         sqlBuffer.append(context.quotedFullyQualifiedName(getEntity()));
         sqlBuffer.append(" ADD COLUMN ");
-        sqlBuffer.append(context.quotedIdentifier(getColumn().getName()));
+        sqlBuffer.append(context.quotedName(getColumn()));
         sqlBuffer.append(" ");
     }
 
     @Override
     public List<String> createSql(DbAdapter adapter) {
         StringBuffer sqlBuffer = new StringBuffer();
-        QuotingStrategy context = adapter.getQuotingStrategy(getEntity()
-                .getDataMap()
-                .isQuotingSQLIdentifiers());
+        QuotingStrategy context = adapter.getQuotingStrategy();
         appendPrefix(sqlBuffer, context);
 
         // copied from JdbcAdapter.createTableAppendColumn

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/merge/DropColumnToDb.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/merge/DropColumnToDb.java?rev=1449462&r1=1449461&r2=1449462&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/merge/DropColumnToDb.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/merge/DropColumnToDb.java Sun Feb 24 11:53:37 2013
@@ -35,13 +35,11 @@ public class DropColumnToDb extends Abst
     @Override
     public List<String> createSql(DbAdapter adapter) {
         StringBuilder sqlBuffer = new StringBuilder();
-        QuotingStrategy context = adapter.getQuotingStrategy(getEntity()
-                .getDataMap()
-                .isQuotingSQLIdentifiers());
+        QuotingStrategy context = adapter.getQuotingStrategy();
         sqlBuffer.append("ALTER TABLE ");
         sqlBuffer.append(context.quotedFullyQualifiedName(getEntity()));
         sqlBuffer.append(" DROP COLUMN ");
-        sqlBuffer.append(context.quotedIdentifier(getColumn().getName()));
+        sqlBuffer.append(context.quotedName(getColumn()));
 
         return Collections.singletonList(sqlBuffer.toString());
     }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/merge/DropRelationshipToDb.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/merge/DropRelationshipToDb.java?rev=1449462&r1=1449461&r2=1449462&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/merge/DropRelationshipToDb.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/merge/DropRelationshipToDb.java Sun Feb 24 11:53:37 2013
@@ -50,9 +50,7 @@ public class DropRelationshipToDb extend
         if (fkName == null) {
             return Collections.emptyList();
         }
-        QuotingStrategy context = adapter.getQuotingStrategy(getEntity()
-                .getDataMap()
-                .isQuotingSQLIdentifiers());
+        QuotingStrategy context = adapter.getQuotingStrategy();
         StringBuilder buf = new StringBuilder();
         buf.append("ALTER TABLE ");
         buf.append(context.quotedFullyQualifiedName(getEntity()));

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/merge/SetAllowNullToDb.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/merge/SetAllowNullToDb.java?rev=1449462&r1=1449461&r2=1449462&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/merge/SetAllowNullToDb.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/merge/SetAllowNullToDb.java Sun Feb 24 11:53:37 2013
@@ -39,13 +39,11 @@ public class SetAllowNullToDb extends Ab
     @Override
     public List<String> createSql(DbAdapter adapter) {
         StringBuilder sqlBuffer = new StringBuilder();
-        QuotingStrategy context = adapter.getQuotingStrategy(getEntity()
-                .getDataMap()
-                .isQuotingSQLIdentifiers());
+        QuotingStrategy context = adapter.getQuotingStrategy();
         sqlBuffer.append("ALTER TABLE ");
         sqlBuffer.append(context.quotedFullyQualifiedName(getEntity()));
         sqlBuffer.append(" ALTER COLUMN ");
-        sqlBuffer.append(context.quotedIdentifier(getColumn().getName()));
+        sqlBuffer.append(context.quotedName(getColumn()));
         sqlBuffer.append(" DROP NOT NULL");
 
         return Collections.singletonList(sqlBuffer.toString());

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/merge/SetColumnTypeToDb.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/merge/SetColumnTypeToDb.java?rev=1449462&r1=1449461&r2=1449462&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/merge/SetColumnTypeToDb.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/merge/SetColumnTypeToDb.java Sun Feb 24 11:53:37 2013
@@ -50,17 +50,15 @@ public class SetColumnTypeToDb extends A
         sqlBuffer.append("ALTER TABLE ");
         sqlBuffer.append(context.quotedFullyQualifiedName(getEntity()));
         sqlBuffer.append(" ALTER ");
-        sqlBuffer.append(context.quotedIdentifier(columnNew.getName()));
+        sqlBuffer.append(context.quotedName(columnNew));
         sqlBuffer.append(" TYPE ");
     }
 
     @Override
     public List<String> createSql(DbAdapter adapter) {
         StringBuffer sqlBuffer = new StringBuffer();
-        QuotingStrategy context = adapter.getQuotingStrategy(getEntity()
-                .getDataMap()
-                .isQuotingSQLIdentifiers());
-        appendPrefix(sqlBuffer, context);
+       
+        appendPrefix(sqlBuffer, adapter.getQuotingStrategy());
   
         // copied from JdbcAdapter.createTableAppendColumn
         String[] types = adapter.externalTypesForJdbcType(columnNew.getType());

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/merge/SetNotNullToDb.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/merge/SetNotNullToDb.java?rev=1449462&r1=1449461&r2=1449462&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/merge/SetNotNullToDb.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/merge/SetNotNullToDb.java Sun Feb 24 11:53:37 2013
@@ -38,13 +38,11 @@ public class SetNotNullToDb extends Abst
     @Override
     public List<String> createSql(DbAdapter adapter) {
         StringBuilder sqlBuffer = new StringBuilder();
-        QuotingStrategy context = adapter.getQuotingStrategy(getEntity()
-                .getDataMap()
-                .isQuotingSQLIdentifiers());
+        QuotingStrategy context = adapter.getQuotingStrategy();
         sqlBuffer.append("ALTER TABLE ");
         sqlBuffer.append(context.quotedFullyQualifiedName(getEntity()));
         sqlBuffer.append(" ALTER COLUMN ");
-        sqlBuffer.append(context.quotedIdentifier(getColumn().getName()));
+        sqlBuffer.append(context.quotedName(getColumn()));
         sqlBuffer.append(" SET NOT NULL");
 
         return Collections.singletonList(sqlBuffer.toString());

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/merge/SetPrimaryKeyToDb.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/merge/SetPrimaryKeyToDb.java?rev=1449462&r1=1449461&r2=1449462&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/merge/SetPrimaryKeyToDb.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/merge/SetPrimaryKeyToDb.java Sun Feb 24 11:53:37 2013
@@ -57,19 +57,19 @@ public class SetPrimaryKeyToDb extends A
         if (detectedPrimaryKeyName == null) {
             return;
         }
-        sqls.add("ALTER TABLE " + getQuotingStrategy(adapter).quotedFullyQualifiedName(getEntity())
+        sqls.add("ALTER TABLE " + adapter.getQuotingStrategy().quotedFullyQualifiedName(getEntity())
                 + " DROP CONSTRAINT " + detectedPrimaryKeyName);
     }
 
     protected void appendAddNewPrimaryKeySQL(DbAdapter adapter, List<String> sqls) {
-        QuotingStrategy quotingStrategy = getQuotingStrategy(adapter);
+        QuotingStrategy quotingStrategy = adapter.getQuotingStrategy();
 
         StringBuilder sql = new StringBuilder();
         sql.append("ALTER TABLE ");
         sql.append(quotingStrategy.quotedFullyQualifiedName(getEntity()));
         sql.append(" ADD PRIMARY KEY (");
         for (Iterator<DbAttribute> it = primaryKeyNew.iterator(); it.hasNext();) {
-            sql.append(quotingStrategy.quotedIdentifier(it.next().getName()));
+            sql.append(quotingStrategy.quotedName(it.next()));
             if (it.hasNext()) {
                 sql.append(", ");
             }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/dba/DefaultQuotingStrategyTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/dba/DefaultQuotingStrategyTest.java?rev=1449462&r1=1449461&r2=1449462&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/dba/DefaultQuotingStrategyTest.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/dba/DefaultQuotingStrategyTest.java Sun Feb 24 11:53:37 2013
@@ -20,12 +20,34 @@ package org.apache.cayenne.dba;
 
 import junit.framework.TestCase;
 
+import org.apache.cayenne.map.DataMap;
+import org.apache.cayenne.map.DbEntity;
+
 public class DefaultQuotingStrategyTest extends TestCase {
 
     public void testQuotedIdentifer() {
+
+        DataMap dm = new DataMap();
+        dm.setQuotingSQLIdentifiers(true);
+        DbEntity de = new DbEntity();
+        de.setDataMap(dm);
+
+        DefaultQuotingStrategy strategy = new DefaultQuotingStrategy("[", "]");
+        assertEquals("[a]", strategy.quotedIdentifier(de, "a"));
+        assertEquals("[a]", strategy.quotedIdentifier(de, null, null, "a"));
+        assertEquals("[c].[b].[a]", strategy.quotedIdentifier(de, "c", "b", "a"));
+    }
+
+    public void testUnQuotedIdentifer() {
+
+        DataMap dm = new DataMap();
+        dm.setQuotingSQLIdentifiers(false);
+        DbEntity de = new DbEntity();
+        de.setDataMap(dm);
+
         DefaultQuotingStrategy strategy = new DefaultQuotingStrategy("[", "]");
-        assertEquals("[a]", strategy.quotedIdentifier("a"));
-        assertEquals("[a]", strategy.quotedIdentifier(null, null, "a"));
-        assertEquals("[c].[b].[a]", strategy.quotedIdentifier("c", "b", "a"));
+        assertEquals("a", strategy.quotedIdentifier(de, "a"));
+        assertEquals("a", strategy.quotedIdentifier(de, null, null, "a"));
+        assertEquals("c.b.a", strategy.quotedIdentifier(de, "c", "b", "a"));
     }
 }



Mime
View raw message