[DB-SIG] DB API extension suggestion

Anthony Tuininga anthony.tuininga at gmail.com
Fri Jun 22 00:39:01 CEST 2007


On 6/21/07, Carsten Haese <carsten at uniqsys.com> wrote:
> On Thu, 2007-06-21 at 14:26 -0600, Anthony Tuininga wrote:
> > On 6/21/07, Carsten Haese <carsten at uniqsys.com> wrote:
> > > with api.connect(dbname) as conn:
> > >    with conn.cursor() as cur:
> > >       cur.execute(stmt)
> >
> > That's interesting but is it of much use? Connections and cursors
> > close themselves when they go out of scope. I rarely use
> > cursor.close() or connection.close() for that reason.
>
> True, but you're at the mercy of when and how that happens. Sometimes
> you need to be certain that the resources are deallocated exactly when
> you need them to be deallocated.

Its fairly rare but it does happen. I guess its a question of what
makes the most sense. Its probably a good thing I asked the question.
:-)

> I don't know if any of my users make use of this with-block feature, but
> it's out there and documented, so I can't just take it away or replace
> the semantics of what happens when a connection object controls a with
> block.

Not without annoying your users, of course. :-)

> For what it's worth, I brought up the above use case back in September
> 2006, and the response was somewhere between indifferent and positive.
> Nobody said it was a terrible idea, so I implemented it.
>
> Is your transaction-controlling implementation of
> connection.__enter__/__exit__ already released, i.e. is it too late to
> get you to change the API to this feature?

I have not released this publicly yet, no. It would be a good idea to
have agreement on this rather than have conflicting implementations.
Anyone else have an opinion on this??

> > Good question on the nested transaction stuff. That might prove useful
> > -- but its also considerably more complicated than what I was
> > suggesting.... :-)
>
> Of course, but it couldn't hurt to think about it for future
> extensibility. Then again, it was mostly an academic questions since
> Informix doesn't support nested transactions ;)
>
> --
> Carsten Haese
> http://informixdb.sourceforge.net
>
>
>


More information about the DB-SIG mailing list