Matt Sergeant writes:
 > On Tue, 15 Aug 2000, Michael Peppler wrote:
 > 
 > > Matt Sergeant writes:
 > >  > On Tue, 15 Aug 2000, Vladislav Safronov wrote:
 > >  > 
 > >  > > Ok. I think, the answers clear the problem, but I have yet more question.
 > >  > > 
 > >  > > What can you say about this code? is it ok (overwriting previous handle)?
 > >  > 
 > >  > [snip]
 > >  > 
 > >  > Well it depends on the DBMS. For example Sybase might not like it if you
 > >  > haven't read everything from the $sth first - it will bite you in the bum
 > >  > with locks. Others will be fine. So just be careful...
 > > 
 > > Actually what happens with Sybase is this:
 > > 
 > > If $sth has pending results when prepare() is called DBD::Sybase opens 
 > > a new connection (because it sees that the $dbh already has an active
 > > $sth). When the return value from prepare() is assigned to $sth the
 > > DESTROY method for the old $sth is called, which cancels the previous
 > > query. 
 > > 
 > > So I think that you *should* be safe from deadlocks, but the problem
 > > will be getting additional connections created, which is not really
 > > optimal. 
 > 
 > Isn't there something different happening when AutoCommit = 0 though?

If AutoCommit = 0 then you'll get a fatal error because DBD::Sybase
can't guarantee consistent rollback behavior accross multiple
connections (which is what happens in this case, even though the first 
$sth gets destroyed before the second one gets executed).

Michael
-- 
Michael Peppler         -||-  Data Migrations Inc.
[EMAIL PROTECTED]    -||-  http://www.mbay.net/~mpeppler
Int. Sybase User Group  -||-  http://www.isug.com
Sybase on Linux mailing list: [EMAIL PROTECTED]

Reply via email to