Re: libpq++ - Mailing list pgsql-interfaces

From David Joyner
Subject Re: libpq++
Date
Msg-id 000501c19d5a$2820a4d0$01854094@bluepoles
Whole thread Raw
In response to libpq++  ("David Joyner" <d4ljoyn@yahoo.com>)
Responses Re: libpq++  (jtv <jtv@xs4all.nl>)
List pgsql-interfaces
I agree with you.  I guess the person that wrote it is not here to defend
themselves, so I'll just work around.

Thanks
Dave

----- Original Message -----
From: "Tom Lane" <tgl@sss.pgh.pa.us>
To: "David Joyner" <d4ljoyn@yahoo.com>
Cc: <pgsql-interfaces@postgresql.org>
Sent: Monday, January 14, 2002 6:32 PM
Subject: Re: [INTERFACES] libpq++


> "David Joyner" <d4ljoyn@yahoo.com> writes:
> > Okay, I see your point, especially your comments on the object
hierarchy.
> > Because here's the problem (someone must have seen this already):
>
> > PgCursor c("host=localhost", "foo");
> > c.Declare("select * from foo where something=somethingelse");
> > c.Fetch();
> > for (int i = 0; i < c.Tuples(); i++)
> > {
> >     if (something is true)
> >    {
> >      c.ExecCommandOk("update bar set something=something where
> > something=somethingelse") )
> >       }
> > }
> > c.Close();
> >  // just rolled back all those updates, but have no idea why!
>
> I'd argue that c.ExecCommandOk() is a bogus operation for a PgCursor
> object to be providing... a cursor is not something that should be
> able to execute SQL queries unrelated to the cursor.
>
> It would make more sense to me for PgCursor to have open/fetch/close
> operations and not much else, and for it to be created with a reference
> to an already-open Connection object that provides the conduit for the
> cursor commands.  To make this work, probably the Connection object
> would have to keep track of whether the backend is inside a transaction
> block, and not allow the transaction to be closed as long as there were
> live PgCursors attached to it.
>
> regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com



pgsql-interfaces by date:

Previous
From: Tom Lane
Date:
Subject: Re: libpq++
Next
From: "Marc G. Fournier"
Date:
Subject: ECPG ... how to convert from oracle -> pgsql ...