You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current library design around handling named and positional parameters in prepared statements is a bit of a mess.
Current behaviour
When a statement containing named parameters is executed via the wrapper connection's executeQuery(), the parameters get unconditionally converted to the positional ones via SQLParserUtils::expandListParameters().
The OCI8Statement class converts positional parameters back to the named ones via OCI8Statement::convertPositionalToNamedPlaceholders().
Therefore:
Parameter names get lost in translation: SELECT :COL1 COL1 FROM DUAL → SELECT :param1 COL1 FROM DUAL.
Extra overhead on query parsing and conversion back and forth.
The wrapper connection implements driver-specific logic which is wrong by design.
How to reproduce
Currently, there's no mechanism to observe the queries in the form in which they hit the underlying DB driver. See the data flow in the new data item added to queryConversionProvider() added in #3738.
Expected behavior
The wrapper statement doesn't contain any conversion logic.
The driver statement converts the unsupported parameters to the supported ones.
No unnecessary conversion happens.
Underlying driver support for parameter binding
Driver
Positional
Named
Expected improvement
ibm_db2
Y
N
mysqli
Y
N
oci8
N
Y
✓
pdo_*
Y
Y
✓
sqlsrv
Y
N
The text was updated successfully, but these errors were encountered:
Bug Report
Summary
The current library design around handling named and positional parameters in prepared statements is a bit of a mess.
Current behaviour
executeQuery()
, the parameters get unconditionally converted to the positional ones viaSQLParserUtils::expandListParameters()
.OCI8Statement
class converts positional parameters back to the named ones viaOCI8Statement::convertPositionalToNamedPlaceholders()
.Therefore:
SELECT :COL1 COL1 FROM DUAL
→SELECT :param1 COL1 FROM DUAL
.How to reproduce
Currently, there's no mechanism to observe the queries in the form in which they hit the underlying DB driver. See the data flow in the new data item added to
queryConversionProvider()
added in #3738.Expected behavior
Underlying driver support for parameter binding
ibm_db2
mysqli
oci8
pdo_*
sqlsrv
The text was updated successfully, but these errors were encountered: