{{info}}
{{msg}}
  
  1. }
  2. try {
  3. // 调试开始
  4. // 预处理
  5. $this->PDOStatement = $pdo->prepare($sql);
  6. // 参数绑定
  7. $this->bindValue($bind);
  8. // 执行查询
  9. $this->PDOStatement->execute();
  10. } catch (\PDOException $e) {
  11. $error = $e->errorInfo;
  12. //2006和2013表示表示连接失败,需要重连接
  13. if ($error[ 1 ] == 2006 || $error[ 1 ] == 2013) {
  14. $this->pdo = null;
  15. $this->connect();
  16. $this->execute($sql, $bind);
  17. } else {
  18. throw $e;
  19. }
  20. }
  21. }
  22. /**
  23. * 切换数据库
  24. *
  25. * @param string $db
  26. */
  27. public function userDb($db) {
  28. $pdo = $this->connect();
  29. // 根据参数绑定组装最终的SQL语句
  30. try {
  31. $pdo->exec("use " . $db);
  32. } catch (\PDOException $e) {
  33. $error = $e->errorInfo;
  34. //2006和2013表示表示连接失败,需要重连接
  35. if ($error[ 1 ] == 2006 || $error[ 1 ] == 2013) {
  36. $this->pdo = null;
  37. $this->connect();
  38. $this->userDb($db);
trace调用栈
    
  1. PDOStatement->execute(...)
  2. rap\db\Connection->execute(...)
  3. rap\db\Update->excuse(...)
  4. app\core\help\ClickCache::click(...)
  5. app\house\pc\controller\HomeController->secondHandPersonalDetail(...)
  6. ReflectionMethod->invokeArgs(...)
  7. rap\web\mvc\HandlerAdapter->invokeRequest(...)
  8. rap\web\mvc\ControllerHandlerAdapter->handle(...)
  9. rap\web\mvc\Dispatcher->doDispatch(...)
  10. rap\web\Application->start(...)
  11. require(...)