Revision 2430
Added by sgarg over 19 years ago
src/xmltables.sql | ||
---|---|---|
34 | 34 |
DROP SEQUENCE xml_replication_id_seq; |
35 | 35 |
DROP SEQUENCE xml_documents_id_seq; |
36 | 36 |
DROP SEQUENCE accession_number_id_seq; |
37 |
DROP SEQUENCE access_log_seq; |
|
37 |
DROP SEQUENCE access_log_id_seq;
|
|
38 | 38 |
DROP SEQUENCE xml_returnfield_id_seq; |
39 | 39 |
DROP SEQUENCE xml_queryresult_id_seq; |
40 | 40 |
|
... | ... | |
64 | 64 |
DROP TABLE harvest_site_schedule; |
65 | 65 |
DROP TABLE harvest_detail_log; |
66 | 66 |
DROP TABLE harvest_log; |
67 |
DROP TABLE xml_queryresult; |
|
67 | 68 |
DROP TABLE xml_returnfield; |
68 |
DROP TABLE xml_queryresult; |
|
69 | 69 |
|
70 | 70 |
/* |
71 | 71 |
*Replication -- table to store servers that metacat is replicated to |
src/upgrade-db-to-1.5.sql | ||
---|---|---|
74 | 74 |
UPDATE xml_catalog |
75 | 75 |
SET system_id = '@systemidserver@@html-path@/schema/eml-2.0.0/stmml.xsd' |
76 | 76 |
WHERE public_id = '@stmmlnamespace@'; |
77 |
|
|
77 | 78 |
|
78 | 79 |
/* |
79 | 80 |
* In Metacat 1.4.0, if user insert a eml201 document and has record in xml_relation |
... | ... | |
82 | 83 |
*/ |
83 | 84 |
UPDATE xml_relation SET packagetype='eml://ecoinformatics.org/eml-2.0.1' |
84 | 85 |
WHERE docid IN (SELECT docid from xml_documents WHERE doctype LIKE 'eml://ecoinformatics.org/eml-2.0.1'); |
85 |
|
|
86 |
|
|
87 |
|
|
88 |
/* |
|
89 |
* Returnfields -- table to store combinations of returnfields requested |
|
90 |
* and the number of times this table is accessed |
|
91 |
*/ |
|
92 |
CREATE TABLE xml_returnfield ( |
|
93 |
returnfield_id NUMBER(20), -- the id for this returnfield entry |
|
94 |
returnfield_string VARCHAR2(2000), -- the returnfield string |
|
95 |
usage_count NUMBER(20), -- the number of times this string |
|
96 |
-- has been requested |
|
97 |
CONSTRAINT xml_returnfield_pk PRIMARY KEY (returnfield_id) |
|
98 |
); |
|
99 |
CREATE INDEX xml_returnfield_idx1 ON xml_returnfield(returnfield_string); |
|
100 |
|
|
101 |
CREATE SEQUENCE xml_returnfield_id_seq; |
|
102 |
|
|
103 |
CREATE TRIGGER xml_returnfield_before_insert |
|
104 |
BEFORE INSERT ON xml_returnfield FOR EACH ROW |
|
105 |
BEGIN |
|
106 |
SELECT xml_returnfield_id_seq.nextval |
|
107 |
INTO :new.returnfield_id |
|
108 |
FROM dual; |
|
109 |
END; |
|
110 |
/ |
|
111 |
|
|
112 |
|
|
113 |
/* |
|
114 |
* Queryresults -- table to store queryresults for a given docid |
|
115 |
* and returnfield_id |
|
116 |
*/ |
|
117 |
CREATE TABLE xml_queryresult( |
|
118 |
queryresult_id NUMBER(20), -- id for this entry |
|
119 |
returnfield_id NUMBER(20), -- id for the returnfield corresponding to this entry |
|
120 |
docid VARCHAR2(250), -- docid of the document |
|
121 |
queryresult_string VARCHAR2(4000), -- resultant text generated for this docid and given |
|
122 |
-- returnfield |
|
123 |
CONSTRAINT xml_queryresult_pk PRIMARY KEY (queryresult_id), |
|
124 |
CONSTRAINT xml_queryresult_searchid_fk |
|
125 |
FOREIGN KEY (returnfield_id) REFERENCES xml_returnfield |
|
126 |
); |
|
127 |
|
|
128 |
CREATE INDEX xml_queryresult_idx1 ON xml_queryresult (returnfield_id, docid); |
|
129 |
|
|
130 |
CREATE SEQUENCE xml_queryresult_id_seq; |
|
131 |
|
|
132 |
CREATE TRIGGER xml_queryresult_before_insert |
|
133 |
BEFORE INSERT ON xml_queryresult FOR EACH ROW |
|
134 |
BEGIN |
|
135 |
SELECT xml_queryresult_id_seq.nextval |
|
136 |
INTO :new.queryresult_id |
|
137 |
FROM dual; |
|
138 |
END; |
|
139 |
/ |
|
140 |
|
src/upgrade-db-to-1.5-postgres.sql | ||
---|---|---|
1 |
/** |
|
2 |
* '$RCSfile$' |
|
3 |
* Copyright: 2004 Regents of the University of California and the |
|
4 |
* National Center for Ecological Analysis and Synthesis |
|
5 |
* |
|
6 |
* '$Author$' |
|
7 |
* '$Date$' |
|
8 |
* '$Revision$' |
|
9 |
* |
|
10 |
* This program is free software; you can redistribute it and/or modify |
|
11 |
* it under the terms of the GNU General Public License as published by |
|
12 |
* the Free Software Foundation; either version 2 of the License, or |
|
13 |
* (at your option) any later version. |
|
14 |
* |
|
15 |
* This program is distributed in the hope that it will be useful, |
|
16 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
17 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
18 |
* GNU General Public License for more details. |
|
19 |
* |
|
20 |
* You should have received a copy of the GNU General Public License |
|
21 |
* along with this program; if not, write to the Free Software |
|
22 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
23 |
*/ |
|
24 |
|
|
25 |
|
|
26 |
|
|
27 |
/* |
|
28 |
* Update the XML_CATALOG table. In Metacat 1.4.0, the system_id in xml_catalog |
|
29 |
* pointed to knb metacat no matter where you install it. We need change it |
|
30 |
* to local schema or dtd file. |
|
31 |
*/ |
|
32 |
UPDATE xml_catalog |
|
33 |
SET system_id = '@systemidserver@@html-path@/dtd/eml-access-@eml-version@.dtd' |
|
34 |
WHERE public_id = '-//ecoinformatics.org//eml-access-@eml-version@//EN'; |
|
35 |
UPDATE xml_catalog |
|
36 |
SET system_id = '@systemidserver@@html-path@/dtd/eml-attribute-@eml-version@.dtd' |
|
37 |
WHERE public_id = '-//ecoinformatics.org//eml-attribute-@eml-version@//EN'; |
|
38 |
UPDATE xml_catalog |
|
39 |
SET system_id = '@systemidserver@@html-path@/dtd/eml-constraint-@eml-version@.dtd' |
|
40 |
WHERE public_id = '-//ecoinformatics.org//eml-constraint-@eml-version@//EN'; |
|
41 |
UPDATE xml_catalog |
|
42 |
SET system_id = '@systemidserver@@html-path@/dtd/eml-coverage-@eml-version@.dtd' |
|
43 |
WHERE public_id = '-//ecoinformatics.org//eml-coverage-@eml-version@//EN'; |
|
44 |
UPDATE xml_catalog |
|
45 |
SET system_id = '@systemidserver@@html-path@/dtd/eml-coverage-@eml-version@.dtd' |
|
46 |
WHERE public_id = '-//ecoinformatics.org//eml-coverage-@eml-version@//EN'; |
|
47 |
UPDATE xml_catalog |
|
48 |
SET system_id = '@systemidserver@@html-path@/dtd/eml-dataset-@eml-version@.dtd' |
|
49 |
WHERE public_id = '-//ecoinformatics.org//eml-dataset-@eml-version@//EN'; |
|
50 |
UPDATE xml_catalog |
|
51 |
SET system_id = '@systemidserver@@html-path@/dtd/eml-entity-@eml-version@.dtd' |
|
52 |
WHERE public_id = '-//ecoinformatics.org//eml-entity-@eml-version@//EN'; |
|
53 |
UPDATE xml_catalog |
|
54 |
SET system_id = '@systemidserver@@html-path@/dtd/eml-literature-@eml-version@.dtd' |
|
55 |
WHERE public_id = '-//ecoinformatics.org//eml-literature-@eml-version@//EN'; |
|
56 |
UPDATE xml_catalog |
|
57 |
SET system_id = '@systemidserver@@html-path@/dtd/eml-physical-@eml-version@.dtd' |
|
58 |
WHERE public_id = '-//ecoinformatics.org//eml-physical-@eml-version@//EN'; |
|
59 |
UPDATE xml_catalog |
|
60 |
SET system_id = '@systemidserver@@html-path@/dtd/eml-project-@eml-version@.dtd' |
|
61 |
WHERE public_id = '-//ecoinformatics.org//eml-project-@eml-version@//EN'; |
|
62 |
UPDATE xml_catalog |
|
63 |
SET system_id = '@systemidserver@@html-path@/dtd/eml-protocol-@eml-version@.dtd' |
|
64 |
WHERE public_id = '-//ecoinformatics.org//eml-protocol-@eml-version@//EN'; |
|
65 |
UPDATE xml_catalog |
|
66 |
SET system_id = '@systemidserver@@html-path@/dtd/eml-software-@eml-version@.dtd' |
|
67 |
WHERE public_id = '-//ecoinformatics.org//eml-software-@eml-version@//EN'; |
|
68 |
UPDATE xml_catalog |
|
69 |
SET system_id = '@systemidserver@@html-path@/schema/eml-2.0.0/eml.xsd' |
|
70 |
WHERE public_id = '@eml2_0_0namespace@'; |
|
71 |
UPDATE xml_catalog |
|
72 |
SET system_id = '@systemidserver@@html-path@/schema/eml-2.0.1/eml.xsd' |
|
73 |
WHERE public_id = '@eml2_0_1namespace@'; |
|
74 |
UPDATE xml_catalog |
|
75 |
SET system_id = '@systemidserver@@html-path@/schema/eml-2.0.0/stmml.xsd' |
|
76 |
WHERE public_id = '@stmmlnamespace@'; |
|
77 |
|
|
78 |
/* |
|
79 |
* In Metacat 1.4.0, if user insert a eml201 document and has record in xml_relation |
|
80 |
* table. The package type in xml_relation table will be eml200 rather than eml201. |
|
81 |
* The bug was fixed and we need a sql command to fix exsited records |
|
82 |
*/ |
|
83 |
UPDATE xml_relation SET packagetype='eml://ecoinformatics.org/eml-2.0.1' |
|
84 |
WHERE docid IN (SELECT docid from xml_documents WHERE doctype LIKE 'eml://ecoinformatics.org/eml-2.0.1'); |
|
85 |
|
|
86 |
|
|
87 |
|
|
88 |
|
|
89 |
/* |
|
90 |
* Returnfields -- table to store combinations of returnfields requested |
|
91 |
* and the number of times this table is accessed |
|
92 |
*/ |
|
93 |
CREATE TABLE xml_returnfield ( |
|
94 |
returnfield_id INT8 default nextval('xml_returnfield_id_seq'), -- the id for this returnfield entry |
|
95 |
returnfield_string VARCHAR(2000), -- the returnfield string |
|
96 |
usage_count INT8, -- the number of times this string has been requested |
|
97 |
CONSTRAINT xml_returnfield_pk PRIMARY KEY (returnfield_id) |
|
98 |
); |
|
99 |
CREATE INDEX xml_returnfield_idx1 ON xml_returnfield(returnfield_string); |
|
100 |
|
|
101 |
CREATE SEQUENCE xml_returnfield_id_seq; |
|
102 |
|
|
103 |
/* |
|
104 |
* Queryresults -- table to store queryresults for a given docid |
|
105 |
* and returnfield_id |
|
106 |
*/ |
|
107 |
CREATE TABLE xml_queryresult( |
|
108 |
queryresult_id INT8 default nextval('xml_queryresult_id_seq'), -- id for this entry |
|
109 |
returnfield_id INT8, -- id for the returnfield corresponding to this entry |
|
110 |
docid VARCHAR(250), -- docid of the document |
|
111 |
queryresult_string VARCHAR(4000), -- resultant text generated for this docid and given |
|
112 |
-- returnfield |
|
113 |
CONSTRAINT xml_queryresult_pk PRIMARY KEY (queryresult_id), |
|
114 |
CONSTRAINT xml_queryresult_searchid_fk |
|
115 |
FOREIGN KEY (returnfield_id) REFERENCES xml_returnfield |
|
116 |
); |
|
117 |
|
|
118 |
|
|
0 | 119 |
src/edu/ucsb/nceas/metacat/DBQuery.java | ||
---|---|---|
624 | 624 |
int count = (new Integer(MetaCatUtil |
625 | 625 |
.getOption("xml_returnfield_count"))) |
626 | 626 |
.intValue(); |
627 |
|
|
628 |
// set enterRecords to true if usage_count is more than the offset |
|
629 |
// specified in metacat.properties |
|
627 | 630 |
if(usage_count > count){ |
628 | 631 |
enterRecords = true; |
629 | 632 |
} |
... | ... | |
633 | 636 |
+ "xml_returnfield table", 20); |
634 | 637 |
} |
635 | 638 |
|
636 |
|
|
637 |
|
|
638 | 639 |
// get the hashtable containing the docids that already in the |
639 | 640 |
// xml_queryresult table |
640 | 641 |
MetaCatUtil.debugMessage("size of partOfDoclist before" |
Also available in: Unified diff
Added new database upgrade script for postgres.
Modified the database upgrade script for oracle
Added comment to DBquery.java
Fixed a bug in xmltables.sql