----- Original Message ----- 
From: "Phillip B Oldham" <[EMAIL PROTECTED]>
To: <zope@zope.org>
Sent: Thursday, August 14, 2008 4:40 AM
Subject: [Zope] Trying ZODB with a background in RDBMS

> Hi all. I'm playing with standalone ZODB at the moment trying to get a
> better understanding of its use in applications. I come from a
> PHP/MySQL background, and I'm taking my first steps with Python at the
> same time.
> One of the things I'm not understanding about ZODB is assigning
> incremental IDs to objects. For instance, if I were to be writing a
> support-ticket system I'd want to give each ticket a unique number,
> but one that's "human-useable" (otherwise you could just use a UUID -
> try giving one of those over the phone!).

One possible solution:

- when you create a new ID store the ID somewhere you can easily retrieve it 
(eg. as a property field on a temporary folder - stored in memory, so 
constant writes of the ID do not bloat your ZODB; or stored as a record in 
an external DB)

- create a routine that returns the stored ID; if the ID is not found then 
this routine would access the appropriate folder and return the highest ID 
found there

- if you have a low-volume application you could skip the ID storage step 
and just look for the highest stored ID each time



Zope maillist  -  Zope@zope.org
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-dev )

Reply via email to