Database Exception – yii\db\Exception
1. in /data/cms/vendor/yiisoft/yii2/db/Connection.php at line 584
575576577578579580581582583584585586587588589590591592593
$token = 'Opening DB connection: ' . $this->dsn; try { Yii::info($token, __METHOD__); Yii::beginProfile($token, __METHOD__); $this->pdo = $this->createPdoInstance(); $this->initConnection(); Yii::endProfile($token, __METHOD__); } catch (\PDOException $e) { Yii::endProfile($token, __METHOD__); throw new Exception($e->getMessage(), $e->errorInfo, (int) $e->getCode(), $e); } } public function close() {
922923924925926927928929930931932933934
* Returns the PDO instance for the currently active master connection. * This method will open the master DB connection and then return [[pdo]]. * @return PDO the PDO instance for the currently active master connection. */ public function getMasterPdo() { $this->open(); return $this->pdo; }
909910911912913914915916917918919920921
* is available and `$fallbackToMaster` is false. */ public function getSlavePdo($fallbackToMaster = true) { $db = $this->getSlave(false); if ($db === null) { return $fallbackToMaster ? $this->getMasterPdo() : null; } else { return $db->pdo; } }
477478479480481482483484485486487488489
public function quoteValue($str) { if (!is_string($str)) { return $str; } if (($value = $this->db->getSlavePdo()->quote($str)) !== false) { return $value; } else { return "'" . addcslashes(str_replace("'", "''", $str), "\000\n\r\\\032") . "'"; } }
818819820821822823824825826827828829830
* @param string $value string to be quoted * @return string the properly quoted string * @see http: */ public function quoteValue($value) { return $this->getSchema()->quoteValue($value); }
169170171172173174175176177178179180181
$params = []; foreach ($this->params as $name => $value) { if (is_string($name) && strncmp(':', $name, 1)) { $name = ':' . $name; } if (is_string($value)) { $params[$name] = $this->db->quoteValue($value); } elseif (is_bool($value)) { $params[$name] = ($value ? 'TRUE' : 'FALSE'); } elseif ($value === null) { $params[$name] = 'NULL'; } elseif (!is_object($value) && !is_resource($value)) { $params[$name] = $value;
860861862863864865866867868869870871872
* @return array array of two elements, the first is boolean of whether profiling is enabled or not. * The second is the rawSql if it has been created. */ private function logQuery($category) { if ($this->db->enableLogging) { $rawSql = $this->getRawSql(); Yii::info($rawSql, $category); } if (!$this->db->enableProfiling) { return [false, isset($rawSql) ? $rawSql : null]; } else { return [true, isset($rawSql) ? $rawSql : $this->getRawSql()];
8. in /data/cms/vendor/yiisoft/yii2/db/Command.php at line 887 – yii\db\Command::logQuery('yii\db\Command::query')
881882883884885886887888889890891892893
* @return mixed the method execution result * @throws Exception if the query causes any problem * @since 2.0.1 this method is protected (was private before). */ protected function queryInternal($method, $fetchMode = null) { list($profile, $rawSql) = $this->logQuery('yii\db\Command::query'); if ($method !== '') { $info = $this->db->getQueryCacheInfo($this->queryCacheDuration, $this->queryCacheDependency); if (is_array($info)) { $cache = $info[0];
370371372373374375376377378379380381382
* @return array|false the first row (in terms of an array) of the query result. False is returned if the query * results in nothing. * @throws Exception execution failed */ public function queryOne($fetchMode = null) { return $this->queryInternal('fetch', $fetchMode); }
247248249250251252253254255256257258259
*/ public function one($db = null) { if ($this->emulateExecution) { return false; } return $this->createCommand($db)->queryOne(); }
11. in /data/cms/vendor/yiisoft/yii2/db/ActiveQuery.php at line 294 – yii\db\Query::one(null)
288289290291292293294295296297298299300
* @return ActiveRecord|array|null a single row of query result. Depending on the setting of [[asArray]], * the query result may be either an array or an ActiveRecord object. `null` will be returned * if the query results in nothing. */ public function one($db = null) { $row = parent::one($db); if ($row !== false) { $models = $this->populate([$row]); return reset($models) ?: null; } else { return null; }
508509510511512513514515516517518519520
* 根据alias返回model * @param string $alias * @return static */ public static function findByAlias($alias) { return static::findByCondition(['alias' => $alias])->one(); }
13. in /data/cms/common/models/Channel.php at line 527 – common\models\Channel::findByAlias('shougong')
521522523524525526527528529530531532533
*/ public static function findByAliasId($id) { if (is_numeric($id)) { $model = Channel::findOne($id); } else { $model = Channel::findByAlias($id); } return $model; }
14. in /data/cms/mobileend/controllers/ChannelController.php at line 45 – common\models\Channel::findByAliasId('shougong')
39404142434445464748495051
* @param string $id 频道别名|ID * @return string * @throws NotFoundHttpException */ public function actionIndex($id) { $model = Channel::findByAliasId($id); if (null === $model) { throw new NotFoundHttpException('找不到频道'); } if ($model->isIndex()) {
15. mobileend\controllers\ChannelController::actionIndex('shougong')
16. in /data/cms/vendor/yiisoft/yii2/base/InlineAction.php at line 57 – call_user_func_array([mobileend\controllers\ChannelController, 'actionIndex'], ['shougong'])
515253545556575859
$args = $this->controller->bindActionParams($this, $params); Yii::trace('Running action: ' . get_class($this->controller) . '::' . $this->actionMethod . '()', __METHOD__); if (Yii::$app->requestedParams === null) { Yii::$app->requestedParams = $args; } return call_user_func_array([$this->controller, $this->actionMethod], $args); } }
150151152153154155156157158159160161162
} $result = null; if ($runAction && $this->beforeAction($action)) { $result = $action->runWithParams($params); $result = $this->afterAction($action, $result); foreach ($modules as $module) {
517518519520521522523524525526527528529
$parts = $this->createController($route); if (is_array($parts)) { list($controller, $actionID) = $parts; $oldController = Yii::$app->controller; Yii::$app->controller = $controller; $result = $controller->runAction($actionID, $params); if ($oldController !== null) { Yii::$app->controller = $oldController; } return $result; }
19. in /data/cms/vendor/yiisoft/yii2/web/Application.php at line 102 – yii\base\Module::runAction('channel/index', ['id' => 'shougong', 'cid' => '106_109'])
96979899100101102103104105106107108
$params = $this->catchAll; unset($params[0]); } try { Yii::trace("Route requested: '$route'", __METHOD__); $this->requestedRoute = $route; $result = $this->runAction($route, $params); if ($result instanceof Response) { return $result; } else { $response = $this->getResponse(); if ($result !== null) { $response->data = $result;
374375376377378379380381382383384385386
try { $this->state = self::STATE_BEFORE_REQUEST; $this->trigger(self::EVENT_BEFORE_REQUEST); $this->state = self::STATE_HANDLING_REQUEST; $response = $this->handleRequest($this->getRequest()); $this->state = self::STATE_AFTER_REQUEST; $this->trigger(self::EVENT_AFTER_REQUEST); $this->state = self::STATE_SENDING_RESPONSE; $response->send();
10111213141516
$config = yii\helpers\ArrayHelper::merge( require(__DIR__ . '/../../common/config/main.php'), require(__DIR__ . '/../config/main.php') ); $application = new yii\web\Application($config); $application->run();
网址:Database Exception – yii\db\Exception https://www.yuejiaxmz.com/news/view/17460
相关内容
启动系统服务clickhouse报错clickhousemysql (8)=====用户授权管理
知识图谱与智能家居的结合:为家庭生活提供智能支持
基于微信小程序的个人账本的设计与实现/个人财务管理系统/基于java的财务管理系统
基于java web个人财务管理系统
【职场小贴士】——时间管理
五个方法,帮助你更有效地管理时间
德国生活费用一览:城市对比与省钱攻略
家庭生活物品收纳管理系统的设计(MyEclipse,SQLServer)
【转贴】60个生活小常识