[PYTHON DB-SIG] oracledb examples

Jim Fulton jim.fulton@digicool.com
Mon, 03 Feb 1997 14:51:24 -0500


Markus Indenbirken wrote:
> 
> Hi folks,
> 
> a few days ago I downloaded the oracledb module. Before I have been using
> Tom Culliton's Oracle module successfully, but I was looking for greater
> speed.
> 
> I'm looking for sample code on inserting multiple rows at a time, which I
> understand is possible using the oracledb module.

The oracldb is supposed to cache prepared sql statements, like this:

 import oracledb
 db=oracldb.oracledb("spam/spamsecret@spamhost")
 c=db.cursor()
 insert="insert into spam values(:1, :2)"
 for tup in some_data: c.execute(insert,tup)
 db.commit()

where tup is a tuple with two values.  Theoretically, 
the cursor detects that the same string is passed to
each execute call and doesn't have to prepare the statement 
on each call.  Unfortunately, this has not yet been 
implemented.

Jim

-- 
Jim Fulton         Digital Creations
jim@digicool.com   540.371.6909
## Python is my favorite language ##
##     http://www.python.org/     ##

_______________
DB-SIG  - SIG on Tabular Databases in Python

send messages to: db-sig@python.org
administrivia to: db-sig-request@python.org
_______________