Skip to content

Commit

Permalink
Fixed issue #9140: VV-Import not working with MSSQL
Browse files Browse the repository at this point in the history
  • Loading branch information
c-schmitz committed Nov 24, 2014
1 parent b8f5b93 commit bedcc30
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions application/helpers/admin/import_helper.php
Expand Up @@ -1897,6 +1897,11 @@ function CSVImportResponses($sFullFilePath,$iSurveyId,$aOptions=array())
$oTransaction = Yii::app()->db->beginTransaction();
try
{
if (isset($oSurvey->id) && !is_null($oSurvey->id))
{
switchMSSQLIdentityInsert('survey_'.$iSurveyId, true);
$bSwitched=true;
}
if($oSurvey->save())
{
$oTransaction->commit();
Expand All @@ -1914,6 +1919,10 @@ function CSVImportResponses($sFullFilePath,$iSurveyId,$aOptions=array())
$oTransaction->rollBack();
$aResponsesError[]=$aResponses[$iIdReponsesKey];
}
if (isset($bSwitched) && $bSwitched==true){
switchMSSQLIdentityInsert('survey_'.$iSurveyId, false);
$bSwitched=false;
}
}
catch(Exception $oException)
{
Expand Down

0 comments on commit bedcc30

Please sign in to comment.