View Issue Details

This bug affects 1 person(s).
 4
IDProjectCategoryView StatusLast Update
06889Bug reportsSurvey participants (Tokens)public2012-11-27 06:11
ReporterpfpDave Assigned Toc_schmitz  
PrioritynormalSeverityminor 
Status closedResolutionfixed 
Product Version2.00+ 
Fixed in Version2.00+ 
Summary06889: Clicking view participants in central participant list from a survey gives error CDbException (Error 500)
Description

When in the participant list of a survey, clicking on the button at the bottom of the list 'View participants of this survey in the central participant database panel' gives the error 'CDbException (Error 500)
Could not process your query.'.

Debug mode gives no further information, however tracing through the code I've managed to determine that the code enters the block of code at \application\models\participants.php line 512 then moves to the block at line 634 at which point it fails. I've not been able to extract the final converted contents of the $command object but I suspect the error is in the SQL query formed. The $command->condition looks like this at the point before it enters the block at line 634:

participant_id IN (SELECT distinct {{survey_links}}.participant_id FROM {{survey_links}}, {{surveys_languagesettings}} WHERE {{survey_links}}.survey_id = {{surveys_languagesettings}}.surveyls_survey_id AND {{surveys_languagesettings}}.surveyls_language=:lang AND ({{surveys_languagesettings}}.surveyls_title = :param2 OR {{survey_links}}.survey_id = :param2))

TagsNo tags attached.
Bug heat4
Complete LimeSurvey version number (& build)121115
I will donate to the project if issue is resolvedNo
BrowserIE8
Database type & versionSQL Express 2012
Server OS (if known)Server 2008
Webserver software & version (if known)IIS 7
PHP Version5.4.8

Users monitoring this issue

There are no users monitoring this issue.

Activities

c_schmitz

c_schmitz

2012-11-16 13:42

administrator   ~22268

Fix committed to master branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=10333

pfpDave

pfpDave

2012-11-16 13:59

reporter   ~22269

I've just downloaded the new Participants.php file and I get the same issue (CDbException (Error 500) Could not process your query.) on my installation ... don't know if I should or not ... appologies if you would expect this.

c_schmitz

c_schmitz

2012-11-16 16:10

administrator   ~22281

I checked again and it works just fine. Make sure that you download the right file, replace it correctly and clean your browser cache.

pfpDave

pfpDave

2012-11-16 16:35

reporter   ~22284

Just tested again and still no joy ... steps to reproduce:

  • Downloaded file from here: https://raw.github.com/LimeSurvey/LimeSurvey/1b431ec5357d5ad4d389aca1173163c0b389f42d/application/models/Participants.php

  • Deleted existing /application/models/Participants.php file and recreated from above URL

  • Opened new browser window with InPrivate filtering

  • Logged in to Limesurvey

  • Opened Survey

  • Clicked on Token Management

  • Clicked on Display Tokens

  • Ticked select all tick box to select both participants listed

  • Clicked on 'View Participants of this survey in the central participant database panel' button at the bottom of the list of tokens (second icon from left)

  • URL Loaded: .../index.php/admin/participants/displayParticipants/searchurl/survey%7C%7Cequal%7C%7C489924

  • Error Displayed: CDbException (Error 500)Could not process your query.

  • Clicked OK to close pop-up error

  • Empty Participant list displayed.

c_schmitz

c_schmitz

2012-11-16 16:41

administrator   ~22285

Maybe you can trace again and check if the issue moved somewhere else?

pfpDave

pfpDave

2012-11-16 16:45

reporter   ~22288

OK just done a simple check (print text and exit) and the code seems to be failing at line 634 $arr = Participants::model()->findAll($command);

I'm afraid I've only got primitive dev tools on this laptop but if you have something specific you'd like me to try I'd be more than happy to.

c_schmitz

c_schmitz

2012-11-16 16:53

administrator   ~22289

Last edited: 2012-11-16 16:53

ok, can you check what the contents of

$command->toArray()

is ?

do a

var_dump($command->toArray()); die()

pfpDave

pfpDave

2012-11-16 17:01

reporter   ~22290

array(15) { ["select"]=> string(1) "*" ["condition"]=> string(359) "participant_id IN (SELECT distinct {{survey_links}}.participant_id FROM {{survey_links}}, {{surveys_languagesettings}} WHERE {{survey_links}}.survey_id = {{surveys_languagesettings}}.surveyls_survey_id AND {{surveys_languagesettings}}.surveyls_language=:lang AND ({{surveys_languagesettings}}.surveyls_title = :param1 OR {{survey_links}}.survey_id = :param2))" ["params"]=> array(3) { [":lang"]=> string(2) "en" [":param1"]=> int(489924) [":param2"]=> int(489924) } ["limit"]=> string(2) "25" ["offset"]=> int(0) ["order"]=> string(0) "" ["group"]=> string(0) "" ["join"]=> string(0) "" ["having"]=> string(0) "" ["distinct"]=> bool(false) ["scopes"]=> NULL ["with"]=> NULL ["alias"]=> NULL ["index"]=> NULL ["together"]=> NULL }

c_schmitz

c_schmitz

2012-11-18 18:51

administrator   ~22305

Fix committed to 2.1 branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=10348

pfpDave

pfpDave

2012-11-19 10:07

reporter   ~22310

Should there be a new version of the file from the 18th?? I've just grabbed the latest one from here: http://github.com/LimeSurvey/LimeSurvey/tree/8fca43738201e737c3688b269d048aec7b31ca5a/application/models/Participants.php and the issue still exists. The contents of $command->toArray() are below if this helps:

array(15) { ["select"]=> string(1) "*" ["condition"]=> string(359) "participant_id IN (SELECT distinct {{survey_links}}.participant_id FROM {{survey_links}}, {{surveys_languagesettings}} WHERE {{survey_links}}.survey_id = {{surveys_languagesettings}}.surveyls_survey_id AND {{surveys_languagesettings}}.surveyls_language=:lang AND ({{surveys_languagesettings}}.surveyls_title = :param1 OR {{survey_links}}.survey_id = :param2))" ["params"]=> array(3) { [":lang"]=> string(2) "en" [":param1"]=> int(378628) [":param2"]=> int(378628) } ["limit"]=> string(2) "25" ["offset"]=> int(0) ["order"]=> string(0) "" ["group"]=> string(0) "" ["join"]=> string(0) "" ["having"]=> string(0) "" ["distinct"]=> bool(false) ["scopes"]=> NULL ["with"]=> NULL ["alias"]=> NULL ["index"]=> NULL ["together"]=> NULL }

c_schmitz

c_schmitz

2012-11-20 15:53

administrator   ~22340

I am sorry but I cannot reproduce the issue. The parameter array looks fine to me, too. Can you try to manually cobble a statement together from that contents and see if there are any problems executing that statement?

pfpDave

pfpDave

2012-11-20 15:58

reporter   ~22343

Rather than my trying to guess is there a place where I can intercept the formed SQL statement before it's executed?

c_schmitz

c_schmitz

2012-11-20 16:02

administrator   ~22344

Do you have Firefix and Firebug installed? If yes you can activate the new parameter in the latest version in config.php and it would appear in the Firebug console.

pfpDave

pfpDave

2012-11-20 16:42

reporter   ~22346

Last edited: 2012-11-20 16:50

Got it! Here's the SQL it's trying to execute.

CDbCommand failed to execute the SQL statement: SQLSTATE[22018]: [Microsoft][SQL Server Native Client 11.0][SQL Server]Conversion failed when converting the varchar value 'Test Large Survey' to data type int.. The SQL statement executed was: SELECT TOP 25 * FROM [dbo].[participants] [t] WHERE participant_id IN (SELECT distinct survey_links.participant_id FROM survey_links, surveys_languagesettings WHERE survey_links.survey_id = surveys_languagesettings.surveyls_survey_id AND surveys_languagesettings.surveyls_language=:lang AND (surveys_languagesettings.surveyls_title = :param1 OR survey_links.survey_id = :param2)) (C:\limesurvey\framework\db\CDbCommand.php:528)

and here's the full error text:

<h1>CDbException</h1>

CDbCommand failed to execute the SQL statement: SQLSTATE[22018]: [Microsoft][SQL Server Native Client 11.0][SQL Server]Conversion failed when converting the varchar value 'Test Large Survey' to data type int.. The SQL statement executed was: SELECT TOP 25 * FROM [dbo].[participants] [t] WHERE participant_id IN (SELECT distinct survey_links.participant_id FROM survey_links, surveys_languagesettings WHERE survey_links.survey_id = surveys_languagesettings.surveyls_survey_id AND surveys_languagesettings.surveyls_language=:lang AND (surveys_languagesettings.surveyls_title = :param1 OR survey_links.survey_id = :param2)) (C:\limesurvey\framework\db\CDbCommand.php:528)

#0 C:\limesurvey\framework\db\CDbCommand.php(390): CDbCommand->queryInternal('fetchAll', Array, Array)
#1 C:\limesurvey\framework\db\ar\CActiveRecord.php(1287): CDbCommand->queryAll()
#2 C:\limesurvey\framework\db\ar\CActiveRecord.php(1406): CActiveRecord->query(Object(CDbCriteria), true)
#3 C:\limesurvey\application\models\Participants.php(631): CActiveRecord->findAll(Object(CDbCriteria))
#4 C:\limesurvey\application\controllers\admin\participantsaction.php(881): Participants->getParticipantsSearchMultiple(Array, '1', '25')
#5 [internal function]: participantsaction->getParticipantsResults_json()
#6 C:\limesurvey\framework\web\actions\CAction.php(107): ReflectionMethod->invokeArgs(Object(participantsaction), Array)
#7 C:\limesurvey\application\core\Survey_Common_Action.php(82): CAction->runWithParamsInternal(Object(participantsaction), Object(ReflectionMethod), Array)
#8 C:\limesurvey\framework\web\CController.php(309): Survey_Common_Action->runWithParams(Array)
#9 C:\limesurvey\framework\web\CController.php(287): CController->runAction(Object(participantsaction))
#10 C:\limesurvey\framework\web\CController.php(266): CController->runActionWithFilters(Object(participantsaction), Array)
#11 C:\limesurvey\application\controllers\AdminController.php(159): CController->run('participants')
#12 C:\limesurvey\framework\web\CWebApplication.php(276): AdminController->run('participants')
#13 C:\limesurvey\framework\web\CWebApplication.php(135): CWebApplication->runController('admin/participa...')
#14 C:\limesurvey\framework\base\CApplication.php(162): CWebApplication->processRequest()
#15 C:\limesurvey\index.php(178): CApplication->run()
#16 {main}

c_schmitz

c_schmitz

2012-11-20 17:06

administrator   ~22348

Thank you - that helped. Hope this fix does the trick.

c_schmitz

c_schmitz

2012-11-20 17:08

administrator   ~22349

Fix committed to 2.0 branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=10382

pfpDave

pfpDave

2012-11-21 10:49

reporter   ~22361

This seems to have resolved the issue, many thanks.

c_schmitz

c_schmitz

2012-11-27 06:11

administrator   ~22594

New 2.00+ build released.

Related Changesets

LimeSurvey: master 1b431ec5

2012-11-16 13:42

c_schmitz


Details Diff
Fixed issue 06889: Clicking view participants in central participant list from a survey gives error in MSSQL Affected Issues
06889
mod - application/models/Participants.php Diff File

LimeSurvey: 2.1 8fca4373

2012-11-16 13:42

c_schmitz


Details Diff
Fixed issue 06889: Clicking view participants in central participant list from a survey gives error in MSSQL Affected Issues
06889
mod - application/models/Participants.php Diff File

LimeSurvey: master e3d0b5a5

2012-11-20 17:05

c_schmitz


Details Diff
Fixed issue 06889: Clicking view participants in central participant list from a survey gives error in MSSQL Affected Issues
06889
mod - application/models/Participants.php Diff File

Issue History

Date Modified Username Field Change
2012-11-16 13:02 pfpDave New Issue
2012-11-16 13:41 c_schmitz Assigned To => c_schmitz
2012-11-16 13:41 c_schmitz Status new => assigned
2012-11-16 13:42 c_schmitz Changeset attached => LimeSurvey master 1b431ec5
2012-11-16 13:42 c_schmitz Note Added: 22268
2012-11-16 13:42 c_schmitz Resolution open => fixed
2012-11-16 13:42 c_schmitz Status assigned => resolved
2012-11-16 13:42 c_schmitz Fixed in Version => 2.00+
2012-11-16 13:59 pfpDave Note Added: 22269
2012-11-16 16:10 c_schmitz Note Added: 22281
2012-11-16 16:35 pfpDave Note Added: 22284
2012-11-16 16:41 c_schmitz Note Added: 22285
2012-11-16 16:45 pfpDave Note Added: 22288
2012-11-16 16:53 c_schmitz Note Added: 22289
2012-11-16 16:53 c_schmitz Note Edited: 22289
2012-11-16 17:01 pfpDave Note Added: 22290
2012-11-16 21:48 c_schmitz Status resolved => closed
2012-11-18 18:51 c_schmitz Changeset attached => LimeSurvey 2.1 8fca4373
2012-11-18 18:51 c_schmitz Note Added: 22305
2012-11-19 10:07 pfpDave Note Added: 22310
2012-11-19 10:07 pfpDave Status closed => feedback
2012-11-19 10:07 pfpDave Resolution fixed => reopened
2012-11-20 15:53 c_schmitz Note Added: 22340
2012-11-20 15:58 pfpDave Note Added: 22343
2012-11-20 15:58 pfpDave Status feedback => assigned
2012-11-20 16:02 c_schmitz Note Added: 22344
2012-11-20 16:42 pfpDave Note Added: 22346
2012-11-20 16:43 pfpDave Note Edited: 22346
2012-11-20 16:50 pfpDave Note Edited: 22346
2012-11-20 17:06 c_schmitz Note Added: 22348
2012-11-20 17:07 c_schmitz Changeset attached => LimeSurvey master e3d0b5a5
2012-11-20 17:08 c_schmitz Note Added: 22349
2012-11-20 17:08 c_schmitz Status assigned => resolved
2012-11-20 17:08 c_schmitz Resolution reopened => fixed
2012-11-21 10:49 pfpDave Note Added: 22361
2012-11-27 06:11 c_schmitz Note Added: 22594
2012-11-27 06:11 c_schmitz Status resolved => closed
2016-12-08 10:39 c_schmitz Category Tokens => Survey participants (Tokens)