in reply to Thread and Fork Safe DBI and DBD::mysql replacement

I have a few quick comments:

It's not clear how this is to be used. Is it a DBD class, which can be accessed from within the normal DBI interface, a wrapper around an existing DBI handle, or is it a parallel mechanism that should be used separately?

Also, the name is much too general. Consider naming it DBD::MySQL::Threadsafe if it is a legitimate DBD subclass, or DBIx::ThreadSafe::MySQL if it's a wrapper.

  • Comment on Re: Thread and Fork Safe DBI and DBD::mysql replacement

Replies are listed 'Best First'.
Re: Re: Thread and Fork Safe DBI and DBD::mysql replacement
by Vautrin (Hermit) on Feb 07, 2004 at 00:30 UTC

    It's a wrapper. I'm updating and putting in a POD now. I'm also going to add an example of when this fails -- it seems mySQL clients < 4.00 are thread safe.

    Update: Thanks gmax for pointing out why DBD::mysql clients can't fork for mysql version 4+, this node. For what it's worth, code to replicate this problem can be used here:

    #! /usr/bin/perl use strict; use warnings; use DBI; my $conn = DBI->connect("DBI:mysql:database=db;host=localhost;", "user +", "password"); my $pid = fork; die ("No more resources") unless (defined $pid); my $query = "SELECT * FROM table"; my $result = $conn->prepare($query) or die ("Cannot prepare query. $!"); $result->execute or die ("Cannot execute query. $!");

    Want to support the EFF and FSF buy buying cool stuff? Click here.