[perl5-dbi/dbi] da5298: Add a new API function dbd_db_do6()

Content-Type: text/plain;
Content-Transfer-Encoding: 7bit

  Branch: refs/heads/master
  Home:   https://github.com/perl5-dbi/dbi
  Commit: da5298c168aa1e6421e853f590cbe7b11da9c029
  Author: Pali <pali@cpan.org>
  Date:   2018-10-21 (Sun, 21 Oct 2018)

  Changed paths:
    M Driver.xst
    M Perl.xs
    M dbd_xsh.h

  Log Message:
  Add a new API function dbd_db_do6()

Current API via dbd_db_do4() function does not allow DBI drivers to
implement $dbh->do() method with additional binding parameters. Binding
parameters for $dbh->do() methods are already documented and supported by
DBI API itself, but can be implemented only for Pure Perl DBI drivers.

Also current API for dbd_db_do4() function is affected by Perl's The
Unicode bug as it uses char* as an XS argument. DBI driver implementer is
not able to process Unicode statement correctly and also is not able to
process statement with nul bytes (e.g. binary blobs). The only fix for DBI
and drivers is to define a new API without those design bugs. All other DBI
APIs pass SV* as a statement, not char* -- therefore they are not affected.

With this new dbd_db_do6() API, DBI driver implementer can use SvPVutf8()
call (or SvPVbyte()) instead of SvPV_nolen() to ensure that returned char*
will be always encoded in UTF-8 (or Latin1). And can also retrieve correct
length of statement in case it contains nul bytes. SvPV_nolen() returns
char* in pseudo-randomly chosen encoding (UTF-8 or Latin1) and so is
absolutely unsuitable for anything else than ASCII strings.

When dbd_db_do6 is defined, then this function takes two additional
arguments: number of supplied bind parameters (items) and stack base offset
(ax) to the first supplied bind parameter, which can be used by ST() macro
to retrieve i-th supplied bind parameter.

This would allow DBI drivers to implement Unicode aware $dbh->do() method
with passing also binding parameters.

  Commit: 271a8c303e3bcdb3b174a39b3c42f2799ef0794a
  Author: Tim Bunce <Tim.Bunce@pobox.com>
  Date:   2018-10-21 (Sun, 21 Oct 2018)

  Changed paths:
    M Driver.xst
    M Perl.xs
    M dbd_xsh.h

  Log Message:
  Merge pull request #61 from pali/master

Add a new API function dbd_db_do6()

Compare: https://github.com/perl5-dbi/dbi/compare/3a317ffbc39c...271a8c303e3b
      **NOTE:** This service has been marked for deprecation: https://developer.github.com/changes/2018-04-25-github-services-deprecation/

      Functionality will be removed from GitHub.com on January 31st, 2019.

10/21/2018 3:12:30 PM
perl.dbi.dev 1960 articles. 0 followers. Follow

0 Replies

Similar Articles

[PageSpeed] 30