ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Coro-Mysql/Mysql.pm
(Generate patch)

Comparing Coro-Mysql/Mysql.pm (file contents):
Revision 1.9 by root, Thu Feb 17 02:05:14 2011 UTC vs.
Revision 1.10 by root, Thu Feb 17 02:06:55 2011 UTC

119It is safe to call this function on any database handle (or just about any 119It is safe to call this function on any database handle (or just about any
120value), but it will only do anything to L<DBD::mysql> handles, others are 120value), but it will only do anything to L<DBD::mysql> handles, others are
121returned unchanged. That means it is harmless when applied to database 121returned unchanged. That means it is harmless when applied to database
122handles of other databases. 122handles of other databases.
123 123
124It is also safe to pass C<undef>, so code like this is works as expected:
125
126 my $dbh = DBI->connect ($database, $user, $pass)->Coro::Mysql::unblock
127 or die $DBI::errstr;
128
124=cut 129=cut
125 130
126sub unblock { 131sub unblock {
127 my ($DBH) = @_; 132 my ($DBH) = @_;
128 133
129 if ($DBH->{Driver}{Name} eq "mysql") { 134 if ($DBH && $DBH->{Driver}{Name} eq "mysql") {
130 my $sock = $DBH->{sock}; 135 my $sock = $DBH->{sock};
131 136
132 open my $fh, "+>&" . $DBH->{sockfd} 137 open my $fh, "+>&" . $DBH->{sockfd}
133 or croak "Coro::Mysql unable to clone mysql fd"; 138 or croak "Coro::Mysql unable to clone mysql fd";
134 139

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines