This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
podoc:count_photos_by_folder_sql_function [2007/04/18 13:25] Luud |
podoc:count_photos_by_folder_sql_function [2007/10/19 20:27] (current) Luud |
||
---|---|---|---|
Line 8: | Line 8: | ||
Count the photos in a particular folder. | Count the photos in a particular folder. | ||
- | |||
- | There are two versions, one that counts all photos and one that counts only those photos up to a given access rights setting. | ||
=== Purpose === | === Purpose === | ||
Line 17: | Line 15: | ||
=== Schema === | === Schema === | ||
- | <code> | + | <code sql> |
- | create function count_photos_by_folder(integer) returns bigint | + | create function count_photos_by_folder(integer, |
- | as ' | + | select count(identifier) from photo where folder = $1 and can_access_photo(identifier, |
- | </ | + | ' language ' |
- | + | ||
- | <code> | + | |
- | create function count_photos_by_folder(integer, | + | |
- | as ' | + | |
</ | </ | ||
Line 45: | Line 39: | ||
= Version 2.5 = | = Version 2.5 = | ||
- | < | + | < |
create function count_photos_by_folder(integer) returns bigint | create function count_photos_by_folder(integer) returns bigint | ||
as ' | as ' | ||
</ | </ | ||
- | < | + | < |
create function count_photos_by_folder(integer, | create function count_photos_by_folder(integer, | ||
as ' | as ' | ||
+ | </ | ||
+ | |||
+ | = Version 2.34 = | ||
+ | |||
+ | <code sql> | ||
+ | drop function count_photos_by_folder(integer); | ||
+ | drop function count_photos_by_folder(integer, | ||
+ | |||
+ | create or replace function count_photos_by_folder(integer, | ||
+ | select count(identifier) from photo where folder = $1 and can_access_photo(identifier, | ||
+ | ' language ' | ||
</ | </ | ||