I would like to use ON DUPLICATE KEY UPDATE in Zend Framework 1.5, is this possible?
Example
INSERT INTO sometable (...) VALUES (...) ON DUPLICATE KEY UPDATE ...
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I worked for Zend and specifically worked on Zend_Db quite a bit.
No, there is no API support for the
ON DUPLICATE KEY UPDATEsyntax. For this case, you must simply usequery()and form the complete SQL statement yourself.I do not recommend interpolating values into the SQL as harvejs shows. Use query parameters.
Edit: You can avoid repeating the parameters by using
VALUES()expressions.