public function safeQuery(string $statement, array $params = [], int $fetch_style = \PDO::FETCH_ASSOC)
{
if (empty($params)) {
$stmt = $this->pdo->query($statement);
if ($stmt !== false) {
return $stmt->fetchAll($fetch_style);
}
return false;
}
$stmt = $this->pdo->prepare($statement);
if ($stmt === false) {
throw new DBAlert\QueryError($this->errorInfo()[2] ?? \json_encode([$statement, $params]), (int) $this->errorInfo()[1]);
}
$stmt->execute($params);
return $stmt->fetchAll($fetch_style);
}