Re: Problems connecting

"Martin J. Evans" <[email protected]>
Newsgroups gmane.comp.db.mysql.perl
Organization Easysoft Limited
Message-ID <1153432119.5070.10.camel@localhost>
On Thu, 2006-07-20 at 14:40 -0700, A. Gerow wrote:
> I'm pretty sure one can fetch only the first couple rows in a return-set 
> and still be ok.
> The general idea is:
>     $dbh-> connect(...)
> 
>     $sth=$dbh->prepare(sql_stmt)
>     $sth->execute()
>     $sth->fetch() # different for different kinds of returns.
>     $sth->finish() # Are you missing this?
>     ...
> 
>     $dbh->disconnect() # Your error.

But the error indicates you are not calling finish.

You never said you were calling finish AND getting the error.

As far as I am aware you WILL get this error it you do not call finish
and have not fetched all the results.

Martin
-- 
Martin J. Evans
Easysoft Limited
http://www.easysoft.com
> Martin J. Evans wrote:
> > The error "disconnect invalidates 1 active statement handle" implies
> > you have an active statement for which all results have not been fetched
> > when you call disconnect. e.g.
> >
> > prepare(some sql)
> > execute
> > fetch one row when there are 20 rows
> >   
> Right here one should call $sth->finish()
> > disconnect (or script terminates)
> >
> > As the error states, if you don't fetch all the results from a select
> > then call finish first or fetch all the results.
> >
> > I cannot tell from your description how "this works on one server"
> > and not another.
> >
> > Martin
> >   
> 
> -- 
> Aaron Gerow
> Open Source Developer
> Digital Media - Information and Technology Services
> Pacific Lutheran University
> Tacoma, Washington
> 
> 



-- 
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe:    http://lists.mysql.com/[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.