AnyEvent-DBI-MySQL

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

	- Switch to Dist::Milla.
	- Use Test::Database.

1.0.6   2014-12-24 11:47:39 EET
	- Fix dependencies, closes RT #93458.

1.0.5   2013-12-15 05:58:43 EET
	- Fix tests for perl 5.16.3.

1.0.4   2013-10-31 19:02:30 EET
	- fix: don't throw on failed connect with {RaiseError=>0}
	- fix: #88907 superfluous warning

1.0.3   2013-05-20 19:22:41 EEST
	- Improve compatibility with CPAN Testers.

1.0.2	2013-04-29 07:02:06 EEST
	- Add support for AnyEvent::CondVar as cb.
	- minor: use $h->err instead of $h->errstr
	- minor: don't send undef in 3rd param to cb

README  view on Meta::CPAN


    This module is an AnyEvent user, you need to make sure that you use and
    run a supported event loop.

    This module implements asynchronous MySQL queries using "ASYNCHRONOUS
    QUERIES" in DBD::mysql feature. Unlike AnyEvent::DBI it doesn't spawn
    any processes.

    You shouldn't use {RaiseError=>1} with this module and should check
    returned values in your callback to detect errors. This is because with
    {RaiseError=>1} exception will be thrown instead of calling your
    callback function, which isn't what you want in most cases.

INTERFACE

    The API is trivial: use it just like usual DBI, but instead of
    expecting return value from functions which may block add one extra
    parameter: callback. That callback will be executed with usual returned
    value of used method in params (only exception is extra $dbh/$sth param
    in do() and execute() for convenience).

lib/AnyEvent/DBI/MySQL.pm  view on Meta::CPAN


This module is an L<AnyEvent> user, you need to make sure that you use and
run a supported event loop.

This module implements asynchronous MySQL queries using
L<DBD::mysql/"ASYNCHRONOUS QUERIES"> feature. Unlike L<AnyEvent::DBI> it
doesn't spawn any processes.

You shouldn't use C<< {RaiseError=>1} >> with this module and should check
returned values in your callback to detect errors. This is because with
C<< {RaiseError=>1} >> exception will be thrown B<instead> of calling your
callback function, which isn't what you want in most cases.


=head1 INTERFACE 

The API is trivial: use it just like usual DBI, but instead of expecting
return value from functions which may block add one extra parameter: callback.
That callback will be executed with usual returned value of used method in
params (only exception is extra $dbh/$sth param in do() and execute() for
convenience).

t/failed_connect.t  view on Meta::CPAN

use AnyEvent::DBI::MySQL;


my $dbh;
lives_ok { $dbh = AnyEvent::DBI::MySQL->connect(
    "dbi:mysql:host=127.0.0.1;port=3307;database=nosuch",
    'baduser', 'cantbethepass', {RaiseError=>0,PrintError=>0}
    ) } 'no exception';
is $dbh, undef, 'undefined $dbh';

throws_ok { AnyEvent::DBI::MySQL->connect(
    "dbi:mysql:host=127.0.0.1;port=3307;database=nosuch",
    'baduser', 'cantbethepass', {RaiseError=>1,PrintError=>0}
    ) } qr/connect/, 'got exception';


done_testing();



( run in 0.376 second using v1.01-cache-2.11-cpan-496ff517765 )