Laravel. SQLSTATE error[HY000]: General error: 2053 in processing several deliverables from MySQL
-
The annex works with the database through stored procedures. Some of them don't return one but some of the results. The problem is some platforms are making a mistake.
Performance/incapacity statistics:
- CentoS 5, Apache 2.2, Php 5.6 - It works.
- Fedora 23, Apache 2.4, Php 5.6 - It works.
- CentoS 6+, Apache 2.4, Php 5.6 - A mistake.
- Ubuntu 14.04, Apache 2.4, Php 5.6 - A mistake.
The following error:
SQLSTATE[HY000]: General error: 2053
Base and results management code
$pdo = DB::connection()->getPdo(); // все имена хранимых процедур и передаваемых параметров вымышлены, любое совпадение случайно ) $dataSets = $pdo->prepare("CALL procedureName($procedureParams)"); $dataSets->execute();
// первый результирующий набор
$setSingleFirst = array($dataSets->fetchAll(PDO::FETCH_CLASS, 'stdClass'));
$setComplex = [
'setSingleFirst' => $setSingleFirst[0]
];$dataSets->nextRowset();
// второй результирующий набор
$setSingleSecond = array($dataSets->fetchAll(PDO::FETCH_CLASS, 'stdClass'));
$setComplex += [
'setSingleSecond' => $setSingleSecond[0]
];return $setComplex;
During the rendezvous, he discovered that
$setSingleFirst
I get it, and it contains all the necessary data, but here for receipt.$setSingleSecond
I'm getting a mistake.What's the reason for some platforms doing things correctly and there's no other version. Php The same, the same modules are the same.
-
http://phpdelusions.net/pdo#call ♪ But if we try to read this, we'll get a mistake. You can use a vorcard.
PDOStatement::columnCount()
:$stmt = $pdo->prepare("CALL procedureName(?)"); $stmt->execute([$procedureParams]); $setSingleFirst = []; do { $setSingleFirst[] = $stmt->fetchAll(PDO::FETCH_OBJ); } while ($stmt->nextRowset() && $stmt->columnCount());
I cleaned the code. Separately put the result in the mass to get him back.