[Zope] Zope Pgsql 7.0/SQL Schema HeLp!
Richard Smith
ozric@tampabay.rr.com
Sun, 21 May 2000 11:01:31 -0400
Lindell Alderman wrote:
>
> > I have Zope all set, and I can run all your standard SELECT, INSERT,
> > UPDATE stuff.
> > But I have one hitch, I can't seem to figure out how to make it so an
> > end user
> > could add a name and email address without knowing about the PKEY
> > number. This is no problem for a DBA but I want to make it easy for
> > anyone to INSERT and UPDATE records. Did I make a bad design choice in
> > use unique numbers to glue all the tables together. Is this an interface
> > problem. Am I missing something. I need some help. Can someone point me
> > in the right direction please?
> >
> > Richard
> You can either use postgresql's serial type or create a sequence
> and then use select nextval('sequence_name') and
> select currval('sequence_name') to get and set the value of the key field.
>
> Check out the user's guide on www.postgresql for exact information
> on this.
>
> -L
I have the SERIAL type set up already. What is holding me up it that I
need to make it possible to INSERT and UPDATE records base on the
persons name and not the id number. somthing along the lines of this.
INSERT INTO address (per_id,street,city,state,zip)
VALUES ('SELECT per_id FROM person WHERE first = '<dtml-var first>'
AND last = '<dtml-var last>'','<dtml-var street>','<dtml-var city>
...etc;
I can't seem to figure out the SQL statment to use. I need to use a
SELECT as a VALUE
in an INSERT statment some how. can that be done, or should I use a View
with an UPDATE and INSERT rule ?
Richard