IDEMPIERE-308 Performance: Replace use of StringBuffer / Fix problem caused by this ticket

found in log this error
05:48:01.930===========> DB.executeUpdate: UPDATE C_Order SET C_Payment_ID=NULL 1000038) WHERE C_Order.C_Order_ID = (SELECT i.C_Order_ID FROM C_Invoice i WHERE i.C_Invoice_ID=1000038) [WFP_49b57bb4-a451-4ade-bb28-8a6146afc3c3] [2661]
org.postgresql.util.PSQLException: ERROR: syntax error at or near "1000038"
This commit is contained in:
Carlos Ruiz 2012-10-23 16:21:14 -05:00
parent cc8a577d87
commit 6e9da7b307
1 changed files with 12 additions and 12 deletions

View File

@ -296,12 +296,12 @@ public class MAllocationLine extends X_C_AllocationLine
} }
// Link to Order // Link to Order
StringBuilder update = new StringBuilder("UPDATE C_Order o ") String update = "UPDATE C_Order o "
.append("SET C_Payment_ID=") + "SET C_Payment_ID="
.append((reverse ? "NULL " : "(SELECT C_Payment_ID FROM C_Invoice WHERE C_Invoice_ID=")).append(C_Invoice_ID).append(") ") + (reverse ? "NULL " : "(SELECT C_Payment_ID FROM C_Invoice WHERE C_Invoice_ID=" + C_Invoice_ID + ") ")
.append("WHERE o.C_Order_ID = (SELECT i.C_Order_ID FROM C_Invoice i ") + "WHERE o.C_Order_ID = (SELECT i.C_Order_ID FROM C_Invoice i "
.append("WHERE i.C_Invoice_ID=").append(C_Invoice_ID).append(")"); + "WHERE i.C_Invoice_ID=" + C_Invoice_ID + ")";
if (DB.executeUpdate(update.toString(), get_TrxName()) > 0) if (DB.executeUpdate(update, get_TrxName()) > 0)
log.fine("C_Payment_ID=" + C_Payment_ID log.fine("C_Payment_ID=" + C_Payment_ID
+ (reverse ? " UnLinked from" : " Linked to") + (reverse ? " UnLinked from" : " Linked to")
+ " order of C_Invoice_ID=" + C_Invoice_ID); + " order of C_Invoice_ID=" + C_Invoice_ID);
@ -325,12 +325,12 @@ public class MAllocationLine extends X_C_AllocationLine
} }
// Link to Order // Link to Order
StringBuilder update = new StringBuilder("UPDATE C_Order o ") String update = "UPDATE C_Order o "
.append("SET C_CashLine_ID=") + "SET C_CashLine_ID="
.append((reverse ? "NULL " : "(SELECT C_CashLine_ID FROM C_Invoice WHERE C_Invoice_ID=")).append(C_Invoice_ID).append(") ") + (reverse ? "NULL " : "(SELECT C_CashLine_ID FROM C_Invoice WHERE C_Invoice_ID=" + C_Invoice_ID + ") ")
.append("WHERE o.C_Order_ID = (SELECT i.C_Order_ID FROM C_Invoice i ") + "WHERE o.C_Order_ID = (SELECT i.C_Order_ID FROM C_Invoice i "
.append("WHERE i.C_Invoice_ID=").append(C_Invoice_ID).append(")"); + "WHERE i.C_Invoice_ID=" + C_Invoice_ID + ")";
if (DB.executeUpdate(update.toString(), get_TrxName()) > 0) if (DB.executeUpdate(update, get_TrxName()) > 0)
log.fine("C_CashLine_ID=" + C_CashLine_ID log.fine("C_CashLine_ID=" + C_CashLine_ID
+ (reverse ? " UnLinked from" : " Linked to") + (reverse ? " UnLinked from" : " Linked to")
+ " order of C_Invoice_ID=" + C_Invoice_ID); + " order of C_Invoice_ID=" + C_Invoice_ID);