Generated with the help of an LLM.
I've used Claude to help find this issue when researching #3571186: mysqli - skip prepared statement to allow async query execution
Problem/Motivation
If you run the following query on MySQLi SELECT 'it\'s :a', :b:, MySQL sees one literal, 'it\'s ?', but the converter treated it as 'it\' followed by code. So :a inside the literal was turned into a placeholder, and the parameter list is off by one from what MySQL sees.
Steps to reproduce
See above
Proposed resolution
Use the MySQL pattern for the mysqli driver. Use NO_BACKSLASH_ESCAPES to decide, since the ANSI pattern is only correct if that mode is on, and Drupal's default sql_mode doesn't set it.
Remaining tasks
User interface changes
None
Introduced terminology
None
API changes
TBD
Data model changes
TBD
Release notes snippet
Issue fork drupal-3636763
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
alexpottThere isn't a simple solution here because the NamedParamConverter needs to know which quotes we've selected in \Drupal\mysqli\Driver\Database\mysqli\Connection::__construct() and we need to add NO_BACKSLASH_ESCAPES detection there as well. Ick... this is not nice.
I've created an MR with test cases that show the problem.