Skip to content

feat(DBI): fill in more DBI internals used by test suite#545

Closed
fglock wants to merge 1 commit intofix/dbi-install-driverfrom
fix/dbi-phase3
Closed

feat(DBI): fill in more DBI internals used by test suite#545
fglock wants to merge 1 commit intofix/dbi-install-driverfrom
fix/dbi-phase3

Conversation

@fglock
Copy link
Copy Markdown
Owner

@fglock fglock commented Apr 22, 2026

Summary

Phase 3 first batch of the DBI test-parity plan. Adds the methods the DBI self-tests and the bundled pure-Perl DBDs (DBD::File, DBD::DBM, DBD::Sponge, DBD::Mem, DBI::DBD::SqlEngine) call on DBI and on handles. Nothing architecturally new — it's all straight ports of existing real-DBI logic into the Perl-side glue we started in #544.

What's added

Top-level DBI methods / helpers:

  • DBI->internal (fake DBD::Switch::dr drh that isa('DBI::dr'))
  • DBI->parse_dsn
  • DBI->driver_prefix (accepts both 'File' and 'DBD::File')
  • DBI->dbixs_revision
  • DBI->install_method / DBI->_install_method
  • DBI::hash (ported from DBI::PurePerl)
  • DBI::_concat_hash_sorted
  • DBI::dbi_profile / dbi_profile_merge / dbi_profile_merge_nodes
  • DBI->data_sources now also accepts the "dbi:DRIVER:" form.

Trace fix in DBI.pm: DBI->trace / DBI->trace_msg now work as class methods (previously crashed on strict refs when the invocant was "DBI").

DBD::_::db base class: do, prepare_cached, selectrow_array / _arrayref / _hashref, selectall_arrayref / _hashref, selectcol_arrayref, type_info stub.

DBD::_::st base class: fetchall_arrayref (plain / slice / hash), fetchall_hashref, _get_fbav, and a FETCH override computing NAME_lc / NAME_uc / NAME_hash / NAME_lc_hash / NAME_uc_hash from NAME when called via $sth->FETCH(...). Direct $sth->{NAME_lc} access still requires tied-hash semantics, which we don't provide.

DBD::_::common base class: FETCH_many, debug, dbixs_revision, install_method, dump_handle.

Effect on jcpan -t DBI (stacked on #544)

Files Subtests Passing Failing
before 200 1600 1240 360
after 200 5610 3978 1632

+2738 subtests now pass (+4010 more executed). 4 fewer test files fail overall. The remaining 166 files are dominated by (a) DBD::File / DBD::DBM-specific methods not yet wired and (b) tied-hash-dependent attribute access.

Cumulative across stacked PRs

Subtests Passing
master 562 308
+ #540 (Exporter) 638 368
+ #542 (verify fallback) 946 676
+ #544 (install_driver) 1600 1240
+ this PR 5610 3978

~13× more subtests passing than master.

Depends on

Test plan

  • make (full unit tests) passes.
  • ./jperl ~/.cpan/build/DBI-1.647-5/t/01basics.t runs 94+ subtests (was 78).
  • ./jperl ~/.cpan/build/DBI-1.647-5/t/02dbidrv.t runs 54 subtests (was 37).
  • ./jperl ~/.cpan/build/DBI-1.647-5/t/48dbi_dbd_sqlengine.t runs 22 subtests with 21 passing.
  • jcpan -t DBI baseline matches the table above.

Generated with Devin

Phase 3 first batch of the DBI test-parity plan: add the methods
the DBI self-tests and the bundled pure-Perl DBDs
(DBD::File / DBD::DBM / DBD::Sponge / DBD::Mem / DBI::DBD::SqlEngine)
call on DBI and on handles.

Top-level DBI methods / helpers:
  * DBI->internal      (fake DBD::Switch::dr drh, isa('DBI::dr'))
  * DBI->parse_dsn
  * DBI->driver_prefix (accepts both 'File' and 'DBD::File')
  * DBI->dbixs_revision
  * DBI->install_method / DBI->_install_method
  * DBI::hash          (ported from DBI::PurePerl)
  * DBI::_concat_hash_sorted
  * DBI::dbi_profile / dbi_profile_merge / dbi_profile_merge_nodes
  * DBI->data_sources now accepts "dbi:DRIVER:" form.

Trace fix in DBI.pm:
  * DBI->trace / DBI->trace_msg now work as class methods
    (previously crashed on strict refs when the invocant was "DBI").

DBD::_::db base class:
  * do, prepare_cached
  * selectrow_array / _arrayref / _hashref
  * selectall_arrayref / _hashref
  * selectcol_arrayref
  * type_info stub

DBD::_::st base class:
  * fetchall_arrayref (plain / slice / hash)
  * fetchall_hashref
  * _get_fbav
  * FETCH override computing NAME_lc / NAME_uc / NAME_hash /
    NAME_lc_hash / NAME_uc_hash from NAME when called via
    $sth->FETCH(...). Direct $sth->{NAME_lc} access still requires
    tied-hash semantics, which we do not provide.

DBD::_::common base class:
  * FETCH_many, debug, dbixs_revision, install_method, dump_handle.

Effect on `jcpan -t DBI` (stacked on #544):
  before: 200 files, 1600 subtests, 1240 passing, 360 failing
  after:  200 files, 5610 subtests, 3978 passing, 1632 failing
  => +2738 subtests now pass (+4010 more executed). 4 fewer test
     files fail overall. The remaining 166 files are dominated by
     (a) DBD::File / DBD::DBM-specific methods not yet wired and
     (b) tied-hash-dependent attribute access.

Cumulative across the four stacked PRs (#540, #542, #544, this one):
  master:  562 subtests, 308 passing
  now:     5610 subtests, 3978 passing  (~13× more passes)

See dev/modules/dbi_test_parity.md.

Generated with [Devin](https://cli.devin.ai/docs)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@fglock
Copy link
Copy Markdown
Owner Author

fglock commented Apr 22, 2026

Superseded by unified PR (see new PR). All four commits rebased into a single branch targeting master.

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