Hi, there seems to be an issue with EE 3.2 executing custom queries when installing add-ons.
I have made a bare-bones add-on which does nothing except execute a simple, safe query when the install() method is called in upd.sample.php class.
ee()->db->query("DROP FUNCTION IF EXISTS SOMEFUNCTION;");
Since I can’t upload a .zip or .php file here, I will instead e-mail the add-on to you on [email protected].
The error it dies with is as follows:
SQLSTATE[HY000]: General error: 2014 Cannot execute queries while other unbuffered queries are active. Consider using PDOStatement::fetchAll(). Alternatively, if your code is only ever going to run against mysql, you may enable query buffering by setting the PDO::MYSQL_ATTR_USE_BUFFERED_QUERY attribute.:
DROP FUNCTION IF EXISTS SOMEFUNCTION;
The error message is quite descriptive and I imagine that some data is fetched before the install method gets called and it doesn’t tell MYSQL to close the cursor just yet, and is iterating through the fetched results one-by-one, thus preventing any other queries from being executed while the cursor hasn’t been released yet.
I tried to pinpoint the cause of this, but failed to find the problem. Could you please take a look at this?
EE 3.1 doesn’t have this problem.
Our Solspace Super Search add-on has been using this very same approach to drop and then create a MYSQL function successfully for years, never once has this been a problem before.
Thank you very much.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.