text: INSERT INTO `u_groups` (`Gruppenname`, `Gruppenname_low-german`, `Gruppenname_english`, `Gruppenname_polish`, `Gruppenname_vietnamese`, `obergruppe`, `order`) VALUES
  ('Bauleitplanung', NULL, NULL, NULL, NULL, NULL, 8);
  
  SET @group_id=LAST_INSERT_ID();
  SET @connection = 'user=xxxx password=xxxx dbname=kvwmapsp';
  
  
  INSERT INTO layer (`Name`,`alias`,`Datentyp`,`Gruppe`,`pfad`,`maintable`,`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`,`processing`,`kurzbeschreibung`,`datenherr`,`metalink`,`privileg`) VALUES('bauleit_bplan1','','5',@group_id,'SELECT p.*, \'\' as gebiete, \'\' as sondergebiete, bezeichnung as vorschau, g.gkz as gemkz, gemeinde, amt_neu as amt, zo as zentrort, kreis, sur, pr,(select coalesce(sum(gb.flaeche), 0) from b_plan_gebiete as gb where gb.plan_id = p.plan_id)+(select coalesce(sum(sgb.flaeche), 0) from b_plan_sondergebiete as sgb where sgb.plan_id = p.plan_id) as flaechensumme FROM gemeinden as g, b_plan_stammdaten as p WHERE g.gkz = p.gkz AND g.pr = 1 order by art, pl_nr, bezeichnung, lfd_rok_nr','b_plan_stammdaten','','bauleitplanung','','','','','','0','0','',@connection,'','6','','','3','pixels','','bauleitplanung/view/plan_b.php','1',NULL,NULL,'-1','-1','','EPSG:35833 EPSG:4326 EPSG:2398 EPSG:25833','','1.1.0','image/png','60','','','','','0','0','','','','','0');
  SET @last_layer_id445=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`,`privileg`) VALUES(@last_layer_id445,'aktenzeichen','aktenzeichen','b_plan_stammdaten','p','varchar','','','1','255','Text','','','','9','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`,`privileg`) VALUES(@last_layer_id445,'aktuell','aktuell','b_plan_stammdaten','p','varchar','','','1','1','Auswahlfeld','select 0 as value, \'nein\' as output UNION select 1 as value, \'ja\' as output','aktuell','','7','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`,`privileg`) VALUES(@last_layer_id445,'amt','amt_neu','gemeinden','g','int4','','','1','32','Auswahlfeld','select name as output, amt_neu as value from gemeinden, aemter where amt_neu = amtsnr and gkz = <requires>gkz</requires>','','','26','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`,`privileg`) VALUES(@last_layer_id445,'art','art','b_plan_stammdaten','p','varchar','','','1','50','Auswahlfeld','\'B-Plan\',\'vb-Plan\',\'Planungsanzeige\',\'Einzelvorhaben\',\'BImSchG\',\'Innenbereichssatzung\',\'Außenbereichssatzung\'','Planart','','2','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`,`privileg`) VALUES(@last_layer_id445,'bezeichnung','bezeichnung','b_plan_stammdaten','p','varchar','','','1','100','Text','','Bezeichnung','','6','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`,`privileg`) VALUES(@last_layer_id445,'datumabl','datumabl','b_plan_stammdaten','p','date','','','1',NULL,'Text','','Datum Ablehnung','','14','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`,`privileg`) VALUES(@last_layer_id445,'datumaufh','datumaufh','b_plan_stammdaten','p','date','','','1',NULL,'Text','','Datum Aufhebung','','17','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`,`privileg`) VALUES(@last_layer_id445,'datumbeka','datumbeka','b_plan_stammdaten','p','date','','','1',NULL,'Text','','Datum Bekanntmachung','','16','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`,`privileg`) VALUES(@last_layer_id445,'datumeing','datumeing','b_plan_stammdaten','p','date','','','1',NULL,'Text','','Datum Eingang','','12','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`,`privileg`) VALUES(@last_layer_id445,'datumgenehm','datumgenehm','b_plan_stammdaten','p','date','','','1',NULL,'Text','','Datum Genehmigung','','15','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`,`privileg`) VALUES(@last_layer_id445,'datumzust','datumzust','b_plan_stammdaten','p','date','','','1',NULL,'Text','','Datum Zustimmung','','13','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`,`privileg`) VALUES(@last_layer_id445,'erteilteaufl','erteilteaufl','b_plan_stammdaten','p','text','','','1',NULL,'Text','','Maßgaben','','18','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`,`privileg`) VALUES(@last_layer_id445,'ert_bemerkungen','ert_bemerkungen','b_plan_stammdaten','p','text','','','1',NULL,'Text','','Bemerkungen','','20','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`,`privileg`) VALUES(@last_layer_id445,'ert_hinweis','ert_hinweis','b_plan_stammdaten','p','text','','','1',NULL,'Text','','Hinweise','','19','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`,`privileg`) VALUES(@last_layer_id445,'flaechensumme','flaechensumme','','','numeric','','',NULL,NULL,'Text','','','','31','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`,`privileg`) VALUES(@last_layer_id445,'gebiete','gebiete','','','unknown','','',NULL,NULL,'SubFormEmbeddedPK','720,plan_id,vorschau;embedded','','','21','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`,`privileg`) VALUES(@last_layer_id445,'geltungsbereich','geltungsbereich','b_plan_stammdaten','p','numeric','','','1','18','Text','','Geldtungsbereich','','5','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`,`privileg`) VALUES(@last_layer_id445,'gemeinde','gemeinde','gemeinden','g','varchar','','','1','255','Text','','','','25','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`,`privileg`) VALUES(@last_layer_id445,'gemeinde_alt','gemeinde_alt','b_plan_stammdaten','p','varchar','','','1','50','Text','','Gemeindename alt','','4','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`,`privileg`) VALUES(@last_layer_id445,'gemkz','gkz','gemeinden','g','int4','','','1','32','Auswahlfeld','select gkz as output, gkz as value from gemeinden where gkz = <requires>gkz</requires>','','','24','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`,`privileg`) VALUES(@last_layer_id445,'gkz','gkz','b_plan_stammdaten','p','int4','','','1','32','Auswahlfeld','select gemeinde as output, gkz as value from gemeinden where pr = 1 order by gemeinde <required by>gemkz,amt,zentrort,kreis,sur,pr</required by>','Gemeinde','','1','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`,`privileg`) VALUES(@last_layer_id445,'kap_gemziel','kap_gemziel','b_plan_stammdaten','p','int4','','','1','32','Text','','','','10','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`,`privileg`) VALUES(@last_layer_id445,'kap_nachstell','kap_nachstell','b_plan_stammdaten','p','int4','','','1','32','Text','','','','11','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`,`privileg`) VALUES(@last_layer_id445,'kreis','kreis','gemeinden','g','int4','','','1','32','Auswahlfeld','select b.kreis as output, a.kreis as value from gemeinden a, kreise b where a.kreis = b.kkz AND gkz = <requires>gkz</requires>','','','28','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`,`privileg`) VALUES(@last_layer_id445,'lfd_rok_nr','lfd_rok_nr','b_plan_stammdaten','p','varchar','','','1','50','Text','','ROK-Nr.','','8','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`,`privileg`) VALUES(@last_layer_id445,'plan_id','plan_id','b_plan_stammdaten','p','int4','','PRIMARY KEY','1','32','Text','','','','0','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`,`privileg`) VALUES(@last_layer_id445,'pl_nr','pl_nr','b_plan_stammdaten','p','varchar','','','1','50','Text','','PlanNr.','','3','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`,`privileg`) VALUES(@last_layer_id445,'pr','pr','gemeinden','g','int4','','','1','32','Auswahlfeld','select planungsregion as output, pr as value from gemeinden, planungsregionen where prz = pr AND gkz = <requires>gkz</requires>','','','30','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`,`privileg`) VALUES(@last_layer_id445,'sondergebiete','sondergebiete','','','unknown','','',NULL,NULL,'SubFormEmbeddedPK','728,plan_id,vorschau;embedded','','','22','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`,`privileg`) VALUES(@last_layer_id445,'sur','sur','gemeinden','g','int4','','','1','32','Auswahlfeld','select name as output, sur as value from gemeinden, stadtumlandraum where sur = surid AND gkz = <requires>gkz</requires>','','','29','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`,`privileg`) VALUES(@last_layer_id445,'vorschau','bezeichnung','b_plan_stammdaten','p','varchar','','','1','100','Text','','','','23','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`,`privileg`) VALUES(@last_layer_id445,'zentrort','zo','gemeinden','g','int4','','','1','32','Auswahlfeld','select zo as output, zo as value from gemeinden where gkz = <requires>gkz</requires>','','','27','0');
  
  
  INSERT INTO layer (`Name`,`alias`,`Datentyp`,`Gruppe`,`pfad`,`maintable`,`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`,`processing`,`kurzbeschreibung`,`datenherr`,`metalink`,`privileg`) VALUES('bauleit_fplan1','','5',@group_id,'SELECT p.*, \'\' as gebiete, \'\' as sondergebiete, bezeichnung as vorschau, g.gkz as gemkz, gemeinde, amt_neu as amt, zo as zentrort, kreis, sur, pr,(select coalesce(sum(gb.flaeche), 0) from b_plan_gebiete as gb where gb.plan_id = p.plan_id)+(select coalesce(sum(sgb.flaeche), 0) from b_plan_sondergebiete as sgb where sgb.plan_id = p.plan_id) as flaechensumme FROM gemeinden as g, f_plan_stammdaten as p WHERE g.gkz = p.gkz AND g.pr = 1 order by art, pl_nr, bezeichnung, lfd_rok_nr','f_plan_stammdaten','','bauleitplanung','','','','','','0','0','',@connection,'','6','','','3','pixels','35833','bauleitplanung/view/plan_f.php','1',NULL,NULL,'-1','-1','','EPSG:35833 EPSG:4326 EPSG:2398 EPSG:25833','','1.1.0','image/png','60','','','','','0','0','','','','','0');
  SET @last_layer_id449=LAST_INSERT_ID();
  INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`decimal_length`,`default`,`form_element_type`,`options`,`alias`,`alias_low-german`,`alias_english`,`alias_polish`,`alias_vietnamese`,`tooltip`,`group`,`raster_visibility`,`mandatory`,`order`,`privileg`,`query_tooltip`) VALUES(@last_layer_id449,'aktenzeichen','aktenzeichen','f_plan_stammdaten','p','varchar','','','1','255',NULL,'','Text','','','','','','','','',NULL,NULL,'8','0','0');
  INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`decimal_length`,`default`,`form_element_type`,`options`,`alias`,`alias_low-german`,`alias_english`,`alias_polish`,`alias_vietnamese`,`tooltip`,`group`,`raster_visibility`,`mandatory`,`order`,`privileg`,`query_tooltip`) VALUES(@last_layer_id449,'aktuell','aktuell','f_plan_stammdaten','p','varchar','','','1','1',NULL,'','Auswahlfeld','select 0 as value, \'im Verfahren\' as output UNION select 1 as value, \'rechtswirksam\' as output','aktuell','','','','','','',NULL,NULL,'6','0','0');
  INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`decimal_length`,`default`,`form_element_type`,`options`,`alias`,`alias_low-german`,`alias_english`,`alias_polish`,`alias_vietnamese`,`tooltip`,`group`,`raster_visibility`,`mandatory`,`order`,`privileg`,`query_tooltip`) VALUES(@last_layer_id449,'amt','amt_neu','gemeinden','g','int4','','','1','32',NULL,'','Auswahlfeld','select name as output, amt_neu as value from gemeinden, aemter where amt_neu = amtsnr and gkz = <requires>gkz</requires>','','','','','','','',NULL,NULL,'23','0','0');
  INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`decimal_length`,`default`,`form_element_type`,`options`,`alias`,`alias_low-german`,`alias_english`,`alias_polish`,`alias_vietnamese`,`tooltip`,`group`,`raster_visibility`,`mandatory`,`order`,`privileg`,`query_tooltip`) VALUES(@last_layer_id449,'art','art','f_plan_stammdaten','p','varchar','','','1','50',NULL,'','Auswahlfeld','\'FNP\',\'Teil-FNP\'','Planart','','','','','','',NULL,NULL,'2','0','0');
  INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`decimal_length`,`default`,`form_element_type`,`options`,`alias`,`alias_low-german`,`alias_english`,`alias_polish`,`alias_vietnamese`,`tooltip`,`group`,`raster_visibility`,`mandatory`,`order`,`privileg`,`query_tooltip`) VALUES(@last_layer_id449,'bezeichnung','bezeichnung','f_plan_stammdaten','p','varchar','','','1','100',NULL,'','Text','','Bezeichnung','','','','','','',NULL,NULL,'5','0','0');
  INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`decimal_length`,`default`,`form_element_type`,`options`,`alias`,`alias_low-german`,`alias_english`,`alias_polish`,`alias_vietnamese`,`tooltip`,`group`,`raster_visibility`,`mandatory`,`order`,`privileg`,`query_tooltip`) VALUES(@last_layer_id449,'datumabl','datumabl','f_plan_stammdaten','p','date','','','1',NULL,NULL,'','Text','','Datum Ablehnung','','','','','','',NULL,NULL,'11','0','0');
  INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`decimal_length`,`default`,`form_element_type`,`options`,`alias`,`alias_low-german`,`alias_english`,`alias_polish`,`alias_vietnamese`,`tooltip`,`group`,`raster_visibility`,`mandatory`,`order`,`privileg`,`query_tooltip`) VALUES(@last_layer_id449,'datumaufh','datumaufh','f_plan_stammdaten','p','date','','','1',NULL,NULL,'','Text','','Datum Aufhebung','','','','','','',NULL,NULL,'14','0','0');
  INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`decimal_length`,`default`,`form_element_type`,`options`,`alias`,`alias_low-german`,`alias_english`,`alias_polish`,`alias_vietnamese`,`tooltip`,`group`,`raster_visibility`,`mandatory`,`order`,`privileg`,`query_tooltip`) VALUES(@last_layer_id449,'datumbeka','datumbeka','f_plan_stammdaten','p','date','','','1',NULL,NULL,'','Text','','Datum Bekanntmachung','','','','','','',NULL,NULL,'13','0','0');
  INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`decimal_length`,`default`,`form_element_type`,`options`,`alias`,`alias_low-german`,`alias_english`,`alias_polish`,`alias_vietnamese`,`tooltip`,`group`,`raster_visibility`,`mandatory`,`order`,`privileg`,`query_tooltip`) VALUES(@last_layer_id449,'datumeing','datumeing','f_plan_stammdaten','p','date','','','1',NULL,NULL,'','Text','','Datum Eingang','','','','','','',NULL,NULL,'9','0','0');
  INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`decimal_length`,`default`,`form_element_type`,`options`,`alias`,`alias_low-german`,`alias_english`,`alias_polish`,`alias_vietnamese`,`tooltip`,`group`,`raster_visibility`,`mandatory`,`order`,`privileg`,`query_tooltip`) VALUES(@last_layer_id449,'datumgenehm','datumgenehm','f_plan_stammdaten','p','date','','','1',NULL,NULL,'','Text','','Datum Genehmigung','','','','','','',NULL,NULL,'12','0','0');
  INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`decimal_length`,`default`,`form_element_type`,`options`,`alias`,`alias_low-german`,`alias_english`,`alias_polish`,`alias_vietnamese`,`tooltip`,`group`,`raster_visibility`,`mandatory`,`order`,`privileg`,`query_tooltip`) VALUES(@last_layer_id449,'datumzust','datumzust','f_plan_stammdaten','p','date','','','1',NULL,NULL,'','Text','','Datum Zustimmung','','','','','','',NULL,NULL,'10','0','0');
  INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`decimal_length`,`default`,`form_element_type`,`options`,`alias`,`alias_low-german`,`alias_english`,`alias_polish`,`alias_vietnamese`,`tooltip`,`group`,`raster_visibility`,`mandatory`,`order`,`privileg`,`query_tooltip`) VALUES(@last_layer_id449,'erteilteaufl','erteilteaufl','f_plan_stammdaten','p','text','','','1',NULL,NULL,'','Text','','Maßgaben','','','','','','',NULL,NULL,'15','0','0');
  INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`decimal_length`,`default`,`form_element_type`,`options`,`alias`,`alias_low-german`,`alias_english`,`alias_polish`,`alias_vietnamese`,`tooltip`,`group`,`raster_visibility`,`mandatory`,`order`,`privileg`,`query_tooltip`) VALUES(@last_layer_id449,'ert_bemerkungen','ert_bemerkungen','f_plan_stammdaten','p','text','','','1',NULL,NULL,'','Text','','Bemerkungen','','','','','','',NULL,NULL,'17','0','0');
  INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`decimal_length`,`default`,`form_element_type`,`options`,`alias`,`alias_low-german`,`alias_english`,`alias_polish`,`alias_vietnamese`,`tooltip`,`group`,`raster_visibility`,`mandatory`,`order`,`privileg`,`query_tooltip`) VALUES(@last_layer_id449,'ert_hinweis','ert_hinweis','f_plan_stammdaten','p','text','','','1',NULL,NULL,'','Text','','Hinweise','','','','','','',NULL,NULL,'16','0','0');
  INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`decimal_length`,`default`,`form_element_type`,`options`,`alias`,`alias_low-german`,`alias_english`,`alias_polish`,`alias_vietnamese`,`tooltip`,`group`,`raster_visibility`,`mandatory`,`order`,`privileg`,`query_tooltip`) VALUES(@last_layer_id449,'flaechensumme','flaechensumme','','','numeric','','',NULL,NULL,NULL,'','Text','','','','','','','','',NULL,NULL,'28','0','0');
  INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`decimal_length`,`default`,`form_element_type`,`options`,`alias`,`alias_low-german`,`alias_english`,`alias_polish`,`alias_vietnamese`,`tooltip`,`group`,`raster_visibility`,`mandatory`,`order`,`privileg`,`query_tooltip`) VALUES(@last_layer_id449,'gebiete','gebiete','','','unknown','','',NULL,NULL,NULL,'','SubFormEmbeddedPK','800,plan_id,vorschau;embedded','','','','','','','',NULL,NULL,'18','0','0');
  INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`decimal_length`,`default`,`form_element_type`,`options`,`alias`,`alias_low-german`,`alias_english`,`alias_polish`,`alias_vietnamese`,`tooltip`,`group`,`raster_visibility`,`mandatory`,`order`,`privileg`,`query_tooltip`) VALUES(@last_layer_id449,'gemeinde','gemeinde','gemeinden','g','varchar','','','1','255',NULL,'','Text','','','','','','','','',NULL,NULL,'22','0','0');
  INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`decimal_length`,`default`,`form_element_type`,`options`,`alias`,`alias_low-german`,`alias_english`,`alias_polish`,`alias_vietnamese`,`tooltip`,`group`,`raster_visibility`,`mandatory`,`order`,`privileg`,`query_tooltip`) VALUES(@last_layer_id449,'gemeinde_alt','gemeinde_alt','f_plan_stammdaten','p','varchar','','','1','50',NULL,'','Text','','Gemeindename alt','','','','','','',NULL,NULL,'4','0','0');
  INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`decimal_length`,`default`,`form_element_type`,`options`,`alias`,`alias_low-german`,`alias_english`,`alias_polish`,`alias_vietnamese`,`tooltip`,`group`,`raster_visibility`,`mandatory`,`order`,`privileg`,`query_tooltip`) VALUES(@last_layer_id449,'gemkz','gkz','gemeinden','g','int4','','','1','32',NULL,'','Auswahlfeld','select gkz as output, gkz as value from gemeinden where gkz = <requires>gkz</requires>','','','','','','','',NULL,NULL,'21','0','0');
  INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`decimal_length`,`default`,`form_element_type`,`options`,`alias`,`alias_low-german`,`alias_english`,`alias_polish`,`alias_vietnamese`,`tooltip`,`group`,`raster_visibility`,`mandatory`,`order`,`privileg`,`query_tooltip`) VALUES(@last_layer_id449,'gkz','gkz','f_plan_stammdaten','p','int4','','','1','32',NULL,'','Auswahlfeld','select gemeinde as output, gkz as value from gemeinden where pr = 1 order by gemeinde <required by>gemkz,amt,zentrort,kreis,sur,pr</required by>','Gemeinde','','','','','','',NULL,NULL,'1','0','0');
  INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`decimal_length`,`default`,`form_element_type`,`options`,`alias`,`alias_low-german`,`alias_english`,`alias_polish`,`alias_vietnamese`,`tooltip`,`group`,`raster_visibility`,`mandatory`,`order`,`privileg`,`query_tooltip`) VALUES(@last_layer_id449,'kreis','kreis','gemeinden','g','int4','','','1','32',NULL,'','Auswahlfeld','select b.kreis as output, a.kreis as value from gemeinden a, kreise b where a.kreis = b.kkz AND gkz = <requires>gkz</requires>','','','','','','','',NULL,NULL,'25','0','0');
  INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`decimal_length`,`default`,`form_element_type`,`options`,`alias`,`alias_low-german`,`alias_english`,`alias_polish`,`alias_vietnamese`,`tooltip`,`group`,`raster_visibility`,`mandatory`,`order`,`privileg`,`query_tooltip`) VALUES(@last_layer_id449,'lfd_rok_nr','lfd_rok_nr','f_plan_stammdaten','p','varchar','','','1','50',NULL,'','Text','','ROK-Nr.','','','','','','',NULL,NULL,'7','0','0');
  INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`decimal_length`,`default`,`form_element_type`,`options`,`alias`,`alias_low-german`,`alias_english`,`alias_polish`,`alias_vietnamese`,`tooltip`,`group`,`raster_visibility`,`mandatory`,`order`,`privileg`,`query_tooltip`) VALUES(@last_layer_id449,'plan_id','plan_id','f_plan_stammdaten','p','int4','','PRIMARY KEY','1','32',NULL,'','Text','','','','','','','','',NULL,NULL,'0','0','0');
  INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`decimal_length`,`default`,`form_element_type`,`options`,`alias`,`alias_low-german`,`alias_english`,`alias_polish`,`alias_vietnamese`,`tooltip`,`group`,`raster_visibility`,`mandatory`,`order`,`privileg`,`query_tooltip`) VALUES(@last_layer_id449,'pl_nr','pl_nr','f_plan_stammdaten','p','varchar','','','1','50',NULL,'','Text','','PlanNr.','','','','','','',NULL,NULL,'3','0','0');
  INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`decimal_length`,`default`,`form_element_type`,`options`,`alias`,`alias_low-german`,`alias_english`,`alias_polish`,`alias_vietnamese`,`tooltip`,`group`,`raster_visibility`,`mandatory`,`order`,`privileg`,`query_tooltip`) VALUES(@last_layer_id449,'pr','pr','gemeinden','g','int4','','','1','32',NULL,'','Auswahlfeld','select planungsregion as output, pr as value from gemeinden, planungsregionen where prz = pr AND gkz = <requires>gkz</requires>','','','','','','','',NULL,NULL,'27','0','0');
  INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`decimal_length`,`default`,`form_element_type`,`options`,`alias`,`alias_low-german`,`alias_english`,`alias_polish`,`alias_vietnamese`,`tooltip`,`group`,`raster_visibility`,`mandatory`,`order`,`privileg`,`query_tooltip`) VALUES(@last_layer_id449,'sondergebiete','sondergebiete','','','unknown','','',NULL,NULL,NULL,'','SubFormEmbeddedPK','801,plan_id,vorschau;embedded','','','','','','','',NULL,NULL,'19','0','0');
  INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`decimal_length`,`default`,`form_element_type`,`options`,`alias`,`alias_low-german`,`alias_english`,`alias_polish`,`alias_vietnamese`,`tooltip`,`group`,`raster_visibility`,`mandatory`,`order`,`privileg`,`query_tooltip`) VALUES(@last_layer_id449,'sur','sur','gemeinden','g','int4','','','1','32',NULL,'','Auswahlfeld','select name as output, sur as value from gemeinden, stadtumlandraum where sur = surid AND gkz = <requires>gkz</requires>','','','','','','','',NULL,NULL,'26','0','0');
  INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`decimal_length`,`default`,`form_element_type`,`options`,`alias`,`alias_low-german`,`alias_english`,`alias_polish`,`alias_vietnamese`,`tooltip`,`group`,`raster_visibility`,`mandatory`,`order`,`privileg`,`query_tooltip`) VALUES(@last_layer_id449,'vorschau','bezeichnung','f_plan_stammdaten','p','varchar','','','1','100',NULL,'','Text','','','','','','','','',NULL,NULL,'20','0','0');
  INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`decimal_length`,`default`,`form_element_type`,`options`,`alias`,`alias_low-german`,`alias_english`,`alias_polish`,`alias_vietnamese`,`tooltip`,`group`,`raster_visibility`,`mandatory`,`order`,`privileg`,`query_tooltip`) VALUES(@last_layer_id449,'zentrort','zo','gemeinden','g','int4','','','1','32',NULL,'','Auswahlfeld','select zo as output, zo as value from gemeinden where gkz = <requires>gkz</requires>','','','','','','','',NULL,NULL,'24','0','0');
  
  INSERT INTO layer (`Name`,`alias`,`Datentyp`,`Gruppe`,`pfad`,`maintable`,`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`,`processing`,`kurzbeschreibung`,`datenherr`,`metalink`,`privileg`) VALUES('bauleit_gebiete_fnp','','5',@group_id,'SELECT plan_id, flaeche||\' ha \'||typ||\' \'||CASE WHEN kap_gemziel IS NULL THEN \'\' ELSE \'(Ziel: \'||kap_gemziel::text END||\' \'||CASE WHEN kap_nachstell IS NULL THEN \'\' ELSE \'n.S.: \'||kap_nachstell::text||\')\'END|| CASE WHEN gebietstypen_fnp.einheit IS NULL OR (kap_nachstell IS NULL AND kap_gemziel IS NULL) THEN \'\' ELSE \' \'||gebietstypen_fnp.einheit||\' \'END as vorschau, gebietstyp, flaeche, kap_gemziel, kap_nachstell FROM gebietstypen_fnp, f_plan_gebiete WHERE gebietstypen_fnp.id = gebietstyp','f_plan_gebiete','','bauleitplanung','','','','','','0','0','',@connection,'','6','','','3','pixels','35833','bauleitplanung/view/bplan_gebiete.php','1',NULL,NULL,'-1','-1','','EPSG:35833 EPSG:4326 EPSG:2398 EPSG:25833','','1.1.0','image/png','60','','','','','0','0','','','','','2');
  SET @last_layer_id800=LAST_INSERT_ID();
  INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`decimal_length`,`default`,`form_element_type`,`options`,`alias`,`alias_low-german`,`alias_english`,`alias_polish`,`alias_vietnamese`,`tooltip`,`group`,`raster_visibility`,`mandatory`,`order`,`privileg`,`query_tooltip`) VALUES(@last_layer_id800,'flaeche','flaeche','f_plan_gebiete','f_plan_gebiete','numeric','','','1','18','2','','Text','','Fläche [ha]','','','','','','',NULL,NULL,'3','1','0');
  INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`decimal_length`,`default`,`form_element_type`,`options`,`alias`,`alias_low-german`,`alias_english`,`alias_polish`,`alias_vietnamese`,`tooltip`,`group`,`raster_visibility`,`mandatory`,`order`,`privileg`,`query_tooltip`) VALUES(@last_layer_id800,'gebietstyp','gebietstyp','f_plan_gebiete','f_plan_gebiete','int4','','','0','32',NULL,'','Auswahlfeld','select id as value, typ as output from gebietstypen_fnp where art = TRUE order by output','Gebietstyp','','','','','','',NULL,NULL,'2','1','0');
  INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`decimal_length`,`default`,`form_element_type`,`options`,`alias`,`alias_low-german`,`alias_english`,`alias_polish`,`alias_vietnamese`,`tooltip`,`group`,`raster_visibility`,`mandatory`,`order`,`privileg`,`query_tooltip`) VALUES(@last_layer_id800,'kap_gemziel','kap_gemziel','f_plan_gebiete','f_plan_gebiete','int4','','','1','32',NULL,'','Text','','Kapazität Ziel','','','','','','',NULL,NULL,'4','1','0');
  INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`decimal_length`,`default`,`form_element_type`,`options`,`alias`,`alias_low-german`,`alias_english`,`alias_polish`,`alias_vietnamese`,`tooltip`,`group`,`raster_visibility`,`mandatory`,`order`,`privileg`,`query_tooltip`) VALUES(@last_layer_id800,'kap_nachstell','kap_nachstell','f_plan_gebiete','f_plan_gebiete','int4','','','1','32',NULL,'','Text','','Kapazität n.S.','','','','','','',NULL,NULL,'5','1','0');
  INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`decimal_length`,`default`,`form_element_type`,`options`,`alias`,`alias_low-german`,`alias_english`,`alias_polish`,`alias_vietnamese`,`tooltip`,`group`,`raster_visibility`,`mandatory`,`order`,`privileg`,`query_tooltip`) VALUES(@last_layer_id800,'plan_id','plan_id','f_plan_gebiete','f_plan_gebiete','int4','','','0','32',NULL,'','Text','','','','','','','','',NULL,NULL,'0','0','0');
  INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`decimal_length`,`default`,`form_element_type`,`options`,`alias`,`alias_low-german`,`alias_english`,`alias_polish`,`alias_vietnamese`,`tooltip`,`group`,`raster_visibility`,`mandatory`,`order`,`privileg`,`query_tooltip`) VALUES(@last_layer_id800,'vorschau','flaeche','f_plan_gebiete','f_plan_gebiete','not_saveable','','','1','18','2','','Text','','','','','','','','',NULL,NULL,'1','0','0');
  
  INSERT INTO layer (`Name`,`alias`,`Datentyp`,`Gruppe`,`pfad`,`maintable`,`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`,`processing`,`kurzbeschreibung`,`datenherr`,`metalink`,`privileg`) VALUES('bauleit_sondergebiete_fnp','','5',@group_id,'SELECT plan_id, flaeche||\' ha \'||typ||\' \'||CASE WHEN kap_gemziel IS NULL THEN \'\' ELSE \'(Ziel: \'||kap_gemziel::text END||\' \'||CASE WHEN kap_nachstell IS NULL THEN \'\' ELSE \'n.S.: \'||kap_nachstell::text||\')\'END|| CASE WHEN gebietstypen_fnp.einheit IS NULL OR (kap_nachstell IS NULL AND kap_gemziel IS NULL) THEN \'\' ELSE \' \'||gebietstypen_fnp.einheit||\' \'END as vorschau, gebietstyp, bemerkungen, flaeche, kap_gemziel, kap_nachstell FROM gebietstypen_fnp, f_plan_sondergebiete WHERE gebietstypen_fnp.id = gebietstyp','f_plan_sondergebiete','','bauleitplanung','','','','','','0','0','',@connection,'','6','','','3','pixels','35833','bauleitplanung/view/bplan_gebiete.php','1',NULL,NULL,'-1','-1','','EPSG:35833 EPSG:4326 EPSG:2398 EPSG:25833','','1.1.0','image/png','60','','','','','0','0','','','','','2');
  SET @last_layer_id801=LAST_INSERT_ID();
  INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`decimal_length`,`default`,`form_element_type`,`options`,`alias`,`alias_low-german`,`alias_english`,`alias_polish`,`alias_vietnamese`,`tooltip`,`group`,`raster_visibility`,`mandatory`,`order`,`privileg`,`query_tooltip`) VALUES(@last_layer_id801,'bemerkungen','bemerkungen','f_plan_sondergebiete','f_plan_sondergebiete','text','','','1',NULL,NULL,'','Textfeld','','Bemerkungen','','','','','','',NULL,NULL,'3','1','0');
  INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`decimal_length`,`default`,`form_element_type`,`options`,`alias`,`alias_low-german`,`alias_english`,`alias_polish`,`alias_vietnamese`,`tooltip`,`group`,`raster_visibility`,`mandatory`,`order`,`privileg`,`query_tooltip`) VALUES(@last_layer_id801,'flaeche','flaeche','f_plan_sondergebiete','f_plan_sondergebiete','numeric','','','1','18','2','','Text','','Fläche [ha]','','','','','','',NULL,NULL,'4','1','0');
  INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`decimal_length`,`default`,`form_element_type`,`options`,`alias`,`alias_low-german`,`alias_english`,`alias_polish`,`alias_vietnamese`,`tooltip`,`group`,`raster_visibility`,`mandatory`,`order`,`privileg`,`query_tooltip`) VALUES(@last_layer_id801,'gebietstyp','gebietstyp','f_plan_sondergebiete','f_plan_sondergebiete','int4','','','0','32',NULL,'','Auswahlfeld','select id as value, typ as output from gebietstypen_fnp where art = FALSE order by output','Gebietstyp','','','','','','',NULL,NULL,'2','1','0');
  INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`decimal_length`,`default`,`form_element_type`,`options`,`alias`,`alias_low-german`,`alias_english`,`alias_polish`,`alias_vietnamese`,`tooltip`,`group`,`raster_visibility`,`mandatory`,`order`,`privileg`,`query_tooltip`) VALUES(@last_layer_id801,'kap_gemziel','kap_gemziel','f_plan_sondergebiete','f_plan_sondergebiete','int4','','','1','32',NULL,'','Text','','Kapazität Ziel','','','','','','',NULL,NULL,'5','1','0');
  INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`decimal_length`,`default`,`form_element_type`,`options`,`alias`,`alias_low-german`,`alias_english`,`alias_polish`,`alias_vietnamese`,`tooltip`,`group`,`raster_visibility`,`mandatory`,`order`,`privileg`,`query_tooltip`) VALUES(@last_layer_id801,'kap_nachstell','kap_nachstell','f_plan_sondergebiete','f_plan_sondergebiete','int4','','','1','32',NULL,'','Text','','Kapazität n.S.','','','','','','',NULL,NULL,'6','1','0');
  INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`decimal_length`,`default`,`form_element_type`,`options`,`alias`,`alias_low-german`,`alias_english`,`alias_polish`,`alias_vietnamese`,`tooltip`,`group`,`raster_visibility`,`mandatory`,`order`,`privileg`,`query_tooltip`) VALUES(@last_layer_id801,'plan_id','plan_id','f_plan_sondergebiete','f_plan_sondergebiete','int4','','','1','32',NULL,'','Text','','','','','','','','',NULL,NULL,'0','0','0');
  INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`decimal_length`,`default`,`form_element_type`,`options`,`alias`,`alias_low-german`,`alias_english`,`alias_polish`,`alias_vietnamese`,`tooltip`,`group`,`raster_visibility`,`mandatory`,`order`,`privileg`,`query_tooltip`) VALUES(@last_layer_id801,'vorschau','flaeche','f_plan_sondergebiete','f_plan_sondergebiete','not_saveable','','','1','18','2','','Text','','','','','','','','',NULL,NULL,'1','0','0');
  
  
  INSERT INTO layer (`Name`,`alias`,`Datentyp`,`Gruppe`,`pfad`,`maintable`,`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`,`processing`,`kurzbeschreibung`,`datenherr`,`metalink`,`privileg`) VALUES('bauleit_gebiete','','5',@group_id,'SELECT plan_id, flaeche||\' ha \'||typ||CASE WHEN bezeichnung IS NULL THEN \' \' ELSE \' \'||bezeichnung END ||\' \'||CASE WHEN kap_gemziel IS NULL THEN \'\' ELSE \'(Ziel: \'||kap_gemziel::text END||\' \'||CASE WHEN kap_nachstell IS NULL THEN \'\' ELSE \'n.S.: \'||kap_nachstell::text||\')\'END|| CASE WHEN gebietstypen.einheit IS NULL OR (kap_nachstell IS NULL AND kap_gemziel IS NULL) THEN \'\' ELSE \' \'||gebietstypen.einheit||\' \'END as vorschau, gebietstyp, konkretisierung, flaeche, kap_gemziel, kap_nachstell FROM gebietstypen, b_plan_gebiete LEFT JOIN konkretisierungen ON konkretisierungen.id = b_plan_gebiete.konkretisierung WHERE gebietstypen.id = gebietstyp','b_plan_gebiete','','bauleitplanung','','','','','','0','0','',@connection,'','6','','','3','pixels','35833','bauleitplanung/view/bplan_gebiete.php','1',NULL,NULL,'-1','-1','','EPSG:35833 EPSG:4326 EPSG:2398 EPSG:25833','','1.1.0','image/png','60','','','','','0','0','','','','','0');
  SET @last_layer_id720=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`,`privileg`) VALUES(@last_layer_id720,'flaeche','flaeche','b_plan_gebiete','b_plan_gebiete','numeric','','','0','18','Text','','Fläche [ha]','','4','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`,`privileg`) VALUES(@last_layer_id720,'gebietstyp','gebietstyp','b_plan_gebiete','b_plan_gebiete','int4','','','0','32','Auswahlfeld','select id as value, typ as output from gebietstypen where art = TRUE order by output <required by>konkretisierung</required by>','Gebietstyp','','2','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`,`privileg`) VALUES(@last_layer_id720,'kap_gemziel','kap_gemziel','b_plan_gebiete','b_plan_gebiete','int4','','','1','32','Text','','Kapazität Ziel','','5','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`,`privileg`) VALUES(@last_layer_id720,'kap_nachstell','kap_nachstell','b_plan_gebiete','b_plan_gebiete','int4','','','1','32','Text','','Kapazität n.S.','','6','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`,`privileg`) VALUES(@last_layer_id720,'konkretisierung','konkretisierung','b_plan_gebiete','b_plan_gebiete','int4','','','1','32','Auswahlfeld','select id as value, bezeichnung as output from konkretisierungen where gebiets_id = <requires>gebietstyp</requires> order by output','Konkretisierung','','3','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`,`privileg`) VALUES(@last_layer_id720,'plan_id','plan_id','b_plan_gebiete','b_plan_gebiete','int4','','','0','32','Text','','','','0','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`,`privileg`) VALUES(@last_layer_id720,'vorschau','flaeche','b_plan_gebiete','b_plan_gebiete','not_saveable','','','0','18','Text','','','','1','0');
  
  INSERT INTO layer (`Name`,`alias`,`Datentyp`,`Gruppe`,`pfad`,`maintable`,`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`,`processing`,`kurzbeschreibung`,`datenherr`,`metalink`,`privileg`) VALUES('bauleit_gebietstypen','','5',@group_id,'SELECT * FROM gebietstypen WHERE 1=1','gebietstypen','the_geom from bauleitplanung.gebietstypen','bauleitplanung','','','','','','0','0','',@connection,'','6','','','3','pixels','35833','','1',NULL,NULL,'-1','-1','','EPSG:35833 EPSG:4326 EPSG:2398 EPSG:25833','','1.1.0','image/png','60','','','','','0','0','','','','','0');
  SET @last_layer_id737=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`,`privileg`) VALUES(@last_layer_id737,'art','art','gebietstypen','gebietstypen','bool','','','1',NULL,'Text','','','','2','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`,`privileg`) VALUES(@last_layer_id737,'einheit','einheit','gebietstypen','gebietstypen','varchar','','','1','30','Text','','','','3','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`,`privileg`) VALUES(@last_layer_id737,'id','id','gebietstypen','gebietstypen','int4','','','1','32','Text','','','','0','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`,`privileg`) VALUES(@last_layer_id737,'typ','typ','gebietstypen','gebietstypen','varchar','','','1','100','Text','','','','1','0');
  
  INSERT INTO layer (`Name`,`alias`,`Datentyp`,`Gruppe`,`pfad`,`maintable`,`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`,`processing`,`kurzbeschreibung`,`datenherr`,`metalink`,`privileg`) VALUES('bauleit_konkretisierungen','','5',@group_id,'SELECT * FROM konkretisierungen WHERE 1=1','konkretisierungen','the_geom from bauleitplanung.konkretisierungen','bauleitplanung','','','','','','0','0','',@connection,'','6','','','3','pixels','35833','','1',NULL,NULL,'-1','-1','','EPSG:35833 EPSG:4326 EPSG:2398 EPSG:25833','','1.1.0','image/png','60','','','','','0','0','','','','','0');
  SET @last_layer_id736=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`,`privileg`) VALUES(@last_layer_id736,'bezeichnung','bezeichnung','konkretisierungen','konkretisierungen','varchar','','','1','100','Text','','Bezeichnung','','2','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`,`privileg`) VALUES(@last_layer_id736,'gebiets_id','gebiets_id','konkretisierungen','konkretisierungen','int4','','','1','32','Text','','','','1','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`,`privileg`) VALUES(@last_layer_id736,'id','id','konkretisierungen','konkretisierungen','int4','','','1','32','Text','','','','0','0');
  
  INSERT INTO layer (`Name`,`alias`,`Datentyp`,`Gruppe`,`pfad`,`maintable`,`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`,`processing`,`kurzbeschreibung`,`datenherr`,`metalink`,`privileg`) VALUES('bauleit_sondergebiete','','5',@group_id,'SELECT plan_id, flaeche||\' ha \'||typ||CASE WHEN bezeichnung IS NULL THEN \' \' ELSE \' \'||bezeichnung END ||\' \'||CASE WHEN kap1_gemziel IS NULL THEN \'\' ELSE \'(Ziel: \'||kap1_gemziel::text END||\' \'||CASE WHEN kap1_nachstell IS NULL THEN \'\' ELSE \'n.S.: \'||kap1_nachstell::text||\')\' END ||\' \'||CASE WHEN kap2_gemziel IS NULL THEN \'\' ELSE \'(Ziel: \'||kap2_gemziel::text END||\' \'||CASE WHEN kap2_nachstell IS NULL THEN \'\' ELSE \'n.S.: \'||kap2_nachstell::text||\')\' END || CASE WHEN gebietstypen.einheit IS NULL OR (kap1_nachstell IS NULL AND kap1_gemziel IS NULL) THEN \'\' ELSE \' \'||gebietstypen.einheit||\' \'END as vorschau, gebietstyp as gebietstyp_s, konkretisierung as konkretisierung_s, flaeche as flaeche_s, kap1_gemziel as kap1_gemziel_s, kap1_nachstell as kap1_nachstell_s, kap2_gemziel as kap2_gemziel_s, kap2_nachstell as kap2_nachstell_s FROM gebietstypen, b_plan_sondergebiete LEFT JOIN konkretisierungen ON konkretisierungen.id = b_plan_sondergebiete.konkretisierung WHERE gebietstypen.id = gebietstyp','b_plan_sondergebiete','','bauleitplanung','','','','','','0','0','',@connection,'','6','','','3','pixels','35833','bauleitplanung/view/bplan_gebiete.php','1',NULL,NULL,'-1','-1','','EPSG:35833 EPSG:4326 EPSG:2398 EPSG:25833','','1.1.0','image/png','60','','','','','0','0','','','','','2');
  SET @last_layer_id728=LAST_INSERT_ID();
  INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`decimal_length`,`default`,`form_element_type`,`options`,`alias`,`alias_low-german`,`alias_english`,`alias_polish`,`alias_vietnamese`,`tooltip`,`group`,`raster_visibility`,`mandatory`,`order`,`privileg`,`query_tooltip`) VALUES(@last_layer_id728,'flaeche_s','flaeche','b_plan_sondergebiete','b_plan_sondergebiete','numeric','','','1','18','2','','Text','','Fläche [ha]','','','','','','',NULL,NULL,'4','1','0');
  INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`decimal_length`,`default`,`form_element_type`,`options`,`alias`,`alias_low-german`,`alias_english`,`alias_polish`,`alias_vietnamese`,`tooltip`,`group`,`raster_visibility`,`mandatory`,`order`,`privileg`,`query_tooltip`) VALUES(@last_layer_id728,'gebietstyp_s','gebietstyp','b_plan_sondergebiete','b_plan_sondergebiete','int4','','','0','32',NULL,'','Auswahlfeld','select id as value, typ as output from gebietstypen where art = FALSE order by output <required by>konkretisierung_s</required by>','Gebietstyp','','','','','','',NULL,NULL,'2','1','0');
  INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`decimal_length`,`default`,`form_element_type`,`options`,`alias`,`alias_low-german`,`alias_english`,`alias_polish`,`alias_vietnamese`,`tooltip`,`group`,`raster_visibility`,`mandatory`,`order`,`privileg`,`query_tooltip`) VALUES(@last_layer_id728,'kap1_gemziel_s','kap1_gemziel','b_plan_sondergebiete','b_plan_sondergebiete','int4','','','1','32',NULL,'','Text','','Kapazität Ziel','','','','','','',NULL,NULL,'5','1','0');
  INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`decimal_length`,`default`,`form_element_type`,`options`,`alias`,`alias_low-german`,`alias_english`,`alias_polish`,`alias_vietnamese`,`tooltip`,`group`,`raster_visibility`,`mandatory`,`order`,`privileg`,`query_tooltip`) VALUES(@last_layer_id728,'kap1_nachstell_s','kap1_nachstell','b_plan_sondergebiete','b_plan_sondergebiete','int4','','','1','32',NULL,'','Text','','Kapazität n.S.','','','','','','',NULL,NULL,'6','1','0');
  INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`decimal_length`,`default`,`form_element_type`,`options`,`alias`,`alias_low-german`,`alias_english`,`alias_polish`,`alias_vietnamese`,`tooltip`,`group`,`raster_visibility`,`mandatory`,`order`,`privileg`,`query_tooltip`) VALUES(@last_layer_id728,'kap2_gemziel_s','kap2_gemziel','b_plan_sondergebiete','b_plan_sondergebiete','int4','','','1','32',NULL,'','Text','','Kapazität Ziel','','','','','','',NULL,NULL,'7','1','0');
  INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`decimal_length`,`default`,`form_element_type`,`options`,`alias`,`alias_low-german`,`alias_english`,`alias_polish`,`alias_vietnamese`,`tooltip`,`group`,`raster_visibility`,`mandatory`,`order`,`privileg`,`query_tooltip`) VALUES(@last_layer_id728,'kap2_nachstell_s','kap2_nachstell','b_plan_sondergebiete','b_plan_sondergebiete','int4','','','1','32',NULL,'','Text','','Kapazität n.S.','','','','','','',NULL,NULL,'8','1','0');
  INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`decimal_length`,`default`,`form_element_type`,`options`,`alias`,`alias_low-german`,`alias_english`,`alias_polish`,`alias_vietnamese`,`tooltip`,`group`,`raster_visibility`,`mandatory`,`order`,`privileg`,`query_tooltip`) VALUES(@last_layer_id728,'konkretisierung_s','konkretisierung','b_plan_sondergebiete','b_plan_sondergebiete','int4','','','1','32',NULL,'','Auswahlfeld','select id as value, bezeichnung as output from konkretisierungen where gebiets_id = <requires>gebietstyp_s</requires> order by output','Konkretisierung','','','','','','',NULL,NULL,'3','1','0');
  INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`decimal_length`,`default`,`form_element_type`,`options`,`alias`,`alias_low-german`,`alias_english`,`alias_polish`,`alias_vietnamese`,`tooltip`,`group`,`raster_visibility`,`mandatory`,`order`,`privileg`,`query_tooltip`) VALUES(@last_layer_id728,'plan_id','plan_id','b_plan_sondergebiete','b_plan_sondergebiete','int4','','','1','32',NULL,'','Text','','','','','','','','',NULL,NULL,'0','0','0');
  INSERT INTO layer_attributes (`layer_id`,`name`,`real_name`,`tablename`,`table_alias_name`,`type`,`geometrytype`,`constraints`,`nullable`,`length`,`decimal_length`,`default`,`form_element_type`,`options`,`alias`,`alias_low-german`,`alias_english`,`alias_polish`,`alias_vietnamese`,`tooltip`,`group`,`raster_visibility`,`mandatory`,`order`,`privileg`,`query_tooltip`) VALUES(@last_layer_id728,'vorschau','flaeche','b_plan_sondergebiete','b_plan_sondergebiete','not_saveable','','','1','18','2','','Text','','','','','','','','',NULL,NULL,'1','0','0');
  
  UPDATE layer_attributes SET options = REPLACE(options, '449', @last_layer_id449) WHERE layer_id IN(@last_layer_id449, @last_layer_id800, @last_layer_id801) AND form_element_type IN ('SubFormPK', 'SubFormFK', 'SubFormEmbeddedPK');
  UPDATE layer_attributes SET options = REPLACE(options, '800', @last_layer_id800) WHERE layer_id IN(@last_layer_id449, @last_layer_id800, @last_layer_id801) AND form_element_type IN ('SubFormPK', 'SubFormFK', 'SubFormEmbeddedPK');
  UPDATE layer_attributes SET options = REPLACE(options, '801', @last_layer_id801) WHERE layer_id IN(@last_layer_id449, @last_layer_id800, @last_layer_id801) AND form_element_type IN ('SubFormPK', 'SubFormFK', 'SubFormEmbeddedPK');
  
  UPDATE layer_attributes SET options = REPLACE(options, '395', @last_layer_id395) WHERE layer_id IN(@last_layer_id395, @last_layer_id445, @last_layer_id446, @last_layer_id447, @last_layer_id448, @last_layer_id443, @last_layer_id449, @last_layer_id450, @last_layer_id451, @last_layer_id452, @last_layer_id720, @last_layer_id737, @last_layer_id736, @last_layer_id728) AND form_element_type IN ('SubFormPK', 'SubFormFK', 'SubFormEmbeddedPK');
  UPDATE layer_attributes SET options = REPLACE(options, '445', @last_layer_id445) WHERE layer_id IN(@last_layer_id395, @last_layer_id445, @last_layer_id446, @last_layer_id447, @last_layer_id448, @last_layer_id443, @last_layer_id449, @last_layer_id450, @last_layer_id451, @last_layer_id452, @last_layer_id720, @last_layer_id737, @last_layer_id736, @last_layer_id728) AND form_element_type IN ('SubFormPK', 'SubFormFK', 'SubFormEmbeddedPK');
  UPDATE layer_attributes SET options = REPLACE(options, '446', @last_layer_id446) WHERE layer_id IN(@last_layer_id395, @last_layer_id445, @last_layer_id446, @last_layer_id447, @last_layer_id448, @last_layer_id443, @last_layer_id449, @last_layer_id450, @last_layer_id451, @last_layer_id452, @last_layer_id720, @last_layer_id737, @last_layer_id736, @last_layer_id728) AND form_element_type IN ('SubFormPK', 'SubFormFK', 'SubFormEmbeddedPK');
  UPDATE layer_attributes SET options = REPLACE(options, '447', @last_layer_id447) WHERE layer_id IN(@last_layer_id395, @last_layer_id445, @last_layer_id446, @last_layer_id447, @last_layer_id448, @last_layer_id443, @last_layer_id449, @last_layer_id450, @last_layer_id451, @last_layer_id452, @last_layer_id720, @last_layer_id737, @last_layer_id736, @last_layer_id728) AND form_element_type IN ('SubFormPK', 'SubFormFK', 'SubFormEmbeddedPK');
  UPDATE layer_attributes SET options = REPLACE(options, '448', @last_layer_id448) WHERE layer_id IN(@last_layer_id395, @last_layer_id445, @last_layer_id446, @last_layer_id447, @last_layer_id448, @last_layer_id443, @last_layer_id449, @last_layer_id450, @last_layer_id451, @last_layer_id452, @last_layer_id720, @last_layer_id737, @last_layer_id736, @last_layer_id728) AND form_element_type IN ('SubFormPK', 'SubFormFK', 'SubFormEmbeddedPK');
  UPDATE layer_attributes SET options = REPLACE(options, '443', @last_layer_id443) WHERE layer_id IN(@last_layer_id395, @last_layer_id445, @last_layer_id446, @last_layer_id447, @last_layer_id448, @last_layer_id443, @last_layer_id449, @last_layer_id450, @last_layer_id451, @last_layer_id452, @last_layer_id720, @last_layer_id737, @last_layer_id736, @last_layer_id728) AND form_element_type IN ('SubFormPK', 'SubFormFK', 'SubFormEmbeddedPK');
  UPDATE layer_attributes SET options = REPLACE(options, '449', @last_layer_id449) WHERE layer_id IN(@last_layer_id395, @last_layer_id445, @last_layer_id446, @last_layer_id447, @last_layer_id448, @last_layer_id443, @last_layer_id449, @last_layer_id450, @last_layer_id451, @last_layer_id452, @last_layer_id720, @last_layer_id737, @last_layer_id736, @last_layer_id728) AND form_element_type IN ('SubFormPK', 'SubFormFK', 'SubFormEmbeddedPK');
  UPDATE layer_attributes SET options = REPLACE(options, '450', @last_layer_id450) WHERE layer_id IN(@last_layer_id395, @last_layer_id445, @last_layer_id446, @last_layer_id447, @last_layer_id448, @last_layer_id443, @last_layer_id449, @last_layer_id450, @last_layer_id451, @last_layer_id452, @last_layer_id720, @last_layer_id737, @last_layer_id736, @last_layer_id728) AND form_element_type IN ('SubFormPK', 'SubFormFK', 'SubFormEmbeddedPK');
  UPDATE layer_attributes SET options = REPLACE(options, '451', @last_layer_id451) WHERE layer_id IN(@last_layer_id395, @last_layer_id445, @last_layer_id446, @last_layer_id447, @last_layer_id448, @last_layer_id443, @last_layer_id449, @last_layer_id450, @last_layer_id451, @last_layer_id452, @last_layer_id720, @last_layer_id737, @last_layer_id736, @last_layer_id728) AND form_element_type IN ('SubFormPK', 'SubFormFK', 'SubFormEmbeddedPK');
  UPDATE layer_attributes SET options = REPLACE(options, '452', @last_layer_id452) WHERE layer_id IN(@last_layer_id395, @last_layer_id445, @last_layer_id446, @last_layer_id447, @last_layer_id448, @last_layer_id443, @last_layer_id449, @last_layer_id450, @last_layer_id451, @last_layer_id452, @last_layer_id720, @last_layer_id737, @last_layer_id736, @last_layer_id728) AND form_element_type IN ('SubFormPK', 'SubFormFK', 'SubFormEmbeddedPK');
  UPDATE layer_attributes SET options = REPLACE(options, '720', @last_layer_id720) WHERE layer_id IN(@last_layer_id395, @last_layer_id445, @last_layer_id446, @last_layer_id447, @last_layer_id448, @last_layer_id443, @last_layer_id449, @last_layer_id450, @last_layer_id451, @last_layer_id452, @last_layer_id720, @last_layer_id737, @last_layer_id736, @last_layer_id728) AND form_element_type IN ('SubFormPK', 'SubFormFK', 'SubFormEmbeddedPK');
  UPDATE layer_attributes SET options = REPLACE(options, '737', @last_layer_id737) WHERE layer_id IN(@last_layer_id395, @last_layer_id445, @last_layer_id446, @last_layer_id447, @last_layer_id448, @last_layer_id443, @last_layer_id449, @last_layer_id450, @last_layer_id451, @last_layer_id452, @last_layer_id720, @last_layer_id737, @last_layer_id736, @last_layer_id728) AND form_element_type IN ('SubFormPK', 'SubFormFK', 'SubFormEmbeddedPK');
  UPDATE layer_attributes SET options = REPLACE(options, '736', @last_layer_id736) WHERE layer_id IN(@last_layer_id395, @last_layer_id445, @last_layer_id446, @last_layer_id447, @last_layer_id448, @last_layer_id443, @last_layer_id449, @last_layer_id450, @last_layer_id451, @last_layer_id452, @last_layer_id720, @last_layer_id737, @last_layer_id736, @last_layer_id728) AND form_element_type IN ('SubFormPK', 'SubFormFK', 'SubFormEmbeddedPK');
  UPDATE layer_attributes SET options = REPLACE(options, '728', @last_layer_id728) WHERE layer_id IN(@last_layer_id395, @last_layer_id445, @last_layer_id446, @last_layer_id447, @last_layer_id448, @last_layer_id443, @last_layer_id449, @last_layer_id450, @last_layer_id451, @last_layer_id452, @last_layer_id720, @last_layer_id737, @last_layer_id736, @last_layer_id728) AND form_element_type IN ('SubFormPK', 'SubFormFK', 'SubFormEmbeddedPK');
  