count_photos_by_album
Count the photos per album for all albums.
To retrieve the number of photos per album for all albums.
CREATE FUNCTION count_photos_by_album(INTEGER, INTEGER, VARCHAR[]) RETURNS BIGINT AS ' select count(photo) from album_content where album = $1 and can_access_photo(photo, $2, $3); ' LANGUAGE 'sql';
Version 2.5
Still in use
= Version 2.5 =
CREATE FUNCTION count_photos_by_album(INTEGER) RETURNS BIGINT AS 'select count(photo.identifier) from album_content, photo where album_content.photo=photo.identifier and album = $1' LANGUAGE 'sql';
CREATE FUNCTION count_photos_by_album(INTEGER, INTEGER) RETURNS BIGINT AS 'select count(photo.identifier) from album_content, photo, album where album_content.photo=photo.identifier and album_content.album=album.identifier and album_content.album = $1 and photo.access_rights <= $2' LANGUAGE 'sql';
= Version 2.34 =
DROP FUNCTION count_photos_by_album(INTEGER); DROP FUNCTION count_photos_by_album(INTEGER, INTEGER); CREATE OR REPLACE FUNCTION count_photos_by_album(INTEGER, INTEGER, VARCHAR[]) RETURNS BIGINT AS ' select count(photo) from album_content where album = $1 and can_access_photo(photo, $2, $3); ' LANGUAGE 'sql';