View Issue Details

This issue affects 1 person(s).
 6
IDProjectCategoryView StatusLast Update
05094Bug reportsOtherpublic2011-04-16 16:46
Reportermedicnick Assigned Toc_schmitz  
PriorityhighSeveritypartial_block 
Status closedResolutionunable to reproduce 
Product Version1.91RC5 
Summary05094: Creating Labelsets error in MSSQL
Description

When saving a test label set in Label Sets Administration, clicking on save results in this error:
e: Undefined index: ajax in E:{PATH}\limesurvey\admin\labels.php on line 594
[Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near ''.:DELETE FROM [ems_labels] WHERElid` = '1'

Saving a second test label set in Label Sets Administration results in
Notice: Undefined index: ajax in E:{PATH}\limesurvey\admin\labels.php on line 594
[Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near ''.:DELETE FROM [ems_labels] WHERElid` = '2'

Both label sets were actually created but the test label title is blank.

TagsNo tags attached.
Bug heat6
Complete LimeSurvey version number (& build)9995
I will donate to the project if issue is resolvedNo
BrowserFF4
Database type & versionMSSQL R2
Server OS (if known)WIN 2008
Webserver software & version (if known)IIS7
PHP Version5.2.5
Git branch / Pull Request URL

Users monitoring this issue

There are no users monitoring this issue.

Activities

mdekker

mdekker

2011-04-07 14:46

reporter   ~14725

Last edited: 2011-04-07 14:47

@c_schmitz: he is referring to the dev branch, but i also noticed that backticks ` exist in the stable branch. As that seems to be a problem for MSSQL (and I only have MySQL) could you review if that really is a problem? Then we need to fix some stuff on the stable branch too

medicnick

medicnick

2011-04-11 06:38

reporter   ~14740

I previously had 1.92dev so now that I have RC5 correctly installed, I reran this test. It resulted in the following error: Inserting the label set failed:
INSERT INTO [ems_labelsets] (label_name,languages) VALUES ('newtest','en')
[Microsoft][ODBC SQL Server Driver][SQL Server]Cannot insert the value NULL into column 'lid', table '<db>.dbo.ems_labelsets'; column does not allow nulls. INSERT fails.

Looking into labels.php it appears to be this particular section
[code]
if (isset($_POST['label_name']))
{
$postlabel_name=sanitize_labelname($_POST['label_name']);
}

$postlabel_name = db_quoteall($postlabel_name,true);
$postlanguageids = db_quoteall($postlanguageids,true);

$query = "INSERT INTO ".db_table_name('labelsets')." (label_name,languages) VALUES ({$postlabel_name},{$postlanguageids})";
if (!$result = $connect->Execute($query))
{
    safe_die("Inserting the label set failed:<br />".$query."<br />".$connect->ErrorMsg());
}
else
{
    return $connect->Insert_ID(db_table_name_nq('labelsets'),"lid");
}

}
[/code]

This function fails to generate a new LID and also fails to return the error message. I confirmed that a new LID was not generated by checking the labelsets table.

I hope this is helpful. Thanks.

c_schmitz

c_schmitz

2011-04-11 11:15

administrator   ~14741

The code is alright. It looks liekyour labelsets table is missing the autoincrement value on the LID field. I also tested it here on MSSQL and was not able to reproduce.
Please re-install the LimeSurvey database and let us know if the error persists.

medicnick

medicnick

2011-04-13 06:48

reporter   ~14806

Ah, I did create a fresh db and a fresh site on my IIS7.5 machine with SQL R2 (2008) and found that none of the tables had the identities or default values set. I manually set the identities and defaults for each column specified in the MSSQL.sql file using SSMS. I think there are one or two tables that had primary key constraints that could not be set this way without dropping the constraints, which concerned me more.

I'm not sure where to start with your scripting process and ADODB to troubleshoot this. Do you have any ideas?

Anyways, once these were properly set now this particular issue is not reoccurring.

c_schmitz

c_schmitz

2011-04-16 16:46

administrator   ~14825

Well, make sure your DB user has permission to set identities or default values.
You can find the SQL used to create the DB in

\admin\install\create-mssql.sql

Closing issue.

Issue History

Date Modified Username Field Change
2011-04-07 05:37 medicnick New Issue
2011-04-07 14:45 mdekker Assigned To => c_schmitz
2011-04-07 14:45 mdekker Status new => assigned
2011-04-07 14:46 mdekker Note Added: 14725
2011-04-07 14:47 mdekker Note Edited: 14725
2011-04-11 06:38 medicnick Note Added: 14740
2011-04-11 11:15 c_schmitz Note Added: 14741
2011-04-11 11:15 c_schmitz Status assigned => feedback
2011-04-13 06:48 medicnick Note Added: 14806
2011-04-13 06:48 medicnick Status feedback => assigned
2011-04-16 16:46 c_schmitz Note Added: 14825
2011-04-16 16:46 c_schmitz Status assigned => closed
2011-04-16 16:46 c_schmitz Resolution open => unable to reproduce