Closed
Description
Migrated from laravel 5.0 to 5.1 and try to use nested transactions (MySQL)
Wile try to call \DB::beginTransaction(); in second time
here is an error
'SQLSTATE[HY000]: General error: 2030 This command is not supported in the prepared statement protocol yet (SQL: SAVEPOINT trans2)'
investigating here
https://github.com/laravel/framework/blob/5.1/src/Illuminate/Database/Connection.php#L509
/**
* Start a new database transaction.
*
* @return void
*/
public function beginTransaction()
{
++$this->transactions;
if ($this->transactions == 1) {
$this->pdo->beginTransaction();
} elseif ($this->transactions > 1 && $this->queryGrammar->supportsSavepoints()) {
$this->statement(
$this->queryGrammar->compileSavepoint('trans'.$this->transactions)
);
}
$this->fireConnectionEvent('beganTransaction');
}
think framework try to bind and execute params on that command
here https://github.com/laravel/framework/blob/5.1/src/Illuminate/Database/Connection.php#L381
public function statement($query, $bindings = [])
{
return $this->run($query, $bindings, function ($me, $query, $bindings) {
if ($me->pretending()) {
return true;
}
// CODE passes here
$bindings = $me->prepareBindings($bindings);
return $me->getPdo()->prepare($query)->execute($bindings);
});
}
Think its help to fix this
Metadata
Metadata
Assignees
Labels
No labels