FR [ 1884435 ] Add more DB.getSQLValue helper methods
This commit is contained in:
parent
567288fbae
commit
b323065f13
|
@ -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<Object> 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<Object> 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<Object> 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<Object> 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
|
||||
|
|
Loading…
Reference in New Issue