Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Named statement parameters are unnecessarily converted to positional on Oracle #3744

Open
morozov opened this issue Nov 23, 2019 · 0 comments

Comments

@morozov
Copy link
Member

morozov commented Nov 23, 2019

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

  1. 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().
  2. The OCI8Statement class converts positional parameters back to the named ones via OCI8Statement::convertPositionalToNamedPlaceholders().

Therefore:

  1. Parameter names get lost in translation: SELECT :COL1 COL1 FROM DUALSELECT :param1 COL1 FROM DUAL.
  2. Extra overhead on query parsing and conversion back and forth.
  3. 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

  1. The wrapper statement doesn't contain any conversion logic.
  2. The driver statement converts the unsupported parameters to the supported ones.
  3. 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant