User Tools

Site Tools


podoc:count_subalbums_by_album_sql_function

Database Function Description of "count_subalbums_by_album"

Name

count_subalbums_by_album

Description

Count the number of sub-albums in a particular album.

Purpose

To retrieve the number of sub-albums in a particular album.

Schema

CREATE FUNCTION count_subalbums_by_album(INTEGER, INTEGER, VARCHAR[]) RETURNS BIGINT AS '
select count(identifier) from album where parent_album = $1 and can_access_album(identifier, $2, $3);
' LANGUAGE 'sql';

History

Used first

Version 2.29

Used last

Still in use

Change history

= Version 2.29 =

CREATE FUNCTION count_subalbums_by_album(INTEGER) RETURNS BIGINT
AS 'select count(identifier) from album where parent_album = $1' LANGUAGE 'sql';
CREATE FUNCTION count_subalbums_by_album(INTEGER, INTEGER) RETURNS BIGINT
AS 'select count(identifier) from album where parent_album = $1 and access_rights <= $2' LANGUAGE 'sql';

= Version 2.34 =

DROP FUNCTION count_subalbums_by_album(INTEGER);
DROP FUNCTION count_subalbums_by_album(INTEGER, INTEGER);
 
CREATE OR REPLACE FUNCTION count_subalbums_by_album(INTEGER, INTEGER, VARCHAR[]) RETURNS BIGINT AS '
select count(identifier) from album where parent_album = $1 and can_access_album(identifier, $2, $3);
' LANGUAGE 'sql';
podoc/count_subalbums_by_album_sql_function.txt · Last modified: 2007/10/19 16:29 by Luud