Skip to content

Commit

Permalink
Workaround for DBI incompatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
wakaba committed Jan 24, 2024
1 parent 344c2d5 commit 8b50815
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
10 changes: 9 additions & 1 deletion lib/Dongry/Database.pod
Original file line number Diff line number Diff line change
Expand Up @@ -247,11 +247,19 @@ for more information.
The user name used to connect the database. This is optional if the
database or the database driver module does not require user name.

If both of C<username> and C<dsn>'s C<user> are specified, how they
are used is database driver dependent. For the
L<AnyEvent::MySQL::Client> mode, C<username> is used if defined.

=item password => string

The password used to connect the database. This is optional if the
database or the database driver module does not require password.

If both of C<password> and C<dsn>'s C<password> are specified, how
they are used is database driver dependent. For the
L<AnyEvent::MySQL::Client> mode, C<password> is used if defined.

=item writable => boolean

Whether the database is writable or not. If not writable, the
Expand Down Expand Up @@ -1704,7 +1712,7 @@ until 7 March, 2022.

=head1 LICENSE

Copyright 2011-2022 Wakaba <[email protected]>.
Copyright 2011-2024 Wakaba <[email protected]>.

This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
Expand Down
18 changes: 13 additions & 5 deletions t/database/connect.t
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,10 @@ sub _onerror_new : Test(2) {
my $db = Dongry::Database->new (onerror => sub {
($onerror_self, %onerror_args) = @_;
});
my $dsn = $test_dsn_1;
$dsn =~ s/password/X/;
$db->source (hoge => {
dsn => $test_dsn_1,
dsn => $dsn,
password => 'foo',
});
dies_here_ok { $db->connect ('hoge') };
Expand Down Expand Up @@ -191,13 +193,17 @@ sub _connect_wrong_username_onerror : Test(5) {
undef $onerror_self;
} # _connect_wrong_username

sub _connect_wrong_password : Test(1) {
sub _connect_wrong_password : Test(2) {
my $db = Dongry::Database->new;
my $dsn = $test_dsn_1;
$dsn =~ s/password/X/;
$db->source (hoge => {
dsn => $test_dsn_1,
dsn => $dsn,
password => 'hoge',
});
dies_here_ok { $db->connect ('hoge') };
my $r;
dies_here_ok { $r = $db->connect ('hoge') };
is $r, undef, $r;
} # _connect_wrong_password

sub _connect_wrong_password_onerror : Test(5) {
Expand All @@ -206,8 +212,10 @@ sub _connect_wrong_password_onerror : Test(5) {
$db->onerror (sub {
($onerror_self, %onerror_args) = @_;
});
my $dsn = $test_dsn_1;
$dsn =~ s/password/X/;
$db->source (hoge => {
dsn => $test_dsn_1,
dsn => $dsn,
password => 'hoge',
});
dies_here_ok { $db->connect ('hoge') };
Expand Down

0 comments on commit 8b50815

Please sign in to comment.