database
database copied to clipboard
add: 'lazy' method
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