Skip to content

Commit db6a3fb

Browse files
committed
ok
1 parent c34f01f commit db6a3fb

File tree

6 files changed

+11
-22
lines changed

6 files changed

+11
-22
lines changed

src/ClickHouseAPI.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -298,8 +298,6 @@ public function setServerUrl($full_server_url = null)
298298
if ($this->host) {
299299
// If host is set, we assume that the server accepts requests
300300
$this->isSupported('query', false, true);
301-
// But, send async-requests to find out this reliably
302-
//$this->versionSendQuery();
303301
}
304302

305303
return $this;
@@ -452,7 +450,6 @@ public function doQuery(
452450
}
453451

454452
return ($response_data['code'] === 102) ? $this : $response_data;
455-
//return $response_data;
456453
}
457454

458455
/**
@@ -680,7 +677,7 @@ public function isSupported($fe_key = 'session_id', $re_check = false, $set = nu
680677
}
681678
if (!isset($support_fe[$s_key][$fe_key]) || $re_check) {
682679
if ($fe_key == 'session_id' || ($fe_key === 'query' && $re_check)) {
683-
$ver = $this->getVersion($re_check);
680+
$this->getVersion($re_check);
684681
} else {
685682
return false;
686683
}
@@ -716,8 +713,8 @@ public function getVersion($re_check = false)
716713
$this->eraseSlot($slot2);
717714
$this->versionSendQuery();
718715
}
719-
$ans = $this->slotWaitReady($slot1);
720-
$ans = $this->slotWaitReady($slot2);
716+
$this->slotWaitReady($slot1);
717+
$this->slotWaitReady($slot2);
721718
$ver = $this->isSupported('version');
722719
if (empty($ver)) {
723720
$ver = 'Unknown';

src/ClickHouseFunctions.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ public function getTableFields($table, $renew_cache = true, $sess = null)
539539
$this->table_structure_cached[$table] = $results = yield;
540540
yield $results;
541541
};
542-
$yi = $yi($table);
542+
$this->last_yi = $yi = $yi($table);
543543
$this->slotHookPush($slot,
544544
['mode' => 1, 'fn' => $yi, 'par' => 'getTableFields']);
545545
}
@@ -708,7 +708,7 @@ public function getTableInfo($table, $extended = 2)
708708
$fields_arr[$col_name] = $col_arr['type'];
709709
}
710710
$ret_arr = $this->getTableRowSize($fields_arr);
711-
$ret_arr['table_name'] = $dbtb = $database . '.' . $table;
711+
$ret_arr['table_name'] = $database . '.' . $table;
712712
if ($extended) {
713713
//results of queryTableSys($dbtb, 'tables', ['d', 't', 'n']);
714714
$engine = $this->slotResults($slots['tables']);
@@ -741,7 +741,7 @@ public function getTableInfo($table, $extended = 2)
741741
}
742742
yield $ret_arr;
743743
};
744-
$yi = $yi($slots, $table, $extended);
744+
$this->last_yi = $yi = $yi($slots, $table, $extended);
745745

746746
$this->slotHookPush($slots['root'],
747747
['mode' => 1, 'fn' => $yi, 'par' => 'getTableInfo']);
@@ -784,7 +784,7 @@ public function clearTable($table, $sess = null)
784784
$this->queryFalse("DROP TABLE IF EXISTS $table", [], $sess);
785785
yield $this->queryFalse($create_request, [], $sess);
786786
};
787-
$yi = $yi($table, $sess, $slot);
787+
$this->last_yi = $yi = $yi($table, $sess, $slot);
788788
$create_request = $yi->current();
789789
if (empty($slot)) {
790790
return $yi->send($create_request);

src/ClickHouseSlots.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,6 @@ public function slotAdd($slot, $curl_h, $slot_hook = false)
187187
if (!$this->multi_h) {
188188
$this->multi_h = \curl_multi_init();
189189
curl_multi_setopt($this->multi_h, \CURLMOPT_MAXCONNECTS, 1023);
190-
//curl_multi_setopt($this->multi_h, \CURLMOPT_MAX_HOST_CONNECTIONS, 1023);
191190
}
192191
$ans = \curl_multi_add_handle($this->multi_h, $curl_h);
193192
if (!$this->multi_h || ($ans !== 0)) {
@@ -386,7 +385,7 @@ public function slotsRefresh()
386385
if (!$this->multi_still_run) {
387386
break;
388387
}
389-
$ans = \curl_multi_exec($this->multi_h, $this->multi_still_run);
388+
\curl_multi_exec($this->multi_h, $this->multi_still_run);
390389
}
391390
foreach ($changed_slots as $slot) {
392391
$curl_h = $this->multi_ch[$slot];
@@ -444,7 +443,7 @@ public function slotContentToResults($slot_low)
444443
if (isset($this->slot_hooks[$slot_low][0])) {
445444
foreach ($this->slot_hooks[$slot_low] as $k => $hook) {
446445
if ($hook['mode'] == 0) {
447-
$ret = \call_user_func(
446+
$this->slot_data[$slot_low]['m0'][] = \call_user_func(
448447
$hook['fn'], $this, $slot_low,
449448
isset($hook['par']) ? $hook['par'] : null
450449
);

tests/src/ClickHouseAPITest.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,6 @@ protected function resetServerUrl()
5454
$clickhouse_url = null;
5555
}
5656
$ch->setServerUrl($clickhouse_url);
57-
if (!is_null($clickhouse_url)) {
58-
$ch->isSupported('session_id', false, true);
59-
}
6057
}
6158

6259
/**
@@ -438,6 +435,7 @@ public function testYiDoApiCall()
438435

439436
$ch->query("DROP TABLE IF EXISTS $table");
440437
unlink($file);
438+
unlink($file . '.gz');
441439
$slot = "tmp1";
442440
$ans = $ch->toSlot($slot)->doApiCall(false, ['query'=>'SELECT 123']);
443441
$this->assertEquals(102, $ans['code']);

tests/src/ClickHouseFunctionsTest.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@ protected function setUp()
2525
$clickhouse_url = null;
2626
}
2727
$this->object = new ClickHouseFunctions($clickhouse_url);
28-
if (!is_null($clickhouse_url)) {
29-
$this->object->isSupported('session_id', false, true);
30-
}
3128
}
3229

3330
/**
@@ -555,6 +552,7 @@ public function testClearTable()
555552

556553
$ans = $ch->clearTable('system.numbers');
557554
$this->assertTrue(\is_string($ans));
555+
$ch->last_yi->next();
558556

559557
$ans = $ch->createTableQuick($table, [
560558
'id' => 'Int16',

tests/src/ClickHouseQueryTest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@ protected function resetServerUrl()
3434
$clickhouse_url = null;
3535
}
3636
$ch->setServerUrl($clickhouse_url);
37-
if (!is_null($clickhouse_url)) {
38-
$ch->isSupported('session_id', false, true);
39-
}
4037
}
4138

4239
/**

0 commit comments

Comments
 (0)