Mailing List Archive

Getting a newly created record
How can I insert a new record and have the new record immediately returned to me
as an object?

_______________________________________________
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db
Re: Getting a newly created record [ In reply to ]
--On 17. November 2005 17:04:22 +0000 Sean Fulmer <wsfulmer@gmail.com>
wrote:

> How can I insert a new record and have the new record immediately
> returned to me as an object?
>

When you insert the data then you have the data you need inside your
application. If not perform a second query using *some* WHERE clause based
on the inserted data.

-aj
Re: Getting a newly created record [ In reply to ]
Sean Fulmer wrote at 2005-11-17 17:04 +0000:
>How can I insert a new record and have the new record immediately returned to me
>as an object?

You must use database means for this.

If your database system supports the "sequence" datatype (and you
use it to generate a unique id) then you can use the sequence's
"curval" to reference the newly created record.

You can combine your insert and a select for the created record
in the same Z SQL Method (separated by "<dtml-sql-delimiter>" (or
similarly spelled).


--
Dieter
_______________________________________________
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db