User Tools

Site Tools


podoc:count_subalbums_by_album_sql_function

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
podoc:count_subalbums_by_album_sql_function [2007/04/16 16:07] – created Luudpodoc:count_subalbums_by_album_sql_function [2007/10/19 20:29] (current) Luud
Line 6: Line 6:
  
 === Description === === Description ===
 +
 +Count the number of sub-albums in a particular album.
  
 === Purpose === === Purpose ===
 +
 +To retrieve the number of sub-albums in a particular album.
  
 === Schema === === Schema ===
  
-<code+<code sql> 
-create function count_subalbums_by_album(integer) returns bigint +create function count_subalbums_by_album(integer, integer, varchar[]) returns bigint as ' 
-as 'select count(identifier) from album where parent_album = $1' language 'sql'; +select count(identifier) from album where parent_album = $1 and can_access_album(identifier, $2, $3); 
-</code> +' language 'sql';
- +
-<code+
-create function count_subalbums_by_album(integer, integer) returns bigint +
-as 'select count(identifier) from album where parent_album = $1 and access_rights <= $2' language 'sql';+
 </code> </code>
  
 === Related tables === === Related tables ===
  
-=== Related indexes === +  * [[album sql table|album]]
- +
-=== Related functions === +
- +
-=== Related views ===+
  
 === History === === History ===
Line 43: Line 39:
 = Version 2.29 = = Version 2.29 =
  
-<code>+<code sql>
 create function count_subalbums_by_album(integer) returns bigint create function count_subalbums_by_album(integer) returns bigint
 as 'select count(identifier) from album where parent_album = $1' language 'sql'; as 'select count(identifier) from album where parent_album = $1' language 'sql';
 </code> </code>
  
-<code>+<code sql>
 create function count_subalbums_by_album(integer, integer) returns bigint create function count_subalbums_by_album(integer, integer) returns bigint
 as 'select count(identifier) from album where parent_album = $1 and access_rights <= $2' language 'sql'; as 'select count(identifier) from album where parent_album = $1 and access_rights <= $2' language 'sql';
 +</code>
 +
 += Version 2.34 =
 +
 +<code sql>
 +drop function count_subalbums_by_album(integer);
 +drop function count_subalbums_by_album(integer, integer);
 +
 +create or replace function count_subalbums_by_album(integer, integer, varchar[]) returns bigint as '
 +select count(identifier) from album where parent_album = $1 and can_access_album(identifier, $2, $3);
 +' language 'sql';
 </code> </code>
  
podoc/count_subalbums_by_album_sql_function.1176739673.txt.gz · Last modified: 2007/04/16 16:07 by Luud