hi, 
i have found a way to get over with this problem which i want to share
with you guys. I hope this works with all of u as well. for each peer
class for which u need getCount method u can declare the following
function

   public static int getCount(Criteria crit)
     {

        try{
            Vector v = new Vector();
            crit.addAsColumn("counter","count(*)"); // adding a column
to get the count of the records. The limitation is              //that
you cannot have COUNTER as your column in table. If u have this
situation you can choose some else string               //literal 
            String query = createQueryString(crit); // this query the
data base with the desire criteria 

            v = executeQuery(query);
            Record row = (Record)v.elementAt(0);
            return row.getValue("counter").asInt(); // this gets the
information about the counter value 
        }
        catch(Exception e)
        {
            e.printStackTrace(); 
        }
            return 0;
     }
this works for all peer classes. we can shift this code to the BasePeer
class as well. Per at the moment its working fine at <table>Peer class
well. 
regards
Hamza Rana 

-----Original Message-----
From: Hamza Rana 
Sent: Monday, February 04, 2002 7:38 PM
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]>

Reply via email to