RE: Question about $sth->finish;

2000-08-17 Thread Vladislav Safronov
> On Tue, Aug 15, 2000 at 03:26:03PM +0400, Vladislav Safronov wrote: > > Hi, > > > > Could you have a look at the lines and answer the question .. > > --- > > sub foo { > > my $dbh = shift; > > > > my $sql = ... > > > > my $sth = $dbh->prepare($sql); > > $sth->execute; > >

Re: Question about $sth->finish;

2000-08-17 Thread Tim Bunce
On Wed, Aug 16, 2000 at 08:26:09AM +0200, Henrik Tougaard wrote: > From: Jay Jacobs [mailto:[EMAIL PROTECTED]] > > On Tue, 15 Aug 2000, Tom Mornini wrote: > > > > > It is my understanding of the DBI docs that you only need to call > > > $sth->finish when you DON'T fetch all the rows that the > >

Re: Question about $sth->finish;

2000-08-17 Thread Tim Bunce
On Tue, Aug 15, 2000 at 12:22:46PM -0500, Jay Jacobs wrote: > > > On Tue, 15 Aug 2000, Tom Mornini wrote: > > > It is my understanding of the DBI docs that you only need to call > > $sth->finish when you DON'T fetch all the rows that the $sth has ready to > > return. > > > > >From "Writing Ap

Re: Question about $sth->finish;

2000-08-17 Thread Tim Bunce
On Tue, Aug 15, 2000 at 03:26:03PM +0400, Vladislav Safronov wrote: > Hi, > > Could you have a look at the lines and answer the question .. > --- > sub foo { > my $dbh = shift; > > my $sql = ... > > my $sth = $dbh->prepare($sql); > $sth->execute; > $sth->finish; >

RE: Question about $sth->finish;

2000-08-16 Thread Vladislav Safronov
Well, summarizing all the answers and assuming using Mysql 1. $sth->finish should be used if (and ONLY if) the the returned data (any SELECT, but not INSERT, UPDATE?) has not been fetched ALL and $sth is going to be overwritten.. 2. $sth (defined as 'my') should not call finish before

RE: Question about $sth->finish;

2000-08-15 Thread Henrik Tougaard
> From: Vladislav Safronov [mailto:[EMAIL PROTECTED]] > What can you say about this code? is it ok (overwriting > previous handle)? > > == > sub foo { > my $dbh = shift; > > my $sql1 = "select *... > my $sql2 = "select *... > > my $sth = $dbh->prepare($sql1); > $

RE: Question about $sth->finish;

2000-08-15 Thread Henrik Tougaard
From: Jay Jacobs [mailto:[EMAIL PROTECTED]] > On Tue, 15 Aug 2000, Tom Mornini wrote: > > > It is my understanding of the DBI docs that you only need to call > > $sth->finish when you DON'T fetch all the rows that the > $sth has ready to > > return. > > > > From "Writing Apache Modules with Pe

RE: Question about $sth->finish;

2000-08-15 Thread Jay Jacobs
On Tue, 15 Aug 2000, Tom Mornini wrote: > It is my understanding of the DBI docs that you only need to call > $sth->finish when you DON'T fetch all the rows that the $sth has ready to > return. > >From "Writing Apache Modules with Perl and C": "You should still call finish() at the end of e

RE: Question about $sth->finish;

2000-08-15 Thread Tom Mornini
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)? > > == > sub foo { > my $dbh = shift; > > my $sql1 = "select *... > my $sql

RE: Question about $sth->finish;

2000-08-15 Thread Michael Peppler
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 c

RE: Question about $sth->finish;

2000-08-15 Thread Matt Sergeant
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)? >

RE: Question about $sth->finish;

2000-08-15 Thread Michael Peppler
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 exam

Re: Question about $sth->finish;

2000-08-15 Thread Matt Sergeant
On Tue, 15 Aug 2000, Keith G. Murphy wrote: > (Boggle) Really? 'My' variables going out of scope don't always get > freed up? Or is this strictly an object thing with DESTROY? Well why would you care if my $str = "hello world" didn't get freed via this bug? It only matters for objects that do

Re: Question about $sth->finish;

2000-08-15 Thread Keith G. Murphy
Matt Sergeant wrote: > > On Tue, 15 Aug 2000, Vladislav Safronov wrote: > > > Hi, > > > > Could you have a look at the lines and answer the question .. > > --- > > sub foo { > > my $dbh = shift; > > > > my $sql = ... > > > > my $sth = $dbh->prepare($sql); > > $sth->execut

RE: Question about $sth->finish;

2000-08-15 Thread Matt Sergeant
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

RE: Question about $sth->finish;

2000-08-15 Thread Vladislav Safronov
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)? == sub foo { my $dbh = shift; my $sql1 = "select *... my $sql2 = "select *... my $sth = $dbh->prepare($sql1);

RE: Question about $sth->finish;

2000-08-15 Thread David Mitchell
Matt Sergeant <[EMAIL PROTECTED]> wrote: > > This can be demonstrated with a very simple object class with a DESTROY > method. There's a message somewhere in the p5p archives about this from > me. That's http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2000-03/msg00604.html to save anyone

RE: Question about $sth->finish;

2000-08-15 Thread Matt Sergeant
On Tue, 15 Aug 2000, Vladislav Safronov wrote: > "my" (perl's my) variables doesn't always get destoyed, does it Perl's > documentation say that "my" vars are the most safe since they get destroyed > when they get out of scope ... I said this was a bug in Perl, although I don't think that 5

RE: Question about $sth->finish;

2000-08-15 Thread Vladislav Safronov
> On Tue, 15 Aug 2000, Vladislav Safronov wrote: > > > Hi, > > > > Could you have a look at the lines and answer the question .. > > --- > > sub foo { > > my $dbh = shift; > > > > my $sql = ... > > > > my $sth = $dbh->prepare($sql); > > $sth->execute; > > $sth->finish; > >

RE: Question about $sth->finish;

2000-08-15 Thread Henrik Tougaard
>From: Vladislav Safronov [mailto:[EMAIL PROTECTED]] > sub foo { > my $dbh = shift; > > my $sql = ... > > my $sth = $dbh->prepare($sql); > $sth->execute; > $sth->finish; > } > === > Do I always need to call $sth->finish? Wouldn't it be > automaticly called when > s

Re: Question about $sth->finish;

2000-08-15 Thread Matt Sergeant
On Tue, 15 Aug 2000, Vladislav Safronov wrote: > Hi, > > Could you have a look at the lines and answer the question .. > --- > sub foo { > my $dbh = shift; > > my $sql = ... > > my $sth = $dbh->prepare($sql); > $sth->execute; > $sth->finish; > } > === > Do I alway

RE: Question about $sth->finish;

2000-08-15 Thread Kenneth Lee
as written in the manpage, this is rarely used, it will be called for you when the handle is going out of scope, but if something is still left in the buffer some warnings will be generated. -Original Message- From: Vladislav Safronov To: [EMAIL PROTECTED] Sent: 8/15/00 7:26 PM Subject: