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/12 16:14]
Luud
podoc:count_photos_by_folder_sql_function [2007/10/19 20:27] (current)
Luud
Line 1: Line 1:
-===== Database Sequence Description of "count_photos_by_folder" =====+===== Database Function Description of "count_photos_by_folder" =====
  
 === Name === === Name ===
Line 6: Line 6:
  
 === Description === === Description ===
 +
 +Count the photos in a particular folder.
  
 === Purpose === === Purpose ===
 +
 +To retrieve the number of photos in a particular folder.
  
 === Schema === === Schema ===
  
-  create function count_photos_by_folder(integer) returns bigint +<code sql> 
-  as 'select count(identifier) from photo where folder = $1' language 'sql'; +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); 
-  create function count_photos_by_folder(integer, integer) returns bigint +' language 'sql'; 
-  as 'select count(identifier) from photo where folder = $1 and access_rights <= $2' language 'sql';+</code>
  
 === Related tables === === Related tables ===
  
-=== Related indexes === +  * [[photo sql table|photo]]
- +
-=== Related functions === +
- +
-=== Related views ===+
  
 === History === === History ===
Line 39: Line 39:
 = Version 2.5 = = Version 2.5 =
  
-  create function count_photos_by_folder(integer) returns bigint +<code sql> 
-  as 'select count(identifier) from photo where folder = $1' language 'sql';+create function count_photos_by_folder(integer) returns bigint 
 +as 'select count(identifier) from photo where folder = $1' language 'sql'
 +</code> 
 + 
 +<code 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'; 
 +</code> 
 + 
 += Version 2.34 = 
 + 
 +<code sql> 
 +drop function count_photos_by_folder(integer); 
 +drop function count_photos_by_folder(integer, integer);
  
-  create function count_photos_by_folder(integer, integer) returns bigint +create or replace function count_photos_by_folder(integer, integer, varchar[]) returns bigint as ' 
-  as 'select count(identifier) from photo where folder = $1 and access_rights <= $2' language 'sql';+select count(identifier) from photo where folder = $1 and can_access_photo(identifier, $2, $3); 
 +' language 'sql'; 
 +</code>
  
podoc/count_photos_by_folder_sql_function.1176394461.txt.gz · Last modified: 2007/04/12 16:14 by Luud