database icon indicating copy to clipboard operation
database copied to clipboard

add: 'lazy' method

Open carloscarucce opened this issue 5 months ago • 3 comments

This method creates a generator that will fetch one row at a time from the data set. This aims to reduce memory load during ResultSet interation while maintaining the simplicity of "fetchAll" when using it inside a loop.

Here is an example:

$rows = $yourQuery->lazy(PDO::FETCH_ASSOC);

foreach ($rows as $row) {
    echo $row['name'], ' - ', $row['age'];
}

Hope you find it useful

carloscarucce avatar Sep 02 '25 17:09 carloscarucce