Skip to content

Commit

Permalink
Allow passing request parameters to executeQuery*() (#112)
Browse files Browse the repository at this point in the history
  • Loading branch information
simPod committed Jul 29, 2021
1 parent 9dbf6f5 commit 0887e3b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
10 changes: 7 additions & 3 deletions src/Client/ClickHouseClient.php
Expand Up @@ -9,10 +9,14 @@

interface ClickHouseClient
{
public function executeQuery(string $query) : void;
/** @param array<string, float|int|string> $requestParameters */
public function executeQuery(string $query, array $requestParameters = []) : void;

/** @param array<string, mixed> $queryParameters */
public function executeQueryWithParameters(string $query, array $queryParameters) : void;
/**
* @param array<string, mixed> $queryParameters
* @param array<string, float|int|string> $requestParameters
*/
public function executeQueryWithParameters(string $query, array $queryParameters, array $requestParameters = []) : void;

/**
* @param array<string, float|int|string> $requestParameters
Expand Down
11 changes: 7 additions & 4 deletions src/Client/PsrClickHouseClient.php
Expand Up @@ -55,17 +55,20 @@ public function __construct(
$this->sqlFactory = new SqlFactory($this->valueFormatter);
}

public function executeQuery(string $query) : void
/**
* {@inheritDoc}
*/
public function executeQuery(string $query, array $requestParameters = []) : void
{
$this->executeRequest($query);
$this->executeRequest($query, $requestParameters);
}

/**
* {@inheritDoc}
*/
public function executeQueryWithParameters(string $query, array $queryParameters) : void
public function executeQueryWithParameters(string $query, array $queryParameters, array $requestParameters = []) : void
{
$this->executeQuery($this->sqlFactory->createWithParameters($query, $queryParameters));
$this->executeQuery($this->sqlFactory->createWithParameters($query, $queryParameters), $requestParameters);
}

/**
Expand Down

0 comments on commit 0887e3b

Please sign in to comment.