Skip site navigation (1) Skip section navigation (2)

Re: [INTERFACES] ecpg SQL-return codes?

From: "Thomas G(dot) Lockhart" <lockhart(at)alumni(dot)caltech(dot)edu>
To: Benedikt Eric Heinen <beh(at)icemark(dot)ch>
Cc: pgsql-interfaces(at)postgreSQL(dot)org
Subject: Re: [INTERFACES] ecpg SQL-return codes?
Date: 1998-07-16 13:41:00
Message-ID: 35AE02EC.14ED75A6@alumni.caltech.edu (view raw or flat)
Thread:
Lists: pgsql-interfaces
>   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

In response to

Responses

pgsql-interfaces by date

Next:From: Thomas G. LockhartDate: 1998-07-16 13:49:27
Subject: Re: [INTERFACES] Re: [HACKERS] changes in 6.4
Previous:From: Thomas G. LockhartDate: 1998-07-16 13:36:01
Subject: Re: [INTERFACES] Re: [HACKERS] changes in 6.4

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group