FOR UPDATE error on postgres reported by Usman88

This commit is contained in:
Carlos Ruiz 2006-12-11 07:14:21 +00:00
parent dada2247a1
commit 94021da928
1 changed files with 14 additions and 12 deletions

View File

@ -272,19 +272,21 @@ public class MSequence extends X_AD_Sequence
+ " FOR UPDATE OF AD_Sequence "; + " FOR UPDATE OF AD_Sequence ";
USE_PROCEDURE=false; USE_PROCEDURE=false;
} }
else
//String selectSQL = "SELECT CurrentNext, CurrentNextSys, IncrementNo, Prefix, Suffix, AD_Sequence_ID "
selectSQL = "SELECT CurrentNext, CurrentNextSys, IncrementNo, Prefix, Suffix, AD_Sequence_ID "
//end vpj-cd e-evolution 09/02/2005 PostgreSQL
+ "FROM AD_Sequence "
+ "WHERE Name=?"
+ " AND AD_Client_ID IN (0,?)"
+ " AND IsActive='Y' AND IsTableID='N' AND IsAutoSequence='Y' ";
if (!DB.isDerby()&&!DB.isDB2())
selectSQL += " ORDER BY AD_Client_ID DESC ";
else else
// selectSQL += " FOR UPDATE OF CurrentNext, CurrentNextSys "; //jz for update , no order by, 10.216 no need {
selectSQL += "FOR UPDATE"; //String selectSQL = "SELECT CurrentNext, CurrentNextSys, IncrementNo, Prefix, Suffix, AD_Sequence_ID "
selectSQL = "SELECT CurrentNext, CurrentNextSys, IncrementNo, Prefix, Suffix, AD_Sequence_ID "
//end vpj-cd e-evolution 09/02/2005 PostgreSQL
+ "FROM AD_Sequence "
+ "WHERE Name=?"
+ " AND AD_Client_ID IN (0,?)"
+ " AND IsActive='Y' AND IsTableID='N' AND IsAutoSequence='Y' ";
if (!DB.isDerby()&&!DB.isDB2())
selectSQL += " ORDER BY AD_Client_ID DESC ";
else
// selectSQL += " FOR UPDATE OF CurrentNext, CurrentNextSys "; //jz for update , no order by, 10.216 no need
selectSQL += "FOR UPDATE";
}
Connection conn = null; Connection conn = null;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
Trx trx = trxName == null ? null : Trx.get(trxName, true); Trx trx = trxName == null ? null : Trx.get(trxName, true);