}
try {
// 调试开始
// 预处理
$this->PDOStatement = $pdo->prepare($sql);
// 参数绑定
$this->bindValue($bind);
// 执行查询
$this->PDOStatement->execute();
} catch (\PDOException $e) {
$error = $e->errorInfo;
//2006和2013表示表示连接失败,需要重连接
if ($error[ 1 ] == 2006 || $error[ 1 ] == 2013) {
$this->pdo = null;
$this->connect();
$this->execute($sql, $bind);
} else {
throw $e;
}
}
}
/**
* 切换数据库
*
* @param string $db
*/
public function userDb($db) {
$pdo = $this->connect();
// 根据参数绑定组装最终的SQL语句
try {
$pdo->exec("use " . $db);
} catch (\PDOException $e) {
$error = $e->errorInfo;
//2006和2013表示表示连接失败,需要重连接
if ($error[ 1 ] == 2006 || $error[ 1 ] == 2013) {
$this->pdo = null;
$this->connect();
$this->userDb($db);
trace调用栈
PDOStatement->execute(...)
rap\db\Connection->execute(...)
rap\db\Update->excuse(...)
app\core\help\ClickCache::click(...)
app\house\pc\controller\HomeController->secondHandPersonalDetail(...)
ReflectionMethod->invokeArgs(...)
rap\web\mvc\HandlerAdapter->invokeRequest(...)
rap\web\mvc\ControllerHandlerAdapter->handle(...)
rap\web\mvc\Dispatcher->doDispatch(...)
rap\web\Application->start(...)
require(...)