PdbDataBinderInterface
extends
PdbDataInterface
in
This defines how values are formatted and bound to queries.
When using Pdb insert/update objects implementing these can override
the behaviour of the binding SQL statements of the query using
the getBindingQuery() method.
The value is still bound using prepared statements. This interface also
lets one modify the value before binding using the getBindingValue() method.
Binders are applied before formatters.
Tags
Table of Contents
Methods
- getBindingQuery() : string
- Get the SQL snippet for an `UPDATE SET` query.
- getBindingValue() : string|int|float|object
- Get the value to bind to a query.
Methods
getBindingQuery()
Get the SQL snippet for an `UPDATE SET` query.
public
getBindingQuery(Pdb $pdb, string $column) : string
The column value will be a numeric placeholder like ?.
Such as: "column" = ?.
Please note, although the value is properly escaped using prepared statements - the column names are not. The Pdb object is provided for this purpose Pdb::quoteField.
Also this is not used for INSERT VALUES. However getBindingValue()
is still used to process the value before binding.
Parameters
- $pdb : Pdb
- $column : string
Return values
stringgetBindingValue()
Get the value to bind to a query.
public
getBindingValue() : string|int|float|object
This provides an opportunity to format the value, or not.
If the result is an object, even itself, it can be still be formatted by the global formatters in PdbConfig.