>>>>> "list" == list <list@stripped> writes:
list> I have quite some experience with Mysql,perl and DBI, but would
list> like to know a bit more. Could somebody explain these tow
list> questions? Please? :)
list> 1)
list> As I undestand it, the database handle as obtained by
list> DBI->connect might go stale and disappear when it actually still
list> is in use. Is there any way to keep it up, or do I have to do a
list> ping to the $dbh for every $sth I use?
This should only happen if the connect has been idle for more than 8
hours or if the MySQL server has been restarted. In most cases, the
connect code will automaticly reconnect in this case.
There is also a 'ping' DBI method you can use; If you have some point
in your code where the client may sleep for hours, it's probably a
good idea to issue a 'ping' after it has waken up.
list> 2)
list> I assume the database handle is not unique but shared amongst
list> all the programs using the same database, and the statement
list> handles are unique and recreated even if the query and database
list> are exactly the same. Is this true?
Yes (as long as you don't use threads)
list> And, if I'm correct, does this mean it is wise to create new
list> statements for queries done in parallel but I can keep ony
list> database handle. Is this valid for forked process also, or do I
list> get a copy of the statement handle and thus am not required to
list> create a new statement, it would even be unwise because it uses
list> more memory?
If you fork, you have to use a different connection for each child.
You should first fork and after this open an own connection in each
child.
Regards,
Monty