>
> I am getting this error:
> Integrity constraint violation: 1062 Duplicate entry '20410' for key 1
>
The query() method is the equivalent of doing a prepare() followed by an
execute().
So if you use query() you don't need to execute() as second time. Doing
this redundantly is no problem for the delete statement, since the second
execute will simply find no matching rows (they've already been deleted).
It is a problem, however, for insert, because you're trying to insert a
second row with the same primary key value, and this is causing the
duplicate entry error.
For what it's worth, the "cardinality violation" error, as you found out, is
due to comparing a single value to a multi-value tuple. MySQL allows
comparisons like "(a, b, c) = (1, 2, 3)" so you can compare multiple things
at once. But of course you must have the same number of items (i.e. the
same cardinality) in each list. You were getting multiple columns returned
by the subquery because the default columns fetched by the Zend_Db_Select
interface are '*'.
Regards,
Bill Karwin
--
View this message in context: http://www.nabble.com/Cardinality-Violation---executing-queries-tp18772524p18776592.html
Sent from the Zend DB mailing list archive at Nabble.com.
没有评论:
发表评论