Skip to content

Commit aef375a

Browse files
authored
Merge pull request #10 from FriendsOfDoctrine/travisCI
Add Travis ci, update version phpClickHouse to ^0.18, cs fix
2 parents 3635feb + 4ff6a5f commit aef375a

20 files changed

+299
-186
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,6 @@
22
composer.lock
33
vendor/
44
phpunit.xml
5+
Vagrantfile
6+
puphpet/
7+
.vagrant/

.travis.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
language: php
2+
dist: trusty
3+
sudo: required
4+
5+
php:
6+
- 7.1
7+
- 7.2
8+
- nightly
9+
10+
services:
11+
- docker
12+
before_install:
13+
- docker run -d -p 127.0.0.1:8123:8123 --name test-clickhouse-server --ulimit nofile=262144:262144 yandex/clickhouse-server
14+
- docker ps -a
15+
- sed -i 's/localhost/clickhouse-server/' ./phpunit.xml.dist
16+
- echo '127.0.0.1 clickhouse-server' | sudo tee /etc/hosts > /dev/null
17+
18+
before_script:
19+
- composer install
20+
21+
script:
22+
- ./vendor/bin/phpunit --configuration ./phpunit.xml.dist
23+
24+
matrix:
25+
fast_finish: true
26+
allow_failures:
27+
- php: nightly

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
[![Build Status](https://travis-ci.org/FriendsOfDoctrine/dbal-clickhouse.svg?branch=master)](https://travis-ci.org/FriendsOfDoctrine/dbal-clickhouse)
2+
[![Total Downloads](https://poser.pugx.org/friendsofdoctrine/dbal-clickhouse/d/total.svg)](https://packagist.org/packages/friendsofdoctrine/dbal-clickhouse)
3+
[![Latest Stable Version](https://poser.pugx.org/friendsofdoctrine/dbal-clickhouse/v/stable.svg)](https://packagist.org/packages/friendsofdoctrine/dbal-clickhouse)
4+
[![License](https://poser.pugx.org/friendsofdoctrine/dbal-clickhouse/license.svg)](https://packagist.org/packages/friendsofdoctrine/dbal-clickhouse)
5+
16
# Doctrine DBAL ClickHouse Driver
27

38
Doctrine DBAL driver for ClickHouse -- an open-source column-oriented database management system by Yandex (https://clickhouse.yandex/)

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
}
1414
],
1515
"require": {
16-
"php": ">=5.4.0",
17-
"smi2/phpClickHouse": "^0.17",
16+
"php": "^7.1",
17+
"smi2/phpClickHouse": "^0.18",
1818
"doctrine/dbal": ">=2.6"
1919
},
2020
"autoload": {
@@ -24,6 +24,6 @@
2424
"psr-4": { "FOD\\DBALClickHouse\\Tests\\": "tests/" }
2525
},
2626
"require-dev": {
27-
"phpunit/phpunit": "^6.1"
27+
"phpunit/phpunit": "^7.0"
2828
}
2929
}

src/ClickHouseConnection.php

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,21 @@ class ClickHouseConnection implements \Doctrine\DBAL\Driver\Connection
3535
/**
3636
* Connection constructor
3737
*
38-
* @param string $username The username to use when connecting.
39-
* @param string $password The password to use when connecting.
38+
* @param string $username The username to use when connecting.
39+
* @param string $password The password to use when connecting.
4040
* @param string $host
4141
* @param int $port
4242
* @param string $database
43+
* @param AbstractPlatform $platform
4344
*/
44-
public function __construct($username = 'default', $password = '', $host = 'localhost', $port = 8123, $database = 'default', AbstractPlatform $platform = null)
45-
{
45+
public function __construct(
46+
$username = 'default',
47+
$password = '',
48+
$host = 'localhost',
49+
$port = 8123,
50+
$database = 'default',
51+
AbstractPlatform $platform
52+
) {
4653
$this->smi2CHClient = new Smi2CHClient([
4754
'host' => $host,
4855
'port' => $port,
@@ -59,7 +66,7 @@ public function __construct($username = 'default', $password = '', $host = 'loca
5966
*/
6067
public function prepare($prepareString)
6168
{
62-
if (! $this->smi2CHClient) {
69+
if (!$this->smi2CHClient) {
6370
throw new \Exception('ClickHouse\Client was not initialized');
6471
}
6572

@@ -71,7 +78,7 @@ public function prepare($prepareString)
7178
*/
7279
public function query()
7380
{
74-
$args = func_get_args();
81+
$args = \func_get_args();
7582
$stmt = $this->prepare($args[0]);
7683
$stmt->execute();
7784

@@ -83,7 +90,7 @@ public function query()
8390
*/
8491
public function quote($input, $type = \PDO::PARAM_STR)
8592
{
86-
if (\PDO::PARAM_INT == $type) {
93+
if (\PDO::PARAM_INT === $type) {
8794
return $input;
8895
}
8996

@@ -148,5 +155,4 @@ public function errorInfo()
148155
{
149156
throw new \LogicException('You need to implement ClickHouseConnection::errorInfo()');
150157
}
151-
152-
}
158+
}

src/ClickHouseException.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,6 @@
1616
*
1717
* @author Mochalygin <[email protected]>
1818
*/
19-
class ClickHouseException extends \Exception {}
19+
class ClickHouseException extends \Exception
20+
{
21+
}

0 commit comments

Comments
 (0)