podoc:count_subalbums_by_album_sql_function
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
podoc:count_subalbums_by_album_sql_function [2007/04/18 13:45] – Luud | podoc:count_subalbums_by_album_sql_function [2007/10/19 20:29] (current) – Luud | ||
---|---|---|---|
Line 8: | Line 8: | ||
Count the number of sub-albums in a particular album. | Count the number of sub-albums in a particular album. | ||
- | |||
- | There are two versions, one that counts all albums and one that counts only those albums up to a given access rights setting. | ||
=== Purpose === | === Purpose === | ||
Line 17: | Line 15: | ||
=== Schema === | === Schema === | ||
- | <code> | + | <code sql> |
- | create function count_subalbums_by_album(integer) returns bigint | + | create function count_subalbums_by_album(integer, |
- | as ' | + | select count(identifier) from album where parent_album = $1 and can_access_album(identifier, |
- | </ | + | ' language ' |
- | + | ||
- | <code> | + | |
- | create function count_subalbums_by_album(integer, | + | |
- | as ' | + | |
</ | </ | ||
Line 45: | Line 39: | ||
= Version 2.29 = | = Version 2.29 = | ||
- | < | + | < |
create function count_subalbums_by_album(integer) returns bigint | create function count_subalbums_by_album(integer) returns bigint | ||
as ' | as ' | ||
</ | </ | ||
- | < | + | < |
create function count_subalbums_by_album(integer, | create function count_subalbums_by_album(integer, | ||
as ' | as ' | ||
+ | </ | ||
+ | |||
+ | = Version 2.34 = | ||
+ | |||
+ | <code sql> | ||
+ | drop function count_subalbums_by_album(integer); | ||
+ | drop function count_subalbums_by_album(integer, | ||
+ | |||
+ | create or replace function count_subalbums_by_album(integer, | ||
+ | select count(identifier) from album where parent_album = $1 and can_access_album(identifier, | ||
+ | ' language ' | ||
</ | </ | ||
podoc/count_subalbums_by_album_sql_function.1176903906.txt.gz · Last modified: 2007/04/18 13:45 by Luud