zend-db icon indicating copy to clipboard operation
zend-db copied to clipboard

Error : Prepared statement needs to be re-prepared

Open GeeH opened this issue 9 years ago • 2 comments

This issue has been moved from the zendframework repository as part of the bug migration program as outlined here - http://framework.zend.com/blog/2016-04-11-issue-closures.html


Original Issue: https://api.github.com/repos/zendframework/zendframework/issues/7331 User: @balalinux Created On: 2015-03-17T05:29:20Z Updated At: 2015-11-06T21:38:55Z Body Hi Team,

Not really sure if this is a bug. Im getting the below error while using Zend\Db\Adapter with Mysqli driver. "Prepared statement needs to be re-prepared" This happens only for the queries which uses the mysql views. Any idea on why this occurs ? Google search suggests to use Pdo_Mysql driver to get rid of this problem. Is this a known issue with Zend2 + Mysqli ? Please let me know.

Thanks.


Comment

User: @visitek Created On: 2015-03-24T20:17:12Z Updated At: 2015-03-24T20:17:12Z Body We had this problem on old mysql. Update is needed.


Comment

User: @balalinux Created On: 2015-03-25T06:59:33Z Updated At: 2015-03-25T06:59:33Z Body I see that we use 10.0.15-MariaDB-1~trusty-log. Any idea on from which version this would work fine ?


Comment

User: @balalinux Created On: 2015-05-12T10:24:04Z Updated At: 2015-05-12T10:24:04Z Body Can you please tell me on which version you found this working ?


Comment

User: @Martin-P Created On: 2015-05-12T14:49:17Z Updated At: 2015-05-12T14:49:17Z Body Perhaps the notes in the MySQL bug report can help: http://bugs.mysql.com/bug.php?id=42041


GeeH avatar Jun 28 '16 13:06 GeeH

I've fixed it temporarily with:

$_reflection = new \ReflectionObject($model);
            $_property   = $_reflection->getProperty('isInitialized');
            $_property->setAccessible(true);
            $_property->setValue($model, false);
            $_property->setAccessible(false);
            $_property = $_reflection->getProperty('sql');
            $_property->setAccessible(true);
            $_property->setValue($model, null);
            $_property->setAccessible(false);

it smells, but only way to flush sql from tablegateway

visitek avatar Jun 28 '16 14:06 visitek

This repository has been closed and moved to laminas/laminas-db; a new issue has been opened at https://github.com/laminas/laminas-db/issues/116.

michalbundyra avatar Jan 16 '20 19:01 michalbundyra