Skip to content

[PHP] Extract DatabaseRowsReader from MySQLDumpProducer - #606

Merged
adamziel merged 1 commit into
trunkfrom
codex/extract-database-row-reader
Aug 14, 2026
Merged

[PHP] Extract DatabaseRowsReader from MySQLDumpProducer#606
adamziel merged 1 commit into
trunkfrom
codex/extract-database-row-reader

Conversation

@adamziel

@adamziel adamziel commented Aug 14, 2026

Copy link
Copy Markdown
Collaborator

Extracts DatabaseRowsReader from MySQLDumpProducer so database records can be consumed without generating SQL first.

MySQLDumpProducer now owns a reader and remains responsible for SQL formatting, oversized values, and the dump lifecycle. The reader owns table discovery, metadata, bounded primary-key queries, exclusions, and cursor state.

This does not change dump output. The child PR #578 uses the reader to process structured live database records directly.

Example

$reader = new DatabaseRowsReader($pdo, [
    "batch_size" => 250,
]);
$reader->initialize_tables_to_process();

while ($reader->move_to_next_table()) {
    while ($reader->next_record()) {
        $table = $reader->get_current_table();
        $record = $reader->get_current_record();

        process_record($table, $record);
        $reader->clear_current_record();
    }
}

Testing

The existing dump producer tests cover batch boundaries, composite keys, exclusions, data types, and cursor resume. PHP 7.2 compatibility, PHPStan, and CI pass.

@github-actions

github-actions Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Pull pipeline performance — large-directory

Site: large-directory · 2,000+ plus targeted file-transfer scenarios files · 10,000 posts · 25,000 postmeta · PHP 8.5.9

Stage PR trunk Δ Status Details
playground-sqlite-db-pull 9.59 s 9.60 s ⚪ -1 ms (-0.0%) condition=db-pull in PHP.wasm
runtime=php.wasm 8.3
wp_mysql_parser=enabled
mode=lexer
native_lexer=verified
native_token_stream=WP_MySQL_Native_Token_Stream
native_token_count=18
native_parser=selected
trunk: condition=db-pull in PHP.wasm
runtime=php.wasm 8.3
wp_mysql_parser=enabled
mode=lexer
native_lexer=verified
native_token_stream=WP_MySQL_Native_Token_Stream
native_token_count=18
native_parser=selected
playground-sqlite-db-apply 3.69 s 3.69 s ⚪ +2 ms (+0.1%) condition=db-apply to SQLite in PHP.wasm
runtime=php.wasm 8.3
wp_mysql_parser=enabled
mode=parser
native_lexer=verified
native_token_stream=WP_MySQL_Native_Token_Stream
native_token_count=18
native_parser=verified
native_ast=WP_MySQL_Native_Parser_Node
sqlite_driver_parser=verified
trunk: condition=db-apply to SQLite in PHP.wasm
runtime=php.wasm 8.3
wp_mysql_parser=enabled
mode=parser
native_lexer=verified
native_token_stream=WP_MySQL_Native_Token_Stream
native_token_count=18
native_parser=verified
native_ast=WP_MySQL_Native_Parser_Node
sqlite_driver_parser=verified
Total 13.28 s 13.28 s ⚪ +1 ms (+0.0%)

Numbers carry runner noise; treat single-run deltas as directional, not authoritative.

📈 Trunk performance history — commit-by-commit timeline.

@adamziel
adamziel force-pushed the codex/extract-database-row-reader branch from ea90655 to f0fd668 Compare August 14, 2026 11:53
@adamziel adamziel changed the title [PHP] Extract bounded database row reading from MySQLDumpProducer [PHP] Extract DatabaseRowsReader from MySQLDumpProducer Aug 14, 2026
@adamziel
adamziel merged commit 0c2a52c into trunk Aug 14, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant