[open-ils-commits] r15475 - in trunk/Open-ILS/src/sql/Pg: . upgrade (miker)
svn at svn.open-ils.org
svn at svn.open-ils.org
Mon Feb 8 15:52:12 EST 2010
Author: miker
Date: 2010-02-08 15:52:07 -0500 (Mon, 08 Feb 2010)
New Revision: 15475
Added:
trunk/Open-ILS/src/sql/Pg/upgrade/0155.schema.more-ingest-normalizers.sql
Modified:
trunk/Open-ILS/src/sql/Pg/002.schema.config.sql
trunk/Open-ILS/src/sql/Pg/020.schema.functions.sql
Log:
adding more ingest normalizers
Modified: trunk/Open-ILS/src/sql/Pg/002.schema.config.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/002.schema.config.sql 2010-02-08 20:18:12 UTC (rev 15474)
+++ trunk/Open-ILS/src/sql/Pg/002.schema.config.sql 2010-02-08 20:52:07 UTC (rev 15475)
@@ -51,7 +51,7 @@
install_date TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
);
-INSERT INTO config.upgrade_log (version) VALUES ('0154'); -- Scott McKellar
+INSERT INTO config.upgrade_log (version) VALUES ('0155'); -- miker
CREATE TABLE config.bib_source (
id SERIAL PRIMARY KEY,
Modified: trunk/Open-ILS/src/sql/Pg/020.schema.functions.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/020.schema.functions.sql 2010-02-08 20:18:12 UTC (rev 15474)
+++ trunk/Open-ILS/src/sql/Pg/020.schema.functions.sql 2010-02-08 20:52:07 UTC (rev 15475)
@@ -96,6 +96,14 @@
SELECT regexp_replace(regexp_replace(regexp_replace($1, E'\\n', ' ', 'g'), E'(?:^\\s+)|(\\s+$)', '', 'g'), E'\\s+', ' ', 'g');
$$ LANGUAGE SQL;
+CREATE OR REPLACE FUNCTION public.remove_commas( TEXT ) RETURNS TEXT AS $$
+ SELECT regexp_replace($1, ',', '', 'g');
+$$ LANGUAGE SQL;
+
+CREATE OR REPLACE FUNCTION public.remove_whitespace( TEXT ) RETURNS TEXT AS $$
+ SELECT regexp_replace(normalize_space($1), E'\\s+', '', 'g');
+$$ LANGUAGE SQL;
+
CREATE OR REPLACE FUNCTION public.lowercase( TEXT ) RETURNS TEXT AS $$
return lc(shift);
$$ LANGUAGE PLPERLU;
Added: trunk/Open-ILS/src/sql/Pg/upgrade/0155.schema.more-ingest-normalizers.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/upgrade/0155.schema.more-ingest-normalizers.sql (rev 0)
+++ trunk/Open-ILS/src/sql/Pg/upgrade/0155.schema.more-ingest-normalizers.sql 2010-02-08 20:52:07 UTC (rev 15475)
@@ -0,0 +1,14 @@
+
+BEGIN;
+
+INSERT INTO config.upgrade_log (version) VALUES ('0155'); -- miker
+
+CREATE OR REPLACE FUNCTION public.remove_commas( TEXT ) RETURNS TEXT AS $$
+ SELECT regexp_replace($1, ',', '', 'g');
+$$ LANGUAGE SQL;
+
+CREATE OR REPLACE FUNCTION public.remove_whitespace( TEXT ) RETURNS TEXT AS $$
+ SELECT regexp_replace(normalize_space($1), E'\\s+', '', 'g');
+$$ LANGUAGE SQL;
+
+COMMIT;
More information about the open-ils-commits
mailing list