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 '' at line 1. The SQL statement executed was: SELECT STDDEV(`978179X2X2`) as stdev, SUM(`978179X2X2`*1) as sum, AVG(`978179X2X2`*1) as average, MIN(`978179X2X2`*1) as minimum, MAX(`978179X2X2`*1) as maximum FROM lime_survey_978179 WHERE `978179X2X2` IS NOT NULL AND

/var/www/fedialisis/vwng_e/framework/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

#1
+
 /var/www/fedialisis/vwng_e/application/helpers/admin/statistics_helper.php(1059): CDbCommand->queryAll()
1054 
1055                 //$sql was set somewhere before
1056                 if ($sql != "NULL") {$query .= " AND $sql";}
1057 
1058                 //execute query
1059                 $result=Yii::app()->db->createCommand($query)->queryAll();
1060 
1061                 //get calculated data
1062                 foreach ($result as $row)
1063                 {
1064                     //put translation of mean and calculated data into $showem array
#2
+
 /var/www/fedialisis/vwng_e/application/helpers/admin/statistics_helper.php(3429): statistics_helper->buildOutputList("N978179X2X2", "es", "978179", "html", ...)
3424             //loop through all selected questions
3425             foreach ($runthrough as $rt)
3426             {
3427 
3428                 //Step 1: Get information about this response field (SGQA) for the summary
3429                 $outputs=$this->buildOutputList($rt, $language, $surveyid, $outputType, $sql, $statlang);
3430                 $statisticsoutput .= $outputs['statisticsoutput'];
3431                 //2. Collect and Display results #######################################################################
3432                 if (isset($outputs['alist']) && $outputs['alist']) //Make sure there really is an answerlist, and if so:
3433                 {
3434                     $display=$this->displayResults($outputs, $results, $rt, $outputType, $surveyid, $sql, $usegraph, $browse, $statlang);
#3
+
 /var/www/fedialisis/vwng_e/application/controllers/admin/statistics.php(467): statistics_helper->generate_statistics("978179", array("idG", "idL", "datestampE", "datestampG", ...), array("idG", "idL", "datestampE", "datestampG", ...), 0, ...)
462             $outputType = $_POST['outputtype'];
463 
464             $helper = new statistics_helper();
465             switch($outputType){
466                 case 'html':
467                     $statisticsoutput .= $helper->generate_statistics($surveyid,$summary,$summary,$usegraph,$outputType,'DD',$statlang);
468                     break;
469                 case 'pdf':
470                     $helper->generate_statistics($surveyid,$summary,$summary,$usegraph,$outputType,'I',$statlang);
471                     exit;
472                     break;
2013-04-25 14:56:06 Apache/2.2.20 (Ubuntu) Yii Framework/1.1.10