@@ -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 | } |
@@ -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 | |
@@ -29,8 +29,7 @@ |
||
| 29 | 29 | if ($else) |
| 30 | 30 | { |
| 31 | 31 | list($condition, $preset ,$variable, $content_true, $content_false) = $matches; |
| 32 | - } |
|
| 33 | - else |
|
| 32 | + } else |
|
| 34 | 33 | { |
| 35 | 34 | list($condition, $preset ,$variable, $content_true) = $matches; |
| 36 | 35 | } |
@@ -295,8 +295,7 @@ discard block |
||
| 295 | 295 | if (!$useSessionId) |
| 296 | 296 | { |
| 297 | 297 | $this->settings()->makeSessionId(); |
| 298 | - } |
|
| 299 | - else |
|
| 298 | + } else |
|
| 300 | 299 | { |
| 301 | 300 | $this->settings()->session_id($useSessionId); |
| 302 | 301 | } |
@@ -415,7 +414,9 @@ discard block |
||
| 415 | 414 | */ |
| 416 | 415 | public function progressFunction($callback) |
| 417 | 416 | { |
| 418 | - if (!is_callable($callback)) throw new \InvalidArgumentException('Not is_callable progressFunction'); |
|
| 417 | + if (!is_callable($callback)) { |
|
| 418 | + throw new \InvalidArgumentException('Not is_callable progressFunction'); |
|
| 419 | + } |
|
| 419 | 420 | |
| 420 | 421 | if (!$this->settings()->is('send_progress_in_http_headers')) |
| 421 | 422 | { |
@@ -540,7 +541,7 @@ discard block |
||
| 540 | 541 | } |
| 541 | 542 | $preparedValues[] = array_values($row); |
| 542 | 543 | } |
| 543 | - }else{ //одна строка |
|
| 544 | + } else{ //одна строка |
|
| 544 | 545 | $preparedFields = array_keys($values); |
| 545 | 546 | $preparedValues = [array_values($values)]; |
| 546 | 547 | } |
@@ -609,8 +610,7 @@ discard block |
||
| 609 | 610 | { |
| 610 | 611 | $sql = 'INSERT INTO ' . $table_name . ' FORMAT '.$format; |
| 611 | 612 | |
| 612 | - } |
|
| 613 | - else |
|
| 613 | + } else |
|
| 614 | 614 | { |
| 615 | 615 | $sql = 'INSERT INTO ' . $table_name . ' ( ' . implode(',', $columns_array) . ' ) FORMAT '.$format; |
| 616 | 616 | |
@@ -654,8 +654,7 @@ discard block |
||
| 654 | 654 | { |
| 655 | 655 | $sql = 'INSERT INTO ' . $table_name . ' FORMAT '.$format; |
| 656 | 656 | |
| 657 | - } |
|
| 658 | - else |
|
| 657 | + } else |
|
| 659 | 658 | { |
| 660 | 659 | $sql = 'INSERT INTO ' . $table_name . ' ( ' . implode(',', $columns_array) . ' ) FORMAT '.$format; |
| 661 | 660 | |