Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 446FD47612B for ; Sun, 19 Jan 2003 09:17:41 -0500 (EST) Received: from mxzilla1.xs4all.nl (mxzilla1.xs4all.nl [194.109.6.54]) by postgresql.org (Postfix) with ESMTP id A379B4760E4 for ; Sun, 19 Jan 2003 09:17:12 -0500 (EST) Received: from xs1.xs4all.nl (xs1.xs4all.nl [194.109.3.11]) by mxzilla1.xs4all.nl (8.12.3/8.12.3) with ESMTP id h0JEHEc4019232; Sun, 19 Jan 2003 15:17:14 +0100 (CET) Received: (from jtv@localhost) by xs1.xs4all.nl (8.11.6/8.11.6) id h0JEHEm89767; Sun, 19 Jan 2003 15:17:14 +0100 (CET) (envelope-from jtv) Date: Sun, 19 Jan 2003 15:17:14 +0100 From: "Jeroen T. Vermeulen" To: Key88 SF Cc: pgsql-interfaces@postgresql.org Subject: Re: libpqxx: Cursors needed??! Message-ID: <20030119141713.GC84000@xs4all.nl> Mail-Followup-To: Key88 SF , pgsql-interfaces@postgresql.org References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4i X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200301/81 X-Sequence-Number: 3581 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