… | |
… | |
100 | |
100 | |
101 | sub readable { &Coro::Handle::FH::readable } |
101 | sub readable { &Coro::Handle::FH::readable } |
102 | sub writable { &Coro::Handle::FH::writable } |
102 | sub writable { &Coro::Handle::FH::writable } |
103 | |
103 | |
104 | BEGIN { |
104 | BEGIN { |
105 | our $VERSION = '1.02'; |
105 | our $VERSION = '1.1'; |
106 | |
106 | |
107 | require XSLoader; |
107 | require XSLoader; |
108 | XSLoader::load Coro::Mysql::, $VERSION; |
108 | XSLoader::load Coro::Mysql::, $VERSION; |
109 | } |
109 | } |
110 | |
110 | |
… | |
… | |
119 | It is safe to call this function on any database handle (or just about any |
119 | It is safe to call this function on any database handle (or just about any |
120 | value), but it will only do anything to L<DBD::mysql> handles, others are |
120 | value), but it will only do anything to L<DBD::mysql> handles, others are |
121 | returned unchanged. That means it is harmless when applied to database |
121 | returned unchanged. That means it is harmless when applied to database |
122 | handles of other databases. |
122 | handles of other databases. |
123 | |
123 | |
|
|
124 | It 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 | |
126 | sub unblock { |
131 | sub 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 | |