db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mattba...@apache.org
Subject cvs commit: jakarta-ojb/src/java/org/apache/ojb/broker/accesslayer StatementsForClassImpl.java JdbcAccess.java
Date Fri, 20 Dec 2002 02:11:34 GMT
mattbaird    2002/12/19 18:11:34

  Modified:    src/java/org/apache/ojb/broker/accesslayer
                        StatementsForClassImpl.java JdbcAccess.java
  Log:
  remove hardcoded NOT_SCROLLABLE and SCROLLABLE settings, use the passed in value, or calculate
it appropriately
  
  Revision  Changes    Path
  1.8       +1 -1      jakarta-ojb/src/java/org/apache/ojb/broker/accesslayer/StatementsForClassImpl.java
  
  Index: StatementsForClassImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ojb/src/java/org/apache/ojb/broker/accesslayer/StatementsForClassImpl.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- StatementsForClassImpl.java	5 Oct 2002 16:46:05 -0000	1.7
  +++ StatementsForClassImpl.java	20 Dec 2002 02:11:34 -0000	1.8
  @@ -185,7 +185,7 @@
   			 * just move to the use of the SQLCachingStatementsForClass as it does this already
   			 */
   
  -            stmt = prepareStatement(sql, Query.SCROLLABLE);
  +            stmt = prepareStatement(sql, scrollable);
           }
           catch (java.sql.SQLException ex)
           {
  
  
  
  1.24      +17 -3     jakarta-ojb/src/java/org/apache/ojb/broker/accesslayer/JdbcAccess.java
  
  Index: JdbcAccess.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ojb/src/java/org/apache/ojb/broker/accesslayer/JdbcAccess.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- JdbcAccess.java	13 Dec 2002 10:52:41 -0000	1.23
  +++ JdbcAccess.java	20 Dec 2002 02:11:34 -0000	1.24
  @@ -230,7 +230,21 @@
           logger.safeDebug("executeQuery", query);
           
           ResultSetAndStatement retval = new ResultSetAndStatement();
  +		/**
  +		 * MBAIRD:
  +		 * we should create a scrollable resultset if the start at index or end at index is set
  +		 */
   		boolean scrollable = ((query.getStartAtIndex() > Query.NO_START_AT_INDEX) || (query.getEndAtIndex()
> Query.NO_END_AT_INDEX));
  +		/**
  +		 * OR if the prefetching of relationships is being used.
  +		 */
  +		if (query != null &&
  +			query.getCriteria() != null &&
  +			!query.getCriteria().getPrefetchedRelationships().isEmpty())
  +		{
  +			scrollable = true;
  +		}
  +
           try
           {
               // if query has criteria, use them in where clause
  @@ -283,7 +297,7 @@
           ResultSetAndStatement retval = new ResultSetAndStatement();
           try
           {
  -            Statement stmt = broker.getStatementManager().getGenericStatement(cld, Query.SCROLLABLE);
  +            Statement stmt = broker.getStatementManager().getGenericStatement(cld, Query.NOT_SCROLLABLE);
               ResultSet rs = stmt.executeQuery(sqlStatement);
               // as we return the resultset for further operations, we cannot release the
statement yet.
               // that has to be done by the JdbcAccess-clients (i.e. RsIterator, ProxyRsIterator
and PkEnumeration.)
  @@ -318,7 +332,7 @@
           Statement stmt = null;
           try
           {
  -             stmt = broker.getStatementManager().getGenericStatement(cld, Query.SCROLLABLE);
  +             stmt = broker.getStatementManager().getGenericStatement(cld, Query.NOT_SCROLLABLE);
                result = stmt.executeUpdate(sqlStatement);
           }
           catch (PersistenceBrokerException e)
  
  
  

Mime
View raw message