那麼由於發佈的空間,我需要在這裏發佈: 情況1個查詢與原始參數,沒有結果:
--no results (parameter $v)
SELECT l0_.ISBN AS ISBN0, l0_.EAN AS EAN1, l0_.numeroPagines AS numeroPagines2,
l0_.preuLlibre AS preuLlibre3,
l0_.format AS format4,
l0_.dataPublicacio AS dataPublicacio5,
l0_.titolOriginal AS titolOriginal6,
l0_.disenyCoberta AS disenyCoberta7,
l0_.ilustrador AS ilustrador8, l0_.coleccio AS coleccio9, l0_.versioDe AS versioDe10,
l0_.descripcioCurta AS descripcioCurta11, l0_.urlMicroSite AS urlMicroSite12,
l0_.visibleInici AS visibleInici13, l0_.titol AS titol14, l0_.autor AS autor15,
l0_.descripcio AS descripcio16, l0_.imatge AS imatge17, l0_.id AS id18,
l0_.idUsuariCreacio AS idUsuariCreacio19, l0_.dataCreacio AS dataCreacio20,
l0_.idUsuariModificacio AS idUsuariModificacio21,
l0_.dataModificacio AS dataModificacio22,
l0_.userLock AS userLock23,
t1_.nomTag AS nomTag24,
t1_.tipusTag AS tipusTag25,
t1_.id AS id26,
t1_.idUsuariCreacio AS idUsuariCreacio27,
t1_.dataCreacio AS dataCreacio28,
t1_.idUsuariModificacio AS idUsuariModificacio29,
t1_.dataModificacio AS dataModificacio30,
t1_.userLock AS userLock31
FROM Llibre l0_ LEFT JOIN llibre_tag l2_
ON l0_.id = l2_.llibre_id
LEFT JOIN Tags t1_
ON t1_.id = l2_.tag_id
WHERE 1 = 1
AND t1_.id = '3'
**AND t1_.id = ''** <-- empty duplicated parameter (but why duplicated??)
ORDER BY l0_.titol ASC
同樣在這裏查詢與參數$ v = 3硬編碼
--1 result as expected (parameter $v)
SELECT l0_.ISBN AS ISBN0, l0_.EAN AS EAN1, l0_.numeroPagines AS numeroPagines2,
l0_.preuLlibre AS preuLlibre3,
l0_.format AS format4,
l0_.dataPublicacio AS dataPublicacio5,
l0_.titolOriginal AS titolOriginal6,
l0_.disenyCoberta AS disenyCoberta7,
l0_.ilustrador AS ilustrador8, l0_.coleccio AS coleccio9, l0_.versioDe AS versioDe10,
l0_.descripcioCurta AS descripcioCurta11, l0_.urlMicroSite AS urlMicroSite12,
l0_.visibleInici AS visibleInici13, l0_.titol AS titol14, l0_.autor AS autor15,
l0_.descripcio AS descripcio16, l0_.imatge AS imatge17, l0_.id AS id18,
l0_.idUsuariCreacio AS idUsuariCreacio19, l0_.dataCreacio AS dataCreacio20,
l0_.idUsuariModificacio AS idUsuariModificacio21,
l0_.dataModificacio AS dataModificacio22,
l0_.userLock AS userLock23,
t1_.nomTag AS nomTag24,
t1_.tipusTag AS tipusTag25,
t1_.id AS id26,
t1_.idUsuariCreacio AS idUsuariCreacio27,
t1_.dataCreacio AS dataCreacio28,
t1_.idUsuariModificacio AS idUsuariModificacio29,
t1_.dataModificacio AS dataModificacio30,
t1_.userLock AS userLock31
FROM Llibre l0_ LEFT JOIN llibre_tag l2_
ON l0_.id = l2_.llibre_id
LEFT JOIN Tags t1_
ON t1_.id = l2_.tag_id
WHERE 1 = 1
AND t1_.id = '3'
**AND t1_.id = '3'**
ORDER BY l0_.titol ASC
最後與不重複的其他參數的查詢..
--1 result as expected (parameter $v=4,$title="%quil%")
SELECT l0_.ISBN AS ISBN0, l0_.EAN AS EAN1, l0_.numeroPagines AS numeroPagines2,
l0_.preuLlibre AS preuLlibre3,
l0_.format AS format4,
l0_.dataPublicacio AS dataPublicacio5,
l0_.titolOriginal AS titolOriginal6,
l0_.disenyCoberta AS disenyCoberta7,
l0_.ilustrador AS ilustrador8, l0_.coleccio AS coleccio9, l0_.versioDe AS versioDe10,
l0_.descripcioCurta AS descripcioCurta11, l0_.urlMicroSite AS urlMicroSite12,
l0_.visibleInici AS visibleInici13, l0_.titol AS titol14, l0_.autor AS autor15,
l0_.descripcio AS descripcio16, l0_.imatge AS imatge17, l0_.id AS id18,
l0_.idUsuariCreacio AS idUsuariCreacio19, l0_.dataCreacio AS dataCreacio20,
l0_.idUsuariModificacio AS idUsuariModificacio21,
l0_.dataModificacio AS dataModificacio22,
l0_.userLock AS userLock23,
t1_.nomTag AS nomTag24,
t1_.tipusTag AS tipusTag25,
t1_.id AS id26,
t1_.idUsuariCreacio AS idUsuariCreacio27,
t1_.dataCreacio AS dataCreacio28,
t1_.idUsuariModificacio AS idUsuariModificacio29,
t1_.dataModificacio AS dataModificacio30,
t1_.userLock AS userLock31
FROM Llibre l0_ LEFT JOIN llibre_tag l2_
ON l0_.id = l2_.llibre_id
LEFT JOIN Tags t1_
ON t1_.id = l2_.tag_id
WHERE 1 = 1
AND l0_.titol LIKE '%quil%'
AND t1_.id = '3'
**AND t1_.id = '3**'
ORDER BY l0_.titol ASC
您應該先記錄SQL語句並查看傳遞給SQL層的內容。 – Ocramius 2013-02-26 17:44:46
您好奧克拉米斯,這裏的SQL日誌,我試了三個案件,似乎是t.id中的參數重複,我不明白。 – tero 2013-02-27 09:46:07