podoc:count_equipment_by_user_sql_function
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
podoc:count_equipment_by_user_sql_function [2007/04/23 14:25] – Luud | podoc:count_equipment_by_user_sql_function [2007/10/19 16:08] (current) – Luud | ||
---|---|---|---|
Line 18: | Line 18: | ||
<code sql> | <code sql> | ||
- | create function count_equipment_by_user(integer) returns bigint | + | create function count_equipment_by_user(integer) returns bigint as ' |
- | as ' | + | |
(select count(identifier) from camera where users = $1) + | (select count(identifier) from camera where users = $1) + | ||
- | (select count(identifier) from flash where users = $1) + | ||
(select count(identifier) from scanner where users = $1) + | (select count(identifier) from scanner where users = $1) + | ||
(select count(identifier) from film where users = $1) + | (select count(identifier) from film where users = $1) + | ||
(select count(identifier) from support where users = $1) + | (select count(identifier) from support where users = $1) + | ||
- | (select count(identifier) from flash where users = $1))' language ' | + | (select count(identifier) from flash where users = $1)) |
+ | ' language ' | ||
</ | </ | ||
<code sql> | <code sql> | ||
- | create function count_equipment_by_user(integer, | + | create function count_equipment_by_user(integer, |
- | as ' | + | |
(select count(identifier) from camera where users = $1 and access_rights <= $2) + | (select count(identifier) from camera where users = $1 and access_rights <= $2) + | ||
- | (select count(identifier) from flash where users = $1 and access_rights <= $2) + | ||
(select count(identifier) from scanner where users = $1 and access_rights <= $2) + | (select count(identifier) from scanner where users = $1 and access_rights <= $2) + | ||
(select count(identifier) from film where users = $1 and access_rights <= $2) + | (select count(identifier) from film where users = $1 and access_rights <= $2) + | ||
(select count(identifier) from support where users = $1 and access_rights <= $2) + | (select count(identifier) from support where users = $1 and access_rights <= $2) + | ||
- | (select count(identifier) from flash where users = $1 and access_rights <= $2))' language ' | + | (select count(identifier) from flash where users = $1 and access_rights <= $2)) |
+ | ' language ' | ||
</ | </ | ||
Line 82: | Line 82: | ||
(select count(identifier) from support where users = $1 and access_rights <= $2) + | (select count(identifier) from support where users = $1 and access_rights <= $2) + | ||
(select count(identifier) from flash where users = $1 and access_rights <= $2))' language ' | (select count(identifier) from flash where users = $1 and access_rights <= $2))' language ' | ||
+ | </ | ||
+ | |||
+ | = Version 2.34 = | ||
+ | |||
+ | <code sql> | ||
+ | ---- Fix up a couple of bogus functions | ||
+ | create or replace function count_equipment_by_user(integer) returns bigint as ' | ||
+ | select ((select count(identifier) from lens where users = $1) + | ||
+ | (select count(identifier) from camera where users = $1) + | ||
+ | (select count(identifier) from scanner where users = $1) + | ||
+ | (select count(identifier) from film where users = $1) + | ||
+ | (select count(identifier) from support where users = $1) + | ||
+ | (select count(identifier) from flash where users = $1)) | ||
+ | ' language ' | ||
+ | |||
+ | create or replace function count_equipment_by_user(integer, | ||
+ | select ((select count(identifier) from lens where users = $1 and access_rights <= $2) + | ||
+ | (select count(identifier) from camera where users = $1 and access_rights <= $2) + | ||
+ | (select count(identifier) from scanner where users = $1 and access_rights <= $2) + | ||
+ | (select count(identifier) from film where users = $1 and access_rights <= $2) + | ||
+ | (select count(identifier) from support where users = $1 and access_rights <= $2) + | ||
+ | (select count(identifier) from flash where users = $1 and access_rights <= $2)) | ||
+ | ' language ' | ||
</ | </ | ||
podoc/count_equipment_by_user_sql_function.txt · Last modified: 2007/10/19 16:08 by Luud