Build(); // Создаю запрос $sql = "SELECT COUNT(*) FROM $this->DBSignOpen$table$this->DBSignClose"; // Если заданы where-параметры if ($where->Count() > 0) // - то добавляю их $sql .= ' WHERE ' . $sql_where; // Выполняю запрос $countResult = $this->Query($sql, $params); // Если запрос выполнен с ошибкой if ($countResult === false) // - то в результат идёт -1 return -1; // Получаю секцию $section = match ($this->Config->Driver) { DBDriver::MySQL, DBDriver::SQLite => "COUNT(*)", DBDriver::MSSQL, DBDriver::OracleDB, DBDriver::PostgreSQL => "" }; // Вывожу количество return isset($countResult[0][$section]) ? (int)$countResult[0][$section] : -1; } /** * Проверяет, существует ли запись в таблице. * * @param string $table Имя таблицы. * @param ConditionBuilder $where Условия выборки. * * @return bool Результат проверки. */ public function IsExist (string $table, ConditionBuilder $where): bool { // Вывожу результат return $this->Count($table, $where) > 0; } }