Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/Client/ClickHouseClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ public function selectWithParams(string $query, array $params, Format $outputFor
* @throws ClientExceptionInterface
* @throws ServerError
* @throws UnsupportedParamType
* @throws UnsupportedParamValue
*/
public function insert(string $table, array $values, array|null $columns = null, array $settings = []): void;

Expand Down
5 changes: 4 additions & 1 deletion src/Sql/ExpressionFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,18 @@

namespace SimPod\ClickHouseClient\Sql;

use SimPod\ClickHouseClient\Exception\UnsupportedParamValue;

use function array_map;
use function sprintf;

final class ExpressionFactory
final readonly class ExpressionFactory
{
public function __construct(private ValueFormatter $valueFormatter)
{
}

/** @throws UnsupportedParamValue */
public function templateAndValues(string $template, mixed ...$values): Expression
{
return Expression::new(
Expand Down
10 changes: 8 additions & 2 deletions src/Sql/ValueFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
use function sprintf;

/** @internal */
final class ValueFormatter
final readonly class ValueFormatter
{
public function __construct(private DateTimeZone|null $dateTimeZone = null)
{
Expand Down Expand Up @@ -117,6 +117,8 @@ public function format(mixed $value, string|null $paramName = null, string|null
* @param array<mixed> $values
*
* @return array<string>
*
* @throws UnsupportedParamValue
*/
public function mapFormat(array $values): array
{
Expand All @@ -132,7 +134,11 @@ function ($value): string {
);
}

/** @param array<mixed> $value */
/**
* @param array<mixed> $value
*
* @throws UnsupportedParamValue
*/
private function formatArray(array $value): string
{
return sprintf(
Expand Down