source: trunk/data/konvert/transaction_delete.sql @ 98

Revision 98, 1.2 KB checked in by astrid.emde, 13 years ago (diff)

table delete

Line 
1-- Table: "delete"
2
3-- DROP TABLE "delete";
4
5CREATE TABLE "delete"
6(
7  ogc_fid serial NOT NULL,
8  typename character(33),
9  featureid character(32),
10  CONSTRAINT delete_pk PRIMARY KEY (ogc_fid)
11)
12WITH (
13  OIDS=TRUE
14);
15ALTER TABLE "delete" OWNER TO postgres;
16
17DROP FUNCTION deletefeature(text, text);
18CREATE FUNCTION deleteFeature(typename text, featureid text) RETURNS text
19AS $$
20 DECLARE
21  query text;
22  res text;
23 BEGIN
24     query := 'DELETE FROM ' || $1 || ' WHERE gml_id = substring(''' || $2 || ''' from 1 for 16)';
25     EXECUTE query;
26
27     IF FOUND THEN
28        RAISE NOTICE 'query successfull % ', query;
29        res := 1;
30     ELSE
31        RAISE NOTICE 'query no object found % ', query;
32        res := 0;
33     END IF;
34  RETURN res;
35 END;
36$$ LANGUAGE plpgsql;
37
38
39INSERT INTO AA_Antragsgebiet (gml_id) VALUES ('DENW44AL0000okRc');
40
41INSERT INTO delete (typename, featureid) VALUES ('AA_Antragsgebiet','DENW44AL0000okRc20110428T135110Z');
42
43Select deleteFeature('AA_Antragsgebiet','DENW44AL0000okRc20110428T135110Z');
44
45INSERT INTO AA_Antragsgebiet (gml_id) VALUES ('DENW44AL0000okRc');
46
47Select * from AA_Antragsgebiet
48
49Select substring('DENW44AL0000okRc20110428T135110Z' from 1 for 16)
50
51Select deleteFeature(typename,featureid) from delete;
Note: See TracBrowser for help on using the repository browser.