[Zope-dev] PROPOSAL: New SQLDA functionality

Evan Simpson evan@4-am.com
Wed, 10 Nov 1999 16:16:00 +0000


Steen Suder wrote:

> I'm using PostgreSQL 6.5 and Zope 2.x on RH6.
>
> When inserting a new record in database I'd like to access the return OID
> from the INSERT query from within my ZSQL method.
>
> That is: if it returns anything... psql does return the OID.
>
> How do I do?

Patch ZPyGreSQLDA :-(

Since OIDs (and their return from INSERTs) aren't a generic SQL feature,
there isn't any general DA support for them.  You would have to hack up
something in ZPyGreSQLDA to return the OID as thought it were a SELECT
result.

I've been thinking that it would be useful to change the standard DA
machinery a bit to allow individual adapters to return arbitrary data for
each SQL statement.  Some kind of 'side-car' attribute containing a sequence
of server-specific data.  This could be used to allow something like:

<dtml-with SQL_put_rec><dtml-var "statement_xdata[0].oid"></dtml-with>

('statment_xdata' would be a list with one element: {'oid': 15678}
constructed from the PostgreSQL return value)

Cheers,

Evan @ 4-am