classQueryRecord
final class QueryRecord
One statement found at a call site, while values may still be bound to it.
A prepared statement is recorded when it is prepared and completed when it is executed, so the record stays open between the two.
Properties§
public CallSite $sitepublic string $siteKeypublic TextPattern $patternpublic StatementKind|null $kind = nullpublic bool $combined = falsepublic list<string> $through = []Methods§
public function __construct(
public CallSite $site,
public string $siteKey,
public TextPattern $pattern,
public StatementKind|null $kind = null,
public bool $combined = false,
public list<string> $through = [],
bool $truncated = false,
)Parameters
$site | CallSite | Where the statement is issued |
$siteKey | string | What tells this call apart from every other, including one on the same line |
$pattern | TextPattern | The statement text as far as it resolved |
$kind | StatementKind|null | The kind the call implies, when it implies one |
$combined | bool | Whether the statement came from pairing parts that vary independently |
$through | list<string> | The path taken to this reading, from the body the walk started in, outermost first |
$truncated | bool | Whether a bound cut the search short of every way the statement can be |
public function isTruncated(): boolWhether a bound cut the search short of every way the statement can be.
Returns
boolTest cases 3
Binds values given as one array, by position and by name.
Named keys are written both with and without their leading colon, so the key is normalized to the name the statement itself uses.
Test cases 18
EntryFactoryTest::testBindPlaceholdersLinesValuesUpByNamecallsEntryFactoryTest::testBindPlaceholdersLinesValuesUpByPositioncallsEntryFactoryTest::testBindPlaceholdersReadsANumberedPlaceholderByPositioncallsEntryFactoryTest::testBuildOneReportsAStatementBoundWithTheWrongNumberOfValuescallsEntryFactoryTest::testBuildReportsAStatementBoundWithTheWrongNumberOfValuescallsEntryFactoryTest::testCountMismatchCountsValuesBoundByPositionAndByNamecallsEntryFactoryTest::testCountMismatchReportsAStatementBoundWithTheWrongNumberOfValuescallsEntryFactoryTest::testCountMismatchStaysQuietWhenTheCallSiteHasAlternativescallsEntryFactoryTest::testCountMismatchStaysQuietWhenTheCountsAgreecallsEntryFactoryTest::testFindingsReportAReadingALimitCutShortAlongsideAWrongCountcallsEntryFactoryTest::testFindingsReportAStatementBoundWithTheWrongNumberOfValuescallsEntryFactoryTest::testMergeFoldsTwoReadingsOfTheSameStatementcallsQueryRecordTest::testAbsorbTakesOverValuesTheOtherReadingAloneHascallsQueryRecordTest::testAbsorbTakesTheUnionOfBothReadingscallsQueryRecordTest::testBindKeepsValuesByPositionAndByNamecallsQueryRecordTest::testBindOneWritesAPositionCountedFromOnecallsQueryRecordTest::testIsBoundAfterAbsorbOnlyWhenEitherReadingWasBoundcallsQueryRecordTest::testIsBoundOnlyAfterSomethingWasBoundcalls
Called from 2
Calls 1
- function-call
ltrimline 78
public function bindOne(string|int|null $key, Domain $value): voidBinds one value, named or positional depending on how it is keyed.
Parameters
$key | string|int|null | |
$value | Domain |
Test cases 7
EntryFactoryTest::testBindPlaceholdersLeavesAPlaceholderNothingWasBoundToEmptycallsEntryFactoryTest::testBindPlaceholdersPrefersAValueBoundUnderTheNumberAsANamecallsQueryRecordTest::testBindOneWritesAPositionCountedFromOnecallsQueryRecordTest::testBindOneWritesUnderThePositionOrTheNamecallsQueryRecordTest::testIsBoundAfterASingleValueIsBoundcallsQueryRecordTest::testPositionalIsOrderedByPositioncallsQueryRecordTest::testPositionalKeepsAValueAtThePositionItWasBoundTocalls
Called from 1
public function absorb(self $other): voidTakes on everything another reading of the same statement bound.
The same call is reached both on its own and through the callers that lead to it. Each reading is one way the statement can be bound, so the record keeps the union of them rather than whichever was seen last.
Parameters
$other | self |
Test cases 5
QueryRecordTest::testAbsorbPreservesCombinationUncertaintyInEitherOrdercallsQueryRecordTest::testAbsorbTakesOverValuesTheOtherReadingAloneHascallsQueryRecordTest::testAbsorbTakesTheUnionOfBothReadingscallsQueryRecordTest::testIsBoundAfterAbsorbOnlyWhenEitherReadingWasBoundcallsQueryRecordTest::testIsTruncatedOnceEitherReadingWasCutShortcalls
public function positional(): array<int, Domain>The values bound by position, keyed by position counting from zero, in order.
A position nothing was bound to is absent rather than closed up, so a value bound to the second placeholder alone stays with the second placeholder.
Returns
array<int, Domain>Test cases 11
QueryRecordTest::testAbsorbTakesOverValuesTheOtherReadingAloneHascallsQueryRecordTest::testAbsorbTakesTheUnionOfBothReadingscallsQueryRecordTest::testBindKeepsValuesByPositionAndByNamecallsQueryRecordTest::testBindOneWritesAPositionCountedFromOnecallsQueryRecordTest::testBindOneWritesUnderThePositionOrTheNamecallsQueryRecordTest::testPositionalIsOrderedByPositioncallsQueryRecordTest::testPositionalKeepsAValueAtThePositionItWasBoundTocallsValueBinderTest::testBindOneRecordAppendsAValueWhoseNameDidNotResolvecallsValueBinderTest::testBindOneRecordReadsAnArrayOfValuescallsValueBinderTest::testBindOneRecordReadsVariadicValuescallsValueBinderTest::testBindOneRecordReadsVariadicValuesWithoutAlsoReadingOneNamedValuecalls
Called from 2
Calls 1
- function-call
ksortline 135
public function named(): array<string, Domain>The values bound by name.
Returns
array<string, Domain>Test cases 8
QueryRecordTest::testAbsorbTakesTheUnionOfBothReadingscallsQueryRecordTest::testBindKeepsValuesByPositionAndByNamecallsQueryRecordTest::testBindOneWritesUnderThePositionOrTheNamecallsQueryRecordTest::testNamedIsEmptyUntilSomethingIsBoundByNamecallsValueBinderTest::testBindOneRecordAppendsAValueWhoseNameDidNotResolvecallsValueBinderTest::testBindOneRecordReadsAnArrayOfValuescallsValueBinderTest::testBindOneRecordReadsOneNamedValuecallsValueBinderTest::testBindOneRecordReadsVariadicValuesWithoutAlsoReadingOneNamedValuecalls
public function isBound(): boolWhether anything was ever bound to the statement.
Returns
boolTest cases 9
QueryRecordTest::testAbsorbTakesOverValuesTheOtherReadingAloneHascallsQueryRecordTest::testIsBoundAfterAbsorbOnlyWhenEitherReadingWasBoundcallsQueryRecordTest::testIsBoundAfterASingleValueIsBoundcallsQueryRecordTest::testIsBoundOnlyAfterSomethingWasBoundcallsValueBinderTest::testBindOneRecordDoesNothingWhenTheCallBindsNothingcallsValueBinderTest::testBindOneRecordIgnoresAValuesArgumentThatDidNotResolvecallsValueBinderTest::testBindOneRecordLeavesAnArrayOfValuesThatDidNotResolveUnboundEvenWhenValuesCouldBeListedcallsValueBinderTest::testBindOneRecordNeedsBothTheNameAndTheValueOfASingleBindcallsValueBinderTest::testBindValuesReachesEveryStatementcalls
Private surface 4§
Implementation details, listed for orientation only.
private array<int, Domain> $positional = []private array<string, Domain> $named = []private bool $bound = falseprivate bool $truncatedTest cases 83§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 15
QueryRecordTest::testAbsorbPreservesCombinationUncertaintyInEitherOrdercallsQueryRecordTest::testAbsorbTakesOverValuesTheOtherReadingAloneHascallsQueryRecordTest::testAbsorbTakesTheUnionOfBothReadingscallsQueryRecordTest::testBindKeepsValuesByPositionAndByNamecallsQueryRecordTest::testBindOneWritesAPositionCountedFromOnecallsQueryRecordTest::testBindOneWritesUnderThePositionOrTheNamecallsQueryRecordTest::testIsBoundAfterAbsorbOnlyWhenEitherReadingWasBoundcallsQueryRecordTest::testIsBoundAfterASingleValueIsBoundcallsQueryRecordTest::testIsBoundOnlyAfterSomethingWasBoundcallsQueryRecordTest::testIsTruncatedIsFalseAndCombinedIsFalseUnlessToldOtherwisecallsQueryRecordTest::testIsTruncatedOnceEitherReadingWasCutShortcallsQueryRecordTest::testIsTruncatedOnlyWhenABoundCutTheSearchShortcallsQueryRecordTest::testNamedIsEmptyUntilSomethingIsBoundByNamecallsQueryRecordTest::testPositionalIsOrderedByPositioncallsQueryRecordTest::testPositionalKeepsAValueAtThePositionItWasBoundTocalls
Other tests reaching this symbol 68
CatalogCommandTestcallsCallEvaluatorTest::testDispatchResolvesAcrossTheImplementationsTheSourceDeclarescallsCallEvaluatorTest::testEvaluateFollowsAFreeFunctionOfTheAnalyzedSourcecallsCallEvaluatorTest::testEvaluateFollowsAMethodOfTheAnalyzedSourcecallsCallEvaluatorTest::testEvaluateFollowsAStaticCallOfTheAnalyzedSourcecallsCallEvaluatorTest::testFollowReadsTheSameCallOnceForTheSameArgumentscallsCallEvaluatorTest::testFollowStopsAtTheDepthLimitcallsEntryFactoryTest::testBindPlaceholdersLeavesAPlaceholderNothingWasBoundToEmptycallsEntryFactoryTest::testBindPlaceholdersLinesValuesUpByNamecallsEntryFactoryTest::testBindPlaceholdersLinesValuesUpByPositioncallsEntryFactoryTest::testBindPlaceholdersPrefersAValueBoundUnderTheNumberAsANamecallsEntryFactoryTest::testBindPlaceholdersReadsANumberedPlaceholderByPositioncallsEntryFactoryTest::testBuildGivesTwoIndistinguishableStatementsDistinctIdentifierscallsEntryFactoryTest::testBuildKeepsAnUndeterminedReadingBesideAResolvedOnecallsEntryFactoryTest::testBuildKeepsBothReadingsOfTheSameCallcallsEntryFactoryTest::testBuildNamesALoneStatementAsItsOwnReadingWouldcallsEntryFactoryTest::testBuildNumbersEachFurtherTwinOnceMorecallsEntryFactoryTest::testBuildOneCarriesTheCallsThatWereFollowedcallsEntryFactoryTest::testBuildOneReadsTheStatementKindTheCallImpliescallsEntryFactoryTest::testBuildOneRecordsWhetherTheAlternativesAreOnesTheCodeCanReachcallsEntryFactoryTest::testBuildOneReportsAStatementBoundWithTheWrongNumberOfValuescallsEntryFactoryTest::testBuildReportsAStatementBoundWithTheWrongNumberOfValuescallsEntryFactoryTest::testBuildSharesSearchCompletionAcrossEveryCandidatecallsEntryFactoryTest::testBuildTurnsRecordsIntoEntriescallsEntryFactoryTest::testCountMismatchCountsValuesBoundByPositionAndByNamecallsEntryFactoryTest::testCountMismatchReportsAStatementBoundWithTheWrongNumberOfValuescallsEntryFactoryTest::testCountMismatchStaysQuietWhenNothingWasBoundcallsEntryFactoryTest::testCountMismatchStaysQuietWhenTheCallSiteHasAlternativescallsEntryFactoryTest::testCountMismatchStaysQuietWhenTheCountsAgreecallsEntryFactoryTest::testFindingsAreEmptyForAResolvedStatementcallsEntryFactoryTest::testFindingsNeverCallAFullyResolvedStatementUnresolvedcallsEntryFactoryTest::testFindingsReportACallNotAnalyzedWithoutClaimingALimitCutItShortcallsEntryFactoryTest::testFindingsReportADynamicStatementcallsEntryFactoryTest::testFindingsReportAnIncompleteSearchOnceEvenWhenALimitAlsoCutItShortcallsEntryFactoryTest::testFindingsReportAReadingALimitCutShortAlongsideAWrongCountcallsEntryFactoryTest::testFindingsReportAStatementBoundWithTheWrongNumberOfValuescallsEntryFactoryTest::testFindingsReportAStatementThatDidNotResolveAtAllcallsEntryFactoryTest::testFindingsReportExternalInputcallsEntryFactoryTest::testFindingsReportExternalInputOnceHoweverManyValuesCarryItcallsEntryFactoryTest::testFindingsReportThatTheSearchDidNotClosecallsEntryFactoryTest::testGroupBySiteKeepsTheCallsApartcallsEntryFactoryTest::testMergeFoldsTwoReadingsOfTheSameStatementcallsEntryFactoryTest::testMergeKeepsTwoStatementsApartWhenTheirKeyAndTextRunTogethercallsEntryFactoryTest::testNotAnalyzedReasonSaysTheAnalysisStoppedBeforeReadingTheCallcallsEntryFactoryTest::testNotAnalyzedReasonSaysTheReceiverCouldNotBeIdentifiedcallsEntryFactoryTest::testRenumberKeepsEverythingButTheIdentifiercallsExpressionEvaluatorTestcallsInterpreterTest::testAnalyzeGivesEveryCallTheWholeBudgetcallsInterpreterTest::testAnalyzeReadsEveryStatementFromTheCallThatIssuesItcallsInterpreterTest::testAnalyzeRecordsNothingAtACallThatOnlyComposesAStatementcallsInterpreterTest::testRecordStatementsFilesTheStatementsOfEveryReadingUnderThePreparedHandlecallsInterpreterTest::testRecordStatementsMarksAStatementCombinedWhenEitherTheTextOrTheReadingIscallsInterpreterTest::testRecordStatementsSkipsAReadingWithoutTheStatementcallsStatementRecorderTestcallsValueBinderTest::testBindOneRecordAppendsAValueWhoseNameDidNotResolvecallsValueBinderTest::testBindOneRecordDoesNothingWhenTheCallBindsNothingcallsValueBinderTest::testBindOneRecordIgnoresAValuesArgumentThatDidNotResolvecallsValueBinderTest::testBindOneRecordLeavesAnArrayOfValuesThatDidNotResolveUnboundEvenWhenValuesCouldBeListedcallsValueBinderTest::testBindOneRecordNeedsBothTheNameAndTheValueOfASingleBindcallsValueBinderTest::testBindOneRecordReadsAnArrayOfValuescallsValueBinderTest::testBindOneRecordReadsOneNamedValuecallsValueBinderTest::testBindOneRecordReadsVariadicValuescallsValueBinderTest::testBindOneRecordReadsVariadicValuesWithoutAlsoReadingOneNamedValuecallsValueBinderTest::testBindValuesReachesEveryStatementcallsCallModelTestcallsAnalyzerTestcallsJsonReporterTestcallsTextReporterTestcalls
Relations§
Instantiated in 1
Method calls 10
- method-call SqlCatalog\Core\Analysis\EntryFactory::buildOne() packages/sql-catalog/src/Core/Analysis/EntryFactory.php:157
- method-call SqlCatalog\Core\Analysis\EntryFactory::bindPlaceholders() packages/sql-catalog/src/Core/Analysis/EntryFactory.php:169
- method-call SqlCatalog\Core\Analysis\EntryFactory::bindPlaceholders() packages/sql-catalog/src/Core/Analysis/EntryFactory.php:170
- method-call SqlCatalog\Core\Analysis\EntryFactory::findings() packages/sql-catalog/src/Core/Analysis/EntryFactory.php:248
- method-call SqlCatalog\Core\Analysis\EntryFactory::countMismatch() packages/sql-catalog/src/Core/Analysis/EntryFactory.php:285
- method-call SqlCatalog\Core\Analysis\EntryFactory::countMismatch() packages/sql-catalog/src/Core/Analysis/EntryFactory.php:289
- method-call SqlCatalog\Core\Analysis\EntryFactory::countMismatch() packages/sql-catalog/src/Core/Analysis/EntryFactory.php:289
- method-call SqlCatalog\Core\Analysis\ValueBinder::bindOneRecord() packages/sql-catalog/src/Core/Analysis/ValueBinder.php:67
- method-call SqlCatalog\Core\Analysis\ValueBinder::bindOneRecord() packages/sql-catalog/src/Core/Analysis/ValueBinder.php:73
- method-call SqlCatalog\Core\Analysis\ValueBinder::bindOneRecord() packages/sql-catalog/src/Core/Analysis/ValueBinder.php:81
Type declarations 8
- type SqlCatalog\Core\Analysis\EntryFactory packages/sql-catalog/src/Core/Analysis/EntryFactory.php:82
- type SqlCatalog\Core\Analysis\EntryFactory packages/sql-catalog/src/Core/Analysis/EntryFactory.php:142
- type SqlCatalog\Core\Analysis\EntryFactory packages/sql-catalog/src/Core/Analysis/EntryFactory.php:167
- type SqlCatalog\Core\Analysis\EntryFactory packages/sql-catalog/src/Core/Analysis/EntryFactory.php:212
- type SqlCatalog\Core\Analysis\EntryFactory packages/sql-catalog/src/Core/Analysis/EntryFactory.php:263
- type SqlCatalog\Core\Analysis\EntryFactory packages/sql-catalog/src/Core/Analysis/EntryFactory.php:283
- type SqlCatalog\Core\Analysis\StatementRecorder packages/sql-catalog/src/Core/Analysis/StatementRecorder.php:41
- type SqlCatalog\Core\Analysis\ValueBinder packages/sql-catalog/src/Core/Analysis/ValueBinder.php:62