|
|
sybperl-l Archive
Up Prev Next
From: scable at elmer dot tci dot com (Steve Cable)
Subject: Re: Passing a $dbh to a subroutine
Date: Sep 18 1997 4:07PM
Sal,
Yes, you can pass $dbh to a subroutine.
I do it all the time.
It works great.
STeve
> From owner-sybperl-l@trln.lib.unc.edu Thu Sep 18 09:50 MDT 1997
> X-ListName: SybPerl Discussion List
> Warnings-To: <>
> From:
> Date: Thu, 18 Sep 97 10:52:12 -0400
> Subject: Passing a $dbh to a subroutine
> MIME-Version: 1.0
> To: SYBPERL-L@trln.lib.unc.edu
> Content-Transfer-Encoding: 7bit
>
> Can this be done? Right now in a majority of my applications I write
> subs to carry out inserts, updates, selects, etc.. Each one of these
> subs opens/keeps its own $dbh that is closed automatically when the
> sub exits. In order to avoid the overhead of opening/closing the
> connection and re-specifying the connection params each time, can I
> just pass the $dbh to the sub and access it that way?
>
> TIA,
>
> Sal
>
>
>
|