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