barak wrote:
Hi,
I wanted to know if there is a way in the new version of torque to use
"count *" (or any other count) from a peer.
I saw there is an option using CountHelper like this:
new CountHelper().count(new Criteria("MyDatabase").add(
some_kind_of_criterion ))
Is there a way to use something like this from the peer so I won't have
to insert my database name each peer?
I used to use something like the following for counting rows:
Criteria criteria = new Criteria();
criteria.addSelectColumn("COUNT(" + MytablePeer.ID + ")");
// add where conditions here ...
List result = BasePeer.doSelect(criteria);
int count = ((Record)result.get(0)).getValue(1).asInt();
Hope it helps
Bye, Thomas.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]