Skip to content

Commit 2b00631

Browse files
committed
Add parameters in $table->scanQuery and fix ScanQueryTest
1 parent 8271338 commit 2b00631

File tree

2 files changed

+18
-9
lines changed

2 files changed

+18
-9
lines changed

src/Table.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -396,11 +396,17 @@ public function describeTable($table)
396396

397397
/**
398398
* @param string $yql
399-
* @param ScanQueryMode $mode
399+
* @param array $parameters
400+
* @param int $mode
400401
* @return \Generator
402+
* @throws Exception
401403
*/
402-
public function scanQuery($yql, $mode = ScanQueryMode::MODE_EXEC)
404+
public function scanQuery($yql, $parameters = [], $mode = ScanQueryMode::MODE_EXEC)
403405
{
406+
if($parameters != []){
407+
throw new Exception("Not implemented");
408+
}
409+
404410
$q = new Query(['yql_text' => $yql]);
405411

406412
return $this->streamRequest('StreamExecuteScanQuery', [

tests/ScanQueryTest.php

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ class ScanQueryTest extends TestCase
1313

1414
function testScanQuery()
1515
{
16-
self::expectNotToPerformAssertions();
1716

1817
$config = [
1918

@@ -49,13 +48,17 @@ function testScanQuery()
4948
FROM scan_table
5049
WHERE id = 1;';
5150

52-
$scanWithOutParam = $table->scanQuery($yql);
53-
$scanWithExplainParam = $table->scanQuery($yql, ScanQueryMode::MODE_EXPLAIN);
54-
$scanWithExecParam = $table->scanQuery($yql, ScanQueryMode::MODE_EXEC);
51+
$scanWithOutMode = $table->scanQuery($yql);
52+
$scanWithExplainMode = $table->scanQuery($yql, [], ScanQueryMode::MODE_EXPLAIN);
53+
$scanWithExecMode = $table->scanQuery($yql, [], ScanQueryMode::MODE_EXEC);
5554

5655
// These `foreach` needs for requests
57-
foreach ($scanWithOutParam as $value){}
58-
foreach ($scanWithExplainParam as $value){}
59-
foreach ($scanWithExecParam as $value){}
56+
foreach ($scanWithOutMode as $value){}
57+
foreach ($scanWithExplainMode as $value){}
58+
foreach ($scanWithExecMode as $value){}
59+
60+
self::expectExceptionMessage("Not implemented");
61+
$scanWithParams = $table->scanQuery($yql, ["value"=>"some"]);
62+
foreach ($scanWithParams as $value){}
6063
}
6164
}

0 commit comments

Comments
 (0)