Skip to content

Commit

Permalink
Fixed issue #18201: Unable to import LSA file with MSSQL and debug set (
Browse files Browse the repository at this point in the history
#2472)

Dev: check if $result['CONTRAINT_NAME'] exist before using it
  • Loading branch information
Shnoulle committed Jul 1, 2022
1 parent f504f5b commit 72e2dac
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions application/helpers/admin/activate_helper.php
Expand Up @@ -525,9 +525,11 @@ function mssql_drop_constraint($fieldname, $tablename)
sys.syscolumns AS col ON t_obj.id = col.id AND con.colid = col.colid
WHERE (c_obj.xtype = 'D') AND (col.name = '$fieldname') AND (t_obj.name='{{{$tablename}}}')";
$result = dbExecuteAssoc($dfquery)->read();
$defaultname = $result['CONTRAINT_NAME'];
if ($defaultname != false) {
modifyDatabase("", "ALTER TABLE {{{$tablename}}} DROP CONSTRAINT {$defaultname[0]}"); echo $modifyoutput; flush();
if (!empty($result['CONTRAINT_NAME'])) {
$defaultname = $result['CONTRAINT_NAME'];
modifyDatabase("", "ALTER TABLE {{{$tablename}}} DROP CONSTRAINT {$defaultname[0]}");
echo $modifyoutput;
flush();
}
}

Expand Down

0 comments on commit 72e2dac

Please sign in to comment.