CDbException

CDbCommand failed to execute the SQL statement: SQLSTATE[42P01]: Undefined table: 7 ERROR: missing FROM-clause entry for table "answerl10ns"
LINE 1: ...id = question.qid) WHERE (question.sid=534913 AND answerL10n...
^. The SQL statement executed was: SELECT "t"."aid" AS "t0_c0", "t"."qid" AS "t0_c1", "t"."code" AS "t0_c2", "t"."sortorder" AS "t0_c3", "t"."assessment_value" AS "t0_c4", "t"."scale_id" AS "t0_c5", "answerL10ns"."id" AS "t1_c0", "answerL10ns"."aid" AS "t1_c1", "answerL10ns"."answer" AS "t1_c2", "answerL10ns"."language" AS "t1_c3", "question"."qid" AS "t2_c0", "question"."parent_qid" AS "t2_c1", "question"."sid" AS "t2_c2", "question"."gid" AS "t2_c3", "question"."type" AS "t2_c4", "question"."title" AS "t2_c5", "question"."preg" AS "t2_c6", "question"."other" AS "t2_c7", "question"."mandatory" AS "t2_c8", "question"."question_order" AS "t2_c9", "question"."scale_id" AS "t2_c10", "question"."same_default" AS "t2_c11", "question"."relevance" AS "t2_c12", "question"."modulename" AS "t2_c13", "question"."encrypted" AS "t2_c14" FROM "answers" "t" LEFT OUTER JOIN "answer_l10ns" "answerL10ns" ON ("answerL10ns"."aid"="t"."aid") LEFT OUTER JOIN "questions" "question" ON (t.qid = question.qid) WHERE (question.sid=534913 AND answerL10ns.language = 'en') ORDER BY question.question_order, t.scale_id, sortorder

/var/www/html/sg_survey-test/framework/db/CDbCommand.php(543)

531         {
532             if($this->_connection->enableProfiling)
533                 Yii::endProfile('system.db.CDbCommand.query('.$this->getText().$par.')','system.db.CDbCommand.query');
534 
535             $errorInfo=$e instanceof PDOException ? $e->errorInfo : null;
536             $message=$e->getMessage();
537             Yii::log(Yii::t('yii','CDbCommand::{method}() failed: {error}. The SQL statement executed was: {sql}.',
538                 array('{method}'=>$method, '{error}'=>$message, '{sql}'=>$this->getText().$par)),CLogger::LEVEL_ERROR,'system.db.CDbCommand');
539 
540             if(YII_DEBUG)
541                 $message.='. The SQL statement executed was: '.$this->getText().$par;
542 
543             throw new CDbException(Yii::t('yii','CDbCommand failed to execute the SQL statement: {error}',
544                 array('{error}'=>$message)),(int)$e->getCode(),$errorInfo);
545         }
546     }
547 
548     /**
549      * Builds a SQL SELECT statement from the given query specification.
550      * @param array $query the query specification in name-value pairs. The following
551      * query options are supported: {@link select}, {@link distinct}, {@link from},
552      * {@link where}, {@link join}, {@link group}, {@link having}, {@link order},
553      * {@link limit}, {@link offset} and {@link union}.
554      * @throws CDbException if "from" key is not present in given query parameter
555      * @return string the SQL statement

Stack Trace

#5
+
 /var/www/html/sg_survey-test/application/models/LSActiveRecord.php(74): CActiveRecord->query(CDbCriteria, true)
69      * @since 1.1.7
70      */
71     protected function query($criteria, $all = false, $asAR = true)
72     {
73         if ($asAR === true) {
74             return parent::query($criteria, $all);
75         } else {
76             $this->beforeFind();
77             $this->applyScopes($criteria);
78             if (!$all) {
79                 $criteria->limit = 1;
#7
+
 /var/www/html/sg_survey-test/application/helpers/admin/export/SurveyDao.php(46): CActiveRecord->findAll(array("condition" => "question.sid=534913 AND answerL10ns.language = 'en'", "order" => "question.question_order, t.scale_id, sortorder"))
41             safeDie("An invalid survey ID was encountered");
42         }
43 
44         $survey->groups = QuestionGroup::model()->findAll(array("condition" => 'sid='.$intId, 'order'=>'group_order'));
45         $survey->questions = Question::model()->findAll(array("condition" => 'sid='.$intId, 'order'=>'question_order'));
46         $aAnswers = Answer::model()->with('answerL10ns', 'question')->findAll(array('condition'=>'question.sid='.$intId.' AND answerL10ns.language = \''.$lang.'\'', 'order' => 'question.question_order, t.scale_id, sortorder'));
47         foreach ($aAnswers as $aAnswer) {
48             if(!empty($oOptions->stripHtmlCode) && $oOptions->stripHtmlCode == 1  && Yii::app()->controller->action->id !='remotecontrol'){
49                 $answer=stripTagsFull($aAnswer->answerL10ns[$lang]->answer);
50             } else {
51                 $answer=$aAnswer->answerL10ns[$lang]->answer;
#8
+
 /var/www/html/sg_survey-test/application/helpers/admin/exportresults_helper.php(102): SurveyDao->loadSurveyById("534913", "en", FormattingOptions)
097         if (!($writer instanceof IWriter)) {
098             throw new Exception(sprintf('Writer for %s should implement IWriter', $sExportPlugin));
099         }
100 
101         $surveyDao = new SurveyDao();
102         $survey = $surveyDao->loadSurveyById($iSurveyId, $sLanguageCode, $oOptions);
103         $writer->init($survey, $sLanguageCode, $oOptions);
104         
105         $surveyDao->loadSurveyResults($survey, $oOptions->responseMinRecord, $oOptions->responseMaxRecord, $sFilter, $oOptions->responseCompletionState, $oOptions->selectedColumns, $oOptions->aResponses);
106         $writer->write($survey, $sLanguageCode, $oOptions, true);
107         $result = $writer->close();
2020-02-27 11:53:33 nginx/1.14.0 Yii Framework/1.1.22-dev