好吧,由于帖子空间,我需要在这里发布:案例 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