Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

BUG in second language? Need help - we must go online SOON!

  • olectrix
  • olectrix's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
10 years 3 months ago - 10 years 3 months ago #102812 by olectrix
We are doing a scientific survey in two languages... or we´d like to... :/

Basic language is Danish, second language is German.
4 categories/groups of questions
ca. 25 Questions

When choosing "edit" the FIRST question in the FIRST category of questions the following ERROR occurs:

"Internal Server Error
The active record cannot be inserted to database because it is not new.

An internal error occurred while the Web server was processing your request. Please contact the webmaster to report this problem.

Thank you.
2013-12-22 21:28:25"

There should be mentioned that this question uses a >text-box< as answer-option (so that the user has to write something)- It seems that we can reproduce the error with the long and the small text-box or with all text-answer-options!

This results in an destroyed german survey, where every second time you choose the "next button", the user will see NO question.

In the BACKEND it seems that the WHOLE survey somehow has errors from that point, because when editing or saving questions the survey the above shown error occurs.

I am not a programmer - but could it be that the database-call for strings, which is needed when text has to be saved/copied into the database, has an error, since the error-message is: "The active record cannot be inserted to database because it is not new." ?


We a writing a 30 Page long university-lecture, which hast to be finished in January the 9th - and we still have NO survey online, because of these issues. We would really appreciate any FAST help!

We will donate an small amount of money to the project, when there´s a chance to get our survey successfully online without errors in the next TWO days - because there´s not much time left for us.

if we can not make it work - 5 days of work will be lost without any results :( - and we have to use expensive tools like "survey-monkey" instead ... we think it is better that THIS project gets the money, if we can solve the issue together.

please help :(


Last edit: 10 years 3 months ago by olectrix. Reason: screenshot
The topic has been locked.
  • olectrix
  • olectrix's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
10 years 3 months ago #102813 by olectrix
And another error-message:

"Internal Server Error
CDbCommand failed to execute the SQL statement: SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens

An internal error occurred while the Web server was processing your request. Please contact the webmaster to report this problem.

Thank you.
2013-12-22 22:05:01"
The topic has been locked.
  • olectrix
  • olectrix's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
10 years 3 months ago #102815 by olectrix
I could reproduce the error with any new survey, by doing the following:

1 - Make a survey in danish (or another language)
2 - add german as second language (or another language)

3 - add 1 question-group/category
4 - add the first question in the firs group and edit it in both languages (this could also be english and afrikaans!) and save

5 - When you try to hit the "edit" button of this question again, the following error occurs:

"Internal Server Error
The active record cannot be inserted to database because it is not new.

An internal error occurred while the Web server was processing your request. Please contact the webmaster to report this problem.

Thank you."

This happens as soon as you define a second language in your survey!

Anyone able to reproduce this on your installation?

Any workarounds?
The topic has been locked.
More
10 years 3 months ago - 10 years 3 months ago #102817 by apmuthu
This issue has been solved by making the qid the same for both languages in the lime_questions table. To enable multi sequence for compound key comprising one auto_increment (qid) column and another column (language), the auto_increment column must not be the first in he primary key order.

Switch the primary key from being (qid, language) to (language, qid). Make sure to set the existing AUTO_INCREMENT values to the correct one and adjust all old entries as desired. The lime_answers table will also need to be corrected for qid values if changed in lime_questions.

There is a bug report with fix in the bug tracker.
bugs.limesurvey.org/view.php?id=8446

The fix is as below:
Code:
ALTER TABLE `lime_questions` DROP PRIMARY KEY, ADD PRIMARY KEY (`language`, `qid`);
Last edit: 10 years 3 months ago by apmuthu. Reason: typo
The following user(s) said Thank You: DenisChenu
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
10 years 3 months ago #102823 by DenisChenu
apmuthu : did your install was directly made in 2.05 ? Or with a 2.00 ?

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
More
10 years 3 months ago #102833 by apmuthu
2.05+ from GitHub as well as the v2.05 release
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
10 years 3 months ago #102846 by DenisChenu
Then really don't understand what happe:

github.com/LimeSurvey/LimeSurvey/blob/ma...reate-mysql.sql#L287

PRIMARY KEY (`qid`,`language`)

???

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
  • olectrix
  • olectrix's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
10 years 3 months ago #102850 by olectrix
OK - this is too technical for us to understand.

We have made a fresh install of limesurvey205plus-build131219(.zip). some days ago - this is the version we are using. We have made NO upgrade or anything.

Now: Is there any fast "fix" or "workaround" ... any code I can paste into some file, or do we have to make two different surveys each for any language, instead of using the obvious buggy multilingual-feature in ONE survey?
The topic has been locked.
More
10 years 3 months ago - 10 years 3 months ago #102858 by apmuthu
  • The existing code creates the lime_questions table with the PRIMARY KEY (`qid`, `language`)
  • We need to correct it by reversing the order of the columns in the key to be PRIMARY KEY (`language`, `qid`)
  • Hence the need to run the said sql statement on the limesurvey database after installation but before usage.
  • Otherwise, edit the schema file before installation.

The reasons, details and references are available at:
bugs.limesurvey.org/view.php?id=8446

The following sql statement can be run from phpMyAdmin or some mysql client:
Code:
ALTER TABLE `lime_questions` DROP PRIMARY KEY, ADD PRIMARY KEY (`language`, `qid`);

There is no harm in accidentally running the above sql statement more than once.
Last edit: 10 years 3 months ago by apmuthu.
The topic has been locked.
More
10 years 3 months ago #102867 by apmuthu
The topic has been locked.
More
8 years 6 months ago - 8 years 6 months ago #125811 by apmuthu
This bug is still there in the last of the v2.05+ (and is still there in the v2.06+ which cannot be run on PHP < 5.3.3 even if forced - will result in multiple namespace overwriting of variables).

Last known commit in the master branch when it was v2.05+ (just before v2.06 was merged into it) was on 2015-06-06.
github.com/LimeSurvey/LimeSurvey/tree/0d...5b2c43ae4a3ef856a1b5

This version installs correctly in XAMPP 1.7.7 / PHP 5.3.1 with no composer / phar stuff needed. The bugfix for the primary key is still needed.

Simulated it in Debian MySQL v5.1.73+deb6u1 and Windows MySQL 5.1.41.
stackoverflow.com/questions/5416548/mysq...-with-auto-increment
If the auto increment key is not the first in the sequence of the primary key definition, it will give the desired results.

Test case:
Code:
CREATE TABLE animals (
    grp ENUM('fish','mammal','bird') NOT NULL,
    id MEDIUMINT NOT NULL AUTO_INCREMENT,
    aname CHAR(30) NOT NULL,
    PRIMARY KEY (id,grp)
) ENGINE=MYISAM;
 
INSERT INTO animals (grp,aname) VALUES
    ('mammal','dog'),('mammal','cat'),
    ('bird','penguin'),('fish','lax'),('mammal','whale'),
    ('bird','ostrich');
 
grp  id  aname
======  ==      =======
mammal  1  dog
mammal  2  cat
bird  3  penguin
fish  4  lax
mammal  5  whale
bird  6  ostrich
;
 
ALTER TABLE animals DROP PRIMARY KEY, ADD PRIMARY KEY (`grp`, `id`);
TRUNCATE TABLE animals;
 
INSERT INTO animals (grp,aname) VALUES
    ('mammal','dog'),('mammal','cat'),
    ('bird','penguin'),('fish','lax'),('mammal','whale'),
    ('bird','ostrich');
;
 
grp  id  aname
======  ==      =======
mammal  1  dog
mammal  2  cat
bird  1  penguin
fish  1  lax
mammal  3  whale
bird  2  ostrich
;

The attachment could be one place of failure due to a missing comma if the first field is a blank.
Last edit: 8 years 6 months ago by apmuthu.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose