You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by "Henning P. Schmiedehausen" <ma...@hometree.net> on 2001/05/08 14:50:54 UTC

Torque generated Peers quirk

Hi,

if I generate a BaseMyTablePeer with torque, I get

--- cut ---
public static Vector doSelectVillageRecords( Criteria criteria ) 
  throws Exception
{
  criteria.setDbName(mapBuilder.getDatabaseMap().getName());
  if (criteria.getSelectColumns().size() == 0)
  {
    addSelectColumns ( criteria );
  }
  return BasePeer.doSelect(criteria);
}
--- cut ---

but

--- cut ---
public static Vector doSelectVillageRecords( Criteria criteria, 
					       DBConnection dbCon ) 
  throws Exception
{
  addSelectColumns ( criteria );
  return BasePeer.doSelect(criteria, dbCon);
}
--- cut ---

Is there a reason that the first method tests on the number of already
existing select columns in the Criteria and the second does not?

Is it necessary at all, because in my understanding, adding a column
twice changes nothing at all.

	Regards
		Henning

-- 
Dipl.-Inf. (Univ.) Henning P. Schmiedehausen       -- Geschaeftsfuehrer
INTERMETA - Gesellschaft fuer Mehrwertdienste mbH     hps@intermeta.de

Am Schwabachgrund 22  Fon.: 09131 / 50654-0   info@intermeta.de
D-91054 Buckenhof     Fax.: 09131 / 50654-20   

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org


Re: Torque generated Peers quirk

Posted by John McNally <jm...@collab.net>.
The reason the checks are there is that in normal Peer operation the
columns are added by the Peer.  But making the check allows the method
to also be used to select an arbitrary set of columns.
So for example you could do a SELECT count(*) FROM ...

In this case you do not want the Peer to add additional columns.

The code should be in both places, I will fix as I am going to make
another change to these templates.

Thanks, 
john mcnally


"Henning P. Schmiedehausen" wrote:
> 
> Hi,
> 
> if I generate a BaseMyTablePeer with torque, I get
> 
> --- cut ---
> public static Vector doSelectVillageRecords( Criteria criteria )
>   throws Exception
> {
>   criteria.setDbName(mapBuilder.getDatabaseMap().getName());
>   if (criteria.getSelectColumns().size() == 0)
>   {
>     addSelectColumns ( criteria );
>   }
>   return BasePeer.doSelect(criteria);
> }
> --- cut ---
> 
> but
> 
> --- cut ---
> public static Vector doSelectVillageRecords( Criteria criteria,
>                                                DBConnection dbCon )
>   throws Exception
> {
>   addSelectColumns ( criteria );
>   return BasePeer.doSelect(criteria, dbCon);
> }
> --- cut ---
> 
> Is there a reason that the first method tests on the number of already
> existing select columns in the Criteria and the second does not?
> 
> Is it necessary at all, because in my understanding, adding a column
> twice changes nothing at all.
> 
>         Regards
>                 Henning
> 
> --
> Dipl.-Inf. (Univ.) Henning P. Schmiedehausen       -- Geschaeftsfuehrer
> INTERMETA - Gesellschaft fuer Mehrwertdienste mbH     hps@intermeta.de
> 
> Am Schwabachgrund 22  Fon.: 09131 / 50654-0   info@intermeta.de
> D-91054 Buckenhof     Fax.: 09131 / 50654-20
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-dev-help@jakarta.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org