Introduce a FetchModeTrait to allow emulating PDO fetch modes

Created on 12 March 2023, over 1 year ago
Updated 19 July 2023, 11 months ago

Problem/Motivation

From 🐛 Implement statement classes using \Iterator to fix memory usage regression and prevent rewinding Fixed .

StatementPrefetch::fetch() has some code that allows emulating different PDO fetch modes, since all data is prefetched on execution in FETCH_ASSOC format, and needs to be re-formatted according to the fetch mode used in each fetch. This code could be reused for contrib drivers that are not based on PDO.

Also, the initialization of a FETCH_CLASS fetch object with constructor arguments is based on reflection - since PHP 5.6 we could have been using the splat operator (...) instead.

Proposed resolution

  • Extract the fetch emulation code in a trait with appropriate protected methods that can be used in statement classes.
  • Implement that in the StatementPrefetch.

Remaining tasks

User interface changes

none

API changes

A new trait with protected methods.

Data model changes

none

Release notes snippet

📌 Task
Status

Fixed

Version

11.0 🔥

Component
Database 

Last updated about 4 hours ago

  • Maintained by
  • 🇳🇱Netherlands @daffie
Created by

🇮🇹Italy mondrake 🇮🇹

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024