Skip to content

Commit 0920795

Browse files
committed
Merge branch 'master-dev'
2 parents dcaafbd + e2ec9fd commit 0920795

30 files changed

+3099
-1
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,4 @@
3030
*.exe
3131
*.out
3232
*.app
33+
vendor

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "lib/clickhouse-cpp"]
2+
path = lib/clickhouse-cpp
3+
url = https://github.com/aiwhj/clickhouse-cpp.git

.travis.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
language: php
2+
3+
compiler:
4+
- gcc
5+
- clang
6+
7+
os:
8+
- linux
9+
10+
services:
11+
- docker
12+
13+
#hosts
14+
addons:
15+
hosts:
16+
- clickhouse
17+
18+
php:
19+
- 5.5
20+
- 5.6
21+
- 7.0
22+
- 7.1
23+
- 7.2
24+
- 7.3
25+
26+
notifications:
27+
email: whj199649@gmail.com
28+
29+
#clickhouse
30+
before_install:
31+
- docker run -d -p 9000:9000 --name some-clickhouse-server --ulimit nofile=262144:262144 yandex/clickhouse-server
32+
- docker ps -a
33+
- g++ -v
34+
- gcc -v
35+
- clang -v
36+
- clang++ -v
37+
38+
#Compile
39+
before_script:
40+
- phpize && ./configure && make clean && make
41+
42+
# test
43+
script:
44+
- ./travis/run-tests.sh

CREDITS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
SeasClick
2+
3+
SeasX Group

EXPERIMENTAL

Whitespace-only changes.

README.md

Lines changed: 91 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,92 @@
1-
# SeasClick
21
SeasClick
2+
=====
3+
[![Build Status](https://travis-ci.org/SeasX/SeasClick.svg?branch=master)](https://travis-ci.org/SeasX/SeasClick)
4+
5+
PHP client for [Yandex ClickHouse](https://clickhouse.yandex/),Based on [ClickHouse C++ client](https://github.com/aiwhj/clickhouse-cpp)
6+
7+
## ClickHouse
8+
* [What is ClickHouse](https://clickhouse.yandex/docs/en/)
9+
* [ClickHouse Performance](https://clickhouse.yandex/docs/en/introduction/performance/)
10+
* [Performance comparison with MySQL](https://clickhouse.yandex/benchmark.html#[%22100000000%22,[%22ClickHouse%22,%22MySQL%22],[%220%22,%221%22]])
11+
12+
## Supported data types
13+
14+
* Array(T)
15+
**Multidimensional arrays are not supported at this time**
16+
* Date
17+
* DateTime
18+
* Enum8, Enum16
19+
* FixedString(N)
20+
* Float32, Float64
21+
* Nullable(T)
22+
* String
23+
* UInt8, UInt16, UInt32, UInt64, Int8, Int16, Int32, Int64
24+
25+
## Supported PHP version
26+
PHP 5.5+
27+
28+
## Performance
29+
![image](https://github.com/SeasX/SeasClick/raw/master/tests/bench_mark/bench_mark.png)
30+
31+
This performance test [demo](https://github.com/SeasX/SeasClick/blob/master/tests/bench_mark/bench_mark.php) is compared to [phpclickhouse](https://github.com/smi2/phpClickHouse)
32+
33+
## Install
34+
```ssh
35+
git clone https://github.com/SeasX/SeasClick.git
36+
git submodule init
37+
git submodule update
38+
cd SeasClick
39+
phpize
40+
./configure
41+
make && make install
42+
```
43+
44+
## Example
45+
46+
```php
47+
<?php
48+
$config = [
49+
"host" => "clickhouse",
50+
"port" => 9000,
51+
"compression" => true
52+
];
53+
54+
clientTest($config);
55+
56+
function clientTest($config)
57+
{
58+
$deleteTable = true;
59+
$client = new SeasClick($config);
60+
61+
$client->execute("CREATE DATABASE IF NOT EXISTS test");
62+
63+
testArray($client, $deleteTable);
64+
}
65+
66+
function testArray($client, $deleteTable = false) {
67+
$client->execute("CREATE TABLE IF NOT EXISTS test.array_test (string_c String, array_c Array(Int8), arraynull_c Array(Nullable(String))) ENGINE = Memory");
68+
69+
$client->insert("test.array_test", [
70+
'string_c', 'array_c', 'arraynull_c'
71+
], [
72+
['string_c1', [1, 2, 3], ['string']],
73+
['string_c2', [4, 5, 6], [null]]
74+
]);
75+
76+
$result = $client->select("SELECT {select} FROM {table}", [
77+
'select' => 'string_c, array_c, arraynull_c',
78+
'table' => 'test.array_test'
79+
]);
80+
var_dump($result);
81+
82+
if ($deleteTable) {
83+
$client->execute("DROP TABLE {table}", [
84+
'table' => 'test.array_test'
85+
]);
86+
}
87+
}
88+
```
89+
#### [More examples](https://github.com/SeasX/SeasClick/tests/test.php)
90+
91+
## Support
92+
SeasX Group

0 commit comments

Comments
 (0)