-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Open
Description
Bug Report
Q | A |
---|---|
Version | 2.10.0 |
Summary
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 viaSQLParserUtils::expandListParameters()
. - The
OCI8Statement
class converts positional parameters back to the named ones viaOCI8Statement::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 |