User: schaefera
Date: 01/11/03 22:56:18
Modified: src/main/org/jboss/resource/adapter/jdbc/local
ConnectionInPool.java PreparedStatementFactory.java
Log:
Fixes for bug #424768 to support ResultSetTyp and Concurrency for prepared
Statements.
Revision Changes Path
1.2 +17 -4
jbosscx/src/main/org/jboss/resource/adapter/jdbc/local/ConnectionInPool.java
Index: ConnectionInPool.java
===================================================================
RCS file:
/cvsroot/jboss/jbosscx/src/main/org/jboss/resource/adapter/jdbc/local/ConnectionInPool.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ConnectionInPool.java 2001/09/08 19:32:20 1.1
+++ ConnectionInPool.java 2001/11/04 06:56:18 1.2
@@ -624,6 +624,13 @@
public PreparedStatement prepareStatement(String sql)
throws SQLException
{
+ return prepareStatement( new PSCacheKey( con, sql ) );
+ }
+
+ protected PreparedStatement prepareStatement( PSCacheKey pKey )
+ throws
+ SQLException
+ {
if (con == null)
{
throw new SQLException(CLOSED);
@@ -633,16 +640,20 @@
PreparedStatementInPool wrapper = null;
if (preparedStatementCacheSize >= 0)
{
- PreparedStatement ps =
(PreparedStatement)preparedStatementCache.useObject(sql);
+ PreparedStatement ps =
(PreparedStatement)preparedStatementCache.useObject( pKey );
if (ps == null)
{
throw new SQLException("Unable to create PreparedStatement!");
}
- wrapper = new PreparedStatementInPool(ps, this, sql);
+ wrapper = new PreparedStatementInPool(ps, this, pKey.sql);
}
else
{
- wrapper = new PreparedStatementInPool(con.prepareStatement(sql), this,
sql);
+ wrapper = new PreparedStatementInPool(
+ con.prepareStatement( pKey.sql, pKey.rsType, pKey.rsConcur ),
+ this,
+ pKey.sql
+ );
}
statements.add(wrapper);
return wrapper;
@@ -829,7 +840,9 @@
public PreparedStatement prepareStatement(String sql, int resultSetType, int
resultSetConcurrency)
throws SQLException
{
- return prepareStatement(sql);
+ return prepareStatement(
+ new PSCacheKey( con, sql, resultSetType, resultSetConcurrency )
+ );
}
/**
1.2 +14 -6
jbosscx/src/main/org/jboss/resource/adapter/jdbc/local/PreparedStatementFactory.java
Index: PreparedStatementFactory.java
===================================================================
RCS file:
/cvsroot/jboss/jbosscx/src/main/org/jboss/resource/adapter/jdbc/local/PreparedStatementFactory.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- PreparedStatementFactory.java 2001/09/08 19:32:20 1.1
+++ PreparedStatementFactory.java 2001/11/04 06:56:18 1.2
@@ -7,10 +7,18 @@
import org.jboss.pool.cache.CachedObjectFactory;
/**
- * Creates PreparedStatements for a PS cache. Doesn't yet handle different
+ * Creates PreparedStatements for a PS cache. Does now handle different
* isolation levels, etc.
*
* @author Aaron Mulder [EMAIL PROTECTED]
+ * @author <a href="mailto:[EMAIL PROTECTED]">Andreas Schaefer</a>
+ *
+ * <p><b>Revisions:</b></p>
+ * <p><b>20011103: Andy</b>
+ * <ul>
+ * <li>Now use PSCacheKey instead of plain SQL-Statement</li>
+ * </ul>
+ * </p>
*/
public class PreparedStatementFactory extends CachedObjectFactory
{
@@ -29,15 +37,15 @@
/**
* Creates a PreparedStatement from a Connection & SQL String.
*
- * @param sqlString Description of Parameter
- * @return Description of the Returned Value
+ * @param pCacheKey Cache Key containing the info
+ * @return Created prepared statement or null if creation failed
*/
- public Object createObject(Object sqlString)
+ public Object createObject( Object pCacheKey )
{
- String sql = (String)sqlString;
+ PSCacheKey lKey = (PSCacheKey) pCacheKey;
try
{
- return con.prepareStatement(sql);
+ return con.prepareStatement( lKey.sql, lKey.rsType, lKey.rsConcur );
}
catch (SQLException e)
{
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development