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

Support streaming result sets #19

Open
clue opened this issue May 6, 2019 · 0 comments
Open

Support streaming result sets #19

clue opened this issue May 6, 2019 · 0 comments
Labels
BC break help wanted Extra attention is needed new feature New feature or request
Milestone

Comments

@clue
Copy link
Owner

clue commented May 6, 2019

Currently, the API only supports buffering the whole result set in memory. This makes sense for smaller result sets as working with an in-memory data structure with some dozens or hundreds of records works perfectly fine.

However, when processing larger result sets with hundreds or thousands of records, it would make sense to use a streaming approach so that one is no longer limited by memory in how many records can be processed.

Eventual API will use ReactPHP's existing stream API and could look something like this:

$stream = $db->queryStream('SELECT * FROM users');

$stream->on('data', function ($row) {
    var_dump($row);
});
$stream->on('end', function () {
    echo 'DONE' . PHP_EOL;
});

Refs friends-of-reactphp/mysql#50

@clue clue added new feature New feature or request help wanted Extra attention is needed labels May 6, 2019
@clue clue added the BC break label Nov 12, 2021
@clue clue added this to the v2.0.0 milestone Nov 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BC break help wanted Extra attention is needed new feature New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant