View Issue Details

This bug affects 1 person(s).
 0
IDProjectCategoryView StatusLast Update
04738Bug reportsOtherpublic2010-11-14 18:25
Reporteruser1329Assigned Toc_schmitz  
PrioritynormalSeveritypartial_block 
Status closedResolutionduplicate 
Fixed in Version1.90+ 
Summary04738: Database check returns SQL error on MSSQL
Description

Performing the database check in Limesurvey returns a SQL error when using the SQL server drivers (odbc_mssql or mssqlnative).

Steps To Reproduce

Go into limesurvey running MSSQL
Click the icon to check data integrity.
The following message appears (and may vary depending on the driver you use).


Couldn't get list of conditions from database

SQLState: 42000 Error Code: 156 Message: [Microsoft][SQL Server Native Client 10.0][SQL Server]Incorrect syntax near the keyword 'like'.

Additional Information

This originates from the two statements at lines 39 and 71 of the integritycheck.php file version 9185:

$sQuery = "show tables like '{$dbprefix}survey_%'";

and

$sQuery = "show tables like '{$dbprefix}tokens_%'";

are indeed invalid SQL statements for MSSQL.

The mssql correct related statements are respectively:
$sQuery = "SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES where TABLE_TYPE='BASE TABLE' and TABLENAME LIKE '{$dbprefix}survey\%'";
and
$sQuery = "SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES where TABLE_TYPE='BASE TABLE' and TABLENAME LIKE '{$dbprefix}tokens\%'";

Adding a condition to check the databasedriver used is therefore ideal to obtain in the end something like:

if ($databasetype=='mssqlnative' || $databasetype=='odbc_mssql') {
$sQuery = "SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES where TABLE_TYPE='BASE TABLE' and TABLENAME LIKE '{$dbprefix}survey_%'";
} else { $sQuery = "show tables like '{$dbprefix}survey\
%'";}

You obviously will have a better way of implementing the fix :))

TagsNo tags attached.
Bug heat0
Complete LimeSurvey version number (& build)9459
I will donate to the project if issue is resolvedNo
Browserany
Database type & versionMSSQL SERVER 2005
Server OS (if known)Windows server 2003
Webserver software & version (if known)IIS6
PHP Version5.3.3

Relationships

duplicate of 04734 closedc_schmitz Integrity Check fails on PostgreSQL 

Users monitoring this issue

There are no users monitoring this issue.

Activities

There are no notes attached to this issue.

Issue History

Date Modified Username Field Change
2010-11-14 17:36 user1329 New Issue
2010-11-14 18:24 c_schmitz Relationship added duplicate of 04734
2010-11-14 18:24 c_schmitz Status new => resolved
2010-11-14 18:24 c_schmitz Fixed in Version => 1.90+
2010-11-14 18:24 c_schmitz Resolution open => duplicate
2010-11-14 18:24 c_schmitz Assigned To => c_schmitz
2010-11-14 18:25 c_schmitz Status resolved => closed