classConflictClause
final class ConflictClause
Restricted visibility: declared "@visibility root". Code outside that scope must not name this declaration.
Conflict clause operations for PostgreSQL statement.
Methods§
public function extractOnConflictTarget(string $sql): ?PgSqlConflictTargetExtract on conflict target.
Parameters
$sql | string |
Returns
Test cases 1
Called from 1
Calls 9
- static-call SqlTokenStream::tokenize() line 25
- static-call PgSqlLexerProfile::create() line 25
- static-call ConflictClause::findOnConflictTargetStart() line 26
- new PgSqlConflictTarget line 36
- method-call ConflictClause::namedConstraint() line 39
- static-call ConflictClause::findTopLevelSymbol() line 45
- function-call
substrline 50 - method-call ConflictClause::indexColumns() line 55
- method-call ConflictClause::indexTarget() line 60
public static function findOnConflictTargetStart(list<SqlToken> $tokens): ?intpublic static function findTopLevelSymbol(
list<SqlToken> $tokens,
int $start,
string $symbol,
): ?intParameters
$tokens | list<SqlToken> | |
$start | int | |
$symbol | string |
Returns
?intTest cases 1
Called from 1
Calls 2
- function-call
countline 89 - class-const SqlTokenKind::Symbol() line 94
public static function findTopLevelKeyword(
list<SqlToken> $tokens,
int $start,
string $keyword,
): ?intpublic function extractOnConflictUpdateColumns(string $sql): array{columns: list<string>, values: array<string, string>}Extract ON CONFLICT ... DO UPDATE SET columns and values.
Parameters
$sql | string |
Returns
array{columns: list<string>, values: array<string, string>}Test cases 1
Called from 1
Calls 7
- static-call SqlTokenStream::tokenize() line 133
- static-call PgSqlLexerProfile::create() line 133
- function-call
rtrimline 145 - function-call
trimline 150 - function-call
preg_matchline 151 - method-call IdentifierDecoder::unquoteIdentifier() line 152
- new IdentifierDecoder line 152
public function extractOnConflictUpdateWhere(string $sql): ?stringExtract on conflict update where.
Parameters
$sql | string |
Returns
?stringTest cases 1
Called from 1
Calls 2
- static-call SqlTokenStream::tokenize() line 166
- static-call PgSqlLexerProfile::create() line 166
public function namedConstraint(list<SqlToken> $tokens, int $conflict): ?PgSqlConflictTargetResolves an ON CONSTRAINT target after the conflict keyword.
Parameters
$tokens | list<SqlToken> | |
$conflict | int |
Returns
Test cases 1
Called from 1
Calls 3
- static-call SqlTokenStream::tokenize() line 189
- static-call PgSqlLexerProfile::create() line 189
- new PgSqlConflictTarget line 194
public function indexColumns(string $columnSql): list<string>|nullRequires each inferred-index item to consist of one identifier.
Parameters
$columnSql | string |
Returns
list<string>|nullTest cases 1
Called from 1
Calls 3
- static-call SqlTokenStream::tokenize() line 204
- static-call PgSqlLexerProfile::create() line 204
- function-call
countline 210
public function indexTarget(
string $sql,
list<SqlToken> $tokens,
int $closing,
list<string> $columns,
): ?PgSqlConflictTargetResolves the optional index predicate and requires an ON CONFLICT action.
Parameters
$sql | string | |
$tokens | list<SqlToken> | |
$closing | int | |
$columns | list<string> |
Returns
Test cases 1
Called from 1
Calls 4
- static-call ConflictClause::findTopLevelKeyword() line 226
- function-call
trimline 235 - function-call
substrline 235 - new PgSqlConflictTarget line 246
public function hasOnConflict(string $sql): boolCheck if INSERT has ON CONFLICT clause.
Parameters
$sql | string |
Returns
boolTest cases 1
Called from 1
Calls 2
- static-call PostgreSqlLexicalMasker::maskComments() line 254
- function-call
preg_matchline 255
Test cases 27§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 10
ConflictClauseTest::testExtractOnConflictTargetcallsConflictClauseTest::testExtractOnConflictUpdateColumnscallsConflictClauseTest::testExtractOnConflictUpdateWherecallsConflictClauseTest::testFindOnConflictTargetStartcallsConflictClauseTest::testFindTopLevelKeywordcallsConflictClauseTest::testFindTopLevelSymbolcallsConflictClauseTest::testHasOnConflictIgnoresCommentedClausescallsConflictClauseTest::testIndexColumnsRejectsExpressionsAndPreservesNamescallsConflictClauseTest::testIndexTargetCarriesThePartialPredicatecallsConflictClauseTest::testNamedConstraintReadsTheArbiterNamecalls
Other tests reaching this symbol 17
PgSqlSessionFactoryTestcallsTableContextTestcallsPgSqlQueryGuardTestcallsPgSqlRewriterTestcallsStatementRewriterTestcallsDeleteTransformerTestcallsSelectProjectionTestcallsUpsertProjectionTestcallsValueProjectionTestcallsInsertSelectRendererTestcallsInsertTransformerTestcallsPgSqlTransformerTestcallsUpdateTransformerTestcallsRowMutationResolverTestcallsTableMutationResolverTestcallsPgSqlMutationResolverTestcallsPgSqlParserTestcalls
Relations§
Instantiated in 4
- new ZtdQuery\Platform\Postgres\Sql\PgSqlParser::hasOnConflict() packages/ztd-query-postgres/src/Sql/PgSqlParser.php:98
- new ZtdQuery\Platform\Postgres\Sql\PgSqlParser::extractOnConflictTarget() packages/ztd-query-postgres/src/Sql/PgSqlParser.php:109
- new ZtdQuery\Platform\Postgres\Sql\PgSqlParser::extractOnConflictUpdateColumns() packages/ztd-query-postgres/src/Sql/PgSqlParser.php:122
- new ZtdQuery\Platform\Postgres\Sql\PgSqlParser::extractOnConflictUpdateWhere() packages/ztd-query-postgres/src/Sql/PgSqlParser.php:133
Method calls 4
- method-call ZtdQuery\Platform\Postgres\Sql\PgSqlParser::hasOnConflict() packages/ztd-query-postgres/src/Sql/PgSqlParser.php:98
- method-call ZtdQuery\Platform\Postgres\Sql\PgSqlParser::extractOnConflictTarget() packages/ztd-query-postgres/src/Sql/PgSqlParser.php:109
- method-call ZtdQuery\Platform\Postgres\Sql\PgSqlParser::extractOnConflictUpdateColumns() packages/ztd-query-postgres/src/Sql/PgSqlParser.php:122
- method-call ZtdQuery\Platform\Postgres\Sql\PgSqlParser::extractOnConflictUpdateWhere() packages/ztd-query-postgres/src/Sql/PgSqlParser.php:133