变更
This commit is contained in:
+5
-4
@@ -67,6 +67,7 @@ class Command extends Component
|
|||||||
{
|
{
|
||||||
[$pdo, $statement] = $this->search();
|
[$pdo, $statement] = $this->search();
|
||||||
|
|
||||||
|
$statement->execute($this->params);
|
||||||
$data = $statement->fetchAll(PDO::FETCH_ASSOC);
|
$data = $statement->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
$this->db->release($pdo);
|
$this->db->release($pdo);
|
||||||
@@ -82,6 +83,7 @@ class Command extends Component
|
|||||||
{
|
{
|
||||||
[$pdo, $statement] = $this->search();
|
[$pdo, $statement] = $this->search();
|
||||||
|
|
||||||
|
$statement->execute($this->params);
|
||||||
$data = $statement->fetch(PDO::FETCH_ASSOC);
|
$data = $statement->fetch(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
$this->db->release($pdo);
|
$this->db->release($pdo);
|
||||||
@@ -97,6 +99,7 @@ class Command extends Component
|
|||||||
{
|
{
|
||||||
[$pdo, $statement] = $this->search();
|
[$pdo, $statement] = $this->search();
|
||||||
|
|
||||||
|
$statement->execute($this->params);
|
||||||
$data = $statement->fetchColumn(PDO::FETCH_ASSOC);
|
$data = $statement->fetchColumn(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
$this->db->release($pdo);
|
$this->db->release($pdo);
|
||||||
@@ -112,6 +115,7 @@ class Command extends Component
|
|||||||
{
|
{
|
||||||
[$pdo, $statement] = $this->search();
|
[$pdo, $statement] = $this->search();
|
||||||
|
|
||||||
|
$statement->execute($this->params);
|
||||||
$data = $statement->rowCount();
|
$data = $statement->rowCount();
|
||||||
|
|
||||||
$this->db->release($pdo);
|
$this->db->release($pdo);
|
||||||
@@ -170,12 +174,9 @@ class Command extends Component
|
|||||||
{
|
{
|
||||||
$pdo = $this->db->getSlaveClient();
|
$pdo = $this->db->getSlaveClient();
|
||||||
try {
|
try {
|
||||||
if (($statement = $pdo->query($this->sql)) === false) {
|
if (($statement = $pdo->prepare($this->sql)) === false) {
|
||||||
throw new Exception($pdo->errorInfo()[1]);
|
throw new Exception($pdo->errorInfo()[1]);
|
||||||
}
|
}
|
||||||
foreach ($this->params as $key => $param) {
|
|
||||||
$statement->bindValue($key, $param);
|
|
||||||
}
|
|
||||||
return [$pdo, $statement];
|
return [$pdo, $statement];
|
||||||
} catch (\Throwable $throwable) {
|
} catch (\Throwable $throwable) {
|
||||||
if (str_contains($throwable->getMessage(), 'MySQL server has gone away')) {
|
if (str_contains($throwable->getMessage(), 'MySQL server has gone away')) {
|
||||||
|
|||||||
Reference in New Issue
Block a user