modify
This commit is contained in:
@@ -196,14 +196,22 @@ class Command extends Component
|
|||||||
|
|
||||||
return $this->addError($this->sql . ':' . $error, 'mysql');
|
return $this->addError($this->sql . ':' . $error, 'mysql');
|
||||||
}
|
}
|
||||||
|
$result = $this->checkResponse($prepare, $connect);
|
||||||
|
$prepare->closeCursor();
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private function checkResponse($prepare, $connect)
|
||||||
|
{
|
||||||
$result = $prepare->execute($this->params);
|
$result = $prepare->execute($this->params);
|
||||||
defer(fn() => $prepare->closeCursor());
|
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
return $this->addError($connect->errorInfo()[2], 'mysql');
|
return $this->addError($connect->errorInfo()[2], 'mysql');
|
||||||
}
|
}
|
||||||
return (int)$connect->lastInsertId();
|
return (int)$connect->lastInsertId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $modelName
|
* @param $modelName
|
||||||
* @return $this
|
* @return $this
|
||||||
|
|||||||
Reference in New Issue
Block a user