sql = $sql; $this->errorCodesToIgnore = $errorCodesToIgnore; } public function shouldIgnoreError($exception) { if (empty($this->errorCodesToIgnore)) { return false; } foreach ($this->errorCodesToIgnore as $code) { if (Db::get()->isErrNo($exception, $code)) { return true; } } return false; } /** * @internal * @param int $errorCode * @return $this */ public function addErrorCodeToIgnore($errorCode) { $this->errorCodesToIgnore[] = $errorCode; return $this; } /** * @internal */ public function getErrorCodesToIgnore() { return $this->errorCodesToIgnore; } public function __toString() { $sql = $this->sql; if (!Common::stringEndsWith($sql, ';')) { $sql .= ';'; } return $sql; } public function exec() { Db::exec($this->sql); } }