[DB-SIG] SQL statement parse for Oracle

M.-A. Lemburg mal@lemburg.com
Mon, 04 Feb 2002 13:42:08 +0100


Hi Greg,

welcome back to the list :-)
 
> On Fri, Dec 14, 2001 at 10:53:30AM +0100, M.-A. Lemburg wrote:
> >...
> > Perhaps I should add a .prepare() method to the set of standard
> > DB API extensions though ?!
> 
> Why? What's the point?
> 
> You're just adding more APIs, but with no benefit. The whole concept of a
> prepare() is to get a cursor with a prepared statement which you can execute
> over and over. The existing API provides for that, for those databases which
> can support such a concept.

Sure, but only by actually executing the statement. That may not be
what you want, though, e.g. testing whether a SQL statement is valid
or not is not possible using the existing DB API methods since you 
always execute the statement. It is also not possible to setup a
few prepared cursors before actually using them for execution. The
latter is sometimes needed in cursor pools where you want to 
pre-allocate resources for a number of predefined SQL commands.
 
> Adding prepare() only monkeys up the interface. Now you have a separate
> call. But wait! That call might not do anything.

.prepare() is not needed in the sense that you have to call it
to execute SQL; .execute() will do the .prepare() for you.
 
> It just seems senseless to keep throwing more and more APIs in. When the
> functionality is *already* there, then keep the API simple.

We are keeping the API simple. 

The .prepare() method as well as
a bunch of other methods are only standardized *extensions* to the
DB API, meaning that if a DB API module author wants to extend the
functionality of the module in one of these ways, he should try
to stick to these recommendations rather than try to reinvent the 
wheel in some non-standard way.

The DB API extensions are not part of what is required for DB API
compatibility. They only form guidelines for DB API extensions
which have become rather common in existing DB API compatible 
packages.

-- 
Marc-Andre Lemburg
CEO eGenix.com Software GmbH
______________________________________________________________________
Company & Consulting:                           http://www.egenix.com/
Python Software:                   http://www.egenix.com/files/python/