classCteHeaderParser
final class CteHeaderParser
Restricted visibility: declared "@visibility ZtdQuery\Platform\Sqlite". Code outside that scope must not name this declaration.
Parses CTE declarations and locates the main statement.
Methods§
public function parseHeader(string $sql): array{names: list<string>, statementOffset: int|null}Parameters
$sql | string |
Returns
array{names: list<string>, statementOffset: int|null}Called from 5
- method-call ZtdQuery\Platform\Sqlite\Rewrite\Cte\CteDependencies::required() packages/ztd-query-sqlite/src/Rewrite/Cte/CteDependencies.php:20
- method-call ZtdQuery\Platform\Sqlite\Rewrite\Cte\SqliteCteShadowComposer::declaredCteNames() packages/ztd-query-sqlite/src/Rewrite/Cte/SqliteCteShadowComposer.php:52
- method-call ZtdQuery\Platform\Sqlite\Rewrite\Cte\SqliteCteShadowComposer::carryPrefix() packages/ztd-query-sqlite/src/Rewrite/Cte/SqliteCteShadowComposer.php:60
- method-call ZtdQuery\Platform\Sqlite\Rewrite\Cte\SqliteCteShadowComposer::carryPrefix() packages/ztd-query-sqlite/src/Rewrite/Cte/SqliteCteShadowComposer.php:70
- method-call ZtdQuery\Platform\Sqlite\Rewrite\Cte\SqliteCteShadowComposer::statementSql() packages/ztd-query-sqlite/src/Rewrite/Cte/SqliteCteShadowComposer.php:108
Calls 6
- static-call SqlTokenStream::tokenize() line 25
- static-call SqliteLexerProfile::create() line 25
- method-call CteHeaderParser::identifierName() line 41
- method-call CteHeaderParser::bodyEndIndex() line 47
- function-call
strtolowerline 52 - method-call CteHeaderParser::isSymbol() line 55
public function findAsIndex(list<SqlToken> $tokens, int $start): ?intParameters
$tokens | list<SqlToken> | |
$start | int |
Returns
?intTest cases 1
Called from 1
Calls 1
- class-const SqlTokenKind::Word() line 79
public function isSymbol(?SqlToken $token, string $symbol): boolParses CTE declarations and locates the main statement.
Parameters
$token | ?SqlToken | |
$symbol | string |
Returns
boolTest cases 1
Called from 3
- method-call ZtdQuery\Platform\Sqlite\Rewrite\Cte\CteHeaderParser::parseHeader() packages/ztd-query-sqlite/src/Rewrite/Cte/CteHeaderParser.php:55
- method-call ZtdQuery\Platform\Sqlite\Rewrite\Cte\CteHeaderParser::bodyEndIndex() packages/ztd-query-sqlite/src/Rewrite/Cte/CteHeaderParser.php:128
- method-call ZtdQuery\Platform\Sqlite\Rewrite\Cte\CteHeaderParser::bodyEndIndex() packages/ztd-query-sqlite/src/Rewrite/Cte/CteHeaderParser.php:129
Calls 1
- class-const SqlTokenKind::Symbol() line 93
public function identifierName(SqlToken $token): ?stringParses CTE declarations and locates the main statement.
Parameters
$token | SqlToken |
Returns
?stringTest cases 1
Called from 2
Calls 5
- class-const SqlTokenKind::Word() line 102
- class-const SqlTokenKind::QuotedIdentifier() line 105
- function-call
strlenline 105 - function-call
substrline 110 - function-call
str_replaceline 112
public function bodyEndIndex(list<SqlToken> $tokens, int $index): ?intParameters
$tokens | list<SqlToken> | Top-level CTE header tokens. |
$index | int |
Returns
?intCalled from 1
Calls 3
- method-call CteHeaderParser::findAsIndex() line 120
- function-call
countline 121 - method-call CteHeaderParser::isSymbol() line 128
Test cases 17§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 5
CteHeaderParserTest::testBodyEndIndexHandlesMaterializationAndIncompleteGroupscallsCteHeaderParserTest::testFindAsIndexSkipsColumnListPunctuationcallsCteHeaderParserTest::testIdentifierNameDecodesEscapedQuotedNamescallsCteHeaderParserTest::testIsSymbolRejectsNullAndDifferentKindscallsCteHeaderParserTest::testParseHeaderLocatesMainStatementAfterMultipleCtescalls
Other tests reaching this symbol 12
ReferencedTableLookupTestcallsCteDependenciesTestcallsCteReferencesTestcallsSqliteCteShadowComposerTestcallsSqliteRewriterTestcallsStatementRewriterTestcallsDeleteTransformerTestcallsInsertTransformerTestcallsSelectTransformerTestcallsSqliteTransformerTestcallsUpdateTransformerTestcallsSqliteSessionFactoryTestcalls
Relations§
Instantiated in 6
- new ZtdQuery\Platform\Sqlite\Rewrite\Cte\CteDependencies::required() packages/ztd-query-sqlite/src/Rewrite/Cte/CteDependencies.php:20
- new ZtdQuery\Platform\Sqlite\Rewrite\Cte\CteReferences::referencesIdentifier() packages/ztd-query-sqlite/src/Rewrite/Cte/CteReferences.php:23
- new ZtdQuery\Platform\Sqlite\Rewrite\Cte\SqliteCteShadowComposer::declaredCteNames() packages/ztd-query-sqlite/src/Rewrite/Cte/SqliteCteShadowComposer.php:52
- new ZtdQuery\Platform\Sqlite\Rewrite\Cte\SqliteCteShadowComposer::carryPrefix() packages/ztd-query-sqlite/src/Rewrite/Cte/SqliteCteShadowComposer.php:60
- new ZtdQuery\Platform\Sqlite\Rewrite\Cte\SqliteCteShadowComposer::carryPrefix() packages/ztd-query-sqlite/src/Rewrite/Cte/SqliteCteShadowComposer.php:70
- new ZtdQuery\Platform\Sqlite\Rewrite\Cte\SqliteCteShadowComposer::statementSql() packages/ztd-query-sqlite/src/Rewrite/Cte/SqliteCteShadowComposer.php:108
Method calls 6
- method-call ZtdQuery\Platform\Sqlite\Rewrite\Cte\CteDependencies::required() packages/ztd-query-sqlite/src/Rewrite/Cte/CteDependencies.php:20
- method-call ZtdQuery\Platform\Sqlite\Rewrite\Cte\CteReferences::referencesIdentifier() packages/ztd-query-sqlite/src/Rewrite/Cte/CteReferences.php:23
- method-call ZtdQuery\Platform\Sqlite\Rewrite\Cte\SqliteCteShadowComposer::declaredCteNames() packages/ztd-query-sqlite/src/Rewrite/Cte/SqliteCteShadowComposer.php:52
- method-call ZtdQuery\Platform\Sqlite\Rewrite\Cte\SqliteCteShadowComposer::carryPrefix() packages/ztd-query-sqlite/src/Rewrite/Cte/SqliteCteShadowComposer.php:60
- method-call ZtdQuery\Platform\Sqlite\Rewrite\Cte\SqliteCteShadowComposer::carryPrefix() packages/ztd-query-sqlite/src/Rewrite/Cte/SqliteCteShadowComposer.php:70
- method-call ZtdQuery\Platform\Sqlite\Rewrite\Cte\SqliteCteShadowComposer::statementSql() packages/ztd-query-sqlite/src/Rewrite/Cte/SqliteCteShadowComposer.php:108