[open-ils-commits] r19887 - trunk/Open-ILS/src/sql/Pg/upgrade (miker)
svn at svn.open-ils.org
svn at svn.open-ils.org
Tue Mar 29 12:06:29 EDT 2011
Author: miker
Date: 2011-03-29 12:06:26 -0400 (Tue, 29 Mar 2011)
New Revision: 19887
Modified:
trunk/Open-ILS/src/sql/Pg/upgrade/0504.schema.parts_and_cnaffix.sql
Log:
Missed function in upgrade script
Modified: trunk/Open-ILS/src/sql/Pg/upgrade/0504.schema.parts_and_cnaffix.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/upgrade/0504.schema.parts_and_cnaffix.sql 2011-03-29 15:39:05 UTC (rev 19886)
+++ trunk/Open-ILS/src/sql/Pg/upgrade/0504.schema.parts_and_cnaffix.sql 2011-03-29 16:06:26 UTC (rev 19887)
@@ -2,6 +2,21 @@
INSERT INTO config.upgrade_log (version) VALUES ('0504'); -- miker
+CREATE OR REPLACE FUNCTION lpad_number_substrings( TEXT, TEXT, INT ) RETURNS TEXT AS $$
+ my $string = shift;
+ my $pad = shift;
+ my $len = shift;
+ my $find = $len - 1;
+
+ while ($string =~ /(?:^|\D)(\d{1,$find})(?:$|\D)/) {
+ my $padded = $1;
+ $padded = $pad x ($len - length($padded)) . $padded;
+ $string =~ s/$1/$padded/sg;
+ }
+
+ return $string;
+$$ LANGUAGE PLPERLU;
+
CREATE TABLE biblio.monograph_part (
id SERIAL PRIMARY KEY,
record BIGINT NOT NULL REFERENCES biblio.record_entry (id),
More information about the open-ils-commits
mailing list