jfrm has asked for the wisdom of the Perl Monks concerning the following question:
And here there and everywhere, there are statements like:require DBI; require DBD::mysql;
I've converted these to have 'my' in front of each instance - I figured this was better practice than a single my ($statement,$sth,$rv,$rc) at the top of each perl file to cover all the subfunctions (I'm sure you'll tell me if I'm wrong). Anyway, previously, I connected to the database at the top:$statement = .... $sth = $dbh->prepare($statement) $rv = $sth->execute @info = $sth->fetchrow_array; $rc = $sth->finish;
and then disconnected at the very end.our $database; $dbh = DBI->connect("DBI:mysql:$database");
And multiple database calls happened using this single connection.$dbh->disconnect;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: DBI::mySQL - philosophical question?
by shotgunefx (Parson) on Jan 29, 2004 at 01:02 UTC | |
|
Re: DBI::mySQL - philosophical question?
by dws (Chancellor) on Jan 29, 2004 at 01:34 UTC | |
|
Re: DBI::mySQL - philosophical question?
by chromatic (Archbishop) on Jan 29, 2004 at 01:00 UTC | |
|
Re: DBI::mySQL - philosophical question?
by Joost (Canon) on Jan 29, 2004 at 01:08 UTC |