Skip to content

Commit

Permalink
refactor(async-client): rename sql param to query (#233)
Browse files Browse the repository at this point in the history
  • Loading branch information
simPod authored Jan 12, 2024
1 parent ffd60ff commit c8e8cdd
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
4 changes: 2 additions & 2 deletions src/Client/ClickHouseAsyncClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ interface ClickHouseAsyncClient
*
* @template O of Output
*/
public function select(string $sql, Format $outputFormat, array $settings = []): PromiseInterface;
public function select(string $query, Format $outputFormat, array $settings = []): PromiseInterface;

/**
* @param array<string, mixed> $params
Expand All @@ -27,7 +27,7 @@ public function select(string $sql, Format $outputFormat, array $settings = []):
* @template O of Output
*/
public function selectWithParams(
string $sql,
string $query,
array $params,
Format $outputFormat,
array $settings = [],
Expand Down
12 changes: 6 additions & 6 deletions src/Client/PsrClickHouseAsyncClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ public function __construct(
*
* @throws Exception
*/
public function select(string $sql, Format $outputFormat, array $settings = []): PromiseInterface
public function select(string $query, Format $outputFormat, array $settings = []): PromiseInterface
{
$formatClause = $outputFormat::toSql();

return $this->executeRequest(
<<<CLICKHOUSE
$sql
$formatClause
CLICKHOUSE,
$query
$formatClause
CLICKHOUSE,
$settings,
static fn (ResponseInterface $response): Output => $outputFormat::output($response->getBody()->__toString())
);
Expand All @@ -57,13 +57,13 @@ public function select(string $sql, Format $outputFormat, array $settings = []):
* @throws Exception
*/
public function selectWithParams(
string $sql,
string $query,
array $params,
Format $outputFormat,
array $settings = [],
): PromiseInterface {
return $this->select(
$this->sqlFactory->createWithParameters($sql, $params),
$this->sqlFactory->createWithParameters($query, $params),
$outputFormat,
$settings,
);
Expand Down
18 changes: 9 additions & 9 deletions src/Client/PsrClickHouseClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ public function select(string $query, Format $outputFormat, array $settings = []

$response = $this->executeRequest(
<<<CLICKHOUSE
$query
$formatClause
CLICKHOUSE,
$query
$formatClause
CLICKHOUSE,
$settings,
);

Expand Down Expand Up @@ -107,10 +107,10 @@ public function insert(string $table, array $values, array|null $columns = null,

$this->executeRequest(
<<<CLICKHOUSE
INSERT INTO $table
$columnsSql
VALUES $valuesSql
CLICKHOUSE,
INSERT INTO $table
$columnsSql
VALUES $valuesSql
CLICKHOUSE,
$settings,
);
}
Expand All @@ -123,8 +123,8 @@ public function insertWithFormat(string $table, Format $inputFormat, string $dat

$this->executeRequest(
<<<CLICKHOUSE
INSERT INTO $table $formatSql $data
CLICKHOUSE,
INSERT INTO $table $formatSql $data
CLICKHOUSE,
$settings,
);
}
Expand Down

0 comments on commit c8e8cdd

Please sign in to comment.