Skip to content

Commit

Permalink
Fixed issue #4136: Multilingual question/group import fails on MSSQL …
Browse files Browse the repository at this point in the history
…server

git-svn-id: file:///Users/Shitiz/Downloads/lssvn/source/limesurvey@8448 b72ed6b6-b9f8-46b5-92b4-906544132732
  • Loading branch information
c-schmitz committed Mar 2, 2010
1 parent 571dbd8 commit a2071f0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions admin/importgroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -449,8 +449,11 @@

$newvalues=array_values($grouprowdata);
$newvalues=array_map(array(&$connect, "qstr"),$newvalues); // quote everything accordingly
if (isset($grouprowdata['gid'])) {@$connect->Execute('SET IDENTITY_INSERT '.db_table_name('groups')." ON");}

$ginsert = "insert INTO {$dbprefix}groups (".implode(',',array_keys($grouprowdata)).") VALUES (".implode(',',$newvalues).")";
$gres = $connect->Execute($ginsert) or safe_die($clang->gT("Error").": Failed to insert group<br />\n$ginsert<br />\n".$connect->ErrorMsg());
if (isset($grouprowdata['gid'])) {@$connect->Execute('SET IDENTITY_INSERT '.db_table_name('groups').' OFF');}

//GET NEW GID .... if is not done before and we count a group if a new gid is required
if ($newgid == 0)
Expand Down Expand Up @@ -517,7 +520,9 @@
$newvalues=array_values($questionrowdata);
$newvalues=array_map(array(&$connect, "qstr"),$newvalues); // quote everything accordingly
$qinsert = "insert INTO {$dbprefix}questions (".implode(',',array_keys($questionrowdata)).") VALUES (".implode(',',$newvalues).")";
if (isset($questionrowdata['qid'])) {@$connect->Execute('SET IDENTITY_INSERT '.db_table_name('questions').' ON');}
$qres = $connect->Execute($qinsert) or safe_die ($clang->gT("Error")."Failed to insert question<br />\n$qinsert<br />\n".$connect->ErrorMsg());
if (isset($questionrowdata['qid'])) {@$connect->Execute('SET IDENTITY_INSERT '.db_table_name('questions').' OFF');}

//GET NEW QID .... if is not done before and we count a question if a new qid is required
if (!isset($newqids[$oldqid]))
Expand Down
4 changes: 4 additions & 0 deletions admin/importquestion.php
Original file line number Diff line number Diff line change
Expand Up @@ -441,9 +441,13 @@

$newvalues=array_values($questionrowdata);
$newvalues=array_map(array(&$connect, "qstr"),$newvalues); // quote everything accordingly
if (isset($questionrowdata['qid'])) {@$connect->Execute('SET IDENTITY_INSERT '.db_table_name('questions').' ON');}

$qinsert = "INSERT INTO {$dbprefix}questions (".implode(',',array_keys($questionrowdata)).") VALUES (".implode(',',$newvalues).")";
$qres = $connect->Execute($qinsert) or safe_die ($clang->gT("Error").": Failed to insert question<br />\n$qinsert<br />\n".$connect->ErrorMsg());

if (isset($questionrowdata['qid'])) {@$connect->Execute('SET IDENTITY_INSERT '.db_table_name('questions').' OFF');}

// set the newqid only if is not set
if (!isset($newqid))
$newqid=$connect->Insert_ID("{$dbprefix}questions","qid");
Expand Down

0 comments on commit a2071f0

Please sign in to comment.