CDbException

CDbCommand failed to execute the SQL statement: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '6155--0-0' for key 'PRIMARY'. The SQL statement executed was: ALTER TABLE `lime_defaultvalues` ADD PRIMARY KEY (`qid`, `specialtype`, `scale_id`, `sqid` )

/mnt/data/shnoulle/nginx/www/develop/framework/db/CDbCommand.php(358)

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

Stack Trace

#1
+
 /mnt/data/shnoulle/nginx/www/develop/application/helpers/update/updatedb_helper.php(2514): CDbCommand->addPrimaryKey("{{defaultvalues_pk}}", "{{defaultvalues}}", array("qid", "specialtype", "scale_id", "sqid"))
2509             
2510             // Drop autoincrement on timings table primary key
2511             upgradeSurveyTimings350();
2512             
2513             $oDB->createCommand()->dropPrimaryKey('{{defaultvalues_pk}}','{{defaultvalues}}');
2514             $oDB->createCommand()->addPrimaryKey('{{defaultvalues_pk}}', '{{defaultvalues}}', ['qid', 'specialtype', 'scale_id', 'sqid']);
2515 
2516             $oDB->createCommand()->update('{{settings_global}}', array('stg_value'=>400), "stg_name='DBVersion'");
2517 
2518             $oTransaction->commit();
2519         }   
#2
+
 /mnt/data/shnoulle/nginx/www/develop/application/helpers/update/update_helper.php(31): db_upgrade_all(356)
26         Yii::app()->loadHelper('update/updatedb');
27         if (isset($subaction) && $subaction == "yes") {
28             $header = Yii::app()->getController()->_getAdminHeader(false, true);
29             $header = preg_replace('/<###begin###>/', '', $header);
30             echo $header;
31             $result = db_upgrade_all(intval($currentDBVersion));
32             if ($result) {
33                 $data =
34                 '<div class="jumbotron message-box">'.
35                     '<h2 class="">'.gT('Success').'</h2>'.
36                     '<p class="lead">'.
#3
+
 /mnt/data/shnoulle/nginx/www/develop/application/controllers/admin/databaseupdate.php(40): CheckForDBUpgrades("yes")
35     public function db($continue = null)
36     {
37         Yii::app()->loadHelper("update/update");
38         $aData = $aViewUrls = [];
39         if (isset($continue) && $continue == "yes") {
40             $aViewUrls['output'] = CheckForDBUpgrades($continue);
41             $aData['display']['header'] = false;
42         } else {
43             $aData['display']['header'] = true;
44             $aViewUrls['output'] = CheckForDBUpgrades();
45         }
2019-04-03 13:43:18 nginx/1.14.2 Yii Framework/1.1.20