classSplitter
final class Splitter
Restricted visibility: declared "@visibility SqlSemantics\Platform\Sqlite". Code outside that scope must not name this declaration.
Finds statement boundaries by asking the parser which prefixes are complete statements.
Methods§
public function __construct(private SqlParser $parser)Parameters
$parser | SqlParser | The parser of the language profile |
public function split(string $sql): list<string>Splits a script into statement texts, each ending with its own terminator.
Parameters
$sql | string |
Returns
list<string>Throws
SourceException When the text after the last boundary is not a statementTest cases 4
SplitterTest::testSplitEndsEachStatementWithItsOwnTerminatorcallsSplitterTest::testSplitIgnoresTerminatorsInsideStringsCommentsAndCompoundStatementscallsSplitterTest::testSplitKeepsTrailingWhitespaceAndCommentsWithTheLastStatementcallsSplitterTest::testSplitOfAnEmptyOrBlankInputHasNoStatementscalls
Called from 1
Calls 5
- method-call SqlParser::tokenize() line 35
- function-call
substrline 39 - method-call SqlParser::parse() line 41
- function-call
array_filterline 49 - function-call
countline 53
Private surface 1§
Implementation details, listed for orientation only.
private SqlParser $parserTest cases 4§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 4
SplitterTest::testSplitEndsEachStatementWithItsOwnTerminatorcallsSplitterTest::testSplitIgnoresTerminatorsInsideStringsCommentsAndCompoundStatementscallsSplitterTest::testSplitKeepsTrailingWhitespaceAndCommentsWithTheLastStatementcallsSplitterTest::testSplitOfAnEmptyOrBlankInputHasNoStatementscalls