[storm] Oracle support review
James Henstridge
james at jamesh.id.au
Wed Sep 10 17:00:08 BST 2008
On Wed, Sep 10, 2008 at 8:23 PM, Gustavo Noronha Silva <kov at alfaiati.net> wrote:
>> Here is a short example of what you can do with PostgreSQL (using a
>> direct DB-API call):
>>
>> c.execute("INSERT INTO money (value) VALUES (42) RETURNING money.id")
>> new_id = c.fetchone()[0]
>>
>> If that works, it should be pretty easily to implement efficient inserts.
>
> For Oracle that would be:
>
> rowid = c.var(oracle.ROWID)
> c.execute("INSERT INTO money (value) VALUES (42) RETURNING ROWID INTO :out_rowid")
> newid = rowid.getvalue()
>
> And it's being done like this already, I only had to do more changes to
> how the rowid eventually gets to the Result object because cx_Oracle
> won't let me add arbitrary attributes to its raw cursor object, as is
> done in the pg backend, for instance, and, as you can see, it's not the
> cursor who holds the value in the end, but that magical rowid variable.
I realise that this is what you're doing right now. What I am asking
is whether you could get Oracle to return the primary key variables
directly instead of the rowid. This would be more general purpose
(e.g. handling tables with composite primary keys). It doesn't help
you with the variable binding problem though :(
James.
>
> Thanks!
>
> --
> Gustavo Noronha Silva <kov at alfaiati.net>
> AlfaiaTI
>
>
More information about the storm
mailing list