Re: Possible DB_DataObject bug with joins
| From: | Didier Galland | Date: | Tue, 21 Nov 2006 18:59:47 +0000 |
| Subject: | Re: Possible DB_DataObject bug with joins | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-25897@lists.php.net to get a copy of this message | ||
cron@odi.com.br a écrit :
$usuario = DB_DataObject::factory("usuario"); $regional = DB_DataObject::factory("regional"); $usuario->strnome = "nome33"; $usuario->joinAdd($regional, "INNER", "regional", "idregional"); insert here$usuario->selectAs();
usuario->selectAs(array('id','strregional'), "regional_%s","regional"); Resulting select SELECT *, regional.id as regional_id , regional.strregional as regional_strregional FROM usuario INNER JOIN regional ON regional.id=usuario.idregional WHERE ( strnome ILIKE '%nome33%' ) Note the *, fields. Does not matter if i use selectAs to select only 2 fields, the * will return all fields from all tables in the join. Not elegant fix, fit it is a fix: Replace (line 2563): return $class; Width: $objClass = new $class; $objClass->_query['data_select'] = $table . ".*"; return $objClass; Ps: No idea if it has collateral damages. Cron___________________________________________________________________________ Yahoo! Mail réinvente le mail ! Découvrez le nouveau Yahoo! Mail et son interface révolutionnaire. http://fr.mail.yahoo.com