db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b..@apache.org
Subject cvs commit: db-ojb/src/java/org/apache/ojb/broker/accesslayer SqlBasedRsIterator.java
Date Fri, 08 Aug 2003 18:48:01 GMT
brj         2003/08/08 11:48:01

  Modified:    src/java/org/apache/ojb/broker/accesslayer
                        SqlBasedRsIterator.java
  Log:
  OJB196: get rid of ORDER BY in select count(*). by Patrick Shea
  
  Revision  Changes    Path
  1.18      +10 -4     db-ojb/src/java/org/apache/ojb/broker/accesslayer/SqlBasedRsIterator.java
  
  Index: SqlBasedRsIterator.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/accesslayer/SqlBasedRsIterator.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- SqlBasedRsIterator.java	3 Aug 2003 09:27:40 -0000	1.17
  +++ SqlBasedRsIterator.java	8 Aug 2003 18:48:01 -0000	1.18
  @@ -118,12 +118,18 @@
           String countSql = "";
           ResultSetAndStatement rsStmt;
           int count = 0;
  -        int fromPos;
   
  -        fromPos = m_sql.toUpperCase().indexOf(" FROM ");
  +        int fromPos = m_sql.toUpperCase().indexOf(" FROM ");
           if (fromPos >= 0)
           {
  -            countSql = "select count(*) " + m_sql.substring(fromPos);
  +            countSql = "select count(*)" + m_sql.substring(fromPos);
  +        }
  +        
  +        // BRJ: cut before ORDER BY
  +        int orderPos = countSql.toUpperCase().indexOf(" ORDER BY ");
  +        if (orderPos >= 0)
  +        {
  +            countSql = countSql.substring(0, orderPos);
           }
   
           rsStmt = m_broker.serviceJdbcAccess().executeSQL(countSql, m_cld, Query.NOT_SCROLLABLE);
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Mime
View raw message