FR [ 2873891 ] DB.getKeyNamePairs should use trxName

https://sourceforge.net/tracker/?func=detail&aid=2873891&group_id=176962&atid=879335
This commit is contained in:
teo_sarca 2009-10-07 06:40:53 +00:00
parent 12991b8771
commit c72bc493fc
1 changed files with 15 additions and 1 deletions

View File

@ -83,6 +83,8 @@ import org.compiere.process.SequenceCheck;
* @author Teo Sarca, teo.sarca@gmail.com * @author Teo Sarca, teo.sarca@gmail.com
* <li>BF [ 2873324 ] DB.TO_NUMBER should be a static method * <li>BF [ 2873324 ] DB.TO_NUMBER should be a static method
* https://sourceforge.net/tracker/?func=detail&aid=2873324&group_id=176962&atid=879332 * https://sourceforge.net/tracker/?func=detail&aid=2873324&group_id=176962&atid=879332
* <li>FR [ 2873891 ] DB.getKeyNamePairs should use trxName
* https://sourceforge.net/tracker/?func=detail&aid=2873891&group_id=176962&atid=879335
*/ */
public final class DB public final class DB
{ {
@ -1591,6 +1593,18 @@ public final class DB
* @param params query parameters * @param params query parameters
*/ */
public static KeyNamePair[] getKeyNamePairs(String sql, boolean optional, Object ... params) public static KeyNamePair[] getKeyNamePairs(String sql, boolean optional, Object ... params)
{
return getKeyNamePairs(null, sql, optional, params);
}
/**
* Get Array of Key Name Pairs
* @param trxName
* @param sql select with id / name as first / second column
* @param optional if true (-1,"") is added
* @param params query parameters
*/
public static KeyNamePair[] getKeyNamePairs(String trxName, String sql, boolean optional, Object ... params)
{ {
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
@ -1601,7 +1615,7 @@ public final class DB
} }
try try
{ {
pstmt = DB.prepareStatement(sql, null); pstmt = DB.prepareStatement(sql, trxName);
setParameters(pstmt, params); setParameters(pstmt, params);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
while (rs.next()) while (rs.next())