hg merge release-1.0c (forward-porting)

This commit is contained in:
Carlos Ruiz 2013-08-22 18:18:41 -05:00
commit 10488f31ef
5 changed files with 33 additions and 29 deletions

View File

@ -434,7 +434,8 @@ public class GridField
}
//check tab context
if (checkContext && getGridTab() != null)
if (checkContext && getGridTab() != null &&
! "Y".equals(Env.getContext(Env.getCtx(), getWindowNo(), "_QUICK_ENTRY_MODE_")))
{
if (getGridTab().isReadOnly())
{

View File

@ -2646,10 +2646,10 @@ public abstract class PO
else
{
if (m_trxName == null)
log.log(Level.WARNING, "#" + no
log.log(Level.WARNING, "Update return " + no + " instead of 1"
+ " - " + p_info.getTableName() + "." + where);
else
log.log(Level.WARNING, "#" + no
log.log(Level.WARNING, "Update return " + no + " instead of 1"
+ " - [" + m_trxName + "] - " + p_info.getTableName() + "." + where);
}
return ok;

View File

@ -49,15 +49,13 @@ public class SQLStatementElementHandler extends AbstractElementHandler {
sql = sql.substring(0, sql.length() - 1);
Savepoint savepoint = null;
PreparedStatement pstmt = null;
X_AD_Package_Imp_Detail impDetail = null;
try {
// NOTE Postgres needs to commit DDL statements
// add a SQL command just with COMMIT if you want to simulate the Oracle behavior (commit on DDL)
// Use savepoint here so that SQL exception would not rollback the whole process
if (DB.isPostgreSQL())
{
Trx trx = Trx.get(getTrxName(ctx), true);
savepoint = trx.setSavepoint(null);
}
Trx trx = Trx.get(getTrxName(ctx), true);
savepoint = trx.setSavepoint(null);
pstmt = DB.prepareStatement(sql, getTrxName(ctx));
if (DBType.equals("ALL")) {
@ -86,27 +84,23 @@ public class SQLStatementElementHandler extends AbstractElementHandler {
DB.close(stmt);
stmt = null;
}
}
X_AD_Package_Imp_Detail impDetail = createImportDetail(ctx, element.qName, "",
0);
logImportDetail (ctx, impDetail, 1, "SQLStatement",1,"Execute");
}
} catch (Exception e) {
if (DB.isPostgreSQL()) {
// rollback immediately postgres on exception to avoid a wrong SQL stop the whole process
if (savepoint != null)
{
Trx trx = Trx.get(getTrxName(ctx), false);
try {
trx.rollback(savepoint);
} catch (SQLException e1) {}
savepoint = null;
// rollback immediately on exception to avoid a wrong SQL stop the whole process
if (savepoint != null)
{
Trx trx = Trx.get(getTrxName(ctx), false);
try {
if (trx.getConnection() != null)
trx.getConnection().rollback(savepoint);
} catch (SQLException e1) {
//a rollback or commit have happens making the savepoint becomes invalid.
//rollback trx to continue
trx.rollback();
}
savepoint = null;
}
log.log(Level.SEVERE,"SQLSatement", e);
X_AD_Package_Imp_Detail impDetail = createImportDetail(ctx, element.qName, "",
0);
logImportDetail (ctx, impDetail, 0, "SQLStatement",1,"Execute");
} finally {
DB.close(pstmt);
pstmt = null;
@ -114,9 +108,18 @@ public class SQLStatementElementHandler extends AbstractElementHandler {
Trx trx = Trx.get(getTrxName(ctx), false);
try {
trx.releaseSavepoint(savepoint);
} catch (SQLException e) {}
} catch (SQLException e) {
if (DB.isPostgreSQL()) {
//a commit or rollback have happens that make the savepoint invalid.
//need to call rollback to continue
trx.commit();
}
}
}
}
impDetail = createImportDetail(ctx, element.qName, "",
0);
logImportDetail (ctx, impDetail, 1, "SQLStatement",1,"Execute");
}
public void endElement(PIPOContext ctx, Element element) throws SAXException {

View File

@ -1387,7 +1387,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
boolean changed = e.isChanged() || e.isInserting();
boolean readOnly = adTabbox.getSelectedGridTab().isReadOnly();
boolean processed = "Y".equals(Env.getContext(Env.getCtx(), getWindowNo(), "Processed", true));
boolean processed = adTabbox.getSelectedGridTab().isProcessed();
boolean insertRecord = !readOnly;
if (!detailTab)
{
@ -1410,7 +1410,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
}
else
{
adTabbox.updateDetailPaneToolbar(changed, readOnly || processed);
adTabbox.updateDetailPaneToolbar(changed, readOnly);
}
toolbar.enableIgnore(adTabbox.needSave(true, false) ||
adTabbox.getSelectedGridTab().isNew() ||

View File

@ -542,7 +542,7 @@ public class DetailPane extends Panel implements EventListener<Event>, IdSpace {
Toolbar toolbar = (Toolbar) tabpanel.getFirstChild();
IADTabpanel adtab = getADTabpanel(index);
if (adtab!=null && adtab.getGridTab().isSortTab())
if (adtab!=null && (adtab.getGridTab().isSortTab() || adtab.getGridTab().isReadOnly()))
readOnly = true;
boolean insertRecord = !readOnly;