Project

General

Profile

« Previous | Next » 

Revision 19

Added by Matt Jones about 24 years ago

added attribute persistence to DB code

View differences:

xmltables.sql
11 11
 */
12 12

  
13 13
/*
14
 * Drop all of the tables in proper order
14
 * Drop all of the objects in proper order
15 15
 */
16
DROP SEQUENCE xml_attributes_id_seq;
17
DROP TRIGGER xml_attributes_before_insert;
18
DROP SEQUENCE xml_elements_id_seq;
19
DROP TRIGGER xml_elements_before_insert;
16 20
DROP TABLE xml_documents;
17 21
DROP TABLE xml_attributes;
18 22
DROP TABLE xml_elements;
......
32 36
		FOREIGN KEY (parentnodeid) REFERENCES xml_elements
33 37
);
34 38

  
39
CREATE SEQUENCE xml_elements_id_seq;
40

  
41
CREATE TRIGGER xml_elements_before_insert
42
BEFORE INSERT ON xml_elements FOR EACH ROW
43
BEGIN
44
  SELECT xml_elements_id_seq.nextval
45
    INTO :new.nodeid
46
    FROM dual;
47
END;
48
/
49

  
35 50
/* 
36 51
 * Documents -- table to store XML document catalog
37 52
 */
......
54 69
	attributeid	NUMBER(20),
55 70
	nodeid		NUMBER(20),
56 71
	attributenumber	NUMBER(20),
57
	attributename	VARCHAR2(2000),
72
	attributename	VARCHAR2(256),
58 73
	attributevalue	VARCHAR2(2000),
59 74
	date_created	DATE,
60 75
	date_updated	DATE,
61 76
   CONSTRAINT xml_attributes_pk PRIMARY KEY (attributeid),
62 77
   CONSTRAINT xml_attributes_parent_node FOREIGN KEY (nodeid) 
63
		REFERENCES xml_elements
78
		REFERENCES xml_elements,
79
   CONSTRAINT xml_attributes_uniq_attribute UNIQUE (nodeid,attributename) 
64 80
);
81

  
82
CREATE SEQUENCE xml_attributes_id_seq;
83

  
84
CREATE TRIGGER xml_attributes_before_insert
85
BEFORE INSERT ON xml_attributes FOR EACH ROW
86
BEGIN
87
  SELECT xml_attributes_id_seq.nextval
88
    INTO :new.attributeid
89
    FROM dual;
90
END;
91
/
92

  

Also available in: Unified diff