title: 'PDOException' with message 'SQLSTATE[HY000]: General error: 2014 Cannot execute queries while other unbuffered queries are active
body: <p>I know this question has been asked many times, but the commonly-accepted answers didn't help me.  But quite by accident I stumbled on an answer.</p>
  
  <p>Here's the setup: I had a load of queries (mostly CREATE TABLE) going through a connection.  But a CREATE TRIGGER kept throwing up the dreaded 2014 error.  This was nothing to do with open cursors, becasue it happened even when it was the only command in the program.  This, for example, failed:</p>
  
  <pre><code>&lt;?php
  $db = new PDO ($cnstring, $user, $pwd);
  $db-&gt;setAttribute (PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  $db-&gt;setAttribute (PDO::ATTR_EMULATE_PREPARES, false);
  $db-&gt;setAttribute (PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);
  
  $st = $db-&gt;query ("CREATE TRIGGER `CirclesClosureSync` AFTER INSERT ON Circles
  FOR EACH ROW BEGIN
      INSERT INTO CirclesClosure (ancestor, descendant) 
      SELECT ancestor, NEW.ID from CirclesClosure WHERE descendant=NEW.Parent;
      INSERT INTO CirclesClosure (ancestor, descendant) values (NEW.ID, NEW.ID);
  END;");
  
  $st-&gt;closeCursor();
  ?&gt;
  </code></pre>
  
  <p>This seemed similar to other problems involving creating stored procedures.  </p>
  
  <p>This is php 5.4.5, MySql 5.5, Windows XP (though it failed on other windows' too)</p>