Re: libpq++

From: "David Joyner" <d4ljoyn(at)yahoo(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: <pgsql-interfaces(at)postgresql(dot)org>
Subject: Re: libpq++
Date: 2002-01-15 00:16:41
Message-ID: 000501c19d5a$2820a4d0$01854094@bluepoles
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)sss(dot)pgh(dot)pa(dot)us>
To: "David Joyner" <d4ljoyn(at)yahoo(dot)com>
Cc: <pgsql-interfaces(at)postgresql(dot)org>
Sent: Monday, January 14, 2002 6:32 PM
Subject: Re: [INTERFACES] libpq++

> "David Joyner" <d4ljoyn(at)yahoo(dot)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(at)postgresql(dot)org

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

In response to

Responses

Browse pgsql-interfaces by date

  From Date Subject
Next Message Bruce Badger 2002-01-15 13:48:40 Frontend/Backend Protocol
Previous Message Tom Lane 2002-01-14 23:32:05 Re: libpq++