db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t.@apache.org
Subject svn commit: r1377462 - /db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/CountHelper.java
Date Sun, 26 Aug 2012 17:16:38 GMT
Author: tv
Date: Sun Aug 26 17:16:37 2012
New Revision: 1377462

URL: http://svn.apache.org/viewvc?rev=1377462&view=rev
Log:
Use generified instance

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=1377462&r1=1377461&r2=1377462&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 17:16:37 2012
@@ -318,20 +318,13 @@ public class CountHelper
 
         c.addSelectColumn(new Count(new ColumnImpl(columnName), distinct));
 
-        List<Integer> result;
-        if (conn == null)
-        {
-            result = new BasePeerImpl<Object>().doSelect(
-                    c,
-                    new IntegerMapper());
-        }
-        else
-        {
-            result = new BasePeerImpl<Object>().doSelect(
-                    c,
-                    new IntegerMapper(),
-                    conn);
-        }
+        BasePeerImpl<Integer> peer = new BasePeerImpl<Integer>(
+                new IntegerMapper(),
+                tableMap, c.getDbName());
+
+        List<Integer> result = (conn == null) ?
+            peer.doSelect(c) :
+            peer.doSelect(c, conn);
 
         return result.get(0);
     }
@@ -376,18 +369,13 @@ public class CountHelper
 
         c.addSelectColumn(new Count(new ColumnImpl(columnName), distinct));
 
-        BasePeerImpl<?> basePeerImpl = new BasePeerImpl<Object>();
-        basePeerImpl.setTableMap(tableMap);
-
-        List<Integer> result;
-        if (conn == null)
-        {
-            result = basePeerImpl.doSelect(c, new IntegerMapper());
-        }
-        else
-        {
-            result = basePeerImpl.doSelect(c, new IntegerMapper(), conn);
-        }
+        BasePeerImpl<Integer> peer = new BasePeerImpl<Integer>(
+                new IntegerMapper(),
+                tableMap, c.getDbName());
+
+        List<Integer> result = (conn == null) ?
+            peer.doSelect(c) :
+            peer.doSelect(c, conn);
 
         return result.get(0);
     }



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