[open-ils-commits] [GIT] Evergreen ILS branch rel_2_0 updated. 561df40dc6fcb364535732cea4658078dc74d87a
Evergreen Git
git at git.evergreen-ils.org
Tue Aug 2 11:39:15 EDT 2011
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".
The branch, rel_2_0 has been updated
via 561df40dc6fcb364535732cea4658078dc74d87a (commit)
via e6093f25d80cabc61d3d0c6307ebd4d0bb8b88e8 (commit)
from 8e35d40ecee620a52ca327675cc9955b74068e25 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 561df40dc6fcb364535732cea4658078dc74d87a
Author: Bill Erickson <berick at esilibrary.com>
Date: Tue Aug 2 11:26:19 2011 -0400
Stamped upgrade script for user/miker/replace_field_fix
Signed-off-by: Bill Erickson <berick at esilibrary.com>
diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql
index 53d0471..c5c517c 100644
--- a/Open-ILS/src/sql/Pg/002.schema.config.sql
+++ b/Open-ILS/src/sql/Pg/002.schema.config.sql
@@ -57,7 +57,7 @@ CREATE TABLE config.upgrade_log (
install_date TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
);
-INSERT INTO config.upgrade_log (version) VALUES ('0587'); -- dbs/berick
+INSERT INTO config.upgrade_log (version) VALUES ('0588'); -- miker/berick
CREATE TABLE config.bib_source (
id SERIAL PRIMARY KEY,
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.replace_field-default-value.sql b/Open-ILS/src/sql/Pg/upgrade/0588.schema.replace_field-default-value.sql
similarity index 84%
rename from Open-ILS/src/sql/Pg/upgrade/XXXX.schema.replace_field-default-value.sql
rename to Open-ILS/src/sql/Pg/upgrade/0588.schema.replace_field-default-value.sql
index f8e5b28..77320a4 100644
--- a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.replace_field-default-value.sql
+++ b/Open-ILS/src/sql/Pg/upgrade/0588.schema.replace_field-default-value.sql
@@ -1,11 +1,6 @@
--- Evergreen DB patch XXXX.schema.replace_field-default-value.sql
---
--- Return the input XML when no replace rule is provided
---
BEGIN;
--- check whether patch can be applied
-SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+INSERT INTO config.upgrade_log (version) VALUES ('0588');
CREATE OR REPLACE FUNCTION vandelay.replace_field ( target_xml TEXT, source_xml TEXT, field TEXT ) RETURNS TEXT AS $_$
DECLARE
commit e6093f25d80cabc61d3d0c6307ebd4d0bb8b88e8
Author: Mike Rylander <mrylander at gmail.com>
Date: Tue Aug 2 10:55:00 2011 -0400
Have replace_field return input XML when no replace rule is provided
Signed-off-by: Mike Rylander <mrylander at gmail.com>
Signed-off-by: Bill Erickson <berick at esilibrary.com>
diff --git a/Open-ILS/src/sql/Pg/012.schema.vandelay.sql b/Open-ILS/src/sql/Pg/012.schema.vandelay.sql
index 476ee07..c61c2ab 100644
--- a/Open-ILS/src/sql/Pg/012.schema.vandelay.sql
+++ b/Open-ILS/src/sql/Pg/012.schema.vandelay.sql
@@ -449,6 +449,7 @@ DECLARE
BEGIN
parsed_target := vandelay.strip_field( target_xml, ''); -- this dance normalizes the format of the xml for the IF below
+ xml_output := parsed_target; -- if there are no replace rules, just return the input
FOR curr_field IN SELECT UNNEST( STRING_TO_ARRAY(field, ',') ) LOOP -- naive split, but it's the same we use in the perl
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.replace_field-default-value.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.replace_field-default-value.sql
new file mode 100644
index 0000000..f8e5b28
--- /dev/null
+++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.replace_field-default-value.sql
@@ -0,0 +1,41 @@
+-- Evergreen DB patch XXXX.schema.replace_field-default-value.sql
+--
+-- Return the input XML when no replace rule is provided
+--
+BEGIN;
+
+-- check whether patch can be applied
+SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+
+CREATE OR REPLACE FUNCTION vandelay.replace_field ( target_xml TEXT, source_xml TEXT, field TEXT ) RETURNS TEXT AS $_$
+DECLARE
+ xml_output TEXT;
+ parsed_target TEXT;
+ curr_field TEXT;
+BEGIN
+
+ parsed_target := vandelay.strip_field( target_xml, ''); -- this dance normalizes the format of the xml for the IF below
+ xml_output := parsed_target; -- if there are no replace rules, just return the input
+
+ FOR curr_field IN SELECT UNNEST( STRING_TO_ARRAY(field, ',') ) LOOP -- naive split, but it's the same we use in the perl
+
+ xml_output := vandelay.strip_field( parsed_target, curr_field);
+
+ IF xml_output <> parsed_target AND curr_field ~ E'~' THEN
+ -- we removed something, and there was a regexp restriction in the curr_field definition, so proceed
+ xml_output := vandelay.add_field( xml_output, source_xml, curr_field, 1 );
+ ELSIF curr_field !~ E'~' THEN
+ -- No regexp restriction, add the curr_field
+ xml_output := vandelay.add_field( xml_output, source_xml, curr_field, 0 );
+ END IF;
+
+ parsed_target := xml_output; -- in prep for any following loop iterations
+
+ END LOOP;
+
+ RETURN xml_output;
+END;
+$_$ LANGUAGE PLPGSQL;
+
+
+COMMIT;
-----------------------------------------------------------------------
Summary of changes:
Open-ILS/src/sql/Pg/002.schema.config.sql | 2 +-
Open-ILS/src/sql/Pg/012.schema.vandelay.sql | 1 +
...=> 0588.schema.replace_field-default-value.sql} | 5 +++--
3 files changed, 5 insertions(+), 3 deletions(-)
copy Open-ILS/src/sql/Pg/upgrade/{0473.schema.vandelay-replace_field.sql => 0588.schema.replace_field-default-value.sql} (88%)
hooks/post-receive
--
Evergreen ILS
More information about the open-ils-commits
mailing list