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:
parent
8228607b35
commit
1fc8f9cb95
|
@ -212,13 +212,7 @@ public class TableCreateColumns extends SvrProcess
|
||||||
*/
|
*/
|
||||||
private void addTableColumn (ResultSet rs, MTable table) throws Exception
|
private void addTableColumn (ResultSet rs, MTable table) throws Exception
|
||||||
{
|
{
|
||||||
String tableName = table.getTableName ();
|
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
|
|
||||||
while (rs.next ())
|
while (rs.next ())
|
||||||
{
|
{
|
||||||
String tn = rs.getString ("TABLE_NAME");
|
String tn = rs.getString ("TABLE_NAME");
|
||||||
|
|
|
@ -527,7 +527,7 @@ public final class DB
|
||||||
{
|
{
|
||||||
if (s_cc != null)
|
if (s_cc != null)
|
||||||
return s_cc.isPostgreSQL();
|
return s_cc.isPostgreSQL();
|
||||||
log.severe("No Database");
|
log.severe("No Database");
|
||||||
return false;
|
return false;
|
||||||
} // isPostgreSQL
|
} // isPostgreSQL
|
||||||
//begin vpj-cd e-evolution 02/07/2005 PostgreSQL
|
//begin vpj-cd e-evolution 02/07/2005 PostgreSQL
|
||||||
|
@ -2415,7 +2415,14 @@ public final class DB
|
||||||
ResultSet rs = null;
|
ResultSet rs = null;
|
||||||
try {
|
try {
|
||||||
DatabaseMetaData metadata = conn.getMetaData();
|
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()) {
|
if (rs.next()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -216,10 +216,10 @@ public class ColumnElementHandler extends AbstractElementHandler {
|
||||||
String schema = DB.getDatabase().getSchema();
|
String schema = DB.getDatabase().getSchema();
|
||||||
String tableName = table.getTableName();
|
String tableName = table.getTableName();
|
||||||
String columnName = column.getColumnName();
|
String columnName = column.getColumnName();
|
||||||
if (DB.isOracle()) {
|
if (md.storesUpperCaseIdentifiers()) {
|
||||||
tableName = tableName.toUpperCase();
|
tableName = tableName.toUpperCase();
|
||||||
columnName = columnName.toUpperCase();
|
columnName = columnName.toUpperCase();
|
||||||
} else if (DB.isPostgreSQL()) {
|
} else if (md.storesLowerCaseIdentifiers()) {
|
||||||
tableName = tableName.toLowerCase();
|
tableName = tableName.toLowerCase();
|
||||||
columnName = columnName.toLowerCase();
|
columnName = columnName.toLowerCase();
|
||||||
}
|
}
|
||||||
|
|
|
@ -309,10 +309,10 @@ public class ColumnElementHandler extends AbstractElementHandler {
|
||||||
String schema = DB.getDatabase().getSchema();
|
String schema = DB.getDatabase().getSchema();
|
||||||
String tableName = table.getTableName();
|
String tableName = table.getTableName();
|
||||||
String columnName = column.getColumnName();
|
String columnName = column.getColumnName();
|
||||||
if (DB.isOracle()) {
|
if (md.storesUpperCaseIdentifiers()) {
|
||||||
tableName = tableName.toUpperCase();
|
tableName = tableName.toUpperCase();
|
||||||
columnName = columnName.toUpperCase();
|
columnName = columnName.toUpperCase();
|
||||||
} else if (DB.isPostgreSQL()) {
|
} else if (md.storesLowerCaseIdentifiers()) {
|
||||||
tableName = tableName.toLowerCase();
|
tableName = tableName.toLowerCase();
|
||||||
columnName = columnName.toLowerCase();
|
columnName = columnName.toLowerCase();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue