User Tools

Site Tools


podoc:count_photos_by_folder_sql_function

Database Function Description of "count_photos_by_folder"

Name

count_photos_by_folder

Description

Count the photos in a particular folder.

Purpose

To retrieve the number of photos in a particular folder.

Schema

CREATE FUNCTION count_photos_by_folder(INTEGER, INTEGER, VARCHAR[]) RETURNS BIGINT AS '
select count(identifier) from photo where folder = $1 and can_access_photo(identifier, $2, $3);
' LANGUAGE 'sql';

History

Used first

Version 2.5

Used last

Still in use

Change history

= Version 2.5 =

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

= Version 2.34 =

DROP FUNCTION count_photos_by_folder(INTEGER);
DROP FUNCTION count_photos_by_folder(INTEGER, INTEGER);
 
CREATE OR REPLACE FUNCTION count_photos_by_folder(INTEGER, INTEGER, VARCHAR[]) RETURNS BIGINT AS '
select count(identifier) from photo where folder = $1 and can_access_photo(identifier, $2, $3);
' LANGUAGE 'sql';
podoc/count_photos_by_folder_sql_function.txt · Last modified: 2007/10/19 16:27 by Luud