CDbException

CDbCommand failed to execute the SQL statement: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Plate White Jade Plate Cream Glass")' at line 1. The SQL statement executed was: SELECT COUNT(*) FROM `nt_youtube_video` `t` WHERE Match(t.content) Against("10" Plate White Jade Plate Cream Glass")

/srv/http/yii/db/CDbCommand.php(528)

516             return $result;
517         }
518         catch(Exception $e)
519         {
520             if($this->_connection->enableProfiling)
521                 Yii::endProfile('system.db.CDbCommand.query('.$this->getText().$par.')','system.db.CDbCommand.query');
522             $errorInfo = $e instanceof PDOException ? $e->errorInfo : null;
523             $message = $e->getMessage();
524             Yii::log(Yii::t('yii','CDbCommand::{method}() failed: {error}. The SQL statement executed was: {sql}.',
525                 array('{method}'=>$method, '{error}'=>$message, '{sql}'=>$this->getText().$par)),CLogger::LEVEL_ERROR,'system.db.CDbCommand');
526             if(YII_DEBUG)
527                 $message .= '. The SQL statement executed was: '.$this->getText().$par;
528             throw new CDbException(Yii::t('yii','CDbCommand failed to execute the SQL statement: {error}',
529                 array('{error}'=>$message)),(int)$e->getCode(),$errorInfo);
530         }
531     }
532 
533     /**
534      * Builds a SQL SELECT statement from the given query specification.
535      * @param array $query the query specification in name-value pairs. The following
536      * query options are supported: {@link select}, {@link distinct}, {@link from},
537      * {@link where}, {@link join}, {@link group}, {@link having}, {@link order},
538      * {@link limit}, {@link offset} and {@link union}.
539      * @return string the SQL statement
540      * @since 1.1.6

Stack Trace

#2
+
 /srv/http/virtual/photo/protected/models/BaseAR.php(34): CActiveRecord->count(CDbCriteria, array())
29         $Dbcache->keyPrefix = $this->getTablePrefix();
30         $tmps = $params;
31         $tmps[] = $condition;
32         $DbcacheKey = __CLASS__ . json_encode($tmps);
33         if ($Dbcache->get($DbcacheKey) === false) {
34             $rs = parent::count($condition, $params);
35             $Dbcache->set($DbcacheKey, $rs, $this->cacheTime);
36         } else {
37             $rs = $Dbcache->get($DbcacheKey);
38         }
39         return $rs;
#3
+
 /srv/http/virtual/photo/protected/models/YoutubeVideo.php(50): BaseAR->count(CDbCriteria)
45     public static function getListFromSearch($search,$limit,$page=-1)
46     {
47         $criteria=new CDbCriteria();
48         $criteria->addCondition('Match(t.content) Against("'.$search.'")');
49 
50         $count=self::model()->count($criteria);
51         // 限制当前只展示1000个相册
52         if($count>1000) $count=1000;
53 
54         if($page>=0){
55             if($page<1) $page=1;
#4
+
 /srv/http/virtual/photo/protected/components/ViewExportMethods.php(509): YoutubeVideo::getListFromSearch("10" Plate White Jade Plate Cream Glass", 4, 0)
504     }
505 
506     // 获取YouTube视频列表
507     public function getYoutubeVideoList($search,$limit=10,$page=0)
508     {
509         return YoutubeVideo::getListFromSearch($search,$limit,$page);
510     }
511 
512     // 根据pid,获取评论列表
513     public function getCommentListByPid($pid,$limit=12,$page=0)
514     {
2024-03-28 12:33:57 nginx/1.18.0 Yii Framework/1.1.12