[DB-SIG] Preparing statement API
26 Jan 2000 09:13:31 +0100
Eric Brunson <brunson@Level3.net> writes:
> From the DCOracle docs:
> prepare(sql) --
> Returns a new Handle Object. A handle is a pre-prepared
> notion of a cursor, where some handling of the SQL
> parsing has already been done.
> You use it like this:
> (Assume a DB connection called "dbc")
> inshndl = dbc.prepare( "insert into mytable ( attribute, value ) "
> "values ( :p1, :p2 )" )
> for attr, val in list:
> inshndl.execute( (attr, val) )
The difference is that the interface of my proposal seems (to me) more
in line with the general cursor-based model of DB API. It only adds
one more function, and everything else happens naturally -- for
instance, you still execute statements through cursor.execute,
retrieve rows through cursor.fetch*, etc.
Everyone please note that my proposal comes from a mere *user* of the
DB modules. If what I propose is hard to implement, don't hesitate to
let me know.