From: | Oliver Elphick <olly(at)lfix(dot)co(dot)uk> |
---|---|
To: | Andrew Magnus <xanadian99(at)yahoo(dot)com> |
Cc: | PostgreSQL <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: &main::execute undefined? |
Date: | 2002-11-22 10:02:36 |
Message-ID: | 1037959356.1045.30.camel@linda |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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(at)lfix(dot)co(dot)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(dot)Elphick(at)lfix(dot)co(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Oliver Elphick | 2002-11-22 10:12:56 | Re: how do i find out when a record was created/modified? |
Previous Message | David Pradier | 2002-11-22 09:55:31 | How to know and change the owner of a table in psql ? |