This commit is contained in:
2021-04-28 10:57:07 +08:00
parent 3e6e8ea824
commit e580072cb4
+1 -3
View File
@@ -152,9 +152,7 @@ class Command extends Component
if (!($query = $connect?->query($this->sql))) { if (!($query = $connect?->query($this->sql))) {
return $this->addError($connect->errorInfo()[2] ?? '数据库异常, 请稍后再试.'); return $this->addError($connect->errorInfo()[2] ?? '数据库异常, 请稍后再试.');
} }
Coroutine::defer(function () use ($query) { defer(fn() => $query->closeCursor());
$query->closeCursor();
});
if ($type === static::FETCH_COLUMN) { if ($type === static::FETCH_COLUMN) {
return $query->fetchAll(PDO::FETCH_ASSOC); return $query->fetchAll(PDO::FETCH_ASSOC);
} else if ($type === static::ROW_COUNT) { } else if ($type === static::ROW_COUNT) {