Fix style

This commit is contained in:
Jakub Vrana 2018-10-27 19:38:43 +02:00
parent a592ad52f1
commit c002009bfe

View file

@ -12,7 +12,7 @@ if (isset($_GET["clickhouse"])) {
@ini_set('track_errors', 1); // @ - may be disabled @ini_set('track_errors', 1); // @ - may be disabled
$file = @file_get_contents("$this->_url/?database=$db", false, stream_context_create(array('http' => array( $file = @file_get_contents("$this->_url/?database=$db", false, stream_context_create(array('http' => array(
'method' => 'POST', 'method' => 'POST',
'content' => $this->is_query_select_like($query) ? ($query.' FORMAT JSONCompact') : $query, 'content' => $this->isQuerySelectLike($query) ? "$query FORMAT JSONCompact" : $query,
'header' => 'Content-type: application/x-www-form-urlencoded', 'header' => 'Content-type: application/x-www-form-urlencoded',
'ignore_errors' => 1, // available since PHP 5.2.10 'ignore_errors' => 1, // available since PHP 5.2.10
)))); ))));
@ -43,7 +43,7 @@ if (isset($_GET["clickhouse"])) {
return new Min_Result($return); return new Min_Result($return);
} }
function is_query_select_like($query) { function isQuerySelectLike($query) {
return (bool) preg_match('~^(select|show)~i', $query); return (bool) preg_match('~^(select|show)~i', $query);
} }
@ -131,7 +131,7 @@ if (isset($_GET["clickhouse"])) {
foreach ($set as $key => $val) { foreach ($set as $key => $val) {
$values[] = "$key = $val"; $values[] = "$key = $val";
} }
$query = "$separator" . implode(",$separator", $values); $query = $separator . implode(",$separator", $values);
return queries("ALTER TABLE " . table($table) . " UPDATE $query$queryWhere"); return queries("ALTER TABLE " . table($table) . " UPDATE $query$queryWhere");
} }
} }