Try something like:
Criteria c = new Criteria();
c.addSelectColumn("COUNT(" + colName + ")");
List result = doSelect();
Record rec = (Record) result.get(0);
int count = rec.getValue(1).asInt();
Where colName is the name of some small column in the table (can't remember
why, but "*" doesn't work when the query is done this way).
BTW: Have you looked at LargeSelect?
HTH,
Scott
--
Scott Eade
Backstage Technologies Pty. Ltd.
http://www.backstagetech.com.au
.Mac Chat/AIM: seade at mac dot com
On 3/02/2003 4:16 AM, "peter riegersperger" <[EMAIL PROTECTED]> wrote:
> hello!
>
> i'm using torque as part of a turbine project, and have spent some time now
> trying to figure out something i think is fairly basic:
> i'm using paginated lists of entries (limit and offset), but i need to know
> the number of total records for the given query (without limit and offset
> set) to calculate the total number of pages.
> i don't want to run the complete query (because i don't need the records), i
> just want to get a "Count(*) from ... where ..."
>
> how can this be done? i've tried and read the javadoc, and the tutorials and
> the list archive, but to no avail. is the solution _that_ obvious? (i sure
> hope not ... ;)
>
> i'd be greatful for any help, i'm definitely completely without the slightest
> idea.
>
> regards,
>
> rick
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]