I have something like the following, in a function that deletes both the files and db entries:
$adapter = $this->getAdapter();
$query = $adapter->query("call find_results_by_job_id(?)", array($jobId));
$items = array();
while (($current = $query->current()) !== false)
$id = $current['id'];
$items = $id;
$result = $adapter->query("call delete_results_by_job_id(?)", array($jobId), \Zend\Db\Adapter\Adapter::QUERY_MODE_EXECUTE);
SQLSTATE[HY000]: General error: 2014 Cannot execute queries while other unbuffered queries are active.
Seems like you are using an unbuffered query in MySQL.
If it is so, you will either have to turn buffering on or break execution of previous query which seems to hang?
$query is instance of
StatementInterface, then there is
getResource() which returns
mysqli_stmt and you can call
close() on it.
EDIT2: (to incorporate final resolution)
In case it uses PDO, you can get
PDOStatement and call