classUpsertExpressionBinder
final class UpsertExpressionBinder
Restricted visibility: declared "@visibility ZtdQuery\Platform\Sqlite". Code outside that scope must not name this declaration.
Binds upsert column references while preserving nested subqueries.
Methods§
public function __construct(
private non-empty-list<string> $incomingNamespaces,
private IdentifierQuoter $quoter,
)Binds accepted incoming namespaces and identifier quoting.
Parameters
$incomingNamespaces | non-empty-list<string> | |
$quoter | IdentifierQuoter |
public function bindExpression(
string $expression,
string $tableName,
list<string> $tableColumns,
string $unqualifiedAlias = '__ztd_existing',
): stringParameters
$expression | string | |
$tableName | string | |
$tableColumns | list<string> | |
$unqualifiedAlias | string |
Returns
stringTest cases 1
Called from 4
- method-call ZtdQuery\Platform\Sqlite\Rewrite\Upsert\SqliteNativeUpsertProjector::project() packages/ztd-query-sqlite/src/Rewrite/Upsert/SqliteNativeUpsertProjector.php:59
- method-call ZtdQuery\Platform\Sqlite\Rewrite\Upsert\SqliteNativeUpsertProjector::project() packages/ztd-query-sqlite/src/Rewrite/Upsert/SqliteNativeUpsertProjector.php:60
- method-call ZtdQuery\Platform\Sqlite\Rewrite\Upsert\SqliteNativeUpsertProjector::project() packages/ztd-query-sqlite/src/Rewrite/Upsert/SqliteNativeUpsertProjector.php:71
- method-call ZtdQuery\Platform\Sqlite\Rewrite\Upsert\SqliteNativeUpsertProjector::project() packages/ztd-query-sqlite/src/Rewrite/Upsert/SqliteNativeUpsertProjector.php:76
Calls 14
- static-call SqlTokenStream::tokenize() line 40
- static-call SqliteLexerProfile::create() line 40
- method-call UpsertExpressionBinder::subqueryTokenIndexes() line 41
- function-call
array_fill_keysline 43 - function-call
array_mapline 43 - method-call UpsertExpressionBinder::isIdentifier() line 47
- method-call UpsertExpressionBinder::identifier() line 53
- function-call
strtolowerline 57 - function-call
strcasecmpline 60 - method-call UpsertConflictPredicate::qualified() line 65
- new UpsertConflictPredicate line 65
- function-call
strlenline 76 - method-call SqlEdits::apply() line 81
- new SqlEdits line 81
public function subqueryTokenIndexes(list<SqlToken> $tokens): array<int, true>Parameters
$tokens | list<SqlToken> |
Returns
array<int, true>public function isIdentifier(SqlToken $token): boolBinds upsert column references while preserving nested subqueries.
Parameters
$token | SqlToken |
Returns
boolTest cases 1
Called from 2
- method-call ZtdQuery\Platform\Sqlite\Rewrite\Upsert\UpsertExpressionBinder::bindExpression() packages/ztd-query-sqlite/src/Rewrite/Upsert/UpsertExpressionBinder.php:47
- method-call ZtdQuery\Platform\Sqlite\Rewrite\Upsert\UpsertExpressionBinder::bindExpression() packages/ztd-query-sqlite/src/Rewrite/Upsert/UpsertExpressionBinder.php:56
Calls 3
- function-call
in_arrayline 112 - class-const SqlTokenKind::Word() line 112
- class-const SqlTokenKind::QuotedIdentifier() line 112
public function identifier(SqlToken $token): stringBinds upsert column references while preserving nested subqueries.
Parameters
$token | SqlToken |
Returns
stringTest cases 1
Called from 2
- method-call ZtdQuery\Platform\Sqlite\Rewrite\Upsert\UpsertExpressionBinder::bindExpression() packages/ztd-query-sqlite/src/Rewrite/Upsert/UpsertExpressionBinder.php:53
- method-call ZtdQuery\Platform\Sqlite\Rewrite\Upsert\UpsertExpressionBinder::bindExpression() packages/ztd-query-sqlite/src/Rewrite/Upsert/UpsertExpressionBinder.php:65
Calls 2
- static-call SqlTokenStream::tokenize() line 120
- static-call SqliteLexerProfile::create() line 120
Private surface 2§
Implementation details, listed for orientation only.
private non-empty-list<string> $incomingNamespacesprivate IdentifierQuoter $quoterTest cases 10§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 4
UpsertExpressionBinderTest::testBindExpressionBindsIncomingExistingAndUnqualifiedColumnscallsUpsertExpressionBinderTest::testIdentifierUnquotesEscapedNamescallsUpsertExpressionBinderTest::testIsIdentifierDistinguishesColumnNamescallsUpsertExpressionBinderTest::testSubqueryTokenIndexesMarksOnlyNestedQueryTokenscalls
Other tests reaching this symbol 6
SqliteRewriterTestcallsStatementRewriterTestcallsInsertTransformerTestcallsSqliteTransformerTestcallsSqliteNativeUpsertProjectorTestcallsSqliteSessionFactoryTestcalls
Relations§
Instantiated in 1
Method calls 4
- method-call ZtdQuery\Platform\Sqlite\Rewrite\Upsert\SqliteNativeUpsertProjector::project() packages/ztd-query-sqlite/src/Rewrite/Upsert/SqliteNativeUpsertProjector.php:59
- method-call ZtdQuery\Platform\Sqlite\Rewrite\Upsert\SqliteNativeUpsertProjector::project() packages/ztd-query-sqlite/src/Rewrite/Upsert/SqliteNativeUpsertProjector.php:60
- method-call ZtdQuery\Platform\Sqlite\Rewrite\Upsert\SqliteNativeUpsertProjector::project() packages/ztd-query-sqlite/src/Rewrite/Upsert/SqliteNativeUpsertProjector.php:71
- method-call ZtdQuery\Platform\Sqlite\Rewrite\Upsert\SqliteNativeUpsertProjector::project() packages/ztd-query-sqlite/src/Rewrite/Upsert/SqliteNativeUpsertProjector.php:76