Hamza,
I had a similar query a few weeks ago. My solution was to add a custom
method to the peer class that forms its own SQL query.
The code looks something like:
public static int getRowCount() throws Exception {
Vector v = executeQuery("select count(*) from " + TABLE_NAME);
Record r = (Record)v.elementAt(0);
return r.getValue(1).asInt();
}
I guess that a method like this could be added to
org.apache.turbine.om.peer.BasePeer. Its a bit restrictive though because
it only returns the count on the entire table. As soon as you wanted the
count to be restricted by some criteria, or the results to return more than
the count then you would be using doSelectVillageRecords or calling
executeQuery yourself anyway.
I saw a post which does something similar, but uses the Criteria object and
doSelectVillageRecords.
http://www.mail-archive.com/[email protected]/msg03916.html
Hope that helps,
Joel
> -----Original Message-----
> From: Hamza Rana [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, February 05, 2002 12:38 AM
> To: Turbine Users List
> Subject: [Query General] How to get Total No of records of a table?
>
>
> Hi every one
> i have simple question
> what is replacement for select count(*) as TotalNoOfRecords from TABLE
> i beleive there would be some method corresponding to this aggregate
> function as it is of much use.
>
> thanks in Advance
> Regards
> Hamza Rana
>
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>