错误消息:SQL错误:SQL语法错误
SQL Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND domain = 'ard.qc' AND snapshot_id = 2010 AND locale = 'en_US'' at line 1
SQL查询:
SELECT
entity_id,
content_id
FROM collateral_cms_mapping
WHERE entity_id IN ({$entity_ids})
AND domain = '{$this->getSite()->getInternalId()}'
AND snapshot_id = {$this->getSnapshotDao()->getCurrentSnapshot()}
AND locale = '{$locale}'
实际SQL后的值被替换,字符串连接:
SELECT
entity_id,
content_id
FROM
collateral_cms_mapping
WHERE
entity_id
IN
()
AND
domain = 'ard.qc'
AND
snapshot_id = 2009
AND
locale = 'en_US'
有什么建议吗?
提供变量值的包装语言是什么?你可以发布整个查询变量解析吗? – 2010-01-04 20:30:59
建议将提供您的字符串连接/变量替换产生的实际语句。 – sberry 2010-01-04 20:31:03
我建议打印您正在运行的实际SQL查询,而不是生成它的代码。查看导致问题的特定查询时,问题会更加明显。 – Welbog 2010-01-04 20:31:28