* [ 1644635 ] WAN: DB.prepareCall not working
This commit is contained in:
parent
fd7c2c9b12
commit
e75b04f535
|
@ -743,22 +743,47 @@ public final class DB
|
||||||
log.fine("closed");
|
log.fine("closed");
|
||||||
} // closeTarget
|
} // closeTarget
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* Prepare Forward Read Only Call
|
* Prepare Forward Read Only Call
|
||||||
* @param RO_SQL sql (RO)
|
* @param SQL sql
|
||||||
* @return Callable Statement
|
* @return Callable Statement
|
||||||
*/
|
*/
|
||||||
public static CallableStatement prepareCall(String RO_SQL)
|
public static CallableStatement prepareCall(String sql)
|
||||||
{
|
{
|
||||||
if (RO_SQL == null || RO_SQL.length() == 0)
|
return prepareCall(sql, ResultSet.CONCUR_UPDATABLE, null);
|
||||||
throw new IllegalArgumentException("Required parameter missing - " + RO_SQL);
|
}
|
||||||
|
|
||||||
|
/**************************************************************************
|
||||||
|
* Prepare Call
|
||||||
|
* @param SQL sql
|
||||||
|
* @param readOnly
|
||||||
|
* @param trxName
|
||||||
|
* @return Callable Statement
|
||||||
|
*/
|
||||||
|
public static CallableStatement prepareCall(String SQL, int resultSetConcurrency, String trxName)
|
||||||
|
{
|
||||||
|
if (SQL == null || SQL.length() == 0)
|
||||||
|
throw new IllegalArgumentException("Required parameter missing - " + SQL);
|
||||||
//
|
//
|
||||||
String sql = getDatabase().convertStatement(RO_SQL);
|
String sql = getDatabase().convertStatement(SQL);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return getConnectionRO().prepareCall
|
Connection conn = null;
|
||||||
(sql, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
|
Trx trx = trxName == null ? null : Trx.get(trxName, true);
|
||||||
|
if (trx != null)
|
||||||
|
conn = trx.getConnection();
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (resultSetConcurrency == ResultSet.CONCUR_UPDATABLE)
|
||||||
|
conn = DB.getConnectionRW ();
|
||||||
|
else
|
||||||
|
conn = DB.getConnectionRO();
|
||||||
|
}
|
||||||
|
if (conn == null)
|
||||||
|
throw new DBException("No Connection");
|
||||||
|
|
||||||
|
return conn.prepareCall
|
||||||
|
(sql, ResultSet.TYPE_FORWARD_ONLY, resultSetConcurrency);
|
||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue