Skip to content

Commit

Permalink
Fixed import issues due to improper merge
Browse files Browse the repository at this point in the history
  • Loading branch information
c-schmitz committed Oct 17, 2018
1 parent 3ef07bb commit 8c47314
Showing 1 changed file with 18 additions and 21 deletions.
39 changes: 18 additions & 21 deletions application/helpers/admin/import_helper.php
Expand Up @@ -3169,27 +3169,6 @@ function createXMLfromData($aData = array()){
} else {
$surveylanguages = array_merge($surveylanguage, $surveyAdditionalLanguages);
}


}

/**
* This function switches identity insert on/off for the MSSQL database
*
* @param string $table table name (without prefix)
* @param boolean $state Set to true to activate ID insert, or false to deactivate
*/
function switchMSSQLIdentityInsert($table, $state)
{
if (in_array(Yii::app()->db->getDriverName(), array('mssql', 'sqlsrv', 'dblib'))) {
if ($state === true) {
// This needs to be done directly on the PDO object because when using CdbCommand or similar it won't have any effect
Yii::app()->db->pdoInstance->exec('SET IDENTITY_INSERT '.Yii::app()->db->tablePrefix.$table.' ON');
} else {
// This needs to be done directly on the PDO object because when using CdbCommand or similar it won't have any effect
Yii::app()->db->pdoInstance->exec('SET IDENTITY_INSERT '.Yii::app()->db->tablePrefix.$table.' OFF');
}
}
$xml = new XMLWriter();
$xml->openMemory();
$xml->setIndent(true);
Expand Down Expand Up @@ -3261,3 +3240,21 @@ function switchMSSQLIdentityInsert($table, $state)
return $xml->outputMemory(true);
}

/**
* This function switches identity insert on/off for the MSSQL database
*
* @param string $table table name (without prefix)
* @param boolean $state Set to true to activate ID insert, or false to deactivate
*/
function switchMSSQLIdentityInsert($table, $state)
{
if (in_array(Yii::app()->db->getDriverName(), array('mssql', 'sqlsrv', 'dblib'))) {
if ($state === true) {
// This needs to be done directly on the PDO object because when using CdbCommand or similar it won't have any effect
Yii::app()->db->pdoInstance->exec('SET IDENTITY_INSERT '.Yii::app()->db->tablePrefix.$table.' ON');
} else {
// This needs to be done directly on the PDO object because when using CdbCommand or similar it won't have any effect
Yii::app()->db->pdoInstance->exec( 'SET IDENTITY_INSERT '.Yii::app()->db->tablePrefix.$table.' OFF');
}
}
}

0 comments on commit 8c47314

Please sign in to comment.