From: Jeroen T. Vermeulen <jtv@xs4all.nl>
To: Key88 SF <key88sf@hotmail.com>
Cc: pgsql-interfaces@postgresql.org
Subject: Re: libpqxx: Cursors needed??!
Date: Sun, 19 Jan 2003 15:17:14 +0100
Message-ID: <20030119141713.GC84000@xs4all.nl> (raw)
In-Reply-To: <F105DEJmGzrLCCtgx8V00032218@hotmail.com>
References: <F105DEJmGzrLCCtgx8V00032218@hotmail.com>
On Wed, Jan 15, 2003 at 10:51:22PM +0000, Key88 SF wrote:
>
> It's not clear to me when to use the Cursor class, if at all. Transactions
> seem to execute fine and I get valid Result classes back without using
> cursors.
There's no special reason why you should use Cursor to retrieve
results--you can always just call TransactionItf::Exec() and get
Results from that. Use Cursor only when you want to create an
SQL cursor.
> Many of the sample programs don't use them either.
The sample programs were mostly written in the order in which they're
numbered, so some of them predate cursors.
> Are cursors needed at all??
No. It's a convenience class; you can always just execute the
cursor-related commands by hand. The wrapper class just gives you
conveniences like additional compiler checking, more specific error
messages, more user-friendly syntax, and absolute positioning. The
latter may be a little harder to do for yourself than it seems,
because of the way postgres returns tuple counts when moving or
fetching with a cursor.
Jeroen
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: jtv@xs4all.nl, key88sf@hotmail.com
Subject: Re: libpqxx: Cursors needed??!
In-Reply-To: <20030119141713.GC84000@xs4all.nl>
* 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