Skip to content

Commit

Permalink
Fixed issue: Various problems when using any MSSQL driver
Browse files Browse the repository at this point in the history
git-svn-id: file:///Users/Shitiz/Downloads/lssvn/source/limesurvey_dev@9772 b72ed6b6-b9f8-46b5-92b4-906544132732
  • Loading branch information
c-schmitz committed Feb 11, 2011
1 parent e756d12 commit a94b54a
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions index.php
Expand Up @@ -2261,7 +2261,7 @@ function submitfailed($errormsg='')
*/
function buildsurveysession()
{
global $thissurvey, $secerror, $clienttoken;
global $thissurvey, $secerror, $clienttoken, $databasetype;
global $tokensexist, $thistpl;
global $surveyid, $dbprefix, $connect;
global $register_errormsg, $clang;
Expand Down Expand Up @@ -2704,7 +2704,14 @@ function buildsurveysession()

// Find all defined randomization groups through question attribute values
$randomGroups=array();
$rgquery = "SELECT attr.qid,value FROM ".db_table_name('question_attributes')." as attr right join ".db_table_name('questions')." as quests on attr.qid=quests.qid WHERE attribute='random_group' and value <> '' and sid=$surveyid GROUP BY attr.qid";
if ($databasetype=='odbc_mssql' || $databasetype=='odbtp' || $databasetype=='mssql_n' || $databasetype=='mssqlnative')
{
$rgquery = "SELECT attr.qid, CAST(value as varchar(255)) FROM ".db_table_name('question_attributes')." as attr right join ".db_table_name('questions')." as quests on attr.qid=quests.qid WHERE attribute='random_group' and CAST(value as varchar(255)) <> '' and sid=$surveyid GROUP BY attr.qid, CAST(value as varchar(255))";
}
else
{
$rgquery = "SELECT attr.qid, value FROM ".db_table_name('question_attributes')." as attr right join ".db_table_name('questions')." as quests on attr.qid=quests.qid WHERE attribute='random_group' and value <> '' and sid=$surveyid GROUP BY attr.qid, value";
}
$rgresult = db_execute_assoc($rgquery);
while($rgrow = $rgresult->FetchRow())
{
Expand Down

0 comments on commit a94b54a

Please sign in to comment.