Request for Review: Async / Non-blocking Core DBI Implementation (PR #185)

[email protected] ("C.J. Collier") Sat, 18 Jul 2026 13:02:15 -0700
Newsgroups perl.dbi.dev
Message-ID <CAJj0Outgyp5OdG7DK=3Br0ot+Q6pwY3pwVTgqtCGZB4hn+bsgg@mail.gmail.com>
--000000000000f272db0656e826ba
Content-Type: text/plain; charset="UTF-8"

Hi DBI Devs,

Please review Pull Request #185 <https://github.com/perl5-dbi/dbi/pull/185>,
which adds non-blocking asynchronous operations to the DBI core.

This pull request addresses two open issues:

   - *Issue #52 <https://github.com/perl5-dbi/dbi/issues/52>*: Non-blocking
   statement execution and event loop readiness hooks.
   - *Issue #183 <https://github.com/perl5-dbi/dbi/issues/183>*:
   Asynchronous execution and event-driven driver dispatch.

Summary of Commits

The PR is organized into 4 directed commits:

   1.

   *Core C/XS Flags & Macros* (DBIXS.h, DBI.xs):
   - Allocates upper-byte bit flags (DBIcf_Async, DBIcf_AsyncWantRead,
      DBIcf_AsyncWantWrite, etc.) and DBI_E_WOULDBLOCK (-1).
      - Implements get/set attribute handlers for Async, AsyncWatcher,
      AsyncErrorDetails, and concurrency locks.
   2.

   *Perl Dispatcher & PurePerl Emulation* (DBI.pm, Perl.xs,
   lib/DBI/PurePerl.pm):
   - Registers async_read_ready and async_write_ready in %DBI::DBI_methods.
      - Adds :async export tag, SQLSTATE IM001 fallback stubs, clone()
      handle rules, and PurePerl emulation mapping.
   3.

   *Reference Mock Driver* (lib/DBD/MockAsync.pm):
   - Implements DBD::MockAsync to simulate non-blocking statement
      execution, network latency, handle polling, and error conditions.
   4.

   *Unit Tests & Build Manifests* (t/18async.t, t/19mock_async.t,
   Makefile.PL, MANIFEST):
   - Adds unit test coverage for statement handle lifecycles, readiness
      checks, error handling, and event loop integration.

Pull Request: https://github.com/perl5-dbi/dbi/pull/185

Thanks,

CJCOLLIER

--000000000000f272db0656e826ba
Content-Type: text/html; charset="UTF-8"

<div dir="ltr"><h1 id="email-draft-for-dbi-devperl.org"><span style="font-size:small;font-weight:normal;background-color:transparent">Hi DBI Devs,</span></h1>
<p>Please review <a href="https://github.com/perl5-dbi/dbi/pull/185">Pull Request #185</a>,
which adds non-blocking asynchronous operations to the DBI core.</p>
<p>This pull request addresses two open issues:</p>
<ul>
<li><strong><a href="https://github.com/perl5-dbi/dbi/issues/52">Issue
#52</a></strong>: Non-blocking statement execution and event loop
readiness hooks.</li>
<li><strong><a href="https://github.com/perl5-dbi/dbi/issues/183">Issue
#183</a></strong>: Asynchronous execution and event-driven driver
dispatch.</li>
</ul>
<h3 id="gmail-summary-of-commits">Summary of Commits</h3>
<p>The PR is organized into 4 directed commits:</p>
<ol type="1">
<li><p><strong>Core C/XS Flags &amp; Macros</strong>
(<code>DBIXS.h</code>, <code>DBI.xs</code>):</p>
<ul>
<li>Allocates upper-byte bit flags (<code>DBIcf_Async</code>,
<code>DBIcf_AsyncWantRead</code>, <code>DBIcf_AsyncWantWrite</code>,
etc.) and <code>DBI_E_WOULDBLOCK</code> (-1).</li>
<li>Implements get/set attribute handlers for <code>Async</code>,
<code>AsyncWatcher</code>, <code>AsyncErrorDetails</code>, and
concurrency locks.</li>
</ul></li>
<li><p><strong>Perl Dispatcher &amp; PurePerl Emulation</strong>
(<code>DBI.pm</code>, <code>Perl.xs</code>,
<code>lib/DBI/PurePerl.pm</code>):</p>
<ul>
<li>Registers <code>async_read_ready</code> and
<code>async_write_ready</code> in <code>%DBI::DBI_methods</code>.</li>
<li>Adds <code>:async</code> export tag, <code>SQLSTATE IM001</code>
fallback stubs, <code>clone()</code> handle rules, and PurePerl
emulation mapping.</li>
</ul></li>
<li><p><strong>Reference Mock Driver</strong>
(<code>lib/DBD/MockAsync.pm</code>):</p>
<ul>
<li>Implements <code>DBD::MockAsync</code> to simulate non-blocking
statement execution, network latency, handle polling, and error
conditions.</li>
</ul></li>
<li><p><strong>Unit Tests &amp; Build Manifests</strong>
(<code>t/18async.t</code>, <code>t/19mock_async.t</code>,
<code>Makefile.PL</code>, <code>MANIFEST</code>):</p>
<ul>
<li>Adds unit test coverage for statement handle lifecycles, readiness
checks, error handling, and event loop integration.</li>
</ul></li>
</ol>
<p>Pull Request: <a href="https://github.com/perl5-dbi/dbi/pull/185">https://github.com/perl5-dbi/dbi/pull/185</a></p>
<p>Thanks,</p>
<p>CJCOLLIER</p></div>

--000000000000f272db0656e826ba--