Hi:

I do not like the idea:

        BasePeer.doGroupSelect(criteria, Criteria.COUNT);


In fact the current BasePeer version support   sql clause like:      select
count(id) from abc;

You can just use:

        criteria.addSelectColumn("count("+AbcPeer.ID+")");
        AbcPeer.doRowSelect(criteria);
        .....
        ....


If you want use it in a group by enviroment:   select count(id) from abc
group by name;        I suggest something like:

        criteria.addSelectColumn("count("+AbcPeer.ID+")");          //this is
already supported in BasePeer, you can also use max, min ....
        criteria.addGroupbyColumn(AbcPeer.NAME);
        AbcPeer.doSelect(criteria);
        .....
        .....

The advantage of this is it looks the same with normal  Peer operation.


Regards

fanyun


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
Behalf Of Oskar Owida
Sent: Friday, February 09, 2001 11:01 PM
To: Turbine
Subject: Re: Peer code extensions and discussion about Peer


Let's merge these ideas...

What about function
      doGroupSelect(Criteria criteria, String function) ?

Usage could work like this:

      Criteria criteria = new Criteria().add(SomePeer.SomeField,"value");

      BasePeer.doGroupSelect(criteria,"count")     or
BasePeer.doGroupSelect(criteria,Criteria.COUNT)

And behavior:
  similar to doSelect but query string generated by this method
  looks like this:
    select count(table.somefield) from table where table.somefield=value

i.e. - we wrap all fields from Criteria by count(...) function
This is also solution for MAX,MIN etc.

                                        Oskar



------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?:           [EMAIL PROTECTED]








------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?:           [EMAIL PROTECTED]

Reply via email to