CDbException

CDbCommand failed to execute the SQL statement: SQLSTATE[42S21]: Column already exists: 1060 Duplicate column name 'date_invited'. The SQL statement executed was: ALTER TABLE `lime2_survey_links` ADD `date_invited` datetime NULL default NULL

/home/www/34ab61b960fc324dd606bf69bfc25b8b/web/limesurvey/framework/db/CDbCommand.php(354)

342             return $n;
343         }
344         catch(Exception $e)
345         {
346             if($this->_connection->enableProfiling)
347                 Yii::endProfile('system.db.CDbCommand.execute('.$this->getText().')','system.db.CDbCommand.execute');
348             $errorInfo = $e instanceof PDOException ? $e->errorInfo : null;
349             $message = $e->getMessage();
350             Yii::log(Yii::t('yii','CDbCommand::execute() failed: {error}. The SQL statement executed was: {sql}.',
351                 array('{error}'=>$message, '{sql}'=>$this->getText().$par)),CLogger::LEVEL_ERROR,'system.db.CDbCommand');
352             if(YII_DEBUG)
353                 $message .= '. The SQL statement executed was: '.$this->getText().$par;
354             throw new CDbException(Yii::t('yii','CDbCommand failed to execute the SQL statement: {error}',
355                 array('{error}'=>$message)),(int)$e->getCode(),$errorInfo);
356         }
357     }
358 
359     /**
360      * Executes the SQL statement and returns query result.
361      * This method is for executing an SQL query that returns result set.
362      * @param array $params input parameters (name=>value) for the SQL execution. This is an alternative
363      * to {@link bindParam} and {@link bindValue}. If you have multiple input parameters, passing
364      * them in this way can improve the performance. Note that if you pass parameters in this way,
365      * you cannot bind parameters or values using {@link bindParam} or {@link bindValue}, and vice versa.
366      * binding methods and  the input parameters this way can improve the performance.

Stack Trace

#1
+
 /home/www/34ab61b960fc324dd606bf69bfc25b8b/web/limesurvey/application/helpers/update/updatedb_helper.php(1696): CDbCommand->addColumn("{{survey_links}}", "date_invited", "datetime NULL default NULL")
1691     if ($sDBDriverName=='mssql')
1692     {
1693         $sType=str_replace('text','varchar(max)',$sType);
1694         $sType=str_replace('binary','text',$sType);
1695     }
1696     Yii::app()->db->createCommand()->addColumn($sTableName,$sColumn,$sType);
1697 }
1698 
1699 
1700 
1701 function dropDefaultValueMSSQL($fieldname, $tablename)
#2
+
 /home/www/34ab61b960fc324dd606bf69bfc25b8b/web/limesurvey/application/helpers/update/updatedb_helper.php(1014): addColumn("{{survey_links}}", "date_invited", "datetime NULL default NULL")
1009         alterLanguageCode('it-formal','it');
1010         Yii::app()->db->createCommand()->update('{{settings_global}}',array('stg_value'=>160),"stg_name='DBVersion'");
1011     }
1012     if ($oldversion < 161)
1013     {
1014         addColumn('{{survey_links}}','date_invited','datetime NULL default NULL');
1015         addColumn('{{survey_links}}','date_completed','datetime NULL default NULL');
1016     }
1017 
1018     fixLanguageConsistencyAllSurveys();
1019     echo '<br /><br />'.sprintf($clang->gT('Database update finished (%s)'),date('Y-m-d H:i:s')).'<br /><br />';
#3
+
 /home/www/34ab61b960fc324dd606bf69bfc25b8b/web/limesurvey/application/helpers/update/update_helper.php(34): db_upgrade_all(160)
29         if(isset($subaction) && $subaction=="yes")
30         {
31             echo Yii::app()->getController()->_getAdminHeader();
32             echo "<div style='width:90%; padding:1% 5%;background-color:#eee;'>";
33             Yii::app()->loadHelper('update/updatedb');
34             db_upgrade_all(intval($currentDBVersion));
35             Yii::app()->db->createCommand()->update('{{settings_global}}', array('stg_value' => intval($dbversionnumber)), 'stg_name = \'DBVersion\'');
36             $data = "<br />".sprintf($clang->gT("Database has been successfully upgraded to version %s"),$dbversionnumber);
37             $data .= "<br /><a href='".Yii::app()->getController()->createUrl("/admin")."'>".$clang->gT("Back to main menu")."</a></div>";
38             return $data;
39         }
2012-07-19 15:18:43 Apache Yii Framework/1.1.10