classStatementRecorder
final class StatementRecorder
Restricted visibility: declared "@visibility root". Code outside that scope must not name this declaration.
Collects the statements found while walking one file.
A prepared statement is filed under the call site that prepared it, so the execute() that comes later can find the records it binds values to even when the prepare produced several alternative statements.
Methods§
public function record(
CallSite $site,
string $siteKey,
TextPattern $pattern,
?StatementKind $kind = null,
bool $combined = false,
list<string> $through = [],
bool $truncated = false,
): QueryRecordRecords a statement issued at a call site.
Parameters
$site | CallSite | |
$siteKey | string | What tells this call apart from every other, including one on the same line |
$pattern | TextPattern | |
$kind | ?StatementKind | |
$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 |
Returns
Test cases 4
Called from 3
- method-call SqlCatalog\Core\Analysis\Interpreter::recordStatements() packages/sql-catalog/src/Core/Analysis/Interpreter.php:341
- method-call SqlCatalog\Core\Analysis\Interpreter::recordStatements() packages/sql-catalog/src/Core/Analysis/Interpreter.php:347
- method-call SqlCatalog\Core\Analysis\Interpreter::recordUnmatched() packages/sql-catalog/src/Core/Analysis/Interpreter.php:359
Calls 1
- new QueryRecord line 50
public function filePrepared(string $handle, list<QueryRecord> $records): voidRecords a statement that was prepared, filed under the handle it produced.
Parameters
$handle | string | |
$records | list<QueryRecord> |
Test cases 2
public function prepared(string $handle): list<QueryRecord>public function records(): list<QueryRecord>Every statement recorded so far.
Returns
list<QueryRecord>Test cases 11
CallEvaluatorTest::testEvaluateRecordsAQueryCallcallsInterpreterTest::testRecordStatementsMarksAStatementCombinedWhenEitherTheTextOrTheReadingIscallsInterpreterTest::testRecordStatementsRecordsACallNothingCouldBeReadFromAsUnreadcallsInterpreterTest::testRecordStatementsSkipsAReadingWithoutTheStatementcallsInterpreterTest::testRecordUnmatchedFilesTheCallUnderItsOwnSinkcallsInterpreterTest::testRecordUnmatchedKeysTheCallByItsFileAndOffsetcallsInterpreterTest::testVisitRecordsAStatementAndHandsBackNothingToBindLatercallsInterpreterTest::testVisitRecordsNothingForACallWithoutItsStatementcallsInterpreterTest::testVisitRecordsNothingForADatabaseCallThatTakesNoStatementcallsStatementRecorderTest::testRecordKeepsTheStatementcallsStatementRecorderTest::testRecordsIsEmptyBeforeAnythingIsRecordedcalls
Private surface 2§
Implementation details, listed for orientation only.
private list<QueryRecord> $records = []private array<string, list<QueryRecord>> $prepared = []Test cases 38§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 5
StatementRecorderTest::testFilePreparedFilesAStatementUnderItsHandlecallsStatementRecorderTest::testPreparedIsEmptyForAHandleNothingWasFiledUndercallsStatementRecorderTest::testRecordKeepsAStatementUncombinedAndWholeUnlessToldOtherwisecallsStatementRecorderTest::testRecordKeepsTheStatementcallsStatementRecorderTest::testRecordsIsEmptyBeforeAnythingIsRecordedcalls
Other tests reaching this symbol 33
CatalogCommandTestcallsCallEvaluatorTest::testArgumentsIsCalledWithTheCallItselfcallsCallEvaluatorTest::testEvaluateRecordsAQueryCallcallsExpressionEvaluatorTestcallsInterpreterTest::testRecordStatementsFilesTheStatementsOfEveryReadingUnderThePreparedHandlecallsInterpreterTest::testRecordStatementsMarksAStatementCombinedWhenEitherTheTextOrTheReadingIscallsInterpreterTest::testRecordStatementsRecordsACallNothingCouldBeReadFromAsUnreadcallsInterpreterTest::testRecordStatementsSkipsAReadingWithoutTheStatementcallsInterpreterTest::testRecordUnmatchedFilesTheCallUnderItsOwnSinkcallsInterpreterTest::testRecordUnmatchedKeysTheCallByItsFileAndOffsetcallsInterpreterTest::testVisitHandsBackNothingForABindingCallWrittenWithoutAReceivercallsInterpreterTest::testVisitHandsBackWhatAnExecuteBindscallsInterpreterTest::testVisitRecordsAStatementAndHandsBackNothingToBindLatercallsInterpreterTest::testVisitRecordsNothingForACallWithoutItsStatementcallsInterpreterTest::testVisitRecordsNothingForADatabaseCallThatTakesNoStatementcallsReferenceEvaluatorTestcallsValueBinderTest::testBindingKeyReadsOnlyScalarKeyscallsValueBinderTest::testBindOneRecordAppendsAValueWhoseNameDidNotResolvecallsValueBinderTest::testBindOneRecordDoesNothingWhenTheCallBindsNothingcallsValueBinderTest::testBindOneRecordIgnoresAValuesArgumentThatDidNotResolvecallsValueBinderTest::testBindOneRecordLeavesAnArrayOfValuesThatDidNotResolveUnboundEvenWhenValuesCouldBeListedcallsValueBinderTest::testBindOneRecordNeedsBothTheNameAndTheValueOfASingleBindcallsValueBinderTest::testBindOneRecordReadsAnArrayOfValuescallsValueBinderTest::testBindOneRecordReadsOneNamedValuecallsValueBinderTest::testBindOneRecordReadsVariadicValuescallsValueBinderTest::testBindOneRecordReadsVariadicValuesWithoutAlsoReadingOneNamedValuecallsValueBinderTest::testBindValuesReachesEveryStatementcallsValueBinderTest::testOpenRecordsFindsTheStatementsAHandleStandsForcallsValueBinderTest::testOpenRecordsIsEmptyForAReceiverWithoutAHandlecallsCallModelTestcallsAnalyzerTestcallsJsonReporterTestcallsTextReporterTestcalls
Relations§
Instantiated in 1
Method calls 6
- method-call SqlCatalog\Core\Analysis\Interpreter::analyze() packages/sql-catalog/src/Core/Analysis/Interpreter.php:126
- method-call SqlCatalog\Core\Analysis\Interpreter::recordStatements() packages/sql-catalog/src/Core/Analysis/Interpreter.php:341
- method-call SqlCatalog\Core\Analysis\Interpreter::recordStatements() packages/sql-catalog/src/Core/Analysis/Interpreter.php:347
- method-call SqlCatalog\Core\Analysis\Interpreter::recordStatements() packages/sql-catalog/src/Core/Analysis/Interpreter.php:350
- method-call SqlCatalog\Core\Analysis\Interpreter::recordUnmatched() packages/sql-catalog/src/Core/Analysis/Interpreter.php:359
- method-call SqlCatalog\Core\Analysis\ValueBinder::openRecords() packages/sql-catalog/src/Core/Analysis/ValueBinder.php:41
Type declarations 5
- type SqlCatalog\Core\Analysis\Interpreter packages/sql-catalog/src/Core/Analysis/Interpreter.php:202
- type SqlCatalog\Core\Analysis\Interpreter packages/sql-catalog/src/Core/Analysis/Interpreter.php:328
- type SqlCatalog\Core\Analysis\Interpreter packages/sql-catalog/src/Core/Analysis/Interpreter.php:357
- type SqlCatalog\Core\Analysis\ValueBinder packages/sql-catalog/src/Core/Analysis/ValueBinder.php:22
- type SqlCatalog\Core\Analysis\ValueBinder packages/sql-catalog/src/Core/Analysis/ValueBinder.php:27