@@ -39,7 +39,9 @@ |
||
39 | 39 | $temp_file_name='/tmp/_test_data.TSV'; |
40 | 40 | |
41 | 41 | |
42 | -if (file_exists($temp_file_name)) unlink('/tmp/_test_data.TSV'); |
|
42 | +if (file_exists($temp_file_name)) { |
|
43 | + unlink('/tmp/_test_data.TSV'); |
|
44 | +} |
|
43 | 45 | foreach ($rows as $row) |
44 | 46 | { |
45 | 47 |
@@ -19,7 +19,9 @@ |
||
19 | 19 | |
20 | 20 | |
21 | 21 | |
22 | -if (!isset($size['size'])) $_flag_create_table=true; |
|
22 | +if (!isset($size['size'])) { |
|
23 | + $_flag_create_table=true; |
|
24 | +} |
|
23 | 25 | |
24 | 26 | |
25 | 27 | if ($_flag_create_table) { |
@@ -13,7 +13,9 @@ |
||
13 | 13 | echo "Site table summing_url_views_cityHash64_site_id : ".(isset($size['size'])?$size['size']:'false')."\n"; |
14 | 14 | |
15 | 15 | |
16 | -if (!isset($size['size'])) $_flag_create_table=true; |
|
16 | +if (!isset($size['size'])) { |
|
17 | + $_flag_create_table=true; |
|
18 | +} |
|
17 | 19 | |
18 | 20 | |
19 | 21 | if ($_flag_create_table) { |
@@ -10,8 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | try { |
12 | 12 | $db->ping(); |
13 | -} |
|
14 | -catch (ClickHouseDB\Exception\QueryException $E) { |
|
13 | +} catch (ClickHouseDB\Exception\QueryException $E) { |
|
15 | 14 | echo "ERROR:" . $E->getMessage() . "\nOK\n"; |
16 | 15 | } |
17 | 16 | |
@@ -28,8 +27,7 @@ discard block |
||
28 | 27 | $db->setConnectTimeOut(1); |
29 | 28 | try { |
30 | 29 | $db->ping(); |
31 | -} |
|
32 | -catch (ClickHouseDB\Exception\QueryException $E) { |
|
30 | +} catch (ClickHouseDB\Exception\QueryException $E) { |
|
33 | 31 | echo "ERROR:" . $E->getMessage() . "\nOK\n"; |
34 | 32 | } |
35 | 33 | |
@@ -43,15 +41,13 @@ discard block |
||
43 | 41 | try { |
44 | 42 | $db->ping(); |
45 | 43 | echo "PING : OK!\n"; |
46 | -} |
|
47 | -catch (ClickHouseDB\Exception\QueryException $E) { |
|
44 | +} catch (ClickHouseDB\Exception\QueryException $E) { |
|
48 | 45 | echo "ERROR:" . $E->getMessage() . "\nOK\n"; |
49 | 46 | } |
50 | 47 | |
51 | 48 | try { |
52 | 49 | $db->select("SELECT xxx as PPPP FROM ZZZZZ ")->rows(); |
53 | -} |
|
54 | -catch (ClickHouseDB\Exception\DatabaseException $E) { |
|
50 | +} catch (ClickHouseDB\Exception\DatabaseException $E) { |
|
55 | 51 | echo "ERROR : DatabaseException : " . $E->getMessage() . "\n"; // Table default.ZZZZZ doesn't exist. |
56 | 52 | } |
57 | 53 |
@@ -32,8 +32,7 @@ |
||
32 | 32 | try { |
33 | 33 | $db->insertAssocBulk('testoperation_log',$dataInsert); |
34 | 34 | echo "$z\r"; |
35 | - } |
|
36 | - catch (Exception $exception) |
|
35 | + } catch (Exception $exception) |
|
37 | 36 | { |
38 | 37 | die("Error:".$exception->getMessage()); |
39 | 38 | } |
@@ -29,7 +29,7 @@ |
||
29 | 29 | { |
30 | 30 | try{ |
31 | 31 | $x=$cl->activeClient()->write("DROP TABLE IF EXISTS default.asdasdasd ON CLUSTER cluster2"); |
32 | - }catch (Exception $exception) |
|
32 | + } catch (Exception $exception) |
|
33 | 33 | { |
34 | 34 | |
35 | 35 | } |
@@ -157,8 +157,10 @@ |
||
157 | 157 | |
158 | 158 | for ($day_ago = 0; $day_ago < 360; $day_ago++) { |
159 | 159 | $date = strtotime('-' . $day_ago . ' day'); |
160 | - for ($hash_id = 1; $hash_id < (1 + $size); $hash_id++) |
|
161 | - for ($site_id = 100; $site_id < 199; $site_id++) { |
|
160 | + for ($hash_id = 1; $hash_id < (1 + $size); $hash_id++) { |
|
161 | + for ($site_id = 100; |
|
162 | + } |
|
163 | + $site_id < 199; $site_id++) { |
|
162 | 164 | $j['event_time'] = date('Y-m-d H:00:00', $date); |
163 | 165 | $j['site_id'] = $site_id; |
164 | 166 | $j['hash_id'] = $hash_id; |
@@ -155,13 +155,11 @@ discard block |
||
155 | 155 | |
156 | 156 | if ($parse) { |
157 | 157 | throw new DatabaseException($parse['message'] . "\nIN:" . $this->sql(), $parse['code']); |
158 | - } |
|
159 | - else { |
|
158 | + } else { |
|
160 | 159 | $code = $this->response()->http_code(); |
161 | 160 | $message = "HttpCode:" . $this->response()->http_code() . " ; ".$this->response()->error()." ;" . $body; |
162 | 161 | } |
163 | - } |
|
164 | - else { |
|
162 | + } else { |
|
165 | 163 | $code = $error_no; |
166 | 164 | $message = $this->response()->error(); |
167 | 165 | } |
@@ -330,8 +328,12 @@ discard block |
||
330 | 328 | $this->init(); |
331 | 329 | if ($key) |
332 | 330 | { |
333 | - if (!is_array($this->statistics)) return null; |
|
334 | - if (!isset($this->statistics[$key])) return null; |
|
331 | + if (!is_array($this->statistics)) { |
|
332 | + return null; |
|
333 | + } |
|
334 | + if (!isset($this->statistics[$key])) { |
|
335 | + return null; |
|
336 | + } |
|
335 | 337 | return $this->statistics[$key]; |
336 | 338 | } |
337 | 339 | return $this->statistics; |
@@ -373,8 +375,7 @@ discard block |
||
373 | 375 | if ($key) { |
374 | 376 | if (isset($this->array_data[0][$key])) { |
375 | 377 | return $this->array_data[0][$key]; |
376 | - } |
|
377 | - else { |
|
378 | + } else { |
|
378 | 379 | return null; |
379 | 380 | } |
380 | 381 | } |
@@ -464,16 +465,14 @@ discard block |
||
464 | 465 | { |
465 | 466 | if (is_array($path)) { |
466 | 467 | $keys = $path; |
467 | - } |
|
468 | - else { |
|
468 | + } else { |
|
469 | 469 | $args = func_get_args(); |
470 | 470 | array_shift($args); |
471 | 471 | |
472 | 472 | if (sizeof($args) < 2) { |
473 | 473 | $separator = '.'; |
474 | 474 | $keys = explode($separator, $path); |
475 | - } |
|
476 | - else { |
|
475 | + } else { |
|
477 | 476 | $keys = $args; |
478 | 477 | } |
479 | 478 | } |
@@ -485,8 +484,7 @@ discard block |
||
485 | 484 | |
486 | 485 | if (isset($arr[$key])) { |
487 | 486 | $val = $arr[$key]; |
488 | - } |
|
489 | - else { |
|
487 | + } else { |
|
490 | 488 | $val = $key; |
491 | 489 | } |
492 | 490 |
@@ -48,7 +48,9 @@ discard block |
||
48 | 48 | private function applyFormatQuery() |
49 | 49 | { |
50 | 50 | // FORMAT\s(\w)*$ |
51 | - if (null === $this->format) return false; |
|
51 | + if (null === $this->format) { |
|
52 | + return false; |
|
53 | + } |
|
52 | 54 | $supportFormats= |
53 | 55 | "FORMAT\\s+TSV|FORMAT\\s+TSVRaw|FORMAT\\s+TSVWithNames|FORMAT\\s+TSVWithNamesAndTypes|FORMAT\\s+Vertical|FORMAT\\s+JSONCompact|FORMAT\\s+JSONEachRow|FORMAT\\s+TSKV|FORMAT\\s+TabSeparatedWithNames|FORMAT\\s+TabSeparatedWithNamesAndTypes|FORMAT\\s+TabSeparatedRaw|FORMAT\\s+BlockTabSeparated|FORMAT\\s+CSVWithNames|FORMAT\\s+CSV|FORMAT\\s+JSON|FORMAT\\s+TabSeparated"; |
54 | 56 | |
@@ -62,8 +64,7 @@ discard block |
||
62 | 64 | $this->format=$format; |
63 | 65 | |
64 | 66 | } |
65 | - } |
|
66 | - else { |
|
67 | + } else { |
|
67 | 68 | $this->sql = $this->sql . ' FORMAT ' . $this->format; |
68 | 69 | } |
69 | 70 | |
@@ -92,8 +93,9 @@ discard block |
||
92 | 93 | { |
93 | 94 | foreach ($this->degenerations as $degeneration) |
94 | 95 | { |
95 | - if ($degeneration instanceof \ClickHouseDB\Query\Degeneration) |
|
96 | - $this->sql=$degeneration->process($this->sql); |
|
96 | + if ($degeneration instanceof \ClickHouseDB\Query\Degeneration) { |
|
97 | + $this->sql=$degeneration->process($this->sql); |
|
98 | + } |
|
97 | 99 | } |
98 | 100 | } |
99 | 101 |