View Issue Details

This bug affects 1 person(s).
 2
IDProjectCategoryView StatusLast Update
19229Bug reportsDatabase designpublic2023-11-13 14:17
Reporterzufolo441 Assigned To 
PrioritynoneSeveritypartial_block 
Status acknowledgedResolutionopen 
Product Version6.3.x 
Summary19229: bug in mssql_drop_coulmn_with_constraints
Description

Hi, when database "limesurvey" in mssql is case sensitive (SQL_Latin1_General_CP1_CS_AS, for example), the function mssql_drop_coulmn_with_constraints in activate_helper.php doesn't work because the query is lowercase.
I had to correct it in the following way:

function mssql_drop_coulmn_with_constraints($tablename, $columnname)
{
Yii::app()->loadHelper("database");

// find out the constraint name of the old primary key
$pkquery = "SELECT CONSTRAINT_NAME
FROM INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE
WHERE TABLE_NAME = '" . $tablename . "' AND COLUMN_NAME = '" . $columnname . "'";

$result = Yii::app()->db->createCommand($pkquery)->queryAll();
foreach ($result as $constraintName) {
    Yii::app()->db->createCommand('alter table [' . $tablename . '] drop constraint "' . $constraintName['CONSTRAINT_NAME'] . '"')->execute();
}
$success = Yii::app()->db->createCommand('ALTER TABLE [' . $tablename . '] DROP COLUMN "' . $columnname . '"')->execute();
return $success;

}

please note the ortographic error in name, as already reported in 19110 , still unresolved.

Many thanks!

Steps To Reproduce

try to activate a survey in a case sensitive MSSQL database.

TagsNo tags attached.
Bug heat2
Complete LimeSurvey version number (& build)6.3.4
I will donate to the project if issue is resolvedNo
BrowserFirefox 119
Database type & versionMicrosoft SQL Server 2012 (SP3-GDR) (KB4019092) - 11.0.6251.0 (X64)
Server OS (if known)Debian 12
Webserver software & version (if known)nginx+php-fpm
PHP Version8.2

Users monitoring this issue

There are no users monitoring this issue.

Activities

gabrieljenik

gabrieljenik

2023-11-13 14:17

manager   ~78413

@Olle should we review and incorporate this?

Issue History

Date Modified Username Field Change
2023-11-09 12:47 zufolo441 New Issue
2023-11-13 14:16 gabrieljenik Status new => acknowledged
2023-11-13 14:17 gabrieljenik Note Added: 78413
2023-11-13 14:17 gabrieljenik Bug heat 0 => 2