perl Pg module and result status - Mailing list pgsql-general

From Fernán Agüero
Subject perl Pg module and result status
Date
Msg-id 20000920.23594100@iib005.iib.unsam.edu.ar
Whole thread Raw
Responses Re: perl Pg module and result status
List pgsql-general
Dear all: i am somewhat new to both perl and PostgreSQL. I am writing
some perl scripts to store and retrieve information in a pgsql database,
using the Pg perl module. However i am having trouble doing checks after
issuing queries or commands.

According to the module documentation:
"
$result_status = $result->resultStatus
Returns the status of the result. For comparing the status you may use
one of the following constants depending upon the command executed:
- PGRES_EMPTY_QUERY
- PGRES_COMMAND_OK
- PGRES_TUPLES_OK
- PGRES_COPY_OUT
- PGRES_COPY_IN
- PGRES_BAD_RESPONSE
- PGRES_NONFATAL_ERROR
- PGRES_FATAL_ERROR
"

When I check the contents of $result_status it is not any of the
mentioned constants, but a number (i am now getting 7 for a
$result->getvalue command after a failed select statement). If i issue
the same select statement in the pgsql terminal everything works. Thus i
don't understand what could be happening.

However, comparisons of the kind of:
    if ($result_status != PGRES_COMMAND_OK)
appear to work most of the times (am i comparing against a number?)

Any help is appreciated.

Thanks in advance,


Fernan



pgsql-general by date:

Previous
From: Tim Kientzle
Date:
Subject: Re: Large Objects
Next
From: Vince Vielhaber
Date:
Subject: Re: Public Database of zip code information