===== Database Function Description of "count_photos_by_album" =====
=== Name ===
count_photos_by_album
=== Description ===
Count the photos per album for all albums.
=== Purpose ===
To retrieve the number of photos per album for all albums.
=== Schema ===
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';
=== Related tables ===
* [[album sql table|album]]
* [[album_content sql table|album_content]]
* [[photo sql table|photo]]
=== History ===
== Used first ==
Version 2.5
== Used last ==
Still in use
== Change history ==
= 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';