diff --git a/db/ddlutils/oracle/ant.sh b/db/ddlutils/oracle/ant.sh index 19b9410a1b..9e1db41a64 100644 --- a/db/ddlutils/oracle/ant.sh +++ b/db/ddlutils/oracle/ant.sh @@ -1 +1 @@ -java -Xms128m -Xmx512m -classpath "../../../tools/lib/ant.jar;../../../tools/lib/ant-launcher.jar;../../../tools/lib/ant-swing.jar;../../../tools/lib/ant-commons-net.jar;../../../tools/lib/commons-net.jar" -Dant.home="." org.apache.tools.ant.Main $* +java -Xms128m -Xmx512m -classpath "../../../targetPlatform/plugins/org.apache.ant_1.7.1.v20100518-1145/lib/ant.jar:../../../targetPlatform/plugins/org.apache.ant_1.7.1.v20100518-1145/lib/ant-launcher.jar:../../../targetPlatform/plugins/org.apache.ant_1.7.1.v20100518-1145/lib/ant-swing.jar:../../../targetPlatform/plugins/org.apache.ant_1.7.1.v20100518-1145/lib/ant-commons-net.jar" -Dant.home="." org.apache.tools.ant.Main $* diff --git a/org.adempiere.base.process/src/org/compiere/process/ColumnEncryption.java b/org.adempiere.base.process/src/org/compiere/process/ColumnEncryption.java index b09a709829..10a1d733db 100644 --- a/org.adempiere.base.process/src/org/compiere/process/ColumnEncryption.java +++ b/org.adempiere.base.process/src/org/compiere/process/ColumnEncryption.java @@ -320,7 +320,8 @@ public class ColumnEncryption extends SvrProcess { ResultSet rs = null; try { - selectStmt = m_conn.prepareStatement(selectSql.toString(), + String selectSqlStr = DB.getDatabase().convertStatement(selectSql.toString()); + selectStmt = m_conn.prepareStatement(selectSqlStr, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE); updateStmt = m_conn.prepareStatement(updateSql.toString()); @@ -397,7 +398,8 @@ public class ColumnEncryption extends SvrProcess { ResultSet rs = null; try { - selectStmt = m_conn.prepareStatement(selectSql.toString(), + String selectSqlStr = DB.getDatabase().convertStatement(selectSql.toString()); + selectStmt = m_conn.prepareStatement(selectSqlStr, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE); updateStmt = m_conn.prepareStatement(updateSql.toString()); @@ -460,10 +462,7 @@ public class ColumnEncryption extends SvrProcess { int rowsEffected = -1; // Select SQL - StringBuilder selectSql = new StringBuilder(); - selectSql.append("SELECT FieldLength"); - selectSql.append(" FROM AD_Column"); - selectSql.append(" WHERE AD_Column_ID=?"); + String selectSql = "SELECT FieldLength FROM AD_Column WHERE AD_Column_ID=?"; // Alter SQL StringBuilder alterSql = new StringBuilder(); @@ -482,7 +481,8 @@ public class ColumnEncryption extends SvrProcess { ResultSet rs = null; try { - selectStmt = m_conn.prepareStatement(selectSql.toString(), + selectSql = DB.getDatabase().convertStatement(selectSql); + selectStmt = m_conn.prepareStatement(selectSql, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE); selectStmt.setInt(1, columnID); diff --git a/org.adempiere.base.process/src/org/compiere/process/ReplicationLocal.java b/org.adempiere.base.process/src/org/compiere/process/ReplicationLocal.java index 7e76fa705e..0ae55bbb6b 100644 --- a/org.adempiere.base.process/src/org/compiere/process/ReplicationLocal.java +++ b/org.adempiere.base.process/src/org/compiere/process/ReplicationLocal.java @@ -541,6 +541,7 @@ public class ReplicationLocal extends SvrProcess // try { + sql = DB.getDatabase().convertStatement(sql); pstmt = conn.prepareStatement(sql, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); // Set Parameters diff --git a/org.adempiere.base/src/org/compiere/model/MSequence.java b/org.adempiere.base/src/org/compiere/model/MSequence.java index d0859d301d..a16fc8fbe9 100644 --- a/org.adempiere.base/src/org/compiere/model/MSequence.java +++ b/org.adempiere.base/src/org/compiere/model/MSequence.java @@ -125,6 +125,8 @@ public class MSequence extends X_AD_Sequence + " AND IsActive='Y' AND IsTableID='Y' AND IsAutoSequence='Y' "; } + if (!DB.isOracle() && !DB.isPostgreSQL()) + selectSQL = DB.getDatabase().convertStatement(selectSQL); Connection conn = null; PreparedStatement pstmt = null; @@ -221,12 +223,16 @@ public class MSequence extends X_AD_Sequence { int incrementNo = rs.getInt(3); if (adempiereSys) { - updateSQL = conn - .prepareStatement("UPDATE AD_Sequence SET CurrentNextSys = CurrentNextSys + ? WHERE AD_Sequence_ID = ?"); + String updateCmd = "UPDATE AD_Sequence SET CurrentNextSys=CurrentNextSys+? WHERE AD_Sequence_ID=?"; + if (!DB.isOracle() && !DB.isPostgreSQL()) + updateCmd = DB.getDatabase().convertStatement(updateCmd); + updateSQL = conn.prepareStatement(updateCmd); retValue = rs.getInt(2); } else { - updateSQL = conn - .prepareStatement("UPDATE AD_Sequence SET CurrentNext = CurrentNext + ? WHERE AD_Sequence_ID = ?"); + String updateCmd = "UPDATE AD_Sequence SET CurrentNext=CurrentNext+? WHERE AD_Sequence_ID=?"; + if (!DB.isOracle() && !DB.isPostgreSQL()) + updateCmd = DB.getDatabase().convertStatement(updateCmd); + updateSQL = conn.prepareStatement(updateCmd); retValue = rs.getInt(1); } updateSQL.setInt(1, incrementNo); @@ -367,6 +373,8 @@ public class MSequence extends X_AD_Sequence selectSQL = selectSQL + " FOR UPDATE OF s"; } } + if (!DB.isOracle() && !DB.isPostgreSQL()) + selectSQL = DB.getDatabase().convertStatement(selectSQL); Connection conn = null; Trx trx = trxName == null ? null : Trx.get(trxName, true); // @@ -439,7 +447,10 @@ public class MSequence extends X_AD_Sequence try { if (adempiereSys) { - updateSQL = conn.prepareStatement("UPDATE AD_Sequence SET CurrentNextSys = CurrentNextSys + ? WHERE AD_Sequence_ID = ?"); + String updateCmd = "UPDATE AD_Sequence SET CurrentNextSys = CurrentNextSys + ? WHERE AD_Sequence_ID = ?"; + if (!DB.isOracle() && !DB.isPostgreSQL()) + updateCmd = DB.getDatabase().convertStatement(updateCmd); + updateSQL = conn.prepareStatement(updateCmd); next = rs.getInt(2); } else { String sql; @@ -447,6 +458,8 @@ public class MSequence extends X_AD_Sequence sql = "UPDATE AD_Sequence_No SET CurrentNext = CurrentNext + ? WHERE AD_Sequence_ID=? AND CalendarYearMonth=? AND AD_Org_ID=?"; else sql = "UPDATE AD_Sequence SET CurrentNext = CurrentNext + ? WHERE AD_Sequence_ID=?"; + if (!DB.isOracle() && !DB.isPostgreSQL()) + sql = DB.getDatabase().convertStatement(sql); updateSQL = conn.prepareStatement(sql); next = rs.getInt(1); } diff --git a/org.adempiere.base/src/org/compiere/model/PO_LOB.java b/org.adempiere.base/src/org/compiere/model/PO_LOB.java index fec006f834..508ef57729 100644 --- a/org.adempiere.base/src/org/compiere/model/PO_LOB.java +++ b/org.adempiere.base/src/org/compiere/model/PO_LOB.java @@ -115,6 +115,8 @@ public class PO_LOB implements Serializable .append(m_tableName) .append(" SET ").append(m_columnName) .append("=? WHERE ").append(m_whereClause); + if (!DB.isPostgreSQL() && !DB.isOracle()) + sql = new StringBuffer(DB.getDatabase().convertStatement(sql.toString())); // if (log.isLoggable(Level.FINE)) log.fine("[" + trxName + "] - Local - " + m_value); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoGeneralPanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoGeneralPanel.java index ac4ba38e7b..fa3fa9a672 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoGeneralPanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoGeneralPanel.java @@ -409,12 +409,12 @@ public class InfoGeneralPanel extends InfoPanel implements EventListener { if (Env.isBaseLanguage(Env.getCtx(), "AD_Ref_List")) colSql = new StringBuffer("(SELECT l.Name FROM AD_Ref_List l WHERE l.AD_Reference_ID=") - .append(AD_Reference_Value_ID).append(" AND l.Value=").append(columnSql) + .append(AD_Reference_Value_ID).append(" AND l.Value=").append(tableName).append(".").append(columnSql) .append(") AS ").append(columnName); else colSql = new StringBuffer("(SELECT t.Name FROM AD_Ref_List l, AD_Ref_List_Trl t " + "WHERE l.AD_Ref_List_ID=t.AD_Ref_List_ID AND l.AD_Reference_ID=") - .append(AD_Reference_Value_ID).append(" AND l.Value=").append(columnSql) + .append(AD_Reference_Value_ID).append(" AND l.Value=").append(tableName).append(".").append(columnSql) .append(" AND t.AD_Language='").append(Env.getAD_Language(Env.getCtx())) .append("') AS ").append(columnName); colClass = String.class;