DBI

 view release on metacpan or  search on metacpan

ChangeLog  view on Meta::CPAN

    with RaiseError=0 (Jens Rehsack)
  Fixed RT#61513 by catching attribute assignment to tied table access
    interface (Jens Rehsack)
  Fixing some misbehavior of DBD::File when running within the Gofer
    server.
  Fixed compiler warnings RT#62640

  Optimized connect() to remove redundant FETCH of \%attrib values.
  Improved initialization phases in DBI::DBD::SqlEngine (Jens Rehsack)

  Added DBD::Gofer::Transport::corostream. An experimental proof-of-concept
    transport that enables asynchronous database calls with few code changes.
    It enables asynchronous use of DBI frameworks like DBIx::Class.

  Added additional notes on DBDs which avoid creating a statement in
    the do() method and the effects on error handlers (Martin J. Evans)
  Adding new attribute "sql_dialect" to DBI::DBD::SqlEngine to allow
    users control used SQL dialect (ANSI, CSV or AnyData), defaults to
    CSV (Jens Rehsack)
  Add documentation for DBI::DBD::SqlEngine attributes (Jens Rehsack)
  Documented dbd_st_execute return (Martin J. Evans)

MANIFEST  view on Meta::CPAN

dbi_sql.h			Definitions based on SQL CLI / ODBC (#inc'd by DBIXS.h)
dbipport.h			Perl portability macros (from Devel::PPort)
dbilogstrip.PL                  Utility to normalise DBI logs so they can be compared with diff
dbiprof.PL
dbiproxy.PL			Frontend for DBI::ProxyServer
dbivport.h			DBI version portability macros (for drivers to copy)
dbixs_rev.h			Defines DBIXS_REVISION macro holding DBIXS.h subversion revision number
dbixs_rev.pl			Utility to write dbixs_rev.h
ex/perl_dbi_nulls_test.pl	A test script for forms of IS NULL qualification in SQL
ex/profile.pl                   A test script for DBI::Profile
ex/corogofer.pl                 A test script for DBD::Gofer::Transport::corostream
ex/unicode_test.pl
lib/Bundle/DBI.pm		A bundle for automatic installation via CPAN.
lib/DBD/DBM.pm			A driver for DBM files (uses DBD::File)
lib/DBD/ExampleP.pm		A very simple example Driver module
lib/DBD/File.pm			A driver base class for simple drivers
lib/DBD/File/Developers.pod	Developer documentation for DBD::File
lib/DBD/File/Roadmap.pod	Roadmap for DBD::File and other Pure Perl DBD's
lib/DBD/File/HowTo.pod		Guide to write a DBD::File based DBI driver
lib/DBD/Gofer.pm                DBD::Gofer 'stateless proxy' driver
lib/DBD/Gofer/Policy/Base.pm
lib/DBD/Gofer/Policy/pedantic.pm    Safest and most transparent, but also slowest
lib/DBD/Gofer/Policy/classic.pm     Reasonable policy for typical usage
lib/DBD/Gofer/Policy/rush.pm        Raw speed, fewest round trips, least transparent
lib/DBD/Gofer/Transport/Base.pm Base class for DBD::Gofer driver transport classes
lib/DBD/Gofer/Transport/corostream.pm Async Gofer transport using Coro and AnyEvent
lib/DBD/Gofer/Transport/null.pm DBD::Gofer transport that executes in same process (for testing)
lib/DBD/Gofer/Transport/pipeone.pm DBD::Gofer transport to new subprocess for each request
lib/DBD/Gofer/Transport/stream.pm DBD::Gofer transport for ssh etc
lib/DBD/Mem.pm                  A pure-perl in-memory driver using DBI::DBD::SqlEngine
lib/DBD/NullP.pm		An empty example Driver module
lib/DBD/Proxy.pm		Proxy driver
lib/DBD/Sponge.pm		A driver for fake cursors (precached data)
lib/DBI/Changes.pm
lib/DBI/Const/GetInfo/ANSI.pm	GetInfo data based on ANSI standard
lib/DBI/Const/GetInfo/ODBC.pm	GetInfo data based on ODBC standard

ex/corogofer.pl  view on Meta::CPAN

use Time::HiRes qw(time);

BEGIN { $ENV{PERL_ANYEVENT_STRICT} = 1; $ENV{PERL_ANYEVENT_VERBOSE} = 1; }

use AnyEvent;

BEGIN { $ENV{DBI_TRACE} = 0; $ENV{DBI_PUREPERL} = 0; $ENV{DBI_GOFER_TRACE} = 0; $ENV{DBD_GOFER_TRACE} = 0; };

use DBI;

$ENV{DBI_AUTOPROXY} = 'dbi:Gofer:transport=corostream';

my $ticker = AnyEvent->timer( after => 0, interval => 0.1, cb => sub {
    warn sprintf "-tick- %.2f\n", time
} );

warn "connecting...\n";
my $dbh = DBI->connect("dbi:NullP:");
warn "...connected\n";

for (1..5) {

lib/DBD/Gofer/Transport/corostream.pm  view on Meta::CPAN

package DBD::Gofer::Transport::corostream;

use strict;
use warnings;

use Carp;

use Coro::Select; #  a slow but coro-aware replacement for CORE::select (global effect!)

use Coro;
use Coro::Handle;

use base qw(DBD::Gofer::Transport::stream);

# XXX ensure DBI_PUREPERL for parent doesn't pass to child
sub start_pipe_command {
    local $ENV{DBI_PUREPERL} = $ENV{DBI_PUREPERL_COROCHILD}; # typically undef
    my $connection = shift->SUPER::start_pipe_command(@_);

lib/DBD/Gofer/Transport/corostream.pm  view on Meta::CPAN

}



1;

__END__

=head1 NAME

DBD::Gofer::Transport::corostream - Async DBD::Gofer stream transport using Coro and AnyEvent

=head1 SYNOPSIS

   DBI_AUTOPROXY="dbi:Gofer:transport=corostream" perl some-perl-script-using-dbi.pl

or

   $dsn = ...; # the DSN for the driver and database you want to use
   $dbh = DBI->connect("dbi:Gofer:transport=corostream;dsn=$dsn", ...);

=head1 DESCRIPTION

The I<BIG WIN> from using L<Coro> is that it enables the use of existing
DBI frameworks like L<DBIx::Class>.

=head1 KNOWN ISSUES AND LIMITATIONS

  - Uses Coro::Select so alters CORE::select globally
    Parent class probably needs refactoring to enable a more encapsulated approach.

lib/DBD/Gofer/Transport/corostream.pm  view on Meta::CPAN

    use Time::HiRes qw(time);

    BEGIN { $ENV{PERL_ANYEVENT_STRICT} = 1; $ENV{PERL_ANYEVENT_VERBOSE} = 1; }

    use AnyEvent;

    BEGIN { $ENV{DBI_TRACE} = 0; $ENV{DBI_GOFER_TRACE} = 0; $ENV{DBD_GOFER_TRACE} = 0; };

    use DBI;

    $ENV{DBI_AUTOPROXY} = 'dbi:Gofer:transport=corostream';

    my $ticker = AnyEvent->timer( after => 0, interval => 0.1, cb => sub {
        warn sprintf "-tick- %.2f\n", time
    } );

    warn "connecting...\n";
    my $dbh = DBI->connect("dbi:NullP:");
    warn "...connected\n";

    for (1..3) {
        warn "entering DBI...\n";
        $dbh->do("sleep 0.3"); # pseudo-sql understood by the DBD::NullP driver
        warn "...returned\n";
    }

    warn "done.";

Example output:

    $ perl corogofer.pl
    connecting...
    -tick- 1293631437.14
    -tick- 1293631437.14
    ...connected
    entering DBI...
    -tick- 1293631437.25
    -tick- 1293631437.35
    -tick- 1293631437.45
    -tick- 1293631437.55
    ...returned
    entering DBI...
    -tick- 1293631437.66
    -tick- 1293631437.76
    -tick- 1293631437.86
    ...returned
    entering DBI...
    -tick- 1293631437.96
    -tick- 1293631438.06
    -tick- 1293631438.16
    ...returned
    done. at corogofer.pl line 39.

You can see that the timer callback is firing while the code 'waits' inside the
do() method for the response from the database. Normally that would block.

=cut

lib/DBI/Changes.pm  view on Meta::CPAN

    with RaiseError=0 (Jens Rehsack)
  Fixed RT#61513 by catching attribute assignment to tied table access
    interface (Jens Rehsack)
  Fixing some misbehavior of DBD::File when running within the Gofer
    server.
  Fixed compiler warnings RT#62640

  Optimized connect() to remove redundant FETCH of \%attrib values.
  Improved initialization phases in DBI::DBD::SqlEngine (Jens Rehsack)

  Added DBD::Gofer::Transport::corostream. An experimental proof-of-concept
    transport that enables asynchronous database calls with few code changes.
    It enables asynchronous use of DBI frameworks like DBIx::Class.

  Added additional notes on DBDs which avoid creating a statement in
    the do() method and the effects on error handlers (Martin J. Evans)
  Adding new attribute "sql_dialect" to DBI::DBD::SqlEngine to allow
    users control used SQL dialect (ANSI, CSV or AnyData), defaults to
    CSV (Jens Rehsack)
  Add documentation for DBI::DBD::SqlEngine attributes (Jens Rehsack)
  Documented dbd_st_execute return (Martin J. Evans)



( run in 0.417 second using v1.01-cache-2.11-cpan-3cd7ad12f66 )