DBI do() handling incorrectly prepares MySQL SET statements under PerlOnJava

Open
#1,371 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
52/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
java, mysql, perl, sqlite

Research direction

Start with DBI.pm around line 113 and inspect how DBI::db::do dispatches when t/standard.t redefines it. Run t/standard.t and t/syntax.t under PerlOnJava, then compare the SQLite-backed path with system Perl. Done means the override is honored and focused regression coverage passes without sending MySQL SET syntax to SQLite.

Written by the indexing model from the issue text.

Description

area:backend area:cpan-port area:runtime bug

Summary

DBIx::Connector::Retry::MySQL v1.0.1 fails under PerlOnJava because a DBI do() call for a MySQL SET SESSION statement is executed against the default in-memory SQLite connection and reaches SQLite prepare handling. SQLite rejects the MySQL SET syntax, causing the retry tests to fail.

Reproduction

Distribution: DBIx-Connector-Retry-MySQL v1.0.1
CPAN run: 20260913-205737-64746
Failing tests: t/standard.t and t/syntax.t

The distribution tests intentionally use an in-memory SQLite database when DBITEST_DSN is unset. In t/standard.t, the test suite redefines DBI::db::do so that SET statements return a successful 0E0 value; the database operation is not intended to require a live MySQL server.

PerlOnJava result:

t/standard.t ........... 10/14 subtests failed
t/syntax.t ............. 1/3 subtests failed
Failed 2/4 test programs. 11/19 subtests failed.

The repeated exception is:

DBI prepare failed: near "SET": syntax error at jar:PERL5LIB/DBI.pm line 113.

The exception propagates through DBIx::Connector::Retry::MySQL::_set_retry_session_timeouts while it executes SET SESSION timeout commands. The failures then cascade into incorrect retry durations, attempt counters, and exception matching.

Oracle

The same distribution and dependency versions pass completely under system Perl in the same run:

t/standard.t ........... ok
t/syntax.t ............. ok
All tests successful.
Files=4, Tests=19

The system-Perl test run also confirms that no MySQL service is required for the default test path. It uses SQLite and the test override for DBI::db::do.

Expected behavior

PerlOnJava should honor the DBI::db::do dispatch used by the test suite, allowing the SET SESSION statements to be handled by the test override, or otherwise provide compatible behavior for this DBI operation without sending MySQL SET syntax to SQLite prepare.

Investigation requested

Investigate DBI method dispatch and do()/prepare() behavior in the PerlOnJava DBI implementation, especially when a Perl test redefines DBI::db::do. Add focused regression coverage for a DBI::db::do override and for the SQLite-backed DBIx::Connector::Retry::MySQL test path.

Dominant language
Perl
Stars
64
Forks
6
Avg merge
5h 25m
Merged PRs (30d)
157

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from fglock/PerlOnJava

All issues in fglock/PerlOnJava

Similar issues

More Perl issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.