IDEMPIERE-2664 DB Extensibility issues / remove calls to DB.isPostgreSQL and DB.isOracle to determine if identifiers are upper/lower-case

This commit is contained in:
Carlos Ruiz 2015-08-17 15:36:17 -05:00
parent 8228607b35
commit 1fc8f9cb95
4 changed files with 14 additions and 13 deletions

View File

@ -212,13 +212,7 @@ public class TableCreateColumns extends SvrProcess
*/
private void addTableColumn (ResultSet rs, MTable table) throws Exception
{
String tableName = table.getTableName ();
if (DB.isOracle ())
tableName = tableName.toUpperCase ();
// globalqss 2005-10-24
if (DB.isPostgreSQL())
tableName = tableName.toLowerCase();
// end globalqss 2005-10-24
String tableName = table.getTableName();
while (rs.next ())
{
String tn = rs.getString ("TABLE_NAME");

View File

@ -2415,7 +2415,14 @@ public final class DB
ResultSet rs = null;
try {
DatabaseMetaData metadata = conn.getMetaData();
rs = metadata.getTables(null, null, (DB.isPostgreSQL() ? tableName.toLowerCase() : tableName.toUpperCase()), null);
String tblName;
if (metadata.storesUpperCaseIdentifiers())
tblName = tableName.toUpperCase();
else if (metadata.storesLowerCaseIdentifiers())
tblName = tableName.toLowerCase();
else
tblName = tableName;
rs = metadata.getTables(null, null, tblName, null);
if (rs.next()) {
return true;
}

View File

@ -216,10 +216,10 @@ public class ColumnElementHandler extends AbstractElementHandler {
String schema = DB.getDatabase().getSchema();
String tableName = table.getTableName();
String columnName = column.getColumnName();
if (DB.isOracle()) {
if (md.storesUpperCaseIdentifiers()) {
tableName = tableName.toUpperCase();
columnName = columnName.toUpperCase();
} else if (DB.isPostgreSQL()) {
} else if (md.storesLowerCaseIdentifiers()) {
tableName = tableName.toLowerCase();
columnName = columnName.toLowerCase();
}

View File

@ -309,10 +309,10 @@ public class ColumnElementHandler extends AbstractElementHandler {
String schema = DB.getDatabase().getSchema();
String tableName = table.getTableName();
String columnName = column.getColumnName();
if (DB.isOracle()) {
if (md.storesUpperCaseIdentifiers()) {
tableName = tableName.toUpperCase();
columnName = columnName.toUpperCase();
} else if (DB.isPostgreSQL()) {
} else if (md.storesLowerCaseIdentifiers()) {
tableName = tableName.toLowerCase();
columnName = columnName.toLowerCase();
}