[storm] future database support
Noah Gift
noah.gift at gmail.com
Wed Jul 18 23:54:25 BST 2007
Wow. Great work. That didn't take long...
On 7/18/07, Willi Langenberger <wlang at wu-wien.ac.at> wrote:
> 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
>
> --
> storm mailing list
> storm at lists.canonical.com
> Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/storm
>
--
http://www.blog.noahgift.com
More information about the storm
mailing list