From 08c539bc8cad0cd19f109ccd6be411b0335dff65 Mon Sep 17 00:00:00 2001 From: Mike Rylander Date: Tue, 28 Jun 2011 15:18:55 -0400 Subject: [PATCH] Correct copy-paste-o spotted by Dan Scott Signed-off-by: Mike Rylander --- Open-ILS/src/sql/Pg/002.schema.config.sql | 2 +- Open-ILS/src/sql/Pg/990.schema.unapi.sql | 2 +- .../sql/Pg/upgrade/0569.schema.unapi-auri-fix.sql | 33 ++++++++++++++++++++++ 3 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 Open-ILS/src/sql/Pg/upgrade/0569.schema.unapi-auri-fix.sql diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql index c7b404da0a..4c4b95ad2e 100644 --- a/Open-ILS/src/sql/Pg/002.schema.config.sql +++ b/Open-ILS/src/sql/Pg/002.schema.config.sql @@ -86,7 +86,7 @@ CREATE TRIGGER no_overlapping_deps BEFORE INSERT OR UPDATE ON config.db_patch_dependencies FOR EACH ROW EXECUTE PROCEDURE evergreen.array_overlap_check ('deprecates'); -INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0568', :eg_version); -- miker/tsbere +INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0569', :eg_version); -- miker CREATE TABLE config.bib_source ( id SERIAL PRIMARY KEY, diff --git a/Open-ILS/src/sql/Pg/990.schema.unapi.sql b/Open-ILS/src/sql/Pg/990.schema.unapi.sql index 3e85f5a578..ad9fffe459 100644 --- a/Open-ILS/src/sql/Pg/990.schema.unapi.sql +++ b/Open-ILS/src/sql/Pg/990.schema.unapi.sql @@ -862,7 +862,7 @@ $F$ LANGUAGE SQL; CREATE OR REPLACE FUNCTION unapi.auri ( obj_id BIGINT, format TEXT, ename TEXT, includes TEXT[], org TEXT, depth INT DEFAULT NULL, slimit INT DEFAULT NULL, soffset INT DEFAULT NULL, include_xmlns BOOL DEFAULT TRUE ) RETURNS XML AS $F$ SELECT XMLELEMENT( - name volume, + name uri, XMLATTRIBUTES( CASE WHEN $9 THEN 'http://open-ils.org/spec/holdings/v1' ELSE NULL END AS xmlns, 'tag:open-ils.org:U2@auri/' || uri.id AS id, diff --git a/Open-ILS/src/sql/Pg/upgrade/0569.schema.unapi-auri-fix.sql b/Open-ILS/src/sql/Pg/upgrade/0569.schema.unapi-auri-fix.sql new file mode 100644 index 0000000000..40dc9a483a --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/0569.schema.unapi-auri-fix.sql @@ -0,0 +1,33 @@ +-- Evergreen DB patch 0569.schema.unapi-auri-fix.sql +-- +-- +BEGIN; + + +-- check whether patch can be applied +SELECT evergreen.upgrade_deps_block_check('0569', :eg_version); + +CREATE OR REPLACE FUNCTION unapi.auri ( obj_id BIGINT, format TEXT, ename TEXT, includes TEXT[], org TEXT, depth INT DEFAULT NULL, slimit INT DEFAULT NULL, soffset INT DEFAULT NULL, include_xmlns BOOL DEFAULT TRUE ) RETURNS XML AS $F$ + SELECT XMLELEMENT( + name uri, + XMLATTRIBUTES( + CASE WHEN $9 THEN 'http://open-ils.org/spec/holdings/v1' ELSE NULL END AS xmlns, + 'tag:open-ils.org:U2@auri/' || uri.id AS id, + use_restriction, + href, + label + ), + XMLELEMENT( name copies, + CASE + WHEN ('acn' = ANY ($4)) THEN + (SELECT XMLAGG(acn) FROM (SELECT unapi.acn( call_number, 'xml', 'copy', evergreen.array_remove_item_by_value($4,'auri'), $5, $6, $7, $8, FALSE) FROM asset.uri_call_number_map WHERE uri = uri.id)x) + ELSE NULL + END + ) + ) AS x + FROM asset.uri uri + WHERE uri.id = $1 + GROUP BY uri.id, use_restriction, href, label; +$F$ LANGUAGE SQL; + +COMMIT; -- 2.11.0