hg merge release-6.1 (merge release6.1 into default)

This commit is contained in:
Carlos Ruiz 2018-12-12 20:45:24 +01:00
commit f12c2b9bc5
9 changed files with 65 additions and 9 deletions

View File

@ -20,6 +20,7 @@ import java.math.BigDecimal;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.ResultSet;
import java.sql.Types;
import java.util.logging.Level;
import org.compiere.model.MColumn;
@ -110,6 +111,21 @@ public class ColumnSync extends SvrProcess
// update existing column
boolean notNull = DatabaseMetaData.columnNoNulls == rs.getInt("NULLABLE");
sql = column.getSQLModify(table, column.isMandatory() != notNull);
if (DB.isOracle()) {
// IDEMPIERE-3842 problem with oracle alter CLOB or BLOB
int actualType = rs.getInt("DATA_TYPE");
if (actualType == Types.CLOB) {
if (sql.contains(" MODIFY " + column.getColumnName() + " CLOB")) {
// trying to make CLOB a column that is already a CLOB
sql = sql.replaceFirst(" MODIFY " + column.getColumnName() + " CLOB", " MODIFY " + column.getColumnName());
}
} else if (actualType == Types.BLOB) {
if (sql.contains(" MODIFY " + column.getColumnName() + " BLOB")) {
// trying to make BLOB a column that is already a BLOB
sql = sql.replaceFirst(" MODIFY " + column.getColumnName() + " BLOB", " MODIFY " + column.getColumnName());
}
}
}
break;
}
DB.close(rs);

View File

@ -763,7 +763,7 @@ public class MColumn extends X_AD_Column
foreignTable = "M_AttributeSetInstance";
} else if (DisplayType.Assignment == refid) {
foreignTable = "S_ResourceAssignment";
} else if (DisplayType.Image == refid) {
} else if (DisplayType.Image == refid && !"BinaryData".equals(getColumnName())) {
foreignTable = "AD_Image";
} else if (DisplayType.Chart == refid) {
foreignTable = "AD_Chart";

View File

@ -20,6 +20,7 @@ import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Types;
import java.util.List;
import java.util.logging.Level;
@ -245,10 +246,23 @@ public class ColumnElementHandler extends AbstractElementHandler {
if (rsc.next()) {
if (doAlter) {
// update existing column
boolean notNull = DatabaseMetaData.columnNoNulls == rsc
.getInt("NULLABLE");
sql = column.getSQLModify(table,
column.isMandatory() != notNull);
boolean notNull = DatabaseMetaData.columnNoNulls == rsc.getInt("NULLABLE");
sql = column.getSQLModify(table, column.isMandatory() != notNull);
if (DB.isOracle()) {
// IDEMPIERE-3842 problem with oracle alter CLOB or BLOB
int actualType = rsc.getInt("DATA_TYPE");
if (actualType == Types.CLOB) {
if (sql.contains(" MODIFY " + column.getColumnName() + " CLOB")) {
// trying to make CLOB a column that is already a CLOB
sql = sql.replaceFirst(" MODIFY " + column.getColumnName() + " CLOB", " MODIFY " + column.getColumnName());
}
} else if (actualType == Types.BLOB) {
if (sql.contains(" MODIFY " + column.getColumnName() + " BLOB")) {
// trying to make BLOB a column that is already a BLOB
sql = sql.replaceFirst(" MODIFY " + column.getColumnName() + " BLOB", " MODIFY " + column.getColumnName());
}
}
}
}
} else {
// No existing column

View File

@ -107,6 +107,8 @@ public class TableElementHandler extends AbstractElementHandler {
public void endElement(PIPOContext ctx, Element element) throws SAXException {
MTable mTable = findPO(ctx, element);
if (element.defer && mTable == null)
return;
boolean isValidateView = false;
MViewComponent[] m_vcs = mTable.getViewComponent(true);
if (m_vcs != null && m_vcs.length > 0)

View File

@ -87,8 +87,17 @@ public abstract class AbstractActivator implements BundleActivator, ServiceTrack
protected boolean installedPackage(String version) {
StringBuilder where = new StringBuilder("AD_Client_ID=? AND Name=? AND PK_Status='Completed successfully'");
List<Object> params = new ArrayList<Object>();
params.add(Env.getAD_Client_ID(Env.getCtx()));
params.add(getName());
String fileName = getName();
int clientId = Env.getAD_Client_ID(Env.getCtx());
if (version == null) {
String [] parts = fileName.split("_");
String clientValue = parts[1];
clientId = DB.getSQLValueEx(null, "SELECT AD_Client_ID FROM AD_Client WHERE Value=?", clientValue);
if (clientId < 0)
clientId = 0;
}
params.add(clientId);
params.add(fileName);
if (version != null) {
where.append(" AND PK_Version LIKE ?");
params.add(version + "%");

View File

@ -30,6 +30,10 @@ VMOPTS="-Dorg.osgi.framework.bootdelegation=sun.security.ssl,org.w3c.dom.events
-Dmail.mime.encodefilename=true
-Dmail.mime.decodefilename=true
-Dmail.mime.encodeparameters=true
-Dmail.mime.decodeparameters=true"
-Dmail.mime.decodeparameters=true
--add-exports java.desktop/sun.awt=ALL-UNNAMED
--add-exports java.sql.rowset/com.sun.rowset=ALL-UNNAMED
--add-exports java.naming/com.sun.jndi.ldap=ALL-UNNAMED
--add-modules=ALL-SYSTEM"
$JAVA ${DEBUG} $IDEMPIERE_JAVA_OPTIONS $VMOPTS -jar $BASE/plugins/org.eclipse.equinox.launcher_1.*.jar -application org.adempiere.server.application

View File

@ -369,6 +369,9 @@ public class DB_Oracle implements AdempiereDatabase
public String convertStatement (String oraStatement)
{
Convert.logMigrationScript(oraStatement, null);
if ("true".equals(System.getProperty("org.idempiere.db.oracle.debug"))) {
log.warning("Oracle -> " + oraStatement);
}
return oraStatement;
} // convertStatement

View File

@ -2,14 +2,22 @@ package org.compiere.dbPort;
import java.util.ArrayList;
import org.compiere.util.CLogger;
public class Convert_Oracle extends Convert {
/** Logger */
private static CLogger log = CLogger.getCLogger(Convert_Oracle.class);
public Convert_Oracle() {}
@Override
protected ArrayList<String> convertStatement(String sqlStatement) {
ArrayList<String> result = new ArrayList<String>();
result.add(sqlStatement);
if ("true".equals(System.getProperty("org.idempiere.db.oracle.debug"))) {
log.warning("Oracle -> " + sqlStatement);
}
return result;
}

View File

@ -793,7 +793,7 @@ public class Convert_PostgreSQL extends Convert_SQL92 {
*/
private String addAliasToIdentifier(String where, String alias)
{
String sqlkey = "AND,OR,FROM,WHERE,JOIN,BY,GROUP,IN,INTO,SELECT,NOT,SET,UPDATE,DELETE,HAVING,IS,NULL,EXISTS,BETWEEN,LIKE,INNER,OUTER";
String sqlkey = "AND,OR,FROM,WHERE,JOIN,BY,GROUP,IN,INTO,SELECT,NOT,SET,UPDATE,DELETE,HAVING,IS,NULL,EXISTS,BETWEEN,LIKE,INNER,OUTER,SIMILAR TO";
StringTokenizer st = new StringTokenizer(where);
String result = "";