User Tools

Site Tools


podoc:count_albums_by_user_sql_function

Database Function Description of "count_albums_by_user"

Name

count_albums_by_user

Description

Counts the number of albums for a given user.

There are two versions, one that counts all albums and one that counts only those albums up to a given access rights setting.

Purpose

To retrieve the number of albums of a user.

Schema

CREATE FUNCTION count_albums_by_user(INTEGER) RETURNS BIGINT
AS 'select count(identifier) from album where users = $1' LANGUAGE 'sql';
CREATE FUNCTION count_albums_by_user(INTEGER, INTEGER) RETURNS BIGINT
AS 'select count(identifier) from album where users = $1 and access_rights <= $2' LANGUAGE 'sql';

History

Used first

Version 2.5

Used last

Still in use

Change history

= Version 2.5 =

CREATE FUNCTION count_albums_by_user(INTEGER) RETURNS BIGINT
AS 'select count(identifier) from album where users = $1' LANGUAGE 'sql';
CREATE FUNCTION count_albums_by_user(INTEGER, INTEGER) RETURNS BIGINT
AS 'select count(identifier) from album where users = $1 and access_rights <= $2' LANGUAGE 'sql';
podoc/count_albums_by_user_sql_function.txt · Last modified: 2007/04/23 14:25 by Luud