From: Tom Lane <tgl@sss.pgh.pa.us>
To: Anna Langer <anna_langer@hotmail.com>
Cc: pgsql-sql@postgreSQL.org
Subject: Re: [SQL] Questions about embedded-sql!
Date: Tue, 20 Apr 1999 10:35:30 -0400
Message-ID: <13837.924618930@sss.pgh.pa.us> (raw)
In-Reply-To: <19990420091812.48659.qmail@hotmail.com>
"Anna Langer" <anna_langer@hotmail.com> writes:
> We are having some problems with writing embedded-sql. We want to
> write like this but it doesn't work. test1 is our table in our
> database.
> res = PQexec(conn, "select * from test1");
> if (!res || PQresultStatus(res) != PGRES_COMMAND_OK)
> {
> fprintf(stderr, "DECLARE CURSOR command failed\n");
> ...
A successful SELECT query will return status PGRES_TUPLES_OK,
not PGRES_COMMAND_OK. You probably adapted this code from
an example that was executing a command that cannot return
tuples (DECLARE CURSOR, no doubt?). PGRES_COMMAND_OK is the
right thing in that case.
You should read the documentation and sample programs
for libpq ...
regards, tom lane
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-sql@postgresql.org
Cc: tgl@sss.pgh.pa.us, anna_langer@hotmail.com
Subject: Re: [SQL] Questions about embedded-sql!
In-Reply-To: <13837.924618930@sss.pgh.pa.us>
* 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