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

Next revision
Previous revision
podoc:count_photos_by_folder_sql_function [2007/04/12 12:20]
Luud created
podoc:count_photos_by_folder_sql_function [2007/10/19 20:27] (current)
Luud
Line 1: Line 1:
-===== Database Function Description =====+===== Database Function Description of "count_photos_by_folder" =====
  
 === Name === === Name ===
 +
 +count_photos_by_folder
  
 === Description === === Description ===
 +
 +Count the photos in a particular folder.
  
 === Purpose === === Purpose ===
 +
 +To retrieve the number of photos in a particular folder.
  
 === Schema === === Schema ===
  
-=== Related tables===+<code 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); 
 +' language 'sql'; 
 +</code>
  
-=== Related sequences ===+=== Related tables ===
  
-=== Related indexes ===+  * [[photo sql table|photo]]
  
 === History === === History ===
Line 29: Line 39:
 = Version 2.5 = = Version 2.5 =
  
-  create function ... +<code 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 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> 
podoc/count_photos_by_folder_sql_function.1176380406.txt.gz · Last modified: 2007/04/12 12:20 by Luud