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 //check tab context
if (checkContext && getGridTab() != null) if (checkContext && getGridTab() != null &&
! "Y".equals(Env.getContext(Env.getCtx(), getWindowNo(), "_QUICK_ENTRY_MODE_")))
{ {
if (getGridTab().isReadOnly()) if (getGridTab().isReadOnly())
{ {

View File

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

View File

@ -49,15 +49,13 @@ public class SQLStatementElementHandler extends AbstractElementHandler {
sql = sql.substring(0, sql.length() - 1); sql = sql.substring(0, sql.length() - 1);
Savepoint savepoint = null; Savepoint savepoint = null;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
X_AD_Package_Imp_Detail impDetail = null;
try { try {
// NOTE Postgres needs to commit DDL statements // 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) // 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 // 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)); pstmt = DB.prepareStatement(sql, getTrxName(ctx));
if (DBType.equals("ALL")) { if (DBType.equals("ALL")) {
@ -87,26 +85,22 @@ public class SQLStatementElementHandler extends AbstractElementHandler {
stmt = null; stmt = null;
} }
} }
X_AD_Package_Imp_Detail impDetail = createImportDetail(ctx, element.qName, "",
0);
logImportDetail (ctx, impDetail, 1, "SQLStatement",1,"Execute");
} catch (Exception e) { } catch (Exception e) {
if (DB.isPostgreSQL()) { // rollback immediately on exception to avoid a wrong SQL stop the whole process
// rollback immediately postgres on exception to avoid a wrong SQL stop the whole process if (savepoint != null)
if (savepoint != null) {
{ Trx trx = Trx.get(getTrxName(ctx), false);
Trx trx = Trx.get(getTrxName(ctx), false); try {
try { if (trx.getConnection() != null)
trx.rollback(savepoint); trx.getConnection().rollback(savepoint);
} catch (SQLException e1) {} } catch (SQLException e1) {
savepoint = null; //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); 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 { } finally {
DB.close(pstmt); DB.close(pstmt);
pstmt = null; pstmt = null;
@ -114,9 +108,18 @@ public class SQLStatementElementHandler extends AbstractElementHandler {
Trx trx = Trx.get(getTrxName(ctx), false); Trx trx = Trx.get(getTrxName(ctx), false);
try { try {
trx.releaseSavepoint(savepoint); 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 { 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 changed = e.isChanged() || e.isInserting();
boolean readOnly = adTabbox.getSelectedGridTab().isReadOnly(); boolean readOnly = adTabbox.getSelectedGridTab().isReadOnly();
boolean processed = "Y".equals(Env.getContext(Env.getCtx(), getWindowNo(), "Processed", true)); boolean processed = adTabbox.getSelectedGridTab().isProcessed();
boolean insertRecord = !readOnly; boolean insertRecord = !readOnly;
if (!detailTab) if (!detailTab)
{ {
@ -1410,7 +1410,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
} }
else else
{ {
adTabbox.updateDetailPaneToolbar(changed, readOnly || processed); adTabbox.updateDetailPaneToolbar(changed, readOnly);
} }
toolbar.enableIgnore(adTabbox.needSave(true, false) || toolbar.enableIgnore(adTabbox.needSave(true, false) ||
adTabbox.getSelectedGridTab().isNew() || adTabbox.getSelectedGridTab().isNew() ||

View File

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