From bfb0e4e174413bca2c6cf2ed4264ec784122c11d Mon Sep 17 00:00:00 2001 From: Nazmus Sakib Date: Thu, 11 Dec 2025 18:24:04 +0600 Subject: [PATCH 1/2] Fix null contentType error --- src/Statement.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Statement.php b/src/Statement.php index 9701d51..4253db4 100644 --- a/src/Statement.php +++ b/src/Statement.php @@ -152,8 +152,8 @@ private function parseErrorClickHouse(string $body) return false; } - private function hasErrorClickhouse(string $body, string $contentType): bool { - if (false === stripos($contentType, 'application/json')) { + private function hasErrorClickhouse(string $body, ?string $contentType): bool { + if ($contentType === null || false === stripos($contentType, 'application/json')) { return preg_match(self::CLICKHOUSE_ERROR_REGEX, $body) === 1; } From e1c82723e2d491f57434ac7165a93fd1dce5a9c0 Mon Sep 17 00:00:00 2001 From: ascrevia Date: Fri, 28 Aug 2026 22:51:46 +0300 Subject: [PATCH 2/2] feat: add WhereInFile support to streamRead and selectGenerator methods --- src/Client.php | 4 ++-- src/Transport/Http.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Client.php b/src/Client.php index 2a5b37a..87d71f1 100644 --- a/src/Client.php +++ b/src/Client.php @@ -422,12 +422,12 @@ public function readWithParams(Stream $streamRead, string $sql, array $params, a * @param array $querySettings Per-query settings override * @return \Generator yields associative arrays, one per row */ - public function selectGenerator(string $sql, array $bindings = [], array $querySettings = []): \Generator + public function selectGenerator(string $sql, array $bindings = [], array $querySettings = [], ?WhereInFile $whereInFile = null): \Generator { $stream = fopen('php://temp', 'r+'); $streamRead = new Transport\StreamRead($stream); - $this->transport()->streamRead($streamRead, $sql . ' FORMAT JSONEachRow', $bindings, $querySettings); + $this->transport()->streamRead($streamRead, $sql . ' FORMAT JSONEachRow', $bindings, $querySettings, $whereInFile); rewind($stream); diff --git a/src/Transport/Http.php b/src/Transport/Http.php index 9d4e434..5550bef 100644 --- a/src/Transport/Http.php +++ b/src/Transport/Http.php @@ -973,10 +973,10 @@ private function streaming(Stream $streamRW, CurlerRequest $request): Statement * @return Statement * @throws \ClickHouseDB\Exception\TransportException */ - public function streamRead(Stream $streamRead, $sql, $bindings = [], array $querySettings = []): Statement + public function streamRead(Stream $streamRead, $sql, $bindings = [], array $querySettings = [], ?WhereInFile $whereInFile = null): Statement { $sql = $this->prepareQuery($sql, $bindings); - $request = $this->getRequestRead($sql, null, null, $querySettings); + $request = $this->getRequestRead($sql, $whereInFile, null, $querySettings); return $this->streaming($streamRead, $request); }