How can I use a stored procedure in a MySql database with Zend Framework?

前端 未结 4 1270
無奈伤痛
無奈伤痛 2020-12-02 12:44

I\'m recently have learned to use Zend Framework. I did a simple CRUD application. But now I want to use a existing database for a more complex application and I want to kno

4条回答
  •  [愿得一人]
    2020-12-02 13:12

    Great answer from Bill. Just for completeness, if you encounter:

    SQLSTATE[HY000]: General error: 2053
    

    When using this method to get a result set from your procedure, check your arguments. I refactored a method and was passing NULLs as arguments to the procedure as the variables I'd used were out of scope. Once I'd fixed this silly mistake the problem went away (to be replaced by another):

    SQLSTATE[HY000]: General error: 2014 Cannot execute queries while other 
    unbuffered queries are active.  Consider using PDOStatement::fetchAll().
    

    I'm using $stmt->fetchAll() though. I switched to using prepare() and execute() in place of query(). Switching to mysqli from pdo_mysql in my Zend_Db config finally got things working for me. I found this information from the following SO question:

    Call Multiple Stored Procedures with the Zend Framework

提交回复
热议问题