@@ -35,11 +35,6 @@ class ClickHouseConnection implements Connection, PingableConnection, ServerInfo
35
35
/** @var AbstractPlatform */
36
36
protected $ platform ;
37
37
38
- /**
39
- * Connection constructor
40
- *
41
- * @param mixed[] $params
42
- */
43
38
public function __construct (
44
39
array $ params ,
45
40
string $ username ,
@@ -60,15 +55,15 @@ public function __construct(
60
55
/**
61
56
* {@inheritDoc}
62
57
*/
63
- public function prepare ($ prepareString )
58
+ public function prepare ($ prepareString ) : ClickHouseStatement
64
59
{
65
60
return new ClickHouseStatement ($ this ->smi2CHClient , $ prepareString , $ this ->platform );
66
61
}
67
62
68
63
/**
69
64
* {@inheritDoc}
70
65
*/
71
- public function query ()
66
+ public function query () : ClickHouseStatement
72
67
{
73
68
$ args = func_get_args ();
74
69
$ stmt = $ this ->prepare ($ args [0 ]);
@@ -105,73 +100,73 @@ public function exec($statement) : int
105
100
*/
106
101
public function lastInsertId ($ name = null )
107
102
{
108
- throw new \ LogicException ('Unable to get last insert id in ClickHouse ' );
103
+ throw ClickHouseException:: notSupported ('Unable to get last insert id in ClickHouse ' );
109
104
}
110
105
111
106
/**
112
107
* {@inheritDoc}
113
108
*/
114
- public function beginTransaction ()
109
+ public function beginTransaction () : bool
115
110
{
116
- throw new \ LogicException ('Transactions are not allowed in ClickHouse ' );
111
+ throw ClickHouseException:: notSupported ('Transactions are not allowed in ClickHouse ' );
117
112
}
118
113
119
114
/**
120
115
* {@inheritDoc}
121
116
*/
122
- public function commit ()
117
+ public function commit () : bool
123
118
{
124
- throw new \ LogicException ('Transactions are not allowed in ClickHouse ' );
119
+ throw ClickHouseException:: notSupported ('Transactions are not allowed in ClickHouse ' );
125
120
}
126
121
127
122
/**
128
123
* {@inheritDoc}
129
124
*/
130
- public function rollBack ()
125
+ public function rollBack () : bool
131
126
{
132
- throw new \ LogicException ('Transactions are not allowed in ClickHouse ' );
127
+ throw ClickHouseException:: notSupported ('Transactions are not allowed in ClickHouse ' );
133
128
}
134
129
135
130
/**
136
131
* {@inheritDoc}
137
132
*/
138
- public function errorCode ()
133
+ public function errorCode () : ? string
139
134
{
140
- throw new \ LogicException ('You need to implement ClickHouseConnection::errorCode() ' );
135
+ throw ClickHouseException:: notSupported ('You need to implement ClickHouseConnection::errorCode() ' );
141
136
}
142
137
143
138
/**
144
139
* {@inheritDoc}
145
140
*/
146
- public function errorInfo ()
141
+ public function errorInfo () : array
147
142
{
148
- throw new \ LogicException ('You need to implement ClickHouseConnection::errorInfo() ' );
143
+ throw ClickHouseException:: notSupported ('You need to implement ClickHouseConnection::errorInfo() ' );
149
144
}
150
145
151
146
/**
152
147
* {@inheritDoc}
153
148
*/
154
- public function ping ()
149
+ public function ping () : bool
155
150
{
156
151
return $ this ->smi2CHClient ->ping ();
157
152
}
158
153
159
154
/**
160
155
* {@inheritDoc}
161
156
*/
162
- public function getServerVersion ()
157
+ public function getServerVersion () : string
163
158
{
164
159
try {
165
160
return $ this ->smi2CHClient ->getServerVersion ();
166
- } catch (TransportException $ exception ) {
161
+ } catch (TransportException $ e ) {
167
162
return '' ;
168
163
}
169
164
}
170
165
171
166
/**
172
167
* {@inheritDoc}
173
168
*/
174
- public function requiresQueryForServerVersion ()
169
+ public function requiresQueryForServerVersion () : bool
175
170
{
176
171
return true ;
177
172
}
0 commit comments