[DB-SIG] Questions about the DB API
Tom Bryan
tbryan@server.python.net
Sun, 7 Nov 1999 00:28:26 -0500 (EST)
On 7 Nov 1999, Hrvoje Niksic wrote:
> Greg Stein <gstein@lyra.org> writes:
>
> > An older version of the API did exactly that -- allow execution
> > directly from the connection object. It was not broadly implemented
> > (i.e. against the spec). When 2.0 came around, we decided that
> > creating a cursor is not a hardship on the programmer and simplified
> > the API to allowing execution only thru cursors.
>
> Hmm. OK. One reason why I asked this is that cursors have a defined
> semantics in database API's, and the Perl people in the company always
> look at me strangely when I create a cursor for the sole reason of
> executing a query.
You might want to write your own small module to wrap the DB API. It
could import the appropriate DB module for you and provide a function for
transparently executing single SQL statements such as
'DROP TABLE perl_hacks'.
You could also add your fetch_iterate to such a module.
---Tom