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.
public static convertPositionalToNamedPlaceholders ( string $statement ) : string | ||
$statement | string | The SQL statement to convert. |
return | string |