IDEMPIERE-4966 Error in FinReport with List Sources and Native Postgr… (#945)

* IDEMPIERE-4966 Error in FinReport with List Sources and Native PostgreSQL

* IDEMPIERE-4966 Error in FinReport with List Sources and Native PostgreSQL

Incorporate suggestion from Carlos (replace DB.executeUpdate call with
DB.executeUpdateEx)
This commit is contained in:
hengsin 2021-10-26 16:35:08 +08:00 committed by GitHub
parent 750a58cabd
commit 85f640ffdf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 24 additions and 20 deletions

View File

@ -544,7 +544,7 @@ public class FinReport extends SvrProcess
update.append(" WHERE AD_PInstance_ID=").append(getAD_PInstance_ID())
.append(" AND PA_ReportLine_ID=").append(m_lines[line].getPA_ReportLine_ID())
.append(" AND ABS(LevelNo)<2"); // 0=Line 1=Acct
int no = DB.executeUpdate(update.toString(), get_TrxName());
int no = DB.executeUpdateEx(update.toString(), get_TrxName());
if (no != 1)
log.log(Level.SEVERE, "#=" + no + " for " + update);
if (log.isLoggable(Level.FINEST)) log.finest(update.toString());
@ -685,7 +685,7 @@ public class FinReport extends SvrProcess
sb.append("WHERE T_Report.AD_PInstance_ID=").append(getAD_PInstance_ID())
.append(" AND T_Report.PA_ReportLine_ID=").append(m_lines[line].getPA_ReportLine_ID())
.append(" AND ABS(T_Report.LevelNo)<1"); // not trx
int no = DB.executeUpdate(sb.toString(), get_TrxName());
int no = DB.executeUpdateEx(sb.toString(), get_TrxName());
if (no != 1)
log.log(Level.SEVERE, "(+) #=" + no + " for " + m_lines[line] + " - " + sb.toString());
else
@ -748,7 +748,7 @@ public class FinReport extends SvrProcess
sb.append("WHERE T_Report.AD_PInstance_ID=").append(getAD_PInstance_ID())
.append(" AND T_Report.PA_ReportLine_ID=").append(m_lines[line].getPA_ReportLine_ID())
.append(" AND ABS(T_Report.LevelNo)<1"); // 0=Line 1=Acct
int no = DB.executeUpdate(sb.toString(), get_TrxName());
int no = DB.executeUpdateEx(sb.toString(), get_TrxName());
if (no != 1)
{
log.severe ("(x) #=" + no + " for " + m_lines[line] + " - " + sb.toString ());
@ -836,7 +836,7 @@ public class FinReport extends SvrProcess
sb.append("WHERE r1.AD_PInstance_ID=").append(getAD_PInstance_ID())
.append(" AND r1.PA_ReportLine_ID=").append(m_lines[line].getPA_ReportLine_ID())
.append(" AND ABS(r1.LevelNo)<1"); // 0=Line 1=Acct
no = DB.executeUpdate(sb.toString(), get_TrxName());
no = DB.executeUpdateEx(sb.toString(), get_TrxName());
if (no != 1)
log.severe ("(x) #=" + no + " for " + m_lines[line] + " - " + sb.toString ());
else
@ -949,7 +949,7 @@ public class FinReport extends SvrProcess
//
sb.append(" WHERE AD_PInstance_ID=").append(getAD_PInstance_ID())
.append(" AND ABS(LevelNo)<2"); // 0=Line 1=Acct
int no = DB.executeUpdate(sb.toString(), get_TrxName());
int no = DB.executeUpdateEx(sb.toString(), get_TrxName());
if (no < 1)
log.severe ("#=" + no + " for " + m_columns[col]
+ " - " + sb.toString());
@ -983,7 +983,7 @@ public class FinReport extends SvrProcess
// 0=Line 1=Acct
sb.append(" AND ABS(LevelNo) < 2 ");
sb.append(" AND EXISTS (SELECT 1 FROM PA_ReportLine rl WHERE rl.PA_ReportLine_ID=T_Report.PA_ReportLine_ID AND rl.IsShowOppositeSign='Y' AND rl.IsActive='Y') ");
int no = DB.executeUpdate(sb.toString(), get_TrxName());
int no = DB.executeUpdateEx(sb.toString(), get_TrxName());
if (no < 1)
log.severe("#=" + no + " for setting opposite sign" + " - " + sb.toString());
else
@ -1137,7 +1137,7 @@ public class FinReport extends SvrProcess
sb.append(" AND seqNo < " + nextSeq);
}
}
int no = DB.executeUpdate(sb.toString(), get_TrxName());
int no = DB.executeUpdateEx(sb.toString(), get_TrxName());
if (no < 1)
log.severe ("#=" + no + " for " + m_columns[col]
+ " - " + sb.toString());
@ -1299,7 +1299,7 @@ public class FinReport extends SvrProcess
.append(" AND Col_0 IS NULL AND Col_1 IS NULL AND Col_2 IS NULL AND Col_3 IS NULL AND Col_4 IS NULL AND Col_5 IS NULL AND Col_6 IS NULL AND Col_7 IS NULL AND Col_8 IS NULL AND Col_9 IS NULL")
.append(" AND Col_10 IS NULL AND Col_11 IS NULL AND Col_12 IS NULL AND Col_13 IS NULL AND Col_14 IS NULL AND Col_15 IS NULL AND Col_16 IS NULL AND Col_17 IS NULL AND Col_18 IS NULL AND Col_19 IS NULL")
.append(" AND Col_20 IS NULL AND Col_21 IS NULL AND Col_22 IS NULL AND Col_23 IS NULL AND Col_24 IS NULL AND Col_25 IS NULL AND Col_26 IS NULL AND Col_27 IS NULL AND Col_28 IS NULL AND Col_29 IS NULL AND Col_30 IS NULL");
int no = DB.executeUpdate(sql.toString(), get_TrxName());
int no = DB.executeUpdateEx(sql.toString(), get_TrxName());
if (log.isLoggable(Level.FINE)) log.fine("Deleted empty #=" + no);
}
//
@ -1311,7 +1311,7 @@ public class FinReport extends SvrProcess
+ "WHERE r1.AD_PInstance_ID=r2.AD_PInstance_ID AND r1.PA_ReportLine_ID=r2.PA_ReportLine_ID"
+ " AND r2.Record_ID=0 AND r2.Fact_Acct_ID=0)"
+ "WHERE SeqNo IS NULL");
int no = DB.executeUpdate(sql.toString(), get_TrxName());
int no = DB.executeUpdateEx(sql.toString(), get_TrxName());
if (log.isLoggable(Level.FINE)) log.fine("SeqNo #=" + no);
if (!m_report.isListTrx())
@ -1328,7 +1328,7 @@ public class FinReport extends SvrProcess
.append(sql_select).append(") "
+ "WHERE Fact_Acct_ID <> 0 AND AD_PInstance_ID=")
.append(getAD_PInstance_ID());
no = DB.executeUpdate(sql.toString(), get_TrxName());
no = DB.executeUpdateEx(sql.toString(), get_TrxName());
if (log.isLoggable(Level.FINE)) log.fine("Trx Name #=" + no + " - " + sql.toString());
} // insertLineDetail
@ -1382,16 +1382,18 @@ public class FinReport extends SvrProcess
unionInsert.append("1 ");
}
String numericType = DB.getDatabase().getNumericDataType();
// for all columns create select statement
for (int col = 0; col < m_columns.length; col++)
{
insert.append(", ");
if (listSourceNoTrx)
unionInsert.append(", Cast(NULL AS NUMBER)");
unionInsert.append(", Cast(NULL AS ").append(numericType).append(")");
// No calculation
if (m_columns[col].isColumnTypeCalculation())
{
insert.append("Cast(NULL AS NUMBER)");
insert.append("Cast(NULL AS ").append(numericType).append(")");
continue;
}
@ -1403,7 +1405,7 @@ public class FinReport extends SvrProcess
select.append (m_columns[col].getSelectClause (true));
else
{
insert.append("Cast(NULL AS NUMBER)");
insert.append("Cast(NULL AS ").append(numericType).append(")");
continue;
}
@ -1569,7 +1571,7 @@ public class FinReport extends SvrProcess
insert.append(unionInsert);
}
int no = DB.executeUpdate(insert.toString(), get_TrxName());
int no = DB.executeUpdateEx(insert.toString(), get_TrxName());
if (log.isLoggable(Level.FINE)) log.fine("Source #=" + no + " - " + insert);
if (no == 0)
return;
@ -1581,7 +1583,7 @@ public class FinReport extends SvrProcess
+ "WHERE Record_ID <> 0 AND AD_PInstance_ID=").append(getAD_PInstance_ID())
.append(" AND PA_ReportLine_ID=").append(m_lines[line].getPA_ReportLine_ID())
.append(" AND Fact_Acct_ID=0");
no = DB.executeUpdate(sql.toString(), get_TrxName());
no = DB.executeUpdateEx(sql.toString(), get_TrxName());
if (log.isLoggable(Level.FINE)) log.fine("Name #=" + no + " - " + sql.toString());
if (m_report.isListTrx())
@ -1613,6 +1615,8 @@ public class FinReport extends SvrProcess
else
insert.append("2 ");
String numericType = DB.getDatabase().getNumericDataType();
// for all columns create select statement
for (int col = 0; col < m_columns.length; col++)
{
@ -1620,7 +1624,7 @@ public class FinReport extends SvrProcess
// No calculation
if (m_columns[col].isColumnTypeCalculation())
{
insert.append("Cast(NULL AS NUMBER)");
insert.append("Cast(NULL AS ").append(numericType).append(")");
continue;
}
@ -1632,7 +1636,7 @@ public class FinReport extends SvrProcess
select.append (m_columns[col].getSelectClause (false));
else
{
insert.append("Cast(NULL AS NUMBER)");
insert.append("Cast(NULL AS ").append(numericType).append(")");
continue;
}
@ -1738,7 +1742,7 @@ public class FinReport extends SvrProcess
whereClause = whereClause.replaceAll(" AND PA_ReportCube_ID=" + p_PA_ReportCube_ID, "");
insert.append(whereClause); // IDEMPIERE-130
int no = DB.executeUpdate(insert.toString(), get_TrxName());
int no = DB.executeUpdateEx(insert.toString(), get_TrxName());
if (log.isLoggable(Level.FINEST)) log.finest("Trx #=" + no + " - " + insert);
if (no == 0)
return;
@ -1757,7 +1761,7 @@ public class FinReport extends SvrProcess
{
String sql = "DELETE FROM T_Report WHERE AD_PInstance_ID=" + getAD_PInstance_ID()
+ " AND PA_ReportLine_ID=" + m_lines[line].getPA_ReportLine_ID();
int no = DB.executeUpdate(sql, get_TrxName());
int no = DB.executeUpdateEx(sql, get_TrxName());
if (no > 0)
if (log.isLoggable(Level.FINE)) log.fine(m_lines[line].getName() + " - #" + no);
}
@ -1783,7 +1787,7 @@ public class FinReport extends SvrProcess
String sql = "UPDATE T_Report SET Col_" + column
+ "=Col_" + column + "/" + divisor
+ " WHERE AD_PInstance_ID=" + getAD_PInstance_ID();
int no = DB.executeUpdate(sql, get_TrxName());
int no = DB.executeUpdateEx(sql, get_TrxName());
if (no > 0)
if (log.isLoggable(Level.FINE)) log.fine(m_columns[column].getName() + " - #" + no);
}