OK, this is not a patch, rather two new methods for BasePeer class.
Look at them,please and send comments
// This is method for counting ALL records in a given table
// IDEA: during Peer generation, torque can create getCountAll() method
// because we know table name
public static int getCountAll(String tablename) throws Exception {
Vector result = executeQuery("select count(*) from "+tablename,
getMapBuilder().getDatabaseMap().getName(),
true);
return
((com.workingdogs.village.Record)result.firstElement()).getValue(1).asInt();
}
// This is method for counting records with specified Criteria
public static int getCount(Criteria criteria) throws Exception
{
String column = null;
Enumeration keys = criteria.keys();
if (keys.hasMoreElements())
{
column = (String)keys.nextElement();
}
else
{
throw new Exception("Cannot determine any column to select.");
}
criteria.addSelectColumn(column);
Vector rows = null;
rows = doSelect(criteria);
return rows.size();
}
Regards
Oskar
>Sounds useful - submit a patch :-)
>
>--
>Sean Legassick
>[EMAIL PROTECTED]
> Jeg er mann: Ingenting menneskelig er fremmed for meg
>
>
------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?: [EMAIL PROTECTED]