Skip to content

Commit

Permalink
dbDelete(): Check that table exists before updating links.
Browse files Browse the repository at this point in the history
  • Loading branch information
arnemorken committed Dec 16, 2023
1 parent 23e57dd commit dd643aa
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions data/mysql/anyTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -2427,10 +2427,14 @@ public function dbDelete()
foreach ($this->mLinking as $idx => $link_type) {
if ($this->mType !== $link_type) {
$link_table = $this->findLinkTableName($link_type);
$stmt = "DELETE FROM ".$link_table." WHERE ".$this->getIdKey()."='".$this->mId."'";
//elog("dbDelete(3):".$stmt);
if (!$this->query($stmt))
return null;
if ($this->tableExists($link_table)) {
$stmt = "DELETE FROM ".$link_table." WHERE ".$this->getIdKey()."='".$this->mId."'";
//elog("dbDelete(3):".$stmt);
if (!$this->query($stmt))
return null;
}
//else
// elog("dbDelete: Link table $link_table does not exist. ");
}
}
}
Expand Down

0 comments on commit dd643aa

Please sign in to comment.