db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t.@apache.org
Subject svn commit: r1377479 - /db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/CountHelper.java
Date Sun, 26 Aug 2012 18:43:34 GMT
Author: tv
Date: Sun Aug 26 18:43:34 2012
New Revision: 1377479

URL: http://svn.apache.org/viewvc?rev=1377479&view=rev
Log:
Allow counting in others than the default database

Modified:
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/CountHelper.java

Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/CountHelper.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/CountHelper.java?rev=1377479&r1=1377478&r2=1377479&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/CountHelper.java
(original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/CountHelper.java
Sun Aug 26 18:43:34 2012
@@ -33,6 +33,7 @@ import java.util.List;
 
 import org.apache.torque.Column;
 import org.apache.torque.ColumnImpl;
+import org.apache.torque.Torque;
 import org.apache.torque.TorqueException;
 import org.apache.torque.criteria.SqlEnum;
 import org.apache.torque.map.TableMap;
@@ -318,9 +319,13 @@ public class CountHelper
 
         c.addSelectColumn(new Count(new ColumnImpl(columnName), distinct));
 
+        String databaseName = (c.getDbName() == null) ?
+                Torque.getDefaultDB():
+                c.getDbName();
+
         BasePeerImpl<Integer> peer = new BasePeerImpl<Integer>(
                 new IntegerMapper(),
-                tableMap, c.getDbName());
+                tableMap, databaseName);
 
         List<Integer> result = (conn == null) ?
             peer.doSelect(c) :
@@ -369,9 +374,13 @@ public class CountHelper
 
         c.addSelectColumn(new Count(new ColumnImpl(columnName), distinct));
 
+        String databaseName = (c.getDbName() == null) ?
+                Torque.getDefaultDB():
+                c.getDbName();
+
         BasePeerImpl<Integer> peer = new BasePeerImpl<Integer>(
                 new IntegerMapper(),
-                tableMap, c.getDbName());
+                tableMap, databaseName);
 
         List<Integer> result = (conn == null) ?
             peer.doSelect(c) :



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


Mime
View raw message