Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: DBI, fork, and clone.

by mr_mischief (Monsignor)
on Jan 16, 2007 at 01:11 UTC ( [id://594834]=note: print w/replies, xml ) Need Help??


in reply to DBI, fork, and clone.

Great work. I don't even get the warning you mention on my test box.

Note that DBI's clone() method is labelled as new and subject to change. Also worth noting is that the username argument to DBI's connect is just that -- 'Username', to be exact.

I mentioned that I don't get the warning you noted in your node. I was thinking that things sounded odd considering the 'User'/'Username' business, so I tried changing the $dbh->clone() call like this:
$db->clone( {'User' => 'foo'} );
... and I got exactly the warning you mentioned!

My guess is that your particular DBI (or DBI/DBD combination) is connect()'ing with a 'Username' attribute and then re-issuing it with something additional called 'User'. I'm using MySQL, and it looks like you're using Postgres from the driver info you had in the test. I'll give you my info for comparison:

DBI1.52
DBD::mysql3.0002
MySQL4.1.12
perl5.8.7

The perl binary I tested against does have Mandriva-applied patches, but I doubt that has anything to do with the matter.

ActiveState perl 5.8.7 on Windows with DBI 1.4.2 and DBD::mysql 3.0002 fails to create a clone, BTW. It gives the following complaint: "DBD::mysql::db clone failed: handle 2 is owned by thread 2244a4 not current thread 1cccad4 (handles can't be shared between threads and your driver may need a CLONE method added) a t db_clone line 59". Probably has to do with Windows not supporting fork() and the perl installation having to make do with threads, smoke, and mirrors.


Christopher E. Stith

Replies are listed 'Best First'.
Re^2: DBI, fork, and clone.
by kyle (Abbot) on Jan 16, 2007 at 20:36 UTC

    I have DBD::Pg version 1.49, and in its connect method, I see:

    152 my ($dbh) = DBI::_new_dbh($drh, { 153 'Name' => $Name, 154 'User' => $user, 'CURRENT_USER' => $user, 155 });

    Maybe that has something to do with it. I don't see User used anywhere else (not that I've done an exhaustive search of DBI-related code), so maybe that's why the warning seems to be toothless.

    Thanks for letting us know how it works on your setup!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://594834]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (7)
As of 2024-04-23 16:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found