Sunday, November 18, 2012

Re: Calling MySQL5 Stored Procedures

I have to call a store procedure on my cakephp can anybpdy tell me how to do it ? 

On Tuesday, October 16, 2007 8:11:46 PM UTC+5, beverly.guillermo wrote:
Hi all,

Just thought I'd post my workaround based on some of the posts here
but I didn't see a consistent answer to the issue.  My environment is
PHP 5.2.3, Apache 2.2.6, and MySQL 5.0.41-community.

So, here's the problem, I have a stored procedure that I want to call
in Cake.  When I try to run the $this->model->query("call
sp_mine(params)"); or  $this->model->_call, I don't get anything back
and an mysql error occurs.

   Error 1312 - PROCEDURE <...> can't return a result set in the given
context: nothing returned

To resolve this, I had to modify the connect call to the database in
dbo_mysql.php to include a client flag, specifically
CLIENT_MULTI_RESULTS or CLIENT_MULTI_STATEMENTS or 65536.  But after
implementing this and calling my stored procedure I go another mysql
error:

  Error 2014 - Commands out of sync; you can't run this command now

I get this for any query or execute that I attempt to call.  And per a
post from blunt, I added this function

    function releaseDB() {
         $db =& ConnectionManager::getDataSource($this->useDbConfig);
         $db->disconnect();
         $db->connect();
    }

to my model_php5.php.  After every sp call, I call that method.


If anyone has a better resolution or if it's fixed in the current cake
version and I'm not doing something right, then let me know. :P

Thanks,
Beverly

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
 
 

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate