diff --git a/base/src/org/compiere/util/DB.java b/base/src/org/compiere/util/DB.java index ac44986bb1..6171c44f61 100644 --- a/base/src/org/compiere/util/DB.java +++ b/base/src/org/compiere/util/DB.java @@ -30,6 +30,7 @@ import java.sql.Statement; import java.sql.Timestamp; import java.text.MessageFormat; import java.util.ArrayList; +import java.util.Collection; import java.util.Properties; import java.util.logging.Level; @@ -1230,6 +1231,20 @@ public final class DB return retValue; } + /** + * Get int Value from sql + * @param trxName trx + * @param sql sql + * @param params collection of parameters + * @return first value or null + */ + public static int getSQLValue (String trxName, String sql, Collection params) + { + Object[] arr = new Object[params.size()]; + params.toArray(arr); + return getSQLValue(trxName, sql, arr); + } + /** * Get String Value from sql * @param trxName trx @@ -1302,6 +1317,20 @@ public final class DB return retValue; } + /** + * Get String Value from sql + * @param trxName trx + * @param sql sql + * @param params collection of parameters + * @return first value or null + */ + public static String getSQLValueString (String trxName, String sql, Collection params) + { + Object[] arr = new Object[params.size()]; + params.toArray(arr); + return getSQLValueString(trxName, sql, arr); + } + /** * Get BigDecimal Value from sql * @param trxName trx @@ -1374,6 +1403,20 @@ public final class DB return retValue; } + /** + * Get BigDecimal Value from sql + * @param trxName trx + * @param sql sql + * @param params collection of parameters + * @return first value or null + */ + public static BigDecimal getSQLValueBD (String trxName, String sql, Collection params) + { + Object[] arr = new Object[params.size()]; + params.toArray(arr); + return getSQLValueBD(trxName, sql, arr); + } + /** * Get Timestamp Value from sql * @param trxName trx @@ -1410,6 +1453,20 @@ public final class DB return retValue; } + /** + * Get Timestamp Value from sql + * @param trxName trx + * @param sql sql + * @param params collection of parameters + * @return first value or null + */ + public static Timestamp getSQLValueTS (String trxName, String sql, Collection params) + { + Object[] arr = new Object[params.size()]; + params.toArray(arr); + return getSQLValueTS(trxName, sql, arr); + } + /** * Get Array of Key Name Pairs * @param sql select with id / name as first / second column