Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Methods that use PDOStatement fetch & Generators #27

Open
rotexdegba opened this issue Apr 4, 2023 · 0 comments
Open

Add Methods that use PDOStatement fetch & Generators #27

rotexdegba opened this issue Apr 4, 2023 · 0 comments
Assignees
Labels
nice-to-have Features or enhancements that are not pressing but nice to have

Comments

@rotexdegba
Copy link
Member

Add methods to the Model class that return a Generator that yields either an assoc arrays or a records. These methods will not be able to eager load related data because they are streaming

  • streamRows(?\Aura\SqlQuery\Common\Select $select_obj=null): Generator
  • streamRecords(?\Aura\SqlQuery\Common\Select $select_obj=null): Generator

The Generator returned will yield a row (assoc array representing a row in the desired DB table) or a record object (representing a row in the desired DB table) on each loop iteration.

These new methods will use minimal & constant memory, but will most likely run not a fast as their fetch(Rows|Records)Into(Array|Collection) counterparts that use more memory as the number of records or rows to be fetched increases but run faster than these two new methods.

They would be very useful for long running applications with large data sets that are to be run in the background. They will be useful where you want to sequentially loop through all rows or records from a DB table with lots of data and you are running on a memory constrained machine.

@rotexdegba rotexdegba added the nice-to-have Features or enhancements that are not pressing but nice to have label Apr 4, 2023
@rotexdegba rotexdegba self-assigned this Apr 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
nice-to-have Features or enhancements that are not pressing but nice to have
Projects
None yet
Development

No branches or pull requests

1 participant