bMustFail = true; $this->iRequestCount = 0; $this->iFailAt = $iFailAt; $this->bShowRequest = true; } /** * @param bool $bShowRequest */ public function SetShowRequest($bShowRequest) { $this->bShowRequest = $bShowRequest; } public function query($sSQL) { if (utils::StartsWith($sSQL, "SELECT")) { return; } if ($this->bShowRequest) { $sShortSQL = substr(preg_replace("/\s+/", " ", substr($sSQL, 0, 180)), 0, 150); echo "$sShortSQL\n"; } if (CMDBSource::IsInsideTransaction() && $this->bMustFail) { $this->iRequestCount++; if ($this->iRequestCount == $this->iFailAt) { echo "Generating a FAKE DEADLOCK\n"; IssueLog::Trace("Generating a FAKE DEADLOCK", 'cmdbsource'); throw new MySQLException("FAKE DEADLOCK", [], new Exception("FAKE DEADLOCK", 1213)); } } } }