For Oracle (and DB2), there is no LIMIT clause. So ZF emulate this on
the fly:
SELECT "INDIVIDUS".*, "AFF".*
FROM "EAI_TA_INDIVIDUS" "INDIVIDUS"
INNER JOIN "EAI_TA_AFFECTATIONS" "AFF" ON INDIVIDUS.IND_ID = AFF.IND_ID
WHERE (INDIVIDUS.ANN_ANNEE = 2009) AND (INDIVIDUS.IND_MATRICULE = '17483')
becomes:
SELECT z2.*
FROM (
SELECT z1.*, ROWNUM AS "zend_db_rownum"
FROM (
SELECT "INDIVIDUS".*, "AFF".*
FROM "EAI_TA_INDIVIDUS" "INDIVIDUS"
INNER JOIN "EAI_TA_AFFECTATIONS" "AFF" ON INDIVIDUS.IND_ID =
AFF.IND_ID
WHERE (INDIVIDUS.ANN_ANNEE = 2009) AND (INDIVIDUS.IND_MATRICULE =
'17483')
) z1
) z2
WHERE z2."zend_db_rownum" BETWEEN 1 AND 1
In this case Oracle (or DB2) is not able to resolve z1.*
We have 2 failures in ZF unit tests for this (see ZF-3168's comments):
2)
testTableRelationshipFindManyToManyRowsetSelect(Zend_Db_Table_Relationships_OracleTest)
3)
testTableRelationshipMagicFindManyToManyRowsetSelect(Zend_Db_Table_Relationships_OracleTest)
A rapid workaround is to realize a fetchAll()->current() instead of
fetchRow().
Mickael
Thomas VEQUAUD a écrit :
>
> Trust me I tried everything with Zend and nothing works.
> Actually, it's a bug with Oracle database :
> http://framework.zend.com/issues/browse/ZF-3168
>
> I have to deliver my web application for Monday... Bad weekend expected!
>
> --
> Thomas VEQUAUD http://thomas.vequaud.free.fr/
> Expert EPITECH en Ingénierie Informatique
> Tél : +33(0)6.50.39.28.10 Fax: +33(0)9.58.46.10.07
>
>
> On Fri, Feb 27, 2009 at 11:40 PM, PHPScriptor <contact@phpscriptor.com
> <mailto:contact@phpscriptor.com>> wrote:
>
>
> Oh yeah, I see it, didn't look good enough... anyway. You should
> rename one
> of the id's.
>
> e.g. the one from INDIVIDUS: IND_ID AS BLABLA. But better I think, you
> should only let the select, select one of the two id's.
>
> e.g.
> $select->joinInner(array("AFF" => "EAI_TA_AFFECTATIONS"),
> 'INDIVIDUS.IND_ID = AFF.IND_ID',array('field1','field2','field3));
> so the 3the parameter is the fields you want to select from this
> table.
> Select them all but not IND_ID.
>
> http://www.phpscriptor.com/tutorial/zend/zend.db.select.html#zend.db.select.building.join
> http://www.phpscriptor.com/tutorial/zend/zend.db.select.html#zend.db.select.building.join
>
>
> Thomas VEQUAUD wrote:
> >
> > Yep I have an IND_ID in each tables... That's why I don't
> understand this
> > issue...
> > If you've got another idea... Just show me the right way! ;)
> >
>
没有评论:
发表评论