View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
09177 | Bug reports | Survey taking | public | 2014-08-19 23:36 | 2014-09-08 21:21 |
Reporter | Ibistide | Assigned To | DenisChenu | ||
Priority | normal | Severity | minor | ||
Status | closed | Resolution | fixed | ||
Product Version | 2.05+ | ||||
Target Version | 2.05+ | Fixed in Version | 2.05+ | ||
Summary | 09177: Surveys with quota causing error in MSSQL | ||||
Description | We have an issue where quizzes that contain a Yes/No question are throwing an MSSQL error. The first page of our quiz is a Yes/No question. When it is submitted, it posts YII_CSRF_TOKEN:5ddf3b8543847c1e09a2c4f7e134bace4f36c136 when the POST occurs, the following query is run on MSSQL server: declare @p1 int Which causes this error: CDbCommand failed to execute the SQL statement: SQLSTATE[42000]: [Microsoft][SQL Server Native Client 11.0][SQL Server]Incorrect syntax near 'X14X235'. Note: this error does not occur in Version 2.05+ Build 140502. It only started happening after we upgraded to 140811. It occurs in both existing surveys created before version 140811, and new surveys created in 140811. | ||||
Steps To Reproduce | (The attached test survey was created on a fresh install of Limesurvey Version 2.05+ Build 140811.)
| ||||
Additional Information | The column names in the T-SQL statements that Limesurvey is generating are not wrapped in []. My guess is that this is causing MSSQL server some confusion; the "AND 624695X14X235 = @P1" portion of the statement may be ambiguous. (It may be trying to perform a comparison of "624695X14X235" itself as a value instead of performing the evaluation on the values in the 624695X14X235 column?) It appears that wrapping [] around the column names solves this issue. Test: Isolating the Select statement and running it by itself in SSMS (SQL Server Management Studio) and replaceing @p1 with the 'Y' value supplied from the form, this statement causes an error: SELECT COUNT(*) FROM [dbo].[survey_624695] [t] WHERE (submitdate IS NOT NULL) AND (624695X14X235 = 'Y') Result: Error: Msg 102, Level 15, State 1, Line 1 After wrapping 624695X14X235 in brackets, the statement runs successfully: SELECT COUNT(*) FROM [dbo].[survey_624695] [t] WHERE (submitdate IS NOT NULL) AND ([624695X14X235] = 'Y') Result: Returns a correct count value. (Note: the column 624695X14X235 in the table [dbo].[survey_624695] in the Limesurvey database is a varchar(1) field.) | ||||
Tags | No tags attached. | ||||
Attached Files | |||||
Bug heat | 4 | ||||
Complete LimeSurvey version number (& build) | 140811 | ||||
I will donate to the project if issue is resolved | No | ||||
Browser | Google Chrome 36.0.1985.143 | ||||
Database type & version | MSSQL Server 2012 SP1 Enterprise Edition, Database: Compatability Level 2012, Collation SQL_Latin1_General_CP1_CI_AS | ||||
Server OS (if known) | Windows 2008 R2 Enterprise | ||||
Webserver software & version (if known) | IIS 7.5 | ||||
PHP Version | PHP 5.4.26.0 | ||||
Fix committed to master branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=14382 |
|
@Ibistide can you apply the same patch than https://github.com/LimeSurvey/LimeSurvey/commit/c85494d76557845166a7dbffaa760ceaffb38081 and test again ? |
|
@DenisChenu - Thanks for the quick turnaround! I edited those changes directly into application/helpers/common_helper.php on our 140811 version. Our Limesurvey admin tested, and says that this change has solved the issue. I confirmed that the T-SQL statement (the one that was previously throwing an error) now has the column names wrapped in [] and is working correctly. Thanks again! |
|
Thanks for return. You can update to the next version when it come (you have some information that common_helper was updated and have to confirm). |
|
LimeSurvey: master c85494d7 2014-08-20 17:38 Details Diff |
Fixed issue 09177: Surveys with quote causing error in MSSQL Dev : Need to quote column name Dev : child of https://github.com/LimeSurvey/LimeSurvey/commit/535035816af172fc5b82f3fa896cdb73d53c9800 |
Affected Issues 09177 |
|
mod - application/helpers/common_helper.php | Diff File |
Date Modified | Username | Field | Change |
---|---|---|---|
2014-08-19 23:36 | Ibistide | New Issue | |
2014-08-19 23:36 | Ibistide | File Added: limesurvey_survey_624695.lss | |
2014-08-20 17:15 | DenisChenu | Assigned To | => DenisChenu |
2014-08-20 17:15 | DenisChenu | Status | new => assigned |
2014-08-20 17:34 | DenisChenu | Summary | Quizzes with Yes/No question causing error in MSSQL => Surveys with quote causing error in MSSQL |
2014-08-20 17:38 | DenisChenu | Changeset attached | => LimeSurvey master c85494d7 |
2014-08-20 17:38 | DenisChenu | Note Added: 30433 | |
2014-08-20 17:38 | DenisChenu | Resolution | open => fixed |
2014-08-20 17:40 | DenisChenu | Note Added: 30434 | |
2014-08-20 17:40 | DenisChenu | Status | assigned => feedback |
2014-08-20 17:40 | DenisChenu | Note Edited: 30434 | |
2014-08-20 17:40 | DenisChenu | Target Version | => 2.05+ |
2014-08-20 17:41 | DenisChenu | Summary | Surveys with quote causing error in MSSQL => Surveys with quota causing error in MSSQL |
2014-08-20 21:16 | Ibistide | Note Added: 30435 | |
2014-08-20 21:16 | Ibistide | Status | feedback => assigned |
2014-08-21 11:29 | DenisChenu | Note Added: 30439 | |
2014-08-21 11:29 | DenisChenu | Status | assigned => resolved |
2014-08-21 11:29 | DenisChenu | Fixed in Version | => 2.05+ |
2014-09-08 21:21 | c_schmitz | Status | resolved => closed |