User Tools

Site Tools


podoc:number_of_manufacturer_ref_sql_function

Database Function Description of "number_of_manufacturer_ref"

Name

number_of_manufacturer_ref

Description

Counts the number of references to a particular manufacturer.

Tentative (is this correct?): this represents the number of equipment items in the database created by the specified manufacturer.

Purpose

To retrieve the number of references to a particular manufacturer.

Schema

CREATE FUNCTION number_of_manufacturer_ref(INTEGER) RETURNS BIGINT AS '
        select ((select count(identifier) from lens_type where manufacturer = $1) +
            (select count(identifier) from camera_type where manufacturer = $1) +
            (select count(identifier) from scanner_type where manufacturer = $1) +
            (select count(identifier) from support_type where manufacturer = $1) +
            (select count(identifier) from film_type where manufacturer = $1) +
            (select count(identifier) from flash_type where manufacturer = $1))
' LANGUAGE 'sql';

History

Used first

Version 2.5

Used last

Still in use

Change history

= Version 2.5 =

CREATE FUNCTION number_of_manufacturer_ref(INTEGER) RETURNS BIGINT
AS 'select ((select count(identifier) from lens_type where manufacturer = $1) +
            (select count(identifier) from camera_type where manufacturer = $1) +
            (select count(identifier) from flash_type where manufacturer = $1) +
            (select count(identifier) from scanner_type where manufacturer = $1) +
            (select count(identifier) from support_type where manufacturer = $1) +
            (select count(identifier) from film_type where manufacturer = $1) +
            (select count(identifier) from flash_type where manufacturer = $1))' LANGUAGE 'sql';

= Version 2.34 =

---- Fix up a couple of bogus functions
CREATE OR REPLACE FUNCTION number_of_manufacturer_ref(INTEGER) RETURNS BIGINT AS '
        select ((select count(identifier) from lens_type where manufacturer = $1) +
            (select count(identifier) from camera_type where manufacturer = $1) +
            (select count(identifier) from scanner_type where manufacturer = $1) +
            (select count(identifier) from support_type where manufacturer = $1) +
            (select count(identifier) from film_type where manufacturer = $1) +
            (select count(identifier) from flash_type where manufacturer = $1))
' LANGUAGE 'sql';
podoc/number_of_manufacturer_ref_sql_function.txt · Last modified: 2007/10/19 16:07 by Luud