mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-07 23:22:48 +08:00
改进数据库驱动类的异常处理
This commit is contained in:
@@ -160,6 +160,7 @@ abstract class Driver {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->bind = [];
|
$this->bind = [];
|
||||||
|
try{
|
||||||
$result = $this->PDOStatement->execute();
|
$result = $this->PDOStatement->execute();
|
||||||
// 调试结束
|
// 调试结束
|
||||||
$this->debug(false);
|
$this->debug(false);
|
||||||
@@ -169,6 +170,11 @@ abstract class Driver {
|
|||||||
} else {
|
} else {
|
||||||
return $this->getResult();
|
return $this->getResult();
|
||||||
}
|
}
|
||||||
|
}catch (\PDOException $e) {
|
||||||
|
$this->error();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -207,6 +213,7 @@ abstract class Driver {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->bind = [];
|
$this->bind = [];
|
||||||
|
try{
|
||||||
$result = $this->PDOStatement->execute();
|
$result = $this->PDOStatement->execute();
|
||||||
$this->debug(false);
|
$this->debug(false);
|
||||||
if ( false === $result) {
|
if ( false === $result) {
|
||||||
@@ -219,6 +226,11 @@ abstract class Driver {
|
|||||||
}
|
}
|
||||||
return $this->numRows;
|
return $this->numRows;
|
||||||
}
|
}
|
||||||
|
}catch (\PDOException $e) {
|
||||||
|
$this->error();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user