[open-ils-commits] r16849 - in trunk/Open-ILS/src/sql/Pg: . upgrade (erickson)
svn at svn.open-ils.org
svn at svn.open-ils.org
Tue Jul 6 11:42:29 EDT 2010
Author: erickson
Date: 2010-07-06 11:42:26 -0400 (Tue, 06 Jul 2010)
New Revision: 16849
Added:
trunk/Open-ILS/src/sql/Pg/upgrade/0324.schema.usr_visible_circ_copies.sql
Modified:
trunk/Open-ILS/src/sql/Pg/002.schema.config.sql
trunk/Open-ILS/src/sql/Pg/090.schema.action.sql
Log:
added stored proc to return the distinct set of target copies from a users visible circ history
Modified: trunk/Open-ILS/src/sql/Pg/002.schema.config.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/002.schema.config.sql 2010-07-06 15:12:04 UTC (rev 16848)
+++ trunk/Open-ILS/src/sql/Pg/002.schema.config.sql 2010-07-06 15:42:26 UTC (rev 16849)
@@ -68,7 +68,7 @@
install_date TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
);
-INSERT INTO config.upgrade_log (version) VALUES ('0323'); -- senator
+INSERT INTO config.upgrade_log (version) VALUES ('0324'); -- berick
CREATE TABLE config.bib_source (
id SERIAL PRIMARY KEY,
Modified: trunk/Open-ILS/src/sql/Pg/090.schema.action.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/090.schema.action.sql 2010-07-06 15:12:04 UTC (rev 16848)
+++ trunk/Open-ILS/src/sql/Pg/090.schema.action.sql 2010-07-06 15:42:26 UTC (rev 16849)
@@ -616,6 +616,16 @@
END;
$func$ LANGUAGE PLPGSQL;
+CREATE OR REPLACE FUNCTION action.usr_visible_circ_copies( user_id INTEGER ) RETURNS SETOF INTEGER AS $$
+ DECLARE
+ copy INTEGER;
+ BEGIN
+ FOR copy IN SELECT DISTINCT(target_copy) FROM action.usr_visible_circs(user_id) LOOP
+ RETURN NEXT copy;
+ END LOOP;
+ END;
+$$ LANGUAGE plpgsql;
+
CREATE OR REPLACE FUNCTION action.usr_visible_holds (usr_id INT) RETURNS SETOF action.hold_request AS $func$
DECLARE
h action.hold_request%ROWTYPE;
Added: trunk/Open-ILS/src/sql/Pg/upgrade/0324.schema.usr_visible_circ_copies.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/upgrade/0324.schema.usr_visible_circ_copies.sql (rev 0)
+++ trunk/Open-ILS/src/sql/Pg/upgrade/0324.schema.usr_visible_circ_copies.sql 2010-07-06 15:42:26 UTC (rev 16849)
@@ -0,0 +1,16 @@
+BEGIN;
+
+INSERT INTO config.upgrade_log (version) VALUES ('0324');
+
+-- returns the distinct set of target copy IDs from a user's visible circulation history
+CREATE OR REPLACE FUNCTION action.usr_visible_circ_copies( user_id INTEGER ) RETURNS SETOF INTEGER AS $$
+ DECLARE
+ copy INTEGER;
+ BEGIN
+ FOR copy IN SELECT DISTINCT(target_copy) FROM action.usr_visible_circs(user_id) LOOP
+ RETURN NEXT copy;
+ END LOOP;
+ END;
+$$ LANGUAGE plpgsql;
+
+COMMIT;
More information about the open-ils-commits
mailing list