[Zope] Tree hierarchy problem with database
juangar@dei.inf.uc3m.es
juangar@dei.inf.uc3m.es
Fri, 7 Sep 2001 05:05:27 +0200
Hi,
My tables in the database (PostgreSQL 7) are:
CREATE TABLE cod_recurso (
codigo_recurso VARCHAR(20) NOT NULL PRIMARY KEY
);
CREATE TABLE recurso (
codigo_recurso VARCHAR(20) NOT NULL,
idioma VARCHAR(10) NOT NULL,
termino VARCHAR(50) NOT NULL,
CONSTRAINT pk_recurso
PRIMARY KEY (codigo_recurso, idioma),
CONSTRAINT existe_idioma
FOREIGN KEY (idioma) REFERENCES idioma
ON DELETE RESTRICT,
CONSTRAINT existe_codigo_recurso
FOREIGN KEY (codigo_recurso) REFERENCES cod_recurso
ON DELETE CASCADE
);
CREATE TABLE relaciones_recursos (
codigo_recurso1 VARCHAR(20) NOT NULL,
codigo_recurso2 VARCHAR(20) NOT NULL,
relacion VARCHAR(10) DEFAULT 'NT',
CONSTRAINT pk_relaciones_recursos
PRIMARY KEY (codigo_recurso1, codigo_recurso2),
CONSTRAINT existe_recurso1
FOREIGN KEY (codigo_recurso1) REFERENCES cod_recurso
ON DELETE CASCADE,
CONSTRAINT existe_recurso2
FOREIGN KEY (codigo_recurso2) REFERENCES cod_recurso
ON DELETE CASCADE
);
Where the last one is where i have the hierarchy with data like this:
codigo_recurso1 | codigo_recurso2 | relacion
1. - 1.1. - NT
1. - 1.2. - NT
1.1. - 1.1.1. - NT
1.1. - 1.1.2. - NT
1.1.1. - 1.1.1.1 - NT
2. - 2.1. - NT
3. - 3.1. - NT
I have a query that returns the direct childs of each code, and this one
is what i use en the tree tag (branches_expr).
With this data i want to show the next tree:
+ 1.
+ 1.1.
+ 1.1.1.
+ 1.1.1.1.
+ 1.1.2.
+ 1.2.
+ 2.
+ 2.1.
+ 3.
+ 3.1.
Is it posible with the tree tag?
Thank you. Bye.