View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|13821||Bug reports||Import/Export||public||2018-06-27 12:07||2020-03-06 00:43|
|Fixed in Version||3.22.7|
|Summary||13821: When importing a survey I receive a "Failed to Insert " error message|
Exporting survey from Live webserver, importing into local webserver. The import creates the survey, the 1st question group and an empty question and then throws the error. I also receive the same error when importing just a question group. Importing a question by itself works (kind of - another bug report).
|Steps To Reproduce|
Create survey on Live webserver
Log into local hosted version
I have also seen a DBCommand error once, but have been unable to reproduce.
This problem also seems to affect creating a question, when creating a question and pressing "Save" it takes me to a blank page. Pressing back shows the question was created. This doesnt occur if I press "Save and New"
|Tags||No tags attached.|
|Complete LimeSurvey version number (& build)||3.12.2+180625 & 3.12.3|
|I will donate to the project if issue is resolved||No|
|Database & DB-Version||sqlsrv|
|Server OS (if known)||Linux 3.10.0-514.el7.x86_64 #1 SMP|
|Webserver software & version (if known)||Apache/2.4.6 (Red Hat Enterprise Linux)|
I cannot reproduce that in 3.12.3
I have updated with the latest ComfortUpdate & am still seeing this error.
Further note, if I press "Create Question Group" directly after the import fails, I see this error;
Internal Server Error
I have grabbed the latest source code from GitHub, configured it to be hosted locally and pointed at a local SQL database. I have then tried to import a survey exported from the Live version (hosted here) and it throws the "Error: Failed to insert data " message.
So definitely nothing to do with my hosted version.
I'm going to try and debug it next.
Confirmed that this is still an issue in the latest ComfortUpdate.
Hi, I'll try to reproduce it tomorow.
additional Information: Despite this error message, the survey gets imported, but only with question groups and without questions!
Client requirements I'm afraid, they are a MSSQL shop.
How does your freetds.conf look like?
I dont appear to have a freetds.conf file on my local machine (Windows) which is displaying the error. I'll try and grab the copy of the RedHat box which is also experiencing the problem.
I have put in a pull request to address the fix. The issue is that the SQL PDO driver has changed its implementation so if you pass in a sequence name, it will always try and get a ID from a sequence, even on MSSQL. Comment from the code;
"Before version 5.0, the SQLSRV driver supports PDO::lastInsertId() with one peculiarity: when $sequence's value is null or empty string it returns empty string. But when parameter is not specified at all it's working as expected and returns actual last inserted ID (like other PDO drivers). 5.0 of the Microsoft PHP Drivers for SQL Server changes the behaviour of PDO::lastInsertID to be consistent with the behaviour outlined in the PDO documentation. It returns the ID of the last inserted sequence or row."
This change has come from the tip of the yii-1.19-dev code I'm not sure if their will be a further release (yii 1.1x is at end of life).
Pull Request Here: https://github.com/LimeSurvey/LimeSurvey/pull/1090
The relevant yii commit is here: https://github.com/yiisoft/yii/commit/7b768c304289ede574768de68939224d1180e2b1
any update on when this issue and\or pull request might be reviewed?
Fix committed to master branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=27599
This version of LimeSurvey is not longer supported. Please check so that the issue is fixed in a more recent version of LimeSurvey. If it's not, reopen this bug report. Thank you.
LimeSurvey: master d69915c1
|Fixed issue 13821: When importing a survey I receive a "Failed to Insert " error message (#1090)
Dev: This issue is caused by a change in the sql pdo driver
Dev: without this fix, new ids aren't returned from tables with identity columns in mssql
Dev: This causes questions not to save correctly (import, new etc)
Dev: This fix is from the yii 1.19-dev label, commit:
Dev: Commit 7b768c304289ede574768de68939224d1180e2b1
|mod - framework/db/schema/mssql/CMssqlSqlsrvPdoAdapter.php||Diff File|
|2018-06-27 12:07||MerkOne||New Issue|
|2018-06-27 14:31||c_schmitz||Assigned To||=> c_schmitz|
|2018-06-27 14:31||c_schmitz||Status||new => feedback|
|2018-06-27 14:31||c_schmitz||Note Added: 48318|
|2018-06-27 14:37||MerkOne||Note Added: 48320|
|2018-06-27 14:37||MerkOne||Status||feedback => assigned|
|2018-06-27 14:52||c_schmitz||Assigned To||c_schmitz => LouisGac|
|2018-06-27 16:20||MerkOne||Note Added: 48348|
|2018-06-28 15:26||MerkOne||Note Added: 48362|
|2018-06-28 17:33||MerkOne||Note Added: 48376|
||Note Added: 48379|
|2018-06-29 09:54||efingdmi||Note Added: 48386|
|2018-06-29 11:28||MerkOne||Note Added: 48396|
|2018-06-29 14:41||c_schmitz||Note Added: 48410|
|2018-06-29 14:42||c_schmitz||Note Edited: 48410||View Revisions|
|2018-06-29 15:05||MerkOne||Note Added: 48413|
|2018-07-02 11:11||MerkOne||Note Added: 48429|
|2018-07-02 11:25||MerkOne||Note Added: 48431|
|2018-07-05 15:27||MerkOne||Note Added: 48455|
||Changeset attached||=> LimeSurvey master d69915c1|
||Note Added: 48466|
||Resolution||open => fixed|
|2019-05-23 09:56||c_schmitz||Relationship added||related to 13822|
|2020-03-06 00:43||c_schmitz||Status||assigned => closed|
|2020-03-06 00:43||c_schmitz||Fixed in Version||=> 3.22.7|
|2020-03-06 00:43||c_schmitz||Note Added: 56344|