[Zope-DB] Re: FW: Re: How do you do update with multiple tables
Casey Duncan
casey at zope.com
Fri Apr 30 16:30:04 EDT 2004
On Fri, 30 Apr 2004 15:08:12 -0500
"Laura McCord" <Laura.McCord at doucet-austin.com> wrote:
>
> I was thinking the same thing and I tried that but doesn't that mean
> that when I insert a new user I would have to know the pcid? When I
> enter the user info I want it to be easy enough for the user to be
> able to enter the name of the pc instead of the id. However, when I do
> the update there is no pcid in the users table that will trigger the
> users.pcname to update.
Most databases provide a way to lookup the next or last value assigned
to an auto-increment field. I know both MySQL and PostgreSQL do. You
will need to
refer to the database server documentation to see exactly how.
This will allow you to populate the foreign key in the same transaction
that
the primary key was assigned.
hth,
-Casey
More information about the Zope-DB
mailing list