[cgiapp] Re: Combining DBIx::Simple and CGI::Session
Dan Horne
dan.horne at redbone.co.nz
Fri Oct 3 02:48:02 EDT 2008
On 2/10/2008, at 03:45 PM, Ron Savage wrote:
> Hi Mark
>
> On Wed, 2008-10-01 at 22:05 -0400, Mark Stosberg wrote:
>>>> The docs for DBIx::Simple cleary warn about using the dbh()
>>>> method to
>>>> get the db handle for use outside DBIx::Simple.
>>>>
>>>> And yet, with CGI::Session, if I pass in a handle (returned from
>>>> DBIx::Simple or otherwise), I know CGI::Session will be doing
>>>> queries
>>>> whenever it feels like it.
>>>>
>>>> So, what to people do?
>>>>
>>>> Use 2 handles, 1 via DBIx::Simple for all normal queries, and 1
>>>> via DBI
>>>> just for use with CGI::Session?
>>>
>>> Actually, another possibility is to use 2 DBIx::Simple-based
>>> handles,
>>> one for all normal queries, and one to pass to CGI::Session but
>>> not ever
>>> use via DBIx::Simple.
>>
>> I asked the author about this. I think it's not that the dual-life
>> handle causes problems inherinently, it's more of a "know what you
>> are
>> doing" situation. If I recall the specific issue, DBIx::Simple does
>> it's
>> own garbage collection, and you are encouraged to not mess that up,
>> which shouldn't be too hard.
>>
>>> Recommendations?
>>
>> My recommendation is to share the handle between DBIx::Simple and
>> CGI::Simple and test that your application doesn't blow up.
>
> OK. Thanx for checking.
>
Is there a risk that a transaction will span the app and the session
with a single connection? You may wish to rollback one and commit the
other...
More information about the cgiapp
mailing list