pggeodb.nancy.inra.fr/db_robot - db_robot on pggeodb.nancy.inra.fr
Previous topic Chapter index Next topic

Function: cleartopogeom

 

 

Schema

topology

 

Owner

albenard

 

Descriptions

args: topogeom - Clears the content of a topo geometry

 

Options

Option

Value

Returns

topology.topogeometry

Language

plpgsql

Parameters

tg topology.topogeometry

 

Definition

CREATE OR REPLACE FUNCTION topology.cleartopogeom (
 tg topology.topogeometry
)
RETURNS topology.topogeometry AS
$span$
DECLARE

 topology_info RECORD;
 sql TEXT;
BEGIN

 -- Get topology information
 SELECT id, name FROM topology.topology
   INTO topology_info
   WHERE id = topology_id(tg);
 IF NOT FOUND THEN
     RAISE EXCEPTION
'No topology with id "%" in topology.topology', topology_id(tg);
 END IF;

 -- Clear the TopoGeometry contents
 sql := 'DELETE FROM ' || quote_ident(topology_info.name)
       || '.relation WHERE layer_id = '
       || layer_id(tg)
       || ' AND topogeo_id = '
       || id(tg);
 EXECUTE sql;


 RETURN tg;

END
$span$
LANGUAGE
'plpgsql'
VOLATILE
RETURNS NULL ON NULL INPUT
SECURITY INVOKER
COST
100;

COMMENT ON FUNCTION topology.cleartopogeom(tg topology.topogeometry)
IS 'args: topogeom - Clears the content of a topo geometry';

This file was generated with SQL Manager for PostgreSQL (www.pgsqlmanager.com) at 26/02/2014 11:51
Previous topic Chapter index Next topic