Re: &main::execute undefined? - Mailing list pgsql-general

From Oliver Elphick
Subject Re: &main::execute undefined?
Date
Msg-id 1037959356.1045.30.camel@linda
Whole thread Raw
In response to &main::execute undefined?  (Andrew Magnus <xanadian99@yahoo.com>)
List pgsql-general
On Thu, 2002-11-21 at 18:46, Andrew Magnus wrote:
>
> Thanks, but it still doesn't work. :-(

In what way?

> For everyone else, the error I'm getting is:
>
> Undefined subroutine &main::execute called at ./test.pl line 10.
>
> where line 10 is:
>
> $statementH = execute() || warn $statementH->errstr ;

You can't do that.  execute is part of the DBI package, so you can't
just call it as if it were declared in your own program.  The way I said
is the standard way to do it, so what goes wrong with that?


>  Oliver Elphick <olly@lfix.co.uk> wrote:On Thu, 2002-11-21 at 05:37, Andrew Magnus wrote:
...
> $statementH->execute() || warn $statementH->errstr ;


From "man 3 DBI":

      The typical method call sequence for a "SELECT" statement is:

        prepare,
         execute, fetch, fetch, ...
         execute, fetch, fetch, ...
         execute, fetch, fetch, ...

      for example:

        $sth = $dbh->prepare("SELECT foo, bar FROM table WHERE baz=?");

        $sth->execute( $baz );

        while ( @row = $sth->fetchrow_array ) {
         print "@row\n";
        }

--
Oliver Elphick                                Oliver.Elphick@lfix.co.uk
Isle of Wight, UK
http://www.lfix.co.uk/oliver
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839  932A 614D 4C34 3E1D 0C1C
                 ========================================
     "Can two walk together, except they be agreed?"
                                     Amos 3:3


pgsql-general by date:

Previous
From: David Pradier
Date:
Subject: How to know and change the owner of a table in psql ?
Next
From: Oliver Elphick
Date:
Subject: Re: how do i find out when a record was created/modified?