Hi Karoly, Il 11/10/2023 17:03, Karoly Negyesi ha scritto:
Drupal has been using PDO for a long time now but as it doesn't have async support, the project is adding a mysqli driver. A sticky point here is the lack of support for named placeholders which are widely used in Drupal land but mysqli doesn't support them. Currently the project is considering parsing the SQL string in userspace to convert the named placeholders to positional ones. This does seem like a waste because PDO already contains battle tested, performant code to do this: pdo_parse_params. Exposing this to userspace would solve the problem. What do you think? If the maintainers of the project agree to the idea I can take a stab at coding this. It can't be too hard (famous last words).
TBH I'm not very excited to expose PDO (or other) internal functions to userland.
The pdo_parse_params function works on a PDO statement, so I would expect you need a PDO statement to call its userland equivalent, unless some major refactoring takes place.
Also, tangentailly related is the fact that the SQL parser is currently hardcoded to MySQL syntax[1] and I was planning to improve that. I had a working PR[2] to allow drivers to have their own SQL parser, but haven't yet managed to find time to go through the RFC process.
References: [1] https://externals.io/message/114016 [2] https://github.com/php/php-src/pull/6852 Cheers -- Matteo Beccati Development & Consulting - http://www.beccati.com/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php