User Tools

Site Tools


podoc:count_photos_by_folder_sql_function

Differences

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

Link to this comparison view

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, integer, varchar[]) returns bigint as ' 
-as 'select count(identifier) from photo where folder = $1' language 'sql'; +select count(identifier) from photo where folder = $1 and can_access_photo(identifier, $2, $3); 
-</code> +' language 'sql';
- +
-<code+
-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';+
 </code> </code>
  
Line 45: Line 39:
 = Version 2.5 = = Version 2.5 =
  
-<code>+<code sql>
 create function count_photos_by_folder(integer) returns bigint create function count_photos_by_folder(integer) returns bigint
 as 'select count(identifier) from photo where folder = $1' language 'sql'; as 'select count(identifier) from photo where folder = $1' language 'sql';
 </code> </code>
  
-<code>+<code sql>
 create function count_photos_by_folder(integer, integer) returns bigint 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'; as 'select count(identifier) from photo where folder = $1 and access_rights <= $2' language 'sql';
 +</code>
 +
 += Version 2.34 =
 +
 +<code sql>
 +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';
 </code> </code>
  
podoc/count_photos_by_folder_sql_function.1176902723.txt.gz · Last modified: 2007/04/18 13:25 by Luud