Skip to content

Commit

Permalink
Fixed issue #4739: Exported survey structure file huge due to questio…
Browse files Browse the repository at this point in the history
…n attribute duplication

git-svn-id: file:///Users/Shitiz/Downloads/lssvn/source/limesurvey@9482 b72ed6b6-b9f8-46b5-92b4-906544132732
  • Loading branch information
c-schmitz committed Nov 15, 2010
1 parent bba421e commit d408f12
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions admin/export_structure_xml.php
Expand Up @@ -59,7 +59,7 @@

function getXMLStructure($xmlwriter, $exclude=array())
{
global $dbprefix, $surveyid;
global $dbprefix, $surveyid, $connect;

$sdump = "";

Expand Down Expand Up @@ -118,8 +118,19 @@ function getXMLStructure($xmlwriter, $exclude=array())
BuildXMLFromQuery($xmlwriter,$qquery,'subquestions');

//Question attributes
$query = "SELECT {$dbprefix}question_attributes.qaid, {$dbprefix}question_attributes.qid, {$dbprefix}question_attributes.attribute, {$dbprefix}question_attributes.value
FROM {$dbprefix}question_attributes JOIN {$dbprefix}questions ON {$dbprefix}questions.qid = {$dbprefix}question_attributes.qid AND {$dbprefix}questions.sid=$surveyid";
$sBaseLanguage=GetBaseLanguageFromSurveyID($surveyid);
if ($connect->databaseType == 'odbc_mssql' || $connect->databaseType == 'odbtp' || $connect->databaseType == 'mssql_n')
{
$query="SELECT qa.qid, qa.attribute, cast(qa.value as varchar(4000))
FROM {$dbprefix}question_attributes qa JOIN {$dbprefix}questions q ON q.qid = qa.qid AND q.sid={$surveyid}
where q.language='{$sBaseLanguage}' group by qa.qid, qa.attribute, cast(qa.value as varchar(4000))";
}
else {
$query="SELECT qa.qid, qa.attribute, qa.value
FROM {$dbprefix}question_attributes qa JOIN {$dbprefix}questions q ON q.qid = qa.qid AND q.sid={$surveyid}
where q.language='{$sBaseLanguage}' group by qa.qid, qa.attribute, qa.value";
}

BuildXMLFromQuery($xmlwriter,$query,'question_attributes');

if ((!isset($exclude) && $exclude['quotas'] !== true) || empty($exclude))
Expand Down

0 comments on commit d408f12

Please sign in to comment.