[PYTHON DB-SIG] oracledb examples
Greg Stein
gstein@microsoft.com
Wed, 5 Feb 1997 11:45:57 -0800
>----------
>From: Jim Fulton[SMTP:jim.fulton@digicool.com]
>Sent: Monday, February 03, 1997 11:51 AM
>To: Markus Indenbirken
>Cc: Python DB-SIG
>Subject: Re: [PYTHON DB-SIG] oracledb examples
>
>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.
This is not implemented yet, either, but the following code is "legal" :
import oracledb
db=oracledb.oracledb("spam/spamsecret@spamhost")
c=db.cursor()
c.execute("insert into spam values (:1, :2)", some_data)
db.commit()
e.g. a sequence of sequences is valid for inserts and specifies an array
insert.
-g
--
Greg Stein, Microsoft Corporation execfile("disclaimer.py")
_______________
DB-SIG - SIG on Tabular Databases in Python
send messages to: db-sig@python.org
administrivia to: db-sig-request@python.org
_______________