PHP client for Yandex ClickHouse,Based on ClickHouse C++ client
PHP 5.4+
This performance test demo is compared to phpclickhouse
git clone https://github.com/SeasX/SeasClick.git
cd SeasClick
phpize
./configure
make && make install
<?php
$config = [
"host" => "clickhouse",
"port" => 9000,
"compression" => true
];
clientTest($config);
function clientTest($config)
{
$deleteTable = true;
$client = new SeasClick($config);
$client->execute("CREATE DATABASE IF NOT EXISTS test");
testArray($client, $deleteTable);
}
function testArray($client, $deleteTable = false) {
$client->execute("CREATE TABLE IF NOT EXISTS test.array_test (string_c String, array_c Array(Int8), arraynull_c Array(Nullable(String))) ENGINE = Memory");
$client->insert("test.array_test", [
'string_c', 'array_c', 'arraynull_c'
], [
['string_c1', [1, 2, 3], ['string']],
['string_c2', [4, 5, 6], [null]]
]);
$result = $client->select("SELECT {select} FROM {table}", [
'select' => 'string_c, array_c, arraynull_c',
'table' => 'test.array_test'
]);
var_dump($result);
if ($deleteTable) {
$client->execute("DROP TABLE {table}", [
'table' => 'test.array_test'
]);
}
}
SeasX Group