View Issue Details

This bug affects 1 person(s).
 14
IDProjectCategoryView StatusLast Update
08396Bug reportsImport/Exportpublic2016-08-25 16:43
ReporterDenisChenu Assigned ToDenisChenu  
PrioritynormalSeverityminor 
Status closedResolutionfixed 
Product Version2.00+ 
Fixed in Version2.00+ 
Summary08396: Sub Question code TIME with Save timings survey : unable to export survey
Description

When trying to export a survey with TIME in question code :
We receive error : unable to acces to page for xls/csv and "CDbCommand failed to execute the SQL statement: SQLSTATE[23000]: Integrity constraint violation: 1052 Column '968546X718X17787TIME' in field list is ambiguous. " in PDF

Steps To Reproduce

Import LSA file and try to export CSV reponse table

Additional Information

Need alias for each table.

TagsNo tags attached.
Attached Files
CDbException.html (10,266 bytes)   
  CDbException

CDbCommand failed to execute the SQL statement: SQLSTATE[23000]:
Integrity constraint violation: 1052 Column '968546X718X17787TIME' in
field list is ambiguous. The SQL statement executed was: SELECT `token`,
`submitdate`, `lastpage`, `startlanguage`, `startdate`, `datestamp`,
`968546X718X17787SQ1`, `968546X718X17787TIME`, `968546X718X17790SQ1`,
`968546X718X17790TIME`, `interviewtime`, `968546X718time`,
`968546X718X17787time`, `968546X718X17790time`, `lime_survey_968546`.`id`
FROM `lime_survey_968546`
LEFT JOIN `lime_survey_968546_timings` `survey_timings` ON
lime_survey_968546.id = survey_timings.id
ORDER BY `lime_survey_968546`.`id` LIMIT 1

/home/sondages.pro/htdocs/limesurvey_GIT/LimeSurvey/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

#0 	
+
–
 /home/sondages.pro/htdocs/limesurvey_GIT/LimeSurvey/framework/db/CDbCommand.php(372):
*CDbCommand*->*queryInternal*("", 0, array())

367      * @return CDbDataReader the reader object for fetching the query result
368      * @throws CException execution failed
369      */
370     public function query($params=array())
371     {
372         return $this->queryInternal('',0,$params);
373     }
374 
375     /**
376      * Executes the SQL statement and returns all rows.
377      * @param boolean $fetchAssociative whether each row should be returned as an associated array with

#1 	
+
–
 /home/sondages.pro/htdocs/limesurvey_GIT/LimeSurvey/application/helpers/admin/exportresults_helper.php(325):
*CDbCommand*->*query*()

320         if ($iOffset+$iLimit>$iMaximum)
321         {
322             $iLimit=$iMaximum-$iOffset;
323         }
324             
325         $survey->responses=$oRecordSet->select($aSelectFields)->order('{{survey_' . $survey->id . '}}.id')->limit($iLimit, $iOffset)->query()->readAll();
326 
327         return count($survey->responses);
328     }
329 }
330 

#2 	
+
–
 /home/sondages.pro/htdocs/limesurvey_GIT/LimeSurvey/application/helpers/admin/exportresults_helper.php(108):
*SurveyDao*->*loadSurveyResults*(SurveyObj, 100, 0, "1", ...)

103 
104         $iBatchSize=100; $iCurrentRecord=$oOptions->responseMinRecord-1;
105         $bMoreRecords=true; $first=true;
106         while ($bMoreRecords)
107         {
108             $iExported= $surveyDao->loadSurveyResults($survey, $iBatchSize, $iCurrentRecord, $oOptions->responseMaxRecord, $sFilter);
109             $iCurrentRecord+=$iExported;
110             $writer->write($survey, $sLanguageCode, $oOptions,$first);
111             $first=false;
112             $bMoreRecords= ($iExported == $iBatchSize);
113         }

#3 	
+
–
 /home/sondages.pro/htdocs/limesurvey_GIT/LimeSurvey/application/controllers/admin/export.php(270):
*ExportSurveyResultsService*->*exportSurvey*("968546", "en", "pdf",
FormattingOptions, ...)

265         else
266         {
267             $sFilter='';
268         }
269         $resultsService = new ExportSurveyResultsService();
270         $resultsService->exportSurvey($iSurveyID, $explang, $type, $options, $sFilter);
271 
272         exit;
273     }
274 
275     /*

#4 	
 unknown(0): *export*->*exportresults*()
#5 	
+
–
 /home/sondages.pro/htdocs/limesurvey_GIT/LimeSurvey/framework/web/actions/CAction.php(107):
*ReflectionMethod*->*invokeArgs*(export, array())

102             else if($param->isDefaultValueAvailable())
103                 $ps[]=$param->getDefaultValue();
104             else
105                 return false;
106         }
107         $method->invokeArgs($object,$ps);
108         return true;
109     }
110 }

#6 	
+
–
 /home/sondages.pro/htdocs/limesurvey_GIT/LimeSurvey/application/core/Survey_Common_Action.php(100):
*CAction*->*runWithParamsInternal*(export, ReflectionMethod,
array("surveyid" => "968546", "sa" => "exportresults", "iSurveyId" =>
"968546", "iSurveyID" => "968546"))

095             $oMethod = new ReflectionMethod($this, $sDefault);
096         }
097 
098         // We're all good to go, let's execute it
099         // runWithParamsInternal would automatically get the parameters of the method and populate them as required with the params
100         return parent::runWithParamsInternal($this, $oMethod, $params);
101     }
102 
103     /**
104     * Some functions have different parameters, which are just an alias of the
105     * usual parameters we're getting in the url. This function just populates

#7 	
+
–
 /home/sondages.pro/htdocs/limesurvey_GIT/LimeSurvey/framework/web/CController.php(309):
*Survey_Common_Action*->*runWithParams*(array("surveyid" => "968546",
"sa" => "exportresults"))

304     {
305         $priorAction=$this->_action;
306         $this->_action=$action;
307         if($this->beforeAction($action))
308         {
309             if($action->runWithParams($this->getActionParams())===false)
310                 $this->invalidActionParams($action);
311             else
312                 $this->afterAction($action);
313         }
314         $this->_action=$priorAction;

#8 	
+
–
 /home/sondages.pro/htdocs/limesurvey_GIT/LimeSurvey/framework/web/CController.php(287):
*CController*->*runAction*(export)

282      * @see runAction
283      */
284     public function runActionWithFilters($action,$filters)
285     {
286         if(empty($filters))
287             $this->runAction($action);
288         else
289         {
290             $priorAction=$this->_action;
291             $this->_action=$action;
292             CFilterChain::create($this,$action,$filters)->run();

#9 	
+
–
 /home/sondages.pro/htdocs/limesurvey_GIT/LimeSurvey/framework/web/CController.php(266):
*CController*->*runActionWithFilters*(export, array())

261         {
262             if(($parent=$this->getModule())===null)
263                 $parent=Yii::app();
264             if($parent->beforeControllerAction($this,$action))
265             {
266                 $this->runActionWithFilters($action,$this->filters());
267                 $parent->afterControllerAction($this,$action);
268             }
269         }
270         else
271             $this->missingAction($actionID);

#10 	
+
–
 /home/sondages.pro/htdocs/limesurvey_GIT/LimeSurvey/application/controllers/AdminController.php(170):
*CController*->*run*("export")

165                     $this->redirect($this->createUrl('/admin/authentication/sa/login'));
166                 }
167                 
168             }
169 
170             return parent::run($action);
171     }
172 
173     /**
174     * Routes all the actions to their respective places
175     *

#11 	
+
–
 /home/sondages.pro/htdocs/limesurvey_GIT/LimeSurvey/framework/web/CWebApplication.php(276):
*AdminController*->*run*("export")

271         {
272             list($controller,$actionID)=$ca;
273             $oldController=$this->_controller;
274             $this->_controller=$controller;
275             $controller->init();
276             $controller->run($actionID);
277             $this->_controller=$oldController;
278         }
279         else
280             throw new CHttpException(404,Yii::t('yii','Unable to resolve the request "{route}".',
281                 array('{route}'=>$route===''?$this->defaultController:$route)));

#12 	
+
–
 /home/sondages.pro/htdocs/limesurvey_GIT/LimeSurvey/framework/web/CWebApplication.php(135):
*CWebApplication*->*runController*("admin/export/sa/exportresults")

130             foreach(array_splice($this->catchAllRequest,1) as $name=>$value)
131                 $_GET[$name]=$value;
132         }
133         else
134             $route=$this->getUrlManager()->parseUrl($this->getRequest());
135         $this->runController($route);
136     }
137 
138     /**
139      * Registers the core application components.
140      * This method overrides the parent implementation by registering additional core components.

#13 	
+
–
 /home/sondages.pro/htdocs/limesurvey_GIT/LimeSurvey/framework/base/CApplication.php(162):
*CWebApplication*->*processRequest*()

157      */
158     public function run()
159     {
160         if($this->hasEventHandler('onBeginRequest'))
161             $this->onBeginRequest(new CEvent($this));
162         $this->processRequest();
163         if($this->hasEventHandler('onEndRequest'))
164             $this->onEndRequest(new CEvent($this));
165     }
166 
167     /**

#14 	
+
–
 /home/sondages.pro/htdocs/limesurvey_GIT/LimeSurvey/index.php(178):
*CApplication*->*run*()

173  *
174  */
175 require_once BASEPATH . 'yii' . EXT;
176 require_once APPPATH . 'core/LSYii_Application' . EXT;
177 
178 Yii::createApplication('LSYii_Application', APPPATH . 'config/config' . EXT)->run();
179 
180 /* End of file index.php */
181 /* Location: ./index.php */

2013-11-20 13:57:22 Apache/2.2.16 (Debian) Yii Framework
<http://www.yiiframework.com/>/1.1.10
CDbException.html (10,266 bytes)   
Bug heat14
Complete LimeSurvey version number (& build)131120
I will donate to the project if issue is resolvedNo
Browsernot relevant
Database type & versionMysql 5
Server OS (if known)debian/linux
Webserver software & version (if known)apache
PHP VersionPHP Version 5.3

Relationships

has duplicate 09909 closedDenisChenu Empty colums in export file while data visible in GUI 

Users monitoring this issue

There are no users monitoring this issue.

Activities

DenisChenu

DenisChenu

2013-11-20 14:50

developer   ~27257

Fix committed to master branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&amp;id=13471

DenisChenu

DenisChenu

2013-11-20 15:45

developer   ~27259

Fix committed to 2.05 branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&amp;id=13473

c_schmitz

c_schmitz

2013-11-24 19:05

administrator   ~27348

2.00+ Build 131122 released

Related Changesets

LimeSurvey: master 06344fda

2013-11-20 13:50:06

DenisChenu

Details Diff
Fixed issue 08396: Sub Question code TIME with Save timings survey : unable to export survey
Dev: adding table prefix for all field
Dev: keep PHP<5.3 compatibility
Affected Issues
08396
mod - application/helpers/admin/exportresults_helper.php Diff File

LimeSurvey: 2.05 7391cf2d

2013-11-20 14:45:10

DenisChenu

Details Diff
Fixed issue 08396: Sub Question code TIME with Save timings survey : unable to export survey
Dev: adding table prefix for all field
Dev: keep PHP<5.3 compatibility
Affected Issues
08396
mod - application/helpers/admin/export/SurveyDao.php Diff File

Issue History

Date Modified Username Field Change
2013-11-20 13:59 DenisChenu New Issue
2013-11-20 13:59 DenisChenu Assigned To => DenisChenu
2013-11-20 13:59 DenisChenu Status new => assigned
2013-11-20 13:59 DenisChenu File Added: CDbException.html
2013-11-20 14:00 DenisChenu File Added: survey_archive_TIME.lsa
2013-11-20 14:50 DenisChenu Changeset attached => LimeSurvey master 06344fda
2013-11-20 14:50 DenisChenu Note Added: 27257
2013-11-20 14:50 DenisChenu Resolution open => fixed
2013-11-20 15:45 DenisChenu Changeset attached => LimeSurvey 2.05 7391cf2d
2013-11-20 15:45 DenisChenu Note Added: 27259
2013-11-20 15:46 DenisChenu Status assigned => resolved
2013-11-20 15:46 DenisChenu Fixed in Version => 2.00+
2013-11-24 19:05 c_schmitz Note Added: 27348
2013-11-24 19:05 c_schmitz Status resolved => closed
2016-08-25 16:43 DenisChenu Relationship added has duplicate 09909