Doctrine\DBAL\Driver\OCI8\OCI8Statement::convertPositionalToNamedPlaceholders
Convert positional (?) into named placeholders (:param<num>)
Oracle does not support positional parameters, hence this method converts all positional parameters into artificially named parameters. Note that this conversion is not perfect. All question marks (?) in the original statement are treated as placeholders and converted to a named parameter. The algorithm uses a state machine with two possible states: InLiteral and NotInLiteral. Question marks inside literal strings are therefore handled correctly by this method. This comes at a cost, the whole sql statement has to be looped over.
Signature
public function convertPositionalToNamedPlaceholders(string
$statement )
Parameters
$statement
— string- The SQL statement to convert.
Returns
- string
Line | Task |
---|---|
81+ | extract into utility class in Doctrine\DBAL\Util namespace |
81+ | review and test for lost spaces. we experienced missing spaces with oci8 in some sql statements. |