[storm] future database support
Willi Langenberger
wlang at wu-wien.ac.at
Wed Jul 18 23:24:50 BST 2007
According to Gustavo Niemeyer:
> > I think this can also be used with the Oracle Call Interface, ie
> > something like:
> >
> > rowid = cursor.execute("""INSERT INTO some_table
> > (col1, col2) VALUES (:1, :2)
> > RETURNING ROWID INTO :3""", col1, col2)
>
> Can you check if that really works?
Tested with DCOracle2::
import random
import DCOracle2
dbc = DCOracle2.connect('...')
cursor = dbc.cursor()
foo = random.randint(0, 10000)
print 'inserting:', foo
sql = """insert into test_table (foo) values (:1)
returning rowid into :out_rowid"""
rowid = cursor._connection.rowid() # empty rowid object
cursor.execute(sql, foo, out_rowid=rowid) # put rowid value into it
# now reading the record with the rowid from the last statement
sql = """select foo from test_table
where rowid = :1"""
cursor.execute(sql, rowid)
foo2, = cursor.fetchone()
print 'reading:', foo2
This seems to work.
Whats left is finding a way to catch the INSERT statements in the
oracle backend and wrap the rowid magic around it.
\wlang{}
--
Willi.Langenberger at wu-wien.ac.at Fax: +43/1/31336/9207
Zentrum fuer Informatikdienste, Wirtschaftsuniversitaet Wien, Austria
More information about the storm
mailing list