pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Thomas G. Lockhart <lockhart@alumni.caltech.edu>
To: Benedikt Eric Heinen <beh@icemark.ch>
Cc: pgsql-interfaces@postgreSQL.org
Subject: Re: [INTERFACES] ecpg SQL-return codes?
Date: Thu, 16 Jul 1998 13:41:00 +0000
Message-ID: <35AE02EC.14ED75A6@alumni.caltech.edu> (raw)
References: <Pine.LNX.4.00.9807160927060.14138-100000@fenun.icemark.ch>

>   how do I determine the result from an SQL statement in an ecpg source?
> >From using adabas/oracle I am somewhat used to using sqlca.sqlcode, but
> when I did a simple test yesterday (trying to update a row in an empty
> table, which of course fails, since there is nothing to update in the
> table) reveiled sqlca.sqlcode to have a value of 0.

Well, it of course succeeded! :)

SQL is set-oriented, and updating no matching rows is a valid result.
Now, if you mis-type the update command so there is a syntax or naming
error, you will probably find an error return. Also, if you do a select
on a cursor, then loop through, you might find a return code of "100"
when there are no more rows to select. But updates on well-formed
queries are likely to succeed and return zero.

                  - Tom



view thread (4+ messages)  latest in thread

Message-ID: <35AE02EC.14ED75A6@alumni.caltech.edu>
Permalink:  ../35AE02EC.14ED75A6@alumni.caltech.edu/
Also on:    postgresql.org/message-id/35AE02EC.14ED75A6@alumni.caltech.edu

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: lockhart@alumni.caltech.edu, beh@icemark.ch
  Subject: Re: [INTERFACES] ecpg SQL-return codes?
  In-Reply-To: <35AE02EC.14ED75A6@alumni.caltech.edu>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox