org.apache.torque.util
Class CountHelper

java.lang.Object
  extended by org.apache.torque.util.CountHelper

public class CountHelper
extends java.lang.Object


Constructor Summary
CountHelper()
           
 
Method Summary
 int count(Criteria c)
          The COUNT function returns the number of rows in a query.
 int count(Criteria c, java.sql.Connection conn)
          The COUNT function returns the number of rows in a query.
 int count(Criteria c, java.sql.Connection conn, java.lang.String columnName)
          Returns the number of rows in a query.
 int count(Criteria c, java.lang.String columnName)
          Returns the number of rows in a query.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CountHelper

public CountHelper()
Method Detail

count

public int count(Criteria c)
          throws TorqueException
The COUNT function returns the number of rows in a query. Does not use a connection, hardcode the column to "*" and set the distinct qualifier to false. Only use this function if you have added additional constraints to the criteria, otherwise Torque does not know which table it should count the datasets in.

Parameters:
c - Criteria to get the count for.
Returns:
number of rows matching the query provided
Throws:
TorqueException - if the query could not be executed

count

public int count(Criteria c,
                 java.sql.Connection conn)
          throws TorqueException
The COUNT function returns the number of rows in a query. Hard code the distinct parameter to false and set the column to "*". Only use this function if you have added additional constraints to the criteria, otherwise Torque does not know which table it should count the datasets in.

Parameters:
c - Criteria to get the count for.
conn - Connection to use
Returns:
number of rows matching the query provided
Throws:
TorqueException - if the query could not be executed

count

public int count(Criteria c,
                 java.lang.String columnName)
          throws TorqueException
Returns the number of rows in a query.

Parameters:
c - Criteria to get the count for.
columnName - Name of database Column which is counted. Preferably, use the primary key here.
Returns:
number of rows matching the query provided
Throws:
TorqueException - if the query could not be executed

count

public int count(Criteria c,
                 java.sql.Connection conn,
                 java.lang.String columnName)
          throws TorqueException
Returns the number of rows in a query.

Parameters:
c - Criteria to get the count for.
conn - Connection to use
columnName - Name of database Column which is counted. Preferably, use the primary key here.
Returns:
number of rows matching the query provided
Throws:
TorqueException - if the query could not be executed


Copyright © 2000-2012 Apache Software Foundation. All Rights Reserved.