libreccm-legacy/ccm-core/test/sql/postgres/domain/setup.sql

38 lines
1.4 KiB
PL/PgSQL
Executable File

--
-- Copyright (C) 2002-2004 Red Hat Inc. All Rights Reserved.
--
-- This library is free software; you can redistribute it and/or
-- modify it under the terms of the GNU Lesser General Public License
-- as published by the Free Software Foundation; either version 2.1 of
-- the License, or (at your option) any later version.
--
-- This library is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- Lesser General Public License for more details.
--
-- You should have received a copy of the GNU Lesser General Public
-- License along with this library; if not, write to the Free Software
-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
--
-- $Id: setup.sql 287 2005-02-22 00:29:02Z sskracic $
-- $DateTime: 2004/08/16 18:10:38 $
@@ ../../default/domain/setup.sql
create or replace function package_abstractness(integer)
returns numeric as '
declare
v_id alias for $1;
abs_count numeric;
total numeric;
begin
select count(*) into abs_count from t_class where package_id = v_id and is_abstract = 1;
select count(*) into total from t_class where package_id = v_id;
return abs_count / total;
end' language 'plpgsql';
@@ ../com/arsdigita/domain/create.sql
@@ ../com/arsdigita/domain/deferred.sql