GLE-Layer-Kompensationsflächen

Aus kvwmap
Wechseln zu: Navigation, Suche

SET @group_id = 1;
SET @connection = 'user=xxxx password=xxxx dbname=kvwmapsp';

INSERT INTO layer (`Name`,`Datentyp`,`Gruppe`,`pfad`,`Data`,`schema`,`document_path`,`tileindex`,`tileitem`,`labelangleitem`,`labelitem`,`labelmaxscale`,`labelminscale`,`labelrequires`,`connection`,`printconnection`,`connectiontype`,`classitem`,`filteritem`,`tolerance`,`toleranceunits`,`epsg_code`,`template`,`queryable`,`transparency`,`drawingorder`,`minscale`,`maxscale`,`offsite`,`ows_srs`,`wms_name`,`wms_server_version`,`wms_format`,`wms_connectiontimeout`,`wms_auth_username`,`wms_auth_password`,`wfs_geom`,`selectiontype`,`querymap`,`logconsume`) VALUES('Abbuchungen','5',@group_id,'SELECT o.massnahme, o.oek_reg_nr , a.id, a.abbuchungsnr, a.abbuchung_dat, a.ausgleichspflichtiger, a.abbuchung_vorhaben, a.abbuchung_punkte, a.bemerkung, a.bearbeiter, a.letzte_akt, abbuchungsnr||\' : \'||abbuchung_dat as vorschau FROM abbuchungen a, oekokontoflaechen o WHERE o.id=a.id','the_geom from (SELECT o.the_geom, o.massnahme, o.oek_reg_nr , a.id, a.abbuchungsnr, a.abbuchung_dat, a.ausgleichspflichtiger, a.abbuchung_vorhaben, a.abbuchung_punkte, a.bemerkung, a.bearbeiter, a.letzte_akt, abbuchungsnr||\' : \'||abbuchung_dat as vorschau FROM abbuchungen a, oekokontoflaechen o WHERE o.id=a.id) as foo','lung','','','','','',NULL,NULL,'',@connection,'','6','','','0','pixels','2398','','1',NULL,NULL,'-1','-1','','EPSG:2398','','1.1.0','image/png','60','','','','','0','0');
SET @last_layer_id25=LAST_INSERT_ID();
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id25,'abbuchungsnr','abbuchungsnr','abbuchungen','a','int4','','','0',NULL,'Text','','Abbuchungsnummer*','','3');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id25,'abbuchung_dat','abbuchung_dat','abbuchungen','a','date','','','0',NULL,'Text','','Datum der Abbuchung*','','4');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id25,'abbuchung_punkte','abbuchung_punkte','abbuchungen','a','int4','','','0',NULL,'Text','','Flächenäquivalente der Abbuchung*','','7');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id25,'abbuchung_vorhaben','abbuchung_vorhaben','abbuchungen','a','text','','','0',NULL,'Text','','Abbuchungsvorhaben*','','6');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id25,'ausgleichspflichtiger','ausgleichspflichtiger','abbuchungen','a','text','','','0',NULL,'Text','','Ausgleichspflichtiger*','','5');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id25,'bearbeiter','bearbeiter','abbuchungen','a','text','','','1',NULL,'User','','Bearbeiter','','9');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id25,'bemerkung','bemerkung','abbuchungen','a','text','','','1',NULL,'Text','','Bemerkung','','8');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id25,'id','id','abbuchungen','a','int4','','','0',NULL,'Text','','ID','','2');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id25,'letzte_akt','letzte_akt','abbuchungen','a','varchar','','','0',NULL,'Time','','Letzte Aktualisierung','','10');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id25,'massnahme','massnahme','oekokontoflaechen','o','text','','','0',NULL,'SubFormFK','23,id','Massnahme','','0');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id25,'oek_reg_nr','oek_reg_nr','oekokontoflaechen','o','text','','','0',NULL,'Text','','Registriernummer','','1');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id25,'vorschau','abbuchungsnr','abbuchungen','a','not_saveable','','','0',NULL,'Text','','Vorschau','','11');

INSERT INTO layer (`Name`,`Datentyp`,`Gruppe`,`pfad`,`Data`,`schema`,`document_path`,`tileindex`,`tileitem`,`labelangleitem`,`labelitem`,`labelmaxscale`,`labelminscale`,`labelrequires`,`connection`,`printconnection`,`connectiontype`,`classitem`,`filteritem`,`tolerance`,`toleranceunits`,`epsg_code`,`template`,`queryable`,`transparency`,`drawingorder`,`minscale`,`maxscale`,`offsite`,`ows_srs`,`wms_name`,`wms_server_version`,`wms_format`,`wms_connectiontimeout`,`wms_auth_username`,`wms_auth_password`,`wfs_geom`,`selectiontype`,`querymap`,`logconsume`) VALUES('Kompensationsflächen','2',@group_id,'SELECT *, \'\' as kontrolle_unb FROM kompensationsflaechen WHERE 1=1','the_geom FROM (select oid, id, status, gen_behoerde, the_geom from lung.kompensationsflaechen) as foo using unique oid using srid=2398','lung','','','','','gen_behoerde',NULL,NULL,'',@connection,'','6','','','3','pixels','2398','','1','50','990',NULL,'1300000','','EPSG:2398','','','','60','','','','','1','0');
SET @last_layer_id22=LAST_INSERT_ID();
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id22,'bearbeiter','bearbeiter','kompensationsflaechen','kompensationsflaechen','text','','','0',NULL,'User','','Bearbeiter','','27');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id22,'bemerkung','bemerkung','kompensationsflaechen','kompensationsflaechen','text','','','1',NULL,'Textfeld','','Bemerkung','','26');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id22,'bil_methode','bil_methode','kompensationsflaechen','kompensationsflaechen','text','','','0',NULL,'Auswahlfeld','\'HzE\',\'LBP-LF\',\'AT-RW\'','Bilanzierungsmethode*','HzE = Hinweise zur Eingriffsregelung; LBP-LF = Leitfaden zur Erstellung und Prüfung landschaftspflegerischer Begleitpläne zu Straßenbauvorhaben in Mecklenburg-Vorpommern','2');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id22,'dokument','dokument','kompensationsflaechen','kompensationsflaechen','text','','','1',NULL,'Dokument','','Dokument (JPG, PDF, DOC)','','25');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id22,'flaeche_gis','flaeche_gis','kompensationsflaechen','kompensationsflaechen','int8','','','0',NULL,'Text','','GIS-Fläche [m²]*','Ganzzahl ohne Komma!','7');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id22,'flaeche_planung','flaeche_planung','kompensationsflaechen','kompensationsflaechen','int8','','','0',NULL,'Text','','Fläche lt. Planung [m²]*','Planungsfläche aus LBP etc. Ganzzahl ohne Komma!','8');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id22,'gen_az','gen_az','kompensationsflaechen','kompensationsflaechen','text','','','0',NULL,'Text','','Aktenzeichen*','lt. Bescheid','23');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id22,'gen_behoerde','gen_behoerde','kompensationsflaechen','kompensationsflaechen','text','','','0',NULL,'Text','','Genehmigungsbehörde*','','21');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id22,'gen_dat','gen_dat','kompensationsflaechen','kompensationsflaechen','date','','','0',NULL,'Text','','Datum der Genehmigung*','lt. Bescheid','22');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id22,'gen_verfahren','gen_verfahren','kompensationsflaechen','kompensationsflaechen','text','','','0',NULL,'Auswahlfeld','\'Einzelgenehmigung\',\'Plangenehmigung\',\'Planfeststellung\',\'Planung mit Pflicht-Eingriffsregelung\'','Genehmigungsverfahren*','Typ der Genehmigung (Planung mit Pflicht-Eingriffsregelung = B-Plan)','19');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id22,'haupt_mnt','haupt_mnt','kompensationsflaechen','kompensationsflaechen','int4','','','0',NULL,'Auswahlfeld','select id as value, bezeichnung as output from massnahmetyp m where m.zielbereich = <requires>zb_haupt_mnt</requires> order by id','Hauptmaßnahmetyp*','lt. Anlage HzE','4');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id22,'id','id','kompensationsflaechen','kompensationsflaechen','int4','','','1',NULL,'Text','','ID','','0');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id22,'komp_fuer','komp_fuer','kompensationsflaechen','kompensationsflaechen','text','','','0',NULL,'Text','','Kompensation für*','Eingriff benennen','17');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id22,'komp_pflichtiger','komp_pflichtiger','kompensationsflaechen','kompensationsflaechen','text','','','0',NULL,'Text','','Kompensationspflichtiger*','','18');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id22,'kontrolle_unb','kontrolle_unb','','','unknown','','',NULL,NULL,'SubFormEmbeddedPK','24,id,kontroll_dat;embedded','Kontrollen','Dokumentation der Kontrollen durch die Untere Naturschutzbehörde','30');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id22,'kreis','kreis','kompensationsflaechen','kompensationsflaechen','text','','','0',NULL,'Auswahlfeld','select kennzeichen as value, kennzeichen as output from kreis order by id','Landkreis / kreisf.Stadt*','Name des Kreises bzw. der kreisfreien Stadt','9');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id22,'letzte_akt','letzte_akt','kompensationsflaechen','kompensationsflaechen','varchar','','','0','20','Time','','Letzte Aktualisierung','','28');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id22,'massnahme','massnahme','kompensationsflaechen','kompensationsflaechen','text','','','0',NULL,'Text','','Maßnahme*','Titel/Inhalt der Maßnahme inkl. Ortsbezeichnung','1');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id22,'neben_mnt','neben_mnt','kompensationsflaechen','kompensationsflaechen','int4','','','1',NULL,'Auswahlfeld','select id as value, bezeichnung as output from massnahmetyp m where m.zielbereich = <requires>zb_neben_mnt</requires>','Nebenmaßnahmetyp','lt. Anlage HzE','6');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id22,'oeff_sicherung','oeff_sicherung','kompensationsflaechen','kompensationsflaechen','text','','','0',NULL,'Auswahlfeld','\'keine\',\'GLb\',\'NSG\',\'Gesetzl.gesch.Biotop\',\'Alleenschutz\'','Sicherung durch Naturschutzstatus*','','15');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id22,'ortsname','ortsname','kompensationsflaechen','kompensationsflaechen','text','','','0',NULL,'Text','','Stadt / Gemeinde*','Ortsname','10');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id22,'planverfasser','planverfasser','kompensationsflaechen','kompensationsflaechen','text','','','0',NULL,'Text','','Planverfasser der Kompensationsmaßnahme*','Name Planungsbüro o.ä.','11');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id22,'privat_sicherung','privat_sicherung','kompensationsflaechen','kompensationsflaechen','text','','','0',NULL,'Auswahlfeld','\'keine\',\'Baulast\',\'Dienstbarkeit\',\'Reallast\'','Privatrechtliche Sicherung*','','16');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id22,'realisierung_y','realisierung_y','kompensationsflaechen','kompensationsflaechen','text','','','0',NULL,'Auswahlfeld','select bezeichnung as value, bezeichnung as output from lung.realisierungsjahr order by id','Jahr der Realisierung*','Umsetzungsjahr (auch festgesetztes bei künftigen Umsetzungen), bei mehrjährigen Maßnahmen Beginnjahr eintragen.','13');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id22,'rechtsgrundlage','rechtsgrundlage','kompensationsflaechen','kompensationsflaechen','text','','','0',NULL,'Auswahlfeld','\'Abfallrecht\',\'Baurecht\',\'Bergrecht\',\'Eisenbahnrecht\',\'Forstrecht\',\'Immissionsschutzrecht\',\'mehrere\',\'Naturschutzrecht\',\'Straßenbaurecht\',\'Wasserrecht\',\'Wasserstraßen-Baurecht\'','Rechtsgrundlage*','','20');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id22,'status','status','kompensationsflaechen','kompensationsflaechen','text','','','0',NULL,'Auswahlfeld','\'festgesetzt\',\'bestandskräftig\',\'realisiert\'','Status*','Umsetzungsstatus (festgesetzt = erlassen, aber noch ohne Bestandskraft)','12');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id22,'the_geom','the_geom','kompensationsflaechen','kompensationsflaechen','geometry','POLYGON','','1',NULL,'Geometrie','','','','29');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id22,'unterhaltung_y','unterhaltung_y','kompensationsflaechen','kompensationsflaechen','text','','','0',NULL,'Auswahlfeld','select bezeichnung as value, bezeichnung as output from unterhaltszeitraum order by id','Unterhaltungszeitraum gemäß § 15 (4) BNatSchG*','Zeitraum, in dem Kompensationsmaßnahme Bestand haben soll.','14');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id22,'web_url','web_url','kompensationsflaechen','kompensationsflaechen','text','','','1',NULL,'Link','','Internet-Link','Link-Adresse, beginned mit http://www.','24');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id22,'zb_haupt_mnt','zb_haupt_mnt','kompensationsflaechen','kompensationsflaechen','text','','','0',NULL,'Auswahlfeld','select distinct zielbereich  as value, zielbereich  as output from massnahmetyp order by zielbereich <required by>haupt_mnt</required by>','Zielbereich Hauptmaßnahmetyp*','lt. Anlage HzE','3');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id22,'zb_neben_mnt','zb_neben_mnt','kompensationsflaechen','kompensationsflaechen','text','','','1',NULL,'Auswahlfeld','select distinct zielbereich as value, zielbereich as output from massnahmetyp <required by>neben_mnt</required by>','Zielbereich Nebenmaßnahmetyp','lt. Anlage HzE','5');
INSERT INTO classes (`Name`,`Layer_ID`,`Expression`,`drawingorder`,`text`) VALUES('festgesetzt',@last_layer_id22,'(\'[status]\' eq \'festgesetzt\')','10','');
SET @last_class_id=LAST_INSERT_ID();
INSERT INTO styles (`symbol`,`symbolname`,`size`,`color`,`backgroundcolor`,`outlinecolor`,`minsize`,`maxsize`,`angle`,`angleitem`,`antialias`,`width`,`minwidth`,`maxwidth`,`sizeitem`) VALUES(NULL,'','1','228 23 0','','0 0 0',NULL,NULL,'360','',NULL,NULL,NULL,NULL,'');
 SET @last_style_id=LAST_INSERT_ID();
INSERT INTO u_styles2classes (style_id, class_id) VALUES (@last_style_id, @last_class_id);
INSERT INTO classes (`Name`,`Layer_ID`,`Expression`,`drawingorder`,`text`) VALUES('bestandskräftig',@last_layer_id22,'(\'[status]\' eq \'bestandskräftig\')','20','');
SET @last_class_id=LAST_INSERT_ID();
INSERT INTO styles (`symbol`,`symbolname`,`size`,`color`,`backgroundcolor`,`outlinecolor`,`minsize`,`maxsize`,`angle`,`angleitem`,`antialias`,`width`,`minwidth`,`maxwidth`,`sizeitem`) VALUES(NULL,'','1','253 255 29','','0 0 0',NULL,NULL,'360','',NULL,NULL,NULL,NULL,'');
 SET @last_style_id=LAST_INSERT_ID();
INSERT INTO u_styles2classes (style_id, class_id) VALUES (@last_style_id, @last_class_id);
INSERT INTO classes (`Name`,`Layer_ID`,`Expression`,`drawingorder`,`text`) VALUES('realisiert',@last_layer_id22,'(\'[status]\' eq \'realisiert\')','30','');
SET @last_class_id=LAST_INSERT_ID();
INSERT INTO styles (`symbol`,`symbolname`,`size`,`color`,`backgroundcolor`,`outlinecolor`,`minsize`,`maxsize`,`angle`,`angleitem`,`antialias`,`width`,`minwidth`,`maxwidth`,`sizeitem`) VALUES(NULL,'','1','56 255 32','','0 0 0',NULL,NULL,'360','',NULL,NULL,NULL,NULL,'');
 SET @last_style_id=LAST_INSERT_ID();
INSERT INTO u_styles2classes (style_id, class_id) VALUES (@last_style_id, @last_class_id);

INSERT INTO layer (`Name`,`Datentyp`,`Gruppe`,`pfad`,`Data`,`schema`,`document_path`,`tileindex`,`tileitem`,`labelangleitem`,`labelitem`,`labelmaxscale`,`labelminscale`,`labelrequires`,`connection`,`printconnection`,`connectiontype`,`classitem`,`filteritem`,`tolerance`,`toleranceunits`,`epsg_code`,`template`,`queryable`,`transparency`,`drawingorder`,`minscale`,`maxscale`,`offsite`,`ows_srs`,`wms_name`,`wms_server_version`,`wms_format`,`wms_connectiontimeout`,`wms_auth_username`,`wms_auth_password`,`wfs_geom`,`selectiontype`,`querymap`,`logconsume`) VALUES('Kontrollen Kompensationsflächen','5',@group_id,'SELECT b.massnahme, b.ortsname, k.id, k.kontroll_nr, k.kontroll_dat, k.kontrolle_durch, k.erstbearbeiter, k.ergebnis, k.bemerkung, k.kontrolle_neu, k.bearbeiter, k.letzte_akt FROM kontrollen_kompf k, kompensationsflaechen b WHERE b.id=k.id','','lung','','','','','',NULL,NULL,'',@connection,'','6','','','0','pixels','2398','','1',NULL,NULL,'-1','-1','','EPSG:2398','','1.1.0','image/png','60','','','','','0','0');
SET @last_layer_id24=LAST_INSERT_ID();
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id24,'bearbeiter','bearbeiter','kontrollen_kompf','k','text','','','1',NULL,'User','','Bearbeiter','','10');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id24,'bemerkung','bemerkung','kontrollen_kompf','k','text','','','1',NULL,'Text','','Bemerkung','','8');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id24,'ergebnis','ergebnis','kontrollen_kompf','k','text','','','0',NULL,'Auswahlfeld','\'vollständig funktionsfähig\', \'leichte Mängel\', \'gravierende Mängel\', \'nicht funktionsfähig\'','Ergebnis*','','7');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id24,'erstbearbeiter','erstbearbeiter','kontrollen_kompf','k','text','','','0',NULL,'Text','','Erstbearbeiter*','','6');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id24,'id','id','kontrollen_kompf','k','int4','','','0',NULL,'Text','','ID','','2');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id24,'kontrolle_durch','kontrolle_durch','kontrollen_kompf','k','text','','','0',NULL,'Auswahlfeld','\'Genehmigungsbehörde\', \'UNB\', \'andere\'','Kontrolle durch*','','5');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id24,'kontrolle_neu','kontrolle_neu','kontrollen_kompf','k','text','','','1',NULL,'Auswahlfeld','select bezeichnung as value, bezeichnung as output from realisierungsjahr where id > 11 order by id','nächste Kontrolle','','9');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id24,'kontroll_dat','kontroll_dat','kontrollen_kompf','k','date','','','0',NULL,'Text','','Kontroll-Datum*','','4');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id24,'kontroll_nr','kontroll_nr','kontrollen_kompf','k','int4','','','0',NULL,'Text','','lfd. Nr. der Kontrolle*','','3');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id24,'letzte_akt','letzte_akt','kontrollen_kompf','k','varchar','','','0','20','Time','','Letzte Aktualisierung','','11');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id24,'massnahme','massnahme','kompensationsflaechen','b','text','','','0',NULL,'SubFormFK','22,id','Maßnahme','','0');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id24,'ortsname','ortsname','kompensationsflaechen','b','text','','','0',NULL,'Text','','Stadt / Gemeinde','','1');

INSERT INTO layer (`Name`,`Datentyp`,`Gruppe`,`pfad`,`Data`,`schema`,`document_path`,`tileindex`,`tileitem`,`labelangleitem`,`labelitem`,`labelmaxscale`,`labelminscale`,`labelrequires`,`connection`,`printconnection`,`connectiontype`,`classitem`,`filteritem`,`tolerance`,`toleranceunits`,`epsg_code`,`template`,`queryable`,`transparency`,`drawingorder`,`minscale`,`maxscale`,`offsite`,`ows_srs`,`wms_name`,`wms_server_version`,`wms_format`,`wms_connectiontimeout`,`wms_auth_username`,`wms_auth_password`,`wfs_geom`,`selectiontype`,`querymap`,`logconsume`) VALUES('Kontrollen Ökokontoflächen','5',@group_id,'SELECT o.massnahme, o.ortsname, k.id, k.kontroll_nr, k.kontroll_dat, k.kontrolle_durch, k.erstbearbeiter, k.ergebnis, k.bemerkung, k.kontrolle_neu, k.bearbeiter, k.letzte_akt FROM kontrollen_oekokf k, oekokontoflaechen o WHERE k.id=o.id','','lung','','','','','',NULL,NULL,'',@connection,'','6','','','0','pixels','2398','','1',NULL,NULL,'-1','-1','','EPSG:2398','','1.1.0','image/png','60','','','','','0','0');
SET @last_layer_id26=LAST_INSERT_ID();
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id26,'bearbeiter','bearbeiter','kontrollen_oekokf','k','text','','','1',NULL,'User','','Bearbeiter','','10');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id26,'bemerkung','bemerkung','kontrollen_oekokf','k','text','','','1',NULL,'Text','','Bemerkung','','8');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id26,'ergebnis','ergebnis','kontrollen_oekokf','k','text','','','0',NULL,'Auswahlfeld','\'vollständig funktionsfähig\', \'leichte Mängel\', \'gravierende Mängel\', \'nicht funktionsfähig\'','Ergebnis*','','7');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id26,'erstbearbeiter','erstbearbeiter','kontrollen_oekokf','k','text','','','0',NULL,'Text','','Erstbearbeiter*','','6');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id26,'id','id','kontrollen_oekokf','k','int4','','','0',NULL,'Text','','ID','','2');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id26,'kontrolle_durch','kontrolle_durch','kontrollen_oekokf','k','text','','','0',NULL,'Auswahlfeld','\'Genehmigungsbehörde\', \'UNB\', \'andere\'','Kontrolle durch*','','5');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id26,'kontrolle_neu','kontrolle_neu','kontrollen_oekokf','k','text','','','1',NULL,'Auswahlfeld','select bezeichnung as value, bezeichnung as output from realisierungsjahr where id > 11 order by id','nächste Kontrolle','','9');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id26,'kontroll_dat','kontroll_dat','kontrollen_oekokf','k','date','','','0',NULL,'Text','','Kontroll-Datum*','','4');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id26,'kontroll_nr','kontroll_nr','kontrollen_oekokf','k','int4','','','0',NULL,'Text','','lfd. Nr. der Kontrolle*','','3');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id26,'letzte_akt','letzte_akt','kontrollen_oekokf','k','varchar','','','0','20','Time','','Letzte Aktualisierung','','11');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id26,'massnahme','massnahme','oekokontoflaechen','o','text','','','0',NULL,'SubFormFK','23,id','Maßnahme','','0');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id26,'ortsname','ortsname','oekokontoflaechen','o','text','','','0',NULL,'Text','','Stadt / Gemeinde','','1');

INSERT INTO layer (`Name`,`Datentyp`,`Gruppe`,`pfad`,`Data`,`schema`,`document_path`,`tileindex`,`tileitem`,`labelangleitem`,`labelitem`,`labelmaxscale`,`labelminscale`,`labelrequires`,`connection`,`printconnection`,`connectiontype`,`classitem`,`filteritem`,`tolerance`,`toleranceunits`,`epsg_code`,`template`,`queryable`,`transparency`,`drawingorder`,`minscale`,`maxscale`,`offsite`,`ows_srs`,`wms_name`,`wms_server_version`,`wms_format`,`wms_connectiontimeout`,`wms_auth_username`,`wms_auth_password`,`wfs_geom`,`selectiontype`,`querymap`,`logconsume`) VALUES('Ökokontoflächen','2',@group_id,'SELECT id, status, oek_reg_nr, oek_kf_behoerde, oek_einb_dat, oek_handelbar, massnahme, zb_haupt_mnt, haupt_mnt, zb_neben_mnt, neben_mnt, flaeche_gis, flaeche_planung, kreis, ortsname, planverfasser, realisierung_y, unterhaltung_y, oeff_sicherung, privat_sicherung, oek_gen_verfahren, oek_gen_behoerde, oek_gen_dat, oek_rechtsgrundlage, oek_az, oek_inhaber, oek_ansprechpartner, oek_adresse, oek_telefon, oek_email, bil_methode, oek_flaechen_aequi, (select oek_flaechen_aequi - CASE WHEN sum(abbuchung_punkte) IS NULL THEN 0 ELSE sum(abbuchung_punkte) END from abbuchungen where abbuchungen.id = oekokontoflaechen.id) AS oek_flaechen_aequi_verf, bemerkung, web_url, dokument, bearbeiter, letzte_akt, \'\' as abbuchungen, \'\' as kontrolle_unb, the_geom FROM oekokontoflaechen WHERE 1 = 1','the_geom FROM 
(select oid, id,oek_reg_nr, oek_kf_behoerde, the_geom from lung.oekokontoflaechen) 
as foo using unique oid using srid=2398','lung','','','','','oek_reg_nr',NULL,NULL,'',@connection,'','6','','','3','pixels','2398','','1','50','980',NULL,NULL,'','EPSG:2398','','','','60','','','','','1','0');
SET @last_layer_id23=LAST_INSERT_ID();
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id23,'abbuchungen','abbuchungen','','','unknown','','',NULL,NULL,'SubFormEmbeddedPK','25,id,vorschau;embedded','Abbuchungen','','38');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id23,'bearbeiter','bearbeiter','oekokontoflaechen','oekokontoflaechen','text','','','0',NULL,'User','','Bearbeiter','','36');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id23,'bemerkung','bemerkung','oekokontoflaechen','oekokontoflaechen','text','','','1',NULL,'Textfeld','','Bemerkung','','33');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id23,'bil_methode','bil_methode','oekokontoflaechen','oekokontoflaechen','text','','','0',NULL,'Auswahlfeld','\'HzE\',\'LBP-LF\',\'AT-RW\'','Bilanzierungsmethode*','','30');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id23,'dokument','dokument','oekokontoflaechen','oekokontoflaechen','text','','','1',NULL,'Dokument','','Dokument (JPG, PDF, DOC)','','35');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id23,'flaeche_gis','flaeche_gis','oekokontoflaechen','oekokontoflaechen','int8','','','0',NULL,'Text','','GIS-Fläche [m²]*','Ganzzahl ohne Komma!','11');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id23,'flaeche_planung','flaeche_planung','oekokontoflaechen','oekokontoflaechen','int8','','','0',NULL,'Text','','Fläche lt. Planung [m²]*','Ganzzahl ohne Komma!','12');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id23,'haupt_mnt','haupt_mnt','oekokontoflaechen','oekokontoflaechen','int4','','','0',NULL,'Auswahlfeld','select id as value, bezeichnung as output from massnahmetyp m where m.zielbereich = <requires>zb_haupt_mnt</requires>','Hauptmaßnahmetyp*','lt. Anlage HzE','8');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id23,'id','id','oekokontoflaechen','oekokontoflaechen','int4','','','1',NULL,'Text','','ID','','0');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id23,'kontrolle_unb','kontrolle_unb','','','unknown','','',NULL,NULL,'SubFormEmbeddedPK','26,id,kontroll_dat;embedded','Kontrollen','Dokumentation der Flächenkontrollen zum Umsetzungsstand','39');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id23,'kreis','kreis','oekokontoflaechen','oekokontoflaechen','text','','','0',NULL,'Auswahlfeld','select kennzeichen as value, kennzeichen as output from kreis order by id','Landkreis / kreisf.Stadt*','','13');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id23,'letzte_akt','letzte_akt','oekokontoflaechen','oekokontoflaechen','varchar','','','0','20','Time','','Letzte Aktualisierung','','37');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id23,'massnahme','massnahme','oekokontoflaechen','oekokontoflaechen','text','','','0',NULL,'Text','','Maßnahme*','Titel/Inhalt der Maßnahme inkl. Ortsbezeichnung','6');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id23,'neben_mnt','neben_mnt','oekokontoflaechen','oekokontoflaechen','int4','','','1',NULL,'Auswahlfeld','select id as value, bezeichnung as output from massnahmetyp m where m.zielbereich = <requires>zb_neben_mnt</requires>','Nebenmaßnahmetyp','lt. Anlage HzE','10');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id23,'oeff_sicherung','oeff_sicherung','oekokontoflaechen','oekokontoflaechen','text','','','0',NULL,'Auswahlfeld','\'keine\',\'GLb\',\'NSG\',\'Gesetzl.gesch.Biotop\',\'Alleenschutz\'','Sicherung durch Naturschutzstatus*','','18');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id23,'oek_adresse','oek_adresse','oekokontoflaechen','oekokontoflaechen','text','','','0',NULL,'Text','','Adresse*','Straße, Hausnr., PLZ, Ort','27');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id23,'oek_ansprechpartner','oek_ansprechpartner','oekokontoflaechen','oekokontoflaechen','text','','','0',NULL,'Text','','Ansprechpartner*','','26');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id23,'oek_az','oek_az','oekokontoflaechen','oekokontoflaechen','text','','','0',NULL,'Text','','Aktenzeichen*','','24');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id23,'oek_einb_dat','oek_einb_dat','oekokontoflaechen','oekokontoflaechen','date','','','0',NULL,'Text','','Datum der Einbuchung*','Datum des 2.Verwaltungsaktes (Anerkennungsbescheid)','4');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id23,'oek_email','oek_email','oekokontoflaechen','oekokontoflaechen','text','','','0',NULL,'Text','','E-Mail*','etwa: gunther.rahmlow@lung.mv-regierung.de','29');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id23,'oek_flaechen_aequi','oek_flaechen_aequi','oekokontoflaechen','oekokontoflaechen','int8','','','0',NULL,'Text','','Flächenäquivalente [m²]*','','31');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id23,'oek_flaechen_aequi_verf','oek_flaechen_aequi_verf','','','int8','','',NULL,NULL,'Text','','Flächenäquivalente noch verfügbar [m²]','','32');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id23,'oek_gen_behoerde','oek_gen_behoerde','oekokontoflaechen','oekokontoflaechen','text','','','0',NULL,'Auswahlfeld','select kurz as value, kurz as output from genehmigungsbehoerde where typ = \'UNB\' order by id','Genehmigungsbehörde*','','21');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id23,'oek_gen_dat','oek_gen_dat','oekokontoflaechen','oekokontoflaechen','date','','','0',NULL,'Text','','Datum der Genehmigung*','','22');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id23,'oek_gen_verfahren','oek_gen_verfahren','oekokontoflaechen','oekokontoflaechen','text','','','0',NULL,'Auswahlfeld','\'Einzelgenehmigung\',\'Plangenehmigung\',\'Planfeststellung\',\'verbindliche Planung\'','Genehmigungsverfahren*','lt. VerVerfG','20');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id23,'oek_handelbar','oek_handelbar','oekokontoflaechen','oekokontoflaechen','text','','','0',NULL,'Auswahlfeld','\'ja\',\'nein\'','Freigabe zum Handel*','wenn ja, dann inkl. Veröffentlichung','5');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id23,'oek_inhaber','oek_inhaber','oekokontoflaechen','oekokontoflaechen','text','','','0',NULL,'Text','','Inhaber*','Name','25');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id23,'oek_kf_behoerde','oek_kf_behoerde','oekokontoflaechen','oekokontoflaechen','text','','','0',NULL,'Text','','Kontoführende Behörde*','','3');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id23,'oek_rechtsgrundlage','oek_rechtsgrundlage','oekokontoflaechen','oekokontoflaechen','text','','','0',NULL,'Auswahlfeld','\'ohne öff-rechtl. Genehmigung\',\'Baurecht\',\'Forstrecht\',\'mehrere\',\'Naturschutzrecht\',\'Wasserrecht\'','Rechtsgrundlage*','verwendete Rechtsgrundlage (','23');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id23,'oek_reg_nr','oek_reg_nr','oekokontoflaechen','oekokontoflaechen','text','','','0',NULL,'Text','','Registriernummer*','etwa: NPV-001','2');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id23,'oek_telefon','oek_telefon','oekokontoflaechen','oekokontoflaechen','text','','','0',NULL,'Text','','Telefon*','etwa 03843-777-204','28');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id23,'ortsname','ortsname','oekokontoflaechen','oekokontoflaechen','text','','','0',NULL,'Text','','Stadt / Gemeinde*','','14');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id23,'planverfasser','planverfasser','oekokontoflaechen','oekokontoflaechen','text','','','0',NULL,'Text','','Planverfasser des Ökokontos*','Name Planungsbüro o.ä.','15');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id23,'privat_sicherung','privat_sicherung','oekokontoflaechen','oekokontoflaechen','text','','','0',NULL,'Auswahlfeld','\'keine\',\'Baulast\',\'Dienstbarkeit\',\'Reallast\'','Privatrechtliche Sicherung*','','19');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id23,'realisierung_y','realisierung_y','oekokontoflaechen','oekokontoflaechen','text','','','0',NULL,'Auswahlfeld','select bezeichnung as value, bezeichnung as output from lung.realisierungsjahr order by id','Jahr der Realisierung*','','16');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id23,'status','status','oekokontoflaechen','oekokontoflaechen','text','','','0',NULL,'Text','','Status','','1');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id23,'the_geom','the_geom','oekokontoflaechen','oekokontoflaechen','geometry','POLYGON','','1',NULL,'Geometrie','','','','40');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id23,'unterhaltung_y','unterhaltung_y','oekokontoflaechen','oekokontoflaechen','text','','','0',NULL,'Auswahlfeld','select bezeichnung as value, bezeichnung as output from unterhaltszeitraum order by id','Unterhaltungszeitraum gemäß § 15 (4) BNatSchG*','','17');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id23,'web_url','web_url','oekokontoflaechen','oekokontoflaechen','text','','','1',NULL,'Link','','Internet-Link','Link-Adresse, beginned mit http://www.','34');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id23,'zb_haupt_mnt','zb_haupt_mnt','oekokontoflaechen','oekokontoflaechen','text','','','0',NULL,'Auswahlfeld','select distinct zielbereich  as value, zielbereich  as output from lung.massnahmetyp <required by>haupt_mnt</required by>','Zielbereich Hauptmaßnahmetyp*','lt. Anlage HzE','7');
INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`form_element_type`,`options`,`alias`,`tooltip`,`order`) VALUES(@last_layer_id23,'zb_neben_mnt','zb_neben_mnt','oekokontoflaechen','oekokontoflaechen','text','','','1',NULL,'Auswahlfeld','select distinct zielbereich as value, zielbereich as output from massnahmetyp <required by>neben_mnt</required by>','Zielbereich Nebenmaßnahmetyp','lt. Anlage HzE','9');
INSERT INTO classes (`Name`,`Layer_ID`,`Expression`,`drawingorder`,`text`) VALUES('alle',@last_layer_id23,'','1','');
SET @last_class_id=LAST_INSERT_ID();
INSERT INTO styles (`symbol`,`symbolname`,`size`,`color`,`backgroundcolor`,`outlinecolor`,`minsize`,`maxsize`,`angle`,`angleitem`,`antialias`,`width`,`minwidth`,`maxwidth`,`sizeitem`) VALUES(NULL,'','1','4 57 255','','0 0 0',NULL,NULL,'360','',NULL,NULL,NULL,NULL,'');
 SET @last_style_id=LAST_INSERT_ID();
INSERT INTO u_styles2classes (style_id, class_id) VALUES (@last_style_id, @last_class_id);
INSERT INTO labels (`font`,`type`,`color`,`outlinecolor`,`shadowcolor`,`shadowsizex`,`shadowsizey`,`backgroundcolor`,`backgroundshadowcolor`,`backgroundshadowsizex`,`backgroundshadowsizey`,`size`,`minsize`,`maxsize`,`position`,`offsetx`,`offsety`,`angle`,`autoangle`,`buffer`,`antialias`,`minfeaturesize`,`maxfeaturesize`,`partials`,`wrap`,`the_force`) VALUES('arial_bold',NULL,'0 0 0','255 255 255','',NULL,NULL,'','',NULL,NULL,'8','6','10',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
 SET @last_label_id=LAST_INSERT_ID();
INSERT INTO u_labels2classes (label_id, class_id) VALUES (@last_label_id, @last_class_id);

UPDATE layer_attributes SET options = REPLACE(options, '25', @last_layer_id25) WHERE layer_id IN(@last_layer_id25,@last_layer_id22,@last_layer_id24,@last_layer_id26,@last_layer_id23) AND form_element_type IN ('SubFormPK', 'SubFormFK', 'SubFormEmbeddedPK');
UPDATE layer_attributes SET options = REPLACE(options, '22', @last_layer_id22) WHERE layer_id IN(@last_layer_id25,@last_layer_id22,@last_layer_id24,@last_layer_id26,@last_layer_id23) AND form_element_type IN ('SubFormPK', 'SubFormFK', 'SubFormEmbeddedPK');
UPDATE layer_attributes SET options = REPLACE(options, '24', @last_layer_id24) WHERE layer_id IN(@last_layer_id25,@last_layer_id22,@last_layer_id24,@last_layer_id26,@last_layer_id23) AND form_element_type IN ('SubFormPK', 'SubFormFK', 'SubFormEmbeddedPK');
UPDATE layer_attributes SET options = REPLACE(options, '26', @last_layer_id26) WHERE layer_id IN(@last_layer_id25,@last_layer_id22,@last_layer_id24,@last_layer_id26,@last_layer_id23) AND form_element_type IN ('SubFormPK', 'SubFormFK', 'SubFormEmbeddedPK');
UPDATE layer_attributes SET options = REPLACE(options, '23', @last_layer_id23) WHERE layer_id IN(@last_layer_id25,@last_layer_id22,@last_layer_id24,@last_layer_id26,@last_layer_id23) AND form_element_type IN ('SubFormPK', 'SubFormFK', 'SubFormEmbeddedPK');