[open-ils-commits] [GIT] Evergreen ILS branch master updated. 0202761608cc6e3ea512e7171b9bcad8af8bc8ff

Evergreen Git git at git.evergreen-ils.org
Mon Jul 30 10:31:34 EDT 2012


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, master has been updated
       via  0202761608cc6e3ea512e7171b9bcad8af8bc8ff (commit)
       via  ec8b943faef89235c0806db983864398acba5b2c (commit)
      from  3670571e47fba3dc38aeec11a5f73ddc6cbea0ce (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 0202761608cc6e3ea512e7171b9bcad8af8bc8ff
Author: Dan Scott <dscott at laurentian.ca>
Date:   Mon Jul 30 10:25:31 2012 -0400

    Wrap upgrade script for "pretty-print XML" function
    
    Signed-off-by: Dan Scott <dscott at laurentian.ca>

diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql
index 64a1a6a..1c885e4 100644
--- a/Open-ILS/src/sql/Pg/002.schema.config.sql
+++ b/Open-ILS/src/sql/Pg/002.schema.config.sql
@@ -87,7 +87,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 ('0726', :eg_version); -- denials
+INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0727', :eg_version); -- denials/mrpeters
 
 CREATE TABLE config.bib_source (
 	id		SERIAL	PRIMARY KEY,
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.function.xml_pretty_print.sql b/Open-ILS/src/sql/Pg/upgrade/0727.function.xml_pretty_print.sql
similarity index 69%
rename from Open-ILS/src/sql/Pg/upgrade/XXXX.function.xml_pretty_print.sql
rename to Open-ILS/src/sql/Pg/upgrade/0727.function.xml_pretty_print.sql
index 0992821..d009070 100644
--- a/Open-ILS/src/sql/Pg/upgrade/XXXX.function.xml_pretty_print.sql
+++ b/Open-ILS/src/sql/Pg/upgrade/0727.function.xml_pretty_print.sql
@@ -1,3 +1,13 @@
+-- Evergreen DB patch 0727.function.xml_pretty_print.sql
+--
+-- A simple pretty printer for XML.
+-- Particularly useful for debugging the biblio.record_entry.marc field.
+--
+BEGIN;
+
+-- check whether patch can be applied
+SELECT evergreen.upgrade_deps_block_check('0727', :eg_version);
+
 CREATE OR REPLACE FUNCTION evergreen.xml_pretty_print(input XML) 
     RETURNS XML
     LANGUAGE SQL AS
@@ -19,3 +29,4 @@ $func$;
 COMMENT ON FUNCTION evergreen.xml_pretty_print(input XML) IS
 'Simple pretty printer for XML, as written by Andrew Dunstan at http://goo.gl/zBHIk';
 
+COMMIT;

commit ec8b943faef89235c0806db983864398acba5b2c
Author: Dan Scott <dan at coffeecode.net>
Date:   Fri Mar 16 21:49:45 2012 -0400

    Add an XML pretty printer database function
    
    Andrew Dunstan was kind enough to share an XML pretty printer function
    for PostgreSQL, and it sure is handy when you're debugging things like
    in-database unapi and MARCXML.
    
    Note that it expects honest-to-goodness XML data type input, so for
    biblio.record_entry.marc columns you'll need to cast it from TEXT.
    
    Signed-off-by: Dan Scott <dan at coffeecode.net>
    Signed-off-by: Michael Peters <mrpeters at library.in.gov>

diff --git a/Open-ILS/src/sql/Pg/000.functions.general.sql b/Open-ILS/src/sql/Pg/000.functions.general.sql
index 6a46d1b..ffbc629 100644
--- a/Open-ILS/src/sql/Pg/000.functions.general.sql
+++ b/Open-ILS/src/sql/Pg/000.functions.general.sql
@@ -36,4 +36,25 @@ $$ LANGUAGE PLPERLU STRICT IMMUTABLE;
 -- Provide a named type for patching functions
 CREATE TYPE evergreen.patch AS (patch TEXT);
 
+CREATE OR REPLACE FUNCTION evergreen.xml_pretty_print(input XML) 
+    RETURNS XML
+    LANGUAGE SQL AS
+$func$
+SELECT xslt_process($1::text,
+$$<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
+    version="1.0">
+   <xsl:output method="xml" omit-xml-declaration="yes" indent="yes"/>
+   <xsl:strip-space elements="*"/>
+   <xsl:template match="@*|node()">
+     <xsl:copy>
+       <xsl:apply-templates select="@*|node()"/>
+     </xsl:copy>
+   </xsl:template>
+ </xsl:stylesheet>
+$$::text)::XML
+$func$;
+
+COMMENT ON FUNCTION evergreen.xml_pretty_print(input XML) IS
+'Simple pretty printer for XML, as written by Andrew Dunstan at http://goo.gl/zBHIk';
+
 COMMIT;
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.function.xml_pretty_print.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.function.xml_pretty_print.sql
new file mode 100644
index 0000000..0992821
--- /dev/null
+++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.function.xml_pretty_print.sql
@@ -0,0 +1,21 @@
+CREATE OR REPLACE FUNCTION evergreen.xml_pretty_print(input XML) 
+    RETURNS XML
+    LANGUAGE SQL AS
+$func$
+SELECT xslt_process($1::text,
+$$<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
+    version="1.0">
+   <xsl:output method="xml" omit-xml-declaration="yes" indent="yes"/>
+   <xsl:strip-space elements="*"/>
+   <xsl:template match="@*|node()">
+     <xsl:copy>
+       <xsl:apply-templates select="@*|node()"/>
+     </xsl:copy>
+   </xsl:template>
+ </xsl:stylesheet>
+$$::text)::XML
+$func$;
+
+COMMENT ON FUNCTION evergreen.xml_pretty_print(input XML) IS
+'Simple pretty printer for XML, as written by Andrew Dunstan at http://goo.gl/zBHIk';
+

-----------------------------------------------------------------------

Summary of changes:
 Open-ILS/src/sql/Pg/000.functions.general.sql      |   21 +++++++++++++
 Open-ILS/src/sql/Pg/002.schema.config.sql          |    2 +-
 .../Pg/upgrade/0727.function.xml_pretty_print.sql  |   32 ++++++++++++++++++++
 3 files changed, 54 insertions(+), 1 deletions(-)
 create mode 100644 Open-ILS/src/sql/Pg/upgrade/0727.function.xml_pretty_print.sql


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list