[Zope] Database table problem

Janko Hauser jh@comunit.de
Wed, 02 Oct 2002 09:15:26 +0200


Renier Leenders wrote:
> Hello,
> 
> I think this question is OT but nevertheless. I don't know where to put my 
> question elsewhere. 
> I use Zope as some kind of 'frontend' for an relational database. I want to 
> use the database to store laws. The idea is to retrieve articles with "SELECT 
> FROM law WHERE  article_number >= x and article_number <= y".
> Unfortunately not all law articles are numbered with 1, 2, 3, etc. If they 
> were I could define article_number as integer. But some articles are numbered 
> with 1, 2, 2a ... 13ab etc. When I define the article_number as char and I 
> retrieve I get a result with an sorting order like this: 1,10,11,11a,11b,12, 
> 13ab ... 2a, 20, 21,21a. I could not find a database who supports "natural 
> sort". 
> Has someone an idea to work around this problem with Zope? Any suggestions 
> would be appreciated.

Before inserting into the database strip the alphabetical part and store 
this in a special row. This can be done with a small PythonScript.

As a side note, for this kind of data the relational storage has no 
benefit over a ZODB storage, except the data should be managed 
independant of Zope, which you state is not the case.

HTH,

__Janko