Author: poeml Date: Mon Apr 19 23:00:28 2010 New Revision: 8035 URL: http://svn.mirrorbrain.org/viewvc/mirrorbrain?rev=8035&view=rev Log: database scheme: - add a stored procedure mirr_get_nfiles() which, given either a mirror id or its name, returns the number of files that the mirror is known to have Modified: trunk/sql/schema-postgresql.sql Modified: trunk/sql/schema-postgresql.sql URL: http://svn.mirrorbrain.org/viewvc/mirrorbrain/trunk/sql/schema-postgresql.sql?rev=8035&r1=8034&r2=8035&view=diff ============================================================================== --- trunk/sql/schema-postgresql.sql (original) +++ trunk/sql/schema-postgresql.sql Mon Apr 19 23:00:28 2010 _at_@ -258,7 +258,13 @@ $$ LANGUAGE 'plpgsql'; - +CREATE OR REPLACE FUNCTION mirr_get_nfiles(integer) RETURNS bigint AS ' + SELECT count(*) FROM filearr WHERE $1 = ANY(mirrors) +' LANGUAGE 'SQL'; + +CREATE OR REPLACE FUNCTION mirr_get_nfiles(text) RETURNS bigint AS ' + SELECT count(*) FROM filearr WHERE (SELECT id from server where identifier = $1) = ANY(mirrors) +' LANGUAGE 'SQL'; -- -------------------------------------------------------- _______________________________________________ mirrorbrain-commits mailing list Archive: http://mirrorbrain.org/archive/mirrorbrain-commits/ Note: To remove yourself from this list, send a mail with the content unsubscribe to the address mirrorbrain-commits-request_at_mirrorbrain.orgReceived on Mon Apr 19 2010 - 21:00:31 GMT
This archive was generated by hypermail 2.3.0 : Mon Feb 20 2012 - 23:47:04 GMT