classParameterBinder
final class ParameterBinder
Binds a caller's parameters to a statement and runs it.
ZTD rewrites a statement's SQL between prepare and execute, so the array a caller passed to execute() cannot simply be handed on: each value has to be bound to the rewritten statement under the placeholder it belongs to, and under the kind PDO would have read it as.
Methods§
public function execute<TValue>(
PDOStatement $statement,
array<int|string, TValue>|null $params,
): boolBinds every parameter to the statement and runs it.
Positional parameters are numbered from one in the order they were written, which is how PDO numbers them.
Parameters
$statement | PDOStatement | Statement to bind against and run |
$params | array<int|string, TValue>|null | Parameters as the caller passed them, or null to run what is already bound |
Returns
bool Whether the statement ranTest cases 3
Called from 1
Calls 6
- method-call
PDOStatement::execute()line 36 - function-call
is_intline 41 - method-call ParameterBinder::parameterName() line 41
- method-call
PDOStatement::bindValue()line 42 - static-call ParameterKind::fromType() line 42
- function-call
gettypeline 42
public function parameterName(string $parameter): stringAnswers a named parameter as the placeholder it stands for.
A caller may write the name with or without the colon PDO's placeholders carry; both name the same placeholder.
Parameters
$parameter | string | Name as the caller wrote it |
Returns
string The same name, written as a placeholderTest cases 2
Called from 1
Test cases 13§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 5
ParameterBinderTest::testExecuteBindsEachValueAsTheKindPdoReadsItAscallsParameterBinderTest::testExecuteBindsEveryKindAndNamesEveryNamedPlaceholdercallsParameterBinderTest::testExecuteRunsWhatIsAlreadyBoundWhereItIsGivenNothingcallsParameterBinderTest::testParameterNameLeavesANameThatIsAlreadyAPlaceholderAlonecallsParameterBinderTest::testParameterNameWritesAPlainNameAsAPlaceholdercalls
Other tests reaching this symbol 8
PdoConnectionTestcallsPdoStatementTestcallsDriverSessionFactoryTestcallsPreparedQueryTestcallsStatementExecutionTestcallsZtdPdoExceptionTestcallsZtdPdoStatementTestcallsZtdPdoTestcalls