View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
06386 | Bug reports | Import/Export | public | 2012-07-25 16:37 | 2012-08-03 13:44 |
Reporter | abita1 | Assigned To | c_schmitz | ||
Priority | normal | Severity | partial_block | ||
Status | closed | Resolution | fixed | ||
Product Version | 2.00RC7 | ||||
Fixed in Version | 2.00RC8 | ||||
Summary | 06386: Importing CSV labels sets from LS website throws SQL exception | ||||
Description | Importing CSV labels sets from LS website throws SQL or PHP exceptions/errors, instead of producing a user friendly error within LS. I can only assume that after throwing the exception, no tangible affront has been made to the underlying LS database, or the status of LS. There is no notation on the LS website indicating with which LS versions any given sample file might work. Probably would be a good thing to add some DB version or LS versioning information to the website, as well as an indication with the LS program about which versioning of the sample files can be successfully imported (an indication at the point of import/browse). | ||||
Steps To Reproduce | Download a [the most recently dated] sample label set from the LS website In a survey, create a new label set and then attempt to import the above downloaded CSV file. | ||||
Additional Information | The error.txt file is the entire returned web page, containing the error with this title, when using the "US_States_Limesurvey_Label_Set": CDbException CDbCommand failed to execute the SQL statement: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'US_States' in 'field list'. The SQL statement executed was: insert INTO labelsets (label_name,languages) VALUES (US_States,en) The error page is uploaded in its entirety. A different error is generated using the "US States" label set. That error, "Undefined variable: labelsarray ", arrives out of PHP. I don't include that error page. | ||||
Tags | No tags attached. | ||||
Attached Files | error.txt (6,248 bytes)
CDbException CDbCommand failed to execute the SQL statement: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'US_States' in 'field list'. The SQL statement executed was: insert INTO labelsets (label_name,languages) VALUES (US_States,en) /home/content/FooFoo/html/limesurvey2/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/content/FooFoo/html/limesurvey2/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/content/FooFoo/html/limesurvey2/application/helpers/admin/import_helper.php(2031): CDbCommand->query() 2026 2027 $newvalues=array_values($labelsetrowdata); 2028 if ($xssfilter) 2029 XSSFilterArray($newvalues); 2030 $lsainsert = "insert INTO {{labelsets}} (".implode(',',array_keys($labelsetrowdata)).") VALUES (".implode(',',$newvalues).")"; //handle db prefix 2031 $lsiresult= Yii::app()->db->createCommand($lsainsert)->query(); 2032 $results['labelsets']++; 2033 2034 // Get the new insert id for the labels inside this labelset 2035 $newlid=Yii::app()->db->getLastInsertID(); 2036 #2 � /home/content/FooFoo/html/limesurvey2/application/controllers/admin/labels.php(143): CSVImportLabelset("/home/content/FooFoo/html/limesurvey2/tmp/US_States_Limes...", array("checkforduplicates" => "on")) 138 $options['checkforduplicates'] = 'off'; 139 if (isset($_POST['checkforduplicates'])) 140 $options['checkforduplicates'] = $_POST['checkforduplicates']; 141 142 if (strtolower($sExtension) == 'csv') 143 $aImportResults = CSVImportLabelset($sFullFilepath, $options); 144 elseif (strtolower($sExtension) == 'lsl') 145 $aImportResults = XMLImportLabelsets($sFullFilepath, $options); 146 else 147 $this->getController()->error($clang->gT("Uploaded label set file needs to have an .lsl extension.")); 148 #3 unknown(0): labels->import() #4 � /home/content/FooFoo/html/limesurvey2/framework/web/actions/CAction.php(107): ReflectionMethod->invokeArgs(labels, 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 } #5 � /home/content/FooFoo/html/limesurvey2/application/core/Survey_Common_Action.php(82): CAction->runWithParamsInternal(labels, ReflectionMethod, array("sa" => "import")) 77 $oMethod = new ReflectionMethod($this, $sDefault); 78 } 79 80 // We're all good to go, let's execute it 81 // runWithParamsInternal would automatically get the parameters of the method and populate them as required with the params 82 return parent::runWithParamsInternal($this, $oMethod, $params); 83 } 84 85 /** 86 * Some functions have different parameters, which are just an alias of the 87 * usual parameters we're getting in the url. This function just populates #6 + /home/content/FooFoo/html/limesurvey2/framework/web/CController.php(309): Survey_Common_Action->runWithParams(array("sa" => "import")) #7 + /home/content/FooFoo/html/limesurvey2/framework/web/CController.php(287): CController->runAction(labels) #8 + /home/content/FooFoo/html/limesurvey2/framework/web/CController.php(266): CController->runActionWithFilters(labels, array()) #9 + /home/content/FooFoo/html/limesurvey2/application/controllers/AdminController.php(158): CController->run("labels") #10 + /home/content/FooFoo/html/limesurvey2/framework/web/CWebApplication.php(276): AdminController->run("labels") #11 + /home/content/FooFoo/html/limesurvey2/framework/web/CWebApplication.php(135): CWebApplication->runController("admin/labels/sa/import") #12 + /home/content/FooFoo/html/limesurvey2/framework/base/CApplication.php(162): CWebApplication->processRequest() #13 + /home/content/FooFoo/html/limesurvey2/index.php(171): CApplication->run() 2012-07-25 07:19:12 Apache Yii Framework/1.1.10 | ||||
Bug heat | 2 | ||||
Complete LimeSurvey version number (& build) | 120721 | ||||
I will donate to the project if issue is resolved | No | ||||
Browser | FireFox 14 | ||||
Database type & version | MySQL | ||||
Server OS (if known) | Linux / Apache | ||||
Webserver software & version (if known) | 1.3.3 | ||||
PHP Version | 5.2.17 | ||||
Fix committed to Yii branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=9139 |
|
2.00RC8 released |
|
LimeSurvey: Yii 945dc7f2 2012-07-26 02:10:03 Details Diff |
Fixed issue 06386: Importing CSV labels sets from LS website throws SQL exception |
Affected Issues 06386 |
|
mod - application/controllers/admin/labels.php | Diff File | ||
mod - application/helpers/admin/import_helper.php | Diff File | ||
mod - application/helpers/common_helper.php | Diff File |
Date Modified | Username | Field | Change |
---|---|---|---|
2012-07-25 16:37 | abita1 | New Issue | |
2012-07-25 16:37 | abita1 | File Added: error.txt | |
2012-07-25 16:52 | c_schmitz | Assigned To | => c_schmitz |
2012-07-25 16:52 | c_schmitz | Status | new => assigned |
2012-07-26 11:09 | c_schmitz | Changeset attached | => LimeSurvey Yii 945dc7f2 |
2012-07-26 11:09 | c_schmitz | Note Added: 19978 | |
2012-07-26 11:09 | c_schmitz | Resolution | open => fixed |
2012-07-26 11:10 | c_schmitz | Status | assigned => resolved |
2012-07-26 11:10 | c_schmitz | Fixed in Version | => 2.00+ |
2012-08-03 13:44 | c_schmitz | Fixed in Version | 2.00+ => 2.00RC8 |
2012-08-03 13:44 | c_schmitz | Note Added: 20141 | |
2012-08-03 13:44 | c_schmitz | Status | resolved => closed |