This commit is contained in:
2023-08-11 14:02:51 +08:00
parent d96f1c27a5
commit dc73de9abd
+4 -3
View File
@@ -187,15 +187,16 @@ class Command extends Component
$result = $client->lastInsertId(); $result = $client->lastInsertId();
$prepare->closeCursor(); $prepare->closeCursor();
if (!$client->inTransaction()) {
$this->connection->release($client);
}
return $result == 0 ? true : (int)$result; return $result == 0 ? true : (int)$result;
} catch (Throwable $throwable) { } catch (Throwable $throwable) {
if ($this->canReconnect($throwable->getMessage())) { if ($this->canReconnect($throwable->getMessage())) {
return $this->_execute(); return $this->_execute();
} }
return $this->error($throwable); return $this->error($throwable);
} finally {
if (isset($client) && !$client->inTransaction()) {
$this->connection->release($client);
}
} }
} }