Closed MoonE closed 6 months ago
Could also use $CLAUSES
to build it. Though it fails to build an invalid statement like KILL ;
which may not matter.
diff --git a/src/Statements/KillStatement.php b/src/Statements/KillStatement.php
index 7040a0f3..4ef3f532 100644
--- a/src/Statements/KillStatement.php
+++ b/src/Statements/KillStatement.php
@@ -28,16 +28,22 @@ class KillStatement extends Statement
'QUERY' => 1,
];
+ public static $CLAUSES = [
+ 'KILL' => [
+ 'KILL',
+ 2,
+ ],
+ // Used for options.
+ '_OPTIONS' => [
+ '_OPTIONS',
+ 1,
+ ],
+ 'EXPRESSION' => [
+ 'KILL',
+ 1,
+ ],
+ ];
+
/** @var Expression|null */
public $processListId = null;
-
- public function build(): string
- {
- $option = $this->options === null || $this->options->isEmpty()
- ? ''
- : ' ' . OptionsArray::build($this->options);
- $expression = $this->processListId === null ? '' : ' ' . Expression::build($this->processListId);
-
- return trim('KILL' . $option . $expression);
- }
}
diff --git a/tests/Parser/KillStatementTest.php b/tests/Parser/KillStatementTest.php
index 99b81f75..e3a1e4c8 100644
--- a/tests/Parser/KillStatementTest.php
+++ b/tests/Parser/KillStatementTest.php
@@ -53,7 +53,6 @@ class KillStatementTest extends TestCase
['KILL (SELECT 3 + 4)'],
['KILL QUERY 3'],
['KILL CONNECTION 3'],
- ['KILL'],
];
}
}
LGTM but I don’t know the KILL command 😅
Fixes #556