Skip to content

Commit 0458c19

Browse files
committed
Fix #187 Client::partitions
1 parent 92ebfc7 commit 0458c19

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

src/Client.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -817,9 +817,14 @@ public function partitions(string $table, int $limit = null, bool $active = null
817817
return $this->select(<<<CLICKHOUSE
818818
SELECT *
819819
FROM system.parts
820-
WHERE like(table,'%$table%') AND database='$database'$whereActiveClause
820+
WHERE table={tbl:String} AND database = {db:String}
821+
$whereActiveClause
821822
ORDER BY max_date $limitClause
822-
CLICKHOUSE
823+
CLICKHOUSE,
824+
[
825+
'db'=>$database,
826+
'tbl'=>$table
827+
]
823828
)->rowsAsTree('name');
824829
}
825830

tests/ClientTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -715,6 +715,12 @@ public function testSelectAsync()
715715
$this->assertEquals(2, $state2->fetchOne('ping'));
716716
}
717717

718+
public function testPartsInfo()
719+
{
720+
$this->create_table_summing_url_views();
721+
$this->insert_data_table_summing_url_views();
722+
$this->assertIsArray($this->client->partitions('summing_url_views'));
723+
}
718724
/**
719725
*
720726
*/

0 commit comments

Comments
 (0)