[Zope] Generating sequence UID?

LD Landis ldl@LDL.HealthPartners.COM
Thu, 23 Sep 1999 08:16:00 -0500 (CDT)


Hi,

  I figured it out...
  
  Where I had (below):

    <dtml-call db_sequence('category')>,

  instead use:

    <dtml-in "db_sequence({'name' : 'contact_id'})">
      <dtml-sqlvar id type=int>,
    </dtml-in>

LD Landis wrote:
> 
> Hi,
> 
>   I have a ZSQL method db_sequence(name) which increments the 'id' of
>   sequence 'name'...  When run ('view') it prompts for the name, and
>   returns a result that has the title 'id' and the next value.  So far so
>   good.
> 
>   Now, I want to have another db_contact() method that gets its stuff from
>   REQUEST, which I have working, but I have been unable to get db_contact()
>   to call db_sequence('contact_id').  I've tried various syntactic things
>   and haven't won yet...
> 
>   The following is not any of the variety of things I've tried, but I hope
>   suggests what I want:
> 
>     db_sequence(name)			(What I have works, even if not
>       update sequence set id = id + 1	 exactly this)
>       where name = <dtml-sqlvar name type=string>
> 
>     db_category(--no parameters--)
>       insert into category (category_id, name, field...field) values (
>       <dtml-call db_sequence('category')>,
>       <dtml-with REQUEST>
>       <dtml-sqlvar name type=string>,
>       <dtml-sqlvar ...  type=string>,
>                    ...
>       <dtml-sqlvar ...  type=string>
>       </dtml-with>
>     )
> 

--
Cheers,
	--ldl
-----------------------------------------------------------------------------
LD Landis ldl@HealthPartners.Com N0YRQ    Voice 612/883-5511 Fax 612/883-6363
HealthPartners, 8100 34th Avenue So, PO Box 1309, Minneapolis, MN  55440-1309
Shape your life not from your memories, but from your hopes.       (Borrowed)
-----------------------------------------------------------------------------