classPostgreSqlLexicalMasker
final class PostgreSqlLexicalMasker
Masks PostgreSQL comments and string literals without exposing their contents to parsers.
Methods§
public static function maskStringLiterals(string $sql): stringReplaces string literals with spaces while preserving byte offsets.
Parameters
$sql | string |
Returns
stringTest cases 1
Called from 2
- static-call ZtdQuery\Platform\Postgres\Sql\Dml\Insert\InsertClauseParser::findInsertSourceClause() packages/ztd-query-postgres/src/Sql/Dml/Insert/InsertClauseParser.php:36
- static-call ZtdQuery\Platform\Postgres\Sql\Statement\StatementClassifier::classifyWithStatement() packages/ztd-query-postgres/src/Sql/Statement/StatementClassifier.php:21
Calls 7
- function-call
strlenline 20 - function-call
substrline 26 - static-call QuotedSpan::quotedLength() line 27
- static-call QuotedSpan::isEscapeStringStart() line 27
- function-call
str_repeatline 28 - function-call
ctype_alnumline 33 - static-call QuotedSpan::dollarQuotedLength() line 35
public static function maskComments(string $sql): stringReplaces each comment with one separator while retaining quoted SQL.
Parameters
$sql | string |
Returns
stringTest cases 3
Called from 20
- static-call ZtdQuery\Platform\Postgres\Sql\Dml\Delete\DeleteClauseParser::extractDeleteAlias() packages/ztd-query-postgres/src/Sql/Dml/Delete/DeleteClauseParser.php:19
- static-call ZtdQuery\Platform\Postgres\Sql\Dml\Insert\InsertClauseParser::extractInsertColumns() packages/ztd-query-postgres/src/Sql/Dml/Insert/InsertClauseParser.php:23
- static-call ZtdQuery\Platform\Postgres\Sql\Dml\Insert\InsertClauseParser::extractInsertValues() packages/ztd-query-postgres/src/Sql/Dml/Insert/InsertClauseParser.php:145
- static-call ZtdQuery\Platform\Postgres\Sql\Dml\Insert\InsertClauseParser::hasInsertSelect() packages/ztd-query-postgres/src/Sql/Dml/Insert/InsertClauseParser.php:184
- static-call ZtdQuery\Platform\Postgres\Sql\Dml\Insert\InsertClauseParser::extractInsertSelectSql() packages/ztd-query-postgres/src/Sql/Dml/Insert/InsertClauseParser.php:195
- static-call ZtdQuery\Platform\Postgres\Sql\Dml\Update\UpdateClauseParser::extractUpdateAlias() packages/ztd-query-postgres/src/Sql/Dml/Update/UpdateClauseParser.php:21
- static-call ZtdQuery\Platform\Postgres\Sql\Statement\ConflictClause::hasOnConflict() packages/ztd-query-postgres/src/Sql/Statement/ConflictClause.php:254
- static-call ZtdQuery\Platform\Postgres\Sql\Statement\StatementClassifier::classifyStatement() packages/ztd-query-postgres/src/Sql/Statement/StatementClassifier.php:150
- static-call ZtdQuery\Platform\Postgres\Sql\Statement\TableDefinitionClauses::extractCreateTableName() packages/ztd-query-postgres/src/Sql/Statement/TableDefinitionClauses.php:76
- static-call ZtdQuery\Platform\Postgres\Sql\Statement\TableDefinitionClauses::hasIfNotExists() packages/ztd-query-postgres/src/Sql/Statement/TableDefinitionClauses.php:89
- static-call ZtdQuery\Platform\Postgres\Sql\Statement\TableDefinitionClauses::hasCreateTableAsSelect() packages/ztd-query-postgres/src/Sql/Statement/TableDefinitionClauses.php:98
- static-call ZtdQuery\Platform\Postgres\Sql\Statement\TableDefinitionClauses::extractCreateTableSelectSql() packages/ztd-query-postgres/src/Sql/Statement/TableDefinitionClauses.php:107
- static-call ZtdQuery\Platform\Postgres\Sql\Statement\TableDefinitionClauses::hasCreateTableLike() packages/ztd-query-postgres/src/Sql/Statement/TableDefinitionClauses.php:120
- static-call ZtdQuery\Platform\Postgres\Sql\Statement\TableDefinitionClauses::extractCreateTableLikeSource() packages/ztd-query-postgres/src/Sql/Statement/TableDefinitionClauses.php:129
- static-call ZtdQuery\Platform\Postgres\Sql\Statement\TableDefinitionClauses::extractDropTableName() packages/ztd-query-postgres/src/Sql/Statement/TableDefinitionClauses.php:142
- static-call ZtdQuery\Platform\Postgres\Sql\Statement\TableDefinitionClauses::hasDropTableIfExists() packages/ztd-query-postgres/src/Sql/Statement/TableDefinitionClauses.php:155
- static-call ZtdQuery\Platform\Postgres\Sql\Statement\TableDefinitionClauses::extractAlterTableName() packages/ztd-query-postgres/src/Sql/Statement/TableDefinitionClauses.php:164
- static-call ZtdQuery\Platform\Postgres\Sql\Statement\TargetTableParser::extractInsertTable() packages/ztd-query-postgres/src/Sql/Statement/TargetTableParser.php:19
- static-call ZtdQuery\Platform\Postgres\Sql\Statement\TargetTableParser::extractUpdateTable() packages/ztd-query-postgres/src/Sql/Statement/TargetTableParser.php:32
- static-call ZtdQuery\Platform\Postgres\Sql\Statement\TargetTableParser::extractDeleteTable() packages/ztd-query-postgres/src/Sql/Statement/TargetTableParser.php:45
Calls 8
- function-call
strlenline 56 - function-call
substrline 63 - static-call QuotedSpan::quotedLength() line 64
- static-call QuotedSpan::isEscapeStringStart() line 64
- function-call
ctype_alnumline 70 - static-call QuotedSpan::dollarQuotedLength() line 72
- function-call
strcspnline 82 - static-call CommentSpan::end() line 90
Test cases 29§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 4
PostgreSqlLexicalMaskerTest::testMaskCommentsMasksCommentsAsSingleLexicalSeparatorscallsPostgreSqlLexicalMaskerTest::testMaskStringLiteralsMasksStringLiteralsWithoutChangingOffsetscallsPostgreSqlLexicalMaskerTest::testPreservesCommentMarkersInsideQuotedFormscallsPostgreSqlLexicalMaskerTest::testPreservesEscapeStringAtStatementStartcalls
Other tests reaching this symbol 25
PgSqlSessionFactoryTestcallsTableContextTestcallsPgSqlQueryGuardTestcallsPgSqlRewriterTestcallsStatementRewriterTestcallsDeleteTransformerTestcallsSelectProjectionTestcallsUpsertProjectionTestcallsValueProjectionTestcallsInsertSelectRendererTestcallsInsertTransformerTestcallsPgSqlTransformerTestcallsUpdateTransformerTestcallsRowMutationResolverTestcallsTableMutationResolverTestcallsPgSqlMutationResolverTestcallsDeleteClauseParserTestcallsInsertClauseParserTestcallsUpdateClauseParserTestcallsIdentifierDecoderTestcallsPgSqlParserTestcallsConflictClauseTestcallsStatementClassifierTestcallsTableDefinitionClausesTestcallsTargetTableParserTestcalls
Relations§
Static calls 22
- static-call ZtdQuery\Platform\Postgres\Sql\Dml\Delete\DeleteClauseParser::extractDeleteAlias() packages/ztd-query-postgres/src/Sql/Dml/Delete/DeleteClauseParser.php:19
- static-call ZtdQuery\Platform\Postgres\Sql\Dml\Insert\InsertClauseParser::extractInsertColumns() packages/ztd-query-postgres/src/Sql/Dml/Insert/InsertClauseParser.php:23
- static-call ZtdQuery\Platform\Postgres\Sql\Dml\Insert\InsertClauseParser::findInsertSourceClause() packages/ztd-query-postgres/src/Sql/Dml/Insert/InsertClauseParser.php:36
- static-call ZtdQuery\Platform\Postgres\Sql\Dml\Insert\InsertClauseParser::extractInsertValues() packages/ztd-query-postgres/src/Sql/Dml/Insert/InsertClauseParser.php:145
- static-call ZtdQuery\Platform\Postgres\Sql\Dml\Insert\InsertClauseParser::hasInsertSelect() packages/ztd-query-postgres/src/Sql/Dml/Insert/InsertClauseParser.php:184
- static-call ZtdQuery\Platform\Postgres\Sql\Dml\Insert\InsertClauseParser::extractInsertSelectSql() packages/ztd-query-postgres/src/Sql/Dml/Insert/InsertClauseParser.php:195
- static-call ZtdQuery\Platform\Postgres\Sql\Dml\Update\UpdateClauseParser::extractUpdateAlias() packages/ztd-query-postgres/src/Sql/Dml/Update/UpdateClauseParser.php:21
- static-call ZtdQuery\Platform\Postgres\Sql\Statement\ConflictClause::hasOnConflict() packages/ztd-query-postgres/src/Sql/Statement/ConflictClause.php:254
- static-call ZtdQuery\Platform\Postgres\Sql\Statement\StatementClassifier::classifyWithStatement() packages/ztd-query-postgres/src/Sql/Statement/StatementClassifier.php:21
- static-call ZtdQuery\Platform\Postgres\Sql\Statement\StatementClassifier::classifyStatement() packages/ztd-query-postgres/src/Sql/Statement/StatementClassifier.php:150
- static-call ZtdQuery\Platform\Postgres\Sql\Statement\TableDefinitionClauses::extractCreateTableName() packages/ztd-query-postgres/src/Sql/Statement/TableDefinitionClauses.php:76
- static-call ZtdQuery\Platform\Postgres\Sql\Statement\TableDefinitionClauses::hasIfNotExists() packages/ztd-query-postgres/src/Sql/Statement/TableDefinitionClauses.php:89
- static-call ZtdQuery\Platform\Postgres\Sql\Statement\TableDefinitionClauses::hasCreateTableAsSelect() packages/ztd-query-postgres/src/Sql/Statement/TableDefinitionClauses.php:98
- static-call ZtdQuery\Platform\Postgres\Sql\Statement\TableDefinitionClauses::extractCreateTableSelectSql() packages/ztd-query-postgres/src/Sql/Statement/TableDefinitionClauses.php:107
- static-call ZtdQuery\Platform\Postgres\Sql\Statement\TableDefinitionClauses::hasCreateTableLike() packages/ztd-query-postgres/src/Sql/Statement/TableDefinitionClauses.php:120
- static-call ZtdQuery\Platform\Postgres\Sql\Statement\TableDefinitionClauses::extractCreateTableLikeSource() packages/ztd-query-postgres/src/Sql/Statement/TableDefinitionClauses.php:129
- static-call ZtdQuery\Platform\Postgres\Sql\Statement\TableDefinitionClauses::extractDropTableName() packages/ztd-query-postgres/src/Sql/Statement/TableDefinitionClauses.php:142
- static-call ZtdQuery\Platform\Postgres\Sql\Statement\TableDefinitionClauses::hasDropTableIfExists() packages/ztd-query-postgres/src/Sql/Statement/TableDefinitionClauses.php:155
- static-call ZtdQuery\Platform\Postgres\Sql\Statement\TableDefinitionClauses::extractAlterTableName() packages/ztd-query-postgres/src/Sql/Statement/TableDefinitionClauses.php:164
- static-call ZtdQuery\Platform\Postgres\Sql\Statement\TargetTableParser::extractInsertTable() packages/ztd-query-postgres/src/Sql/Statement/TargetTableParser.php:19
- static-call ZtdQuery\Platform\Postgres\Sql\Statement\TargetTableParser::extractUpdateTable() packages/ztd-query-postgres/src/Sql/Statement/TargetTableParser.php:32
- static-call ZtdQuery\Platform\Postgres\Sql\Statement\TargetTableParser::extractDeleteTable() packages/ztd-query-postgres/src/Sql/Statement/TargetTableParser.php:45