db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arm...@apache.org
Subject svn commit: r452277 - /db/ojb/trunk/src/java/org/apache/ojb/broker/accesslayer/RsIterator.java
Date Tue, 03 Oct 2006 00:07:38 GMT
Author: arminw
Date: Mon Oct  2 17:07:37 2006
New Revision: 452277

URL: http://svn.apache.org/viewvc?view=rev&rev=452277
Log:
fix bug, when GROUP BY is used we have to summarize all count(*) rows

Modified:
    db/ojb/trunk/src/java/org/apache/ojb/broker/accesslayer/RsIterator.java

Modified: db/ojb/trunk/src/java/org/apache/ojb/broker/accesslayer/RsIterator.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/java/org/apache/ojb/broker/accesslayer/RsIterator.java?view=diff&rev=452277&r1=452276&r2=452277
==============================================================================
--- db/ojb/trunk/src/java/org/apache/ojb/broker/accesslayer/RsIterator.java (original)
+++ db/ojb/trunk/src/java/org/apache/ojb/broker/accesslayer/RsIterator.java Mon Oct  2 17:07:37
2006
@@ -540,14 +540,20 @@
 
         try
         {
-            if (rsStmt.m_rs.next())
+            /*
+            arminw: if GROUP BY was used in query statement, the result will be a bunch
+            of single rows. Seems we can't remove GROUP BY from query, because in
+            BrokerHelper().getReportQueryByCriteriaCount there is a note that this
+            can't be removed. Thus we have to summarize all count(*) rows
+            */
+            while (rsStmt.m_rs.next())
             {
-                count = rsStmt.m_rs.getInt(1);
+                count += rsStmt.m_rs.getInt(1);
             }
         }
         catch (SQLException e)
         {
-            throw new PersistenceBrokerException(e);
+            throw new PersistenceBrokerSQLException(e);
         }
         finally
         {



---------------------------------------------------------------------
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