#Procedure actualizar

CREATE DEFINER = 'root'@'localhost' PROCEDURE `proc_actualizar_apartamento`(IN id INTEGER(11), IN description VARCHAR(255), IN date INTEGER(11), IN totalArea FLOAT, IN transactionType INTEGER(11), IN price FLOAT, IN geenZones INTEGER(11), IN courtTenis INTEGER(11), IN golf INTEGER(11), IN firemen INTEGER(11), IN library INTEGER(11), IN autoRoad INTEGER(11), IN cityCenter INTEGER(11), IN commercialZone INTEGER(11), IN sightRiver INTEGER(11), IN sightField INTEGER(11), IN sightBeach INTEGER(11), IN sightLak INTEGER(11), IN riverPort INTEGER(11), IN seaPort INTEGER(11), IN areaInfantileLeisure INTEGER(11), IN beach INTEGER(11), IN publicTransports INTEGER(11), IN police INTEGER(11), IN hospital INTEGER(11), IN hypermarket INTEGER(11), IN airport INTEGER(11), IN pharmacy INTEGER(11), IN gymnasium INTEGER(11), IN school INTEGER(11), IN CompanyId INTEGER(11), IN typeProperty INTEGER(11), IN council INTEGER(11), IN freguesia INTEGER(11), IN zip INTEGER(11), IN orderBy INTEGER(11), IN parking INTEGER(11), IN contactId INTEGER(11), IN reference VARCHAR(255), IN userId INTEGER(11), IN accessDeficient INTEGER(11), IN centralAspiration INTEGER(11), IN airConditioned INTEGER(11), IN internetLinking INTEGER(11), IN alarm INTEGER(11), IN phone INTEGER(11), IN detectorIntrusion INTEGER(11), IN detectorFires INTEGER(11), IN detectorFlooding INTEGER(11), IN elevator INTEGER(11), IN jusGas INTEGER(11), IN naturalGas INTEGER(11), IN canalizedGas INTEGER(11), IN thermalIsolation INTEGER(11), IN acousticIsolation INTEGER(11), IN armoredDoor INTEGER(11), IN highDoorSecurity INTEGER(11), IN garage INTEGER(11), IN annex INTEGER(11), IN preInstalationAirConditioned INTEGER(11), IN preInstalationCentralAspiration INTEGER(11), IN preInstalationGas INTEGER(11), IN construtionYear INTEGER(11), IN state INTEGER(11), IN boiler INTEGER(11), IN typology VARCHAR(255), IN hall INTEGER(11), IN bedRoom INTEGER(11), IN laundryRoom INTEGER(11), IN marquee INTEGER(11), IN suite INTEGER(11), IN livingRoom INTEGER(11), IN verandah INTEGER(11), IN pantry INTEGER(11), IN kitchenet INTEGER(11), IN dinnerRoom INTEGER(11), IN kitchen INTEGER(11), IN barbecue INTEGER(11), IN hidromassagemBathtub INTEGER(11), IN mirroredGlass INTEGER(11), IN doubleGlasses INTEGER(11), IN videoDoorman INTEGER(11), IN heatedTowelRacks INTEGER(11), IN securityService INTEGER(11), IN poliban INTEGER(11), IN closet INTEGER(11), IN dishWasher INTEGER(11), IN dryer INTEGER(11), IN jacuzzi INTEGER(11), IN microWaves INTEGER(11), IN exhaustFan INTEGER(11), IN fireplace INTEGER(11), IN waterHeater INTEGER(11), IN electricBlinds INTEGER(11), IN stove INTEGER(11), IN oven INTEGER(11), IN refrigerator INTEGER(11), IN terrace INTEGER(11), IN pool INTEGER(11), IN coveredTerrace INTEGER(11), IN land FLOAT, IN clothesWather INTEGER(11), IN typeHousing INTEGER(11), IN idnovo INTEGER(11))
    NOT DETERMINISTIC
    CONTAINS SQL
    SQL SECURITY DEFINER
    COMMENT ''
begin
    declare _id INT;
   start TRANSACTION;

UPDATE property
	SET 
	description = description,
	totalArea = totalArea,
	transactionType= transactionType,
	price=price ,
	geenZones=geenZones ,
	courtTenis=courtTenis ,
	golf=golf ,
	firemen=firemen,
	library=library ,
	autoRoad=autoRoad,
	cityCenter=cityCenter ,
	commercialZone=commercialZone ,
	sightRiver=sightRiver ,
	sightField=sightField ,
	sightBeach=sightBeach ,
	sightLak=sightLak ,
	riverPort=riverPort ,
	seaPort=seaPort ,
	areaInfantileLeisure=areaInfantileLeisure ,
	beach =beach,
	publicTransports =publicTransports,
	police=police ,
	hospital=hospital ,
	hypermarket = hypermarket,
	airport =airport,
	pharmacy=pharmacy ,
	gymnasium=gymnasium ,
	school = school,
	CompanyId =CompanyId,
	typeProperty = typeProperty,
	council = council,
	freguesia = freguesia,
	zip = zip,
	orderBy = orderBy,
	parking = parking,
	contactId =contactId,
	reference =reference,
	userId =userId,
	accessDeficient=accessDeficient,
	centralAspiration=centralAspiration,
	airConditioned=airConditioned,
	internetLinking=internetLinking,
	alarm=alarm,
	phone=phone,
	detectorIntrusion=detectorIntrusion,
	detectorFires=detectorFires,
	detectorFlooding=detectorFlooding,
	elevator=elevator,
	jusGas=jusGas,
	naturalGas=naturalGas,
	canalizedGas=canalizedGas,
	thermalIsolation=thermalIsolation,
	acousticIsolation=acousticIsolation,
	armoredDoor=armoredDoor,
	highDoorSecurity=highDoorSecurity,
	garage=garage,
	annex=annex,
	preInstalationAirConditioned=preInstalationAirConditioned,
	preInstalationCentralAspiration=preInstalationCentralAspiration,
	preInstalationGas=preInstalationGas,	
	construtionYear=construtionYear,	
	state=state,	
	boiler=boiler
where property.id=id;



UPDATE apartmentHousingFarm
	SET 
		typology=typology,
		hall=hall,
		bedRoom=bedRoom,
		laundryRoom=laundryRoom,
		marquee=marquee,
		suite=suite,
		livingRoom=livingRoom,
		verandah=verandah,
		pantry=pantry,
		kitchenet=kitchenet,
		dinnerRoom=dinnerRoom,
		kitchen=kitchen,
		barbecue=barbecue,
		hidromassagemBathtub=hidromassagemBathtub,
		mirroredGlass=mirroredGlass,
		doubleGlasses=doubleGlasses,
		videoDoorman=videoDoorman,
		heatedTowelRacks=heatedTowelRacks,
		securityService=securityService,
		poliban=poliban,
		closet=closet,
		dishWasher=dishWasher,
		dryer=dryer,    
        jacuzzi= jacuzzi,
  		microWaves= microWaves,
	  	exhaustFan= exhaustFan,
		fireplace= fireplace,
  		waterHeater= waterHeater,
  		electricBlinds= electricBlinds,
  		stove= stove,
  		oven= oven,
  		refrigerator= refrigerator,
 		terrace= terrace,
  		pool= pool,
 		coveredTerrace= coveredTerrace,
  		land= land,
  		clothesWather= clothesWather,
  		typeHousing= typeHousing    
	where apartmentHousingFarm.id=id;
  COMMIT;
 
end;

CREATE DEFINER = 'root'@'localhost' PROCEDURE `proc_actualizar_armazem`(IN id INTEGER(11), IN description VARCHAR(255), IN date INTEGER(11), IN totalArea FLOAT, IN transactionType INTEGER(11), IN price FLOAT, IN geenZones INTEGER(11), IN courtTenis INTEGER(11), IN golf INTEGER(11), IN firemen INTEGER(11), IN library INTEGER(11), IN autoRoad INTEGER(11), IN cityCenter INTEGER(11), IN commercialZone INTEGER(11), IN sightRiver INTEGER(11), IN sightField INTEGER(11), IN sightBeach INTEGER(11), IN sightLak INTEGER(11), IN riverPort INTEGER(11), IN seaPort INTEGER(11), IN areaInfantileLeisure INTEGER(11), IN beach INTEGER(11), IN publicTransports INTEGER(11), IN police INTEGER(11), IN hospital INTEGER(11), IN hypermarket INTEGER(11), IN airport INTEGER(11), IN pharmacy INTEGER(11), IN gymnasium INTEGER(11), IN school INTEGER(11), IN CompanyId INTEGER(11), IN typeProperty INTEGER(11), IN council INTEGER(11), IN freguesia INTEGER(11), IN zip INTEGER(11), IN orderBy INTEGER(11), IN parking INTEGER(11), IN contactId INTEGER(11), IN reference VARCHAR(255), IN userId INTEGER(11), IN accessDeficient INTEGER(11), IN centralAspiration INTEGER(11), IN airConditioned INTEGER(11), IN internetLinking INTEGER(11), IN alarm INTEGER(11), IN phone INTEGER(11), IN detectorIntrusion INTEGER(11), IN detectorFires INTEGER(11), IN detectorFlooding INTEGER(11), IN elevator INTEGER(11), IN jusGas INTEGER(11), IN naturalGas INTEGER(11), IN canalizedGas INTEGER(11), IN thermalIsolation INTEGER(11), IN acousticIsolation INTEGER(11), IN armoredDoor INTEGER(11), IN highDoorSecurity INTEGER(11), IN garage INTEGER(11), IN annex INTEGER(11), IN preInstalationAirConditioned INTEGER(11), IN preInstalationCentralAspiration INTEGER(11), IN preInstalationGas INTEGER(11), IN construtionYear INTEGER(11), IN state INTEGER(11), IN boiler INTEGER(11), IN bathHouse INTEGER(11), IN numberDivisions INTEGER(11), IN idnovo INTEGER(11), IN removableWalls INTEGER(11), IN storeWindow INTEGER(11))
    NOT DETERMINISTIC
    CONTAINS SQL
    SQL SECURITY DEFINER
    COMMENT ''
begin
   
   start TRANSACTION;

UPDATE property
	SET 
	description = description,
	totalArea = totalArea,
	transactionType= transactionType,
	price=price ,
	geenZones=geenZones ,
	courtTenis=courtTenis ,
	golf=golf ,
	firemen=firemen,
	library=library ,
	autoRoad=autoRoad,
	cityCenter=cityCenter ,
	commercialZone=commercialZone ,
	sightRiver=sightRiver ,
	sightField=sightField ,
	sightBeach=sightBeach ,
	sightLak=sightLak ,
	riverPort=riverPort ,
	seaPort=seaPort ,
	areaInfantileLeisure=areaInfantileLeisure ,
	beach =beach,
	publicTransports =publicTransports,
	police=police ,
	hospital=hospital ,
	hypermarket = hypermarket,
	airport =airport,
	pharmacy=pharmacy ,
	gymnasium=gymnasium ,
	school = school,
	CompanyId =CompanyId,
	typeProperty = typeProperty,
	council = council,
	freguesia = freguesia,
	zip = zip,
	orderBy = orderBy,
	parking = parking,
	contactId =contactId,
	reference =reference,
	userId =userId,
	accessDeficient=accessDeficient,
	centralAspiration=centralAspiration,
	airConditioned=airConditioned,
	internetLinking=internetLinking,
	alarm=alarm,
	phone=phone,
	detectorIntrusion=detectorIntrusion,
	detectorFires=detectorFires,
	detectorFlooding=detectorFlooding,
	elevator=elevator,
	jusGas=jusGas,
	naturalGas=naturalGas,
	canalizedGas=canalizedGas,
	thermalIsolation=thermalIsolation,
	acousticIsolation=acousticIsolation,
	armoredDoor=armoredDoor,
	highDoorSecurity=highDoorSecurity,
	garage=garage,
	annex=annex,
	preInstalationAirConditioned=preInstalationAirConditioned,
	preInstalationCentralAspiration=preInstalationCentralAspiration,
	preInstalationGas=preInstalationGas,	
	construtionYear=construtionYear,	
	state=state,	
	boiler=boiler
where property.id=id;




UPDATE warehouseStoreOffice
	SET              
       bathHouse=bathHouse,
       numberDivisions=numberDivisions,
       removableWalls=removableWalls,
       storeWindow=storeWindow
	where warehouseStoreOffice.id=id;
  COMMIT;
 
end;

CREATE DEFINER = 'root'@'localhost' PROCEDURE `proc_actualizar_predio`(IN id INTEGER(11), IN description VARCHAR(255), IN date INTEGER(11), IN totalArea FLOAT, IN transactionType INTEGER(11), IN price FLOAT, IN geenZones INTEGER(11), IN courtTenis INTEGER(11), IN golf INTEGER(11), IN firemen INTEGER(11), IN library INTEGER(11), IN autoRoad INTEGER(11), IN cityCenter INTEGER(11), IN commercialZone INTEGER(11), IN sightRiver INTEGER(11), IN sightField INTEGER(11), IN sightBeach INTEGER(11), IN sightLak INTEGER(11), IN riverPort INTEGER(11), IN seaPort INTEGER(11), IN areaInfantileLeisure INTEGER(11), IN beach INTEGER(11), IN publicTransports INTEGER(11), IN police INTEGER(11), IN hospital INTEGER(11), IN hypermarket INTEGER(11), IN airport INTEGER(11), IN pharmacy INTEGER(11), IN gymnasium INTEGER(11), IN school INTEGER(11), IN CompanyId INTEGER(11), IN typeProperty INTEGER(11), IN council INTEGER(11), IN freguesia INTEGER(11), IN zip INTEGER(11), IN orderBy INTEGER(11), IN parking INTEGER(11), IN contactId INTEGER(11), IN reference VARCHAR(255), IN userId INTEGER(11), IN accessDeficient INTEGER(11), IN centralAspiration INTEGER(11), IN airConditioned INTEGER(11), IN internetLinking INTEGER(11), IN alarm INTEGER(11), IN phone INTEGER(11), IN detectorIntrusion INTEGER(11), IN detectorFires INTEGER(11), IN detectorFlooding INTEGER(11), IN elevator INTEGER(11), IN jusGas INTEGER(11), IN naturalGas INTEGER(11), IN canalizedGas INTEGER(11), IN thermalIsolation INTEGER(11), IN acousticIsolation INTEGER(11), IN armoredDoor INTEGER(11), IN highDoorSecurity INTEGER(11), IN garage INTEGER(11), IN annex INTEGER(11), IN preInstalationAirConditioned INTEGER(11), IN preInstalationCentralAspiration INTEGER(11), IN preInstalationGas INTEGER(11), IN construtionYear INTEGER(11), IN state INTEGER(11), IN boiler INTEGER(11), IN apartmentNumber INTEGER(11), IN commerce INTEGER(11), IN idnovo INTEGER(11))
    NOT DETERMINISTIC
    CONTAINS SQL
    SQL SECURITY DEFINER
    COMMENT ''
begin
   
   start TRANSACTION;

UPDATE property
	SET 
	description = description,
	totalArea = totalArea,
	transactionType= transactionType,
	price=price ,
	geenZones=geenZones ,
	courtTenis=courtTenis ,
	golf=golf ,
	firemen=firemen,
	library=library ,
	autoRoad=autoRoad,
	cityCenter=cityCenter ,
	commercialZone=commercialZone ,
	sightRiver=sightRiver ,
	sightField=sightField ,
	sightBeach=sightBeach ,
	sightLak=sightLak ,
	riverPort=riverPort ,
	seaPort=seaPort ,
	areaInfantileLeisure=areaInfantileLeisure ,
	beach =beach,
	publicTransports =publicTransports,
	police=police ,
	hospital=hospital ,
	hypermarket = hypermarket,
	airport =airport,
	pharmacy=pharmacy ,
	gymnasium=gymnasium ,
	school = school,
	CompanyId =CompanyId,
	typeProperty = typeProperty,
	council = council,
	freguesia = freguesia,
	zip = zip,
	orderBy = orderBy,
	parking = parking,
	contactId =contactId,
	reference =reference,
	userId =userId,
	accessDeficient=accessDeficient,
	centralAspiration=centralAspiration,
	airConditioned=airConditioned,
	internetLinking=internetLinking,
	alarm=alarm,
	phone=phone,
	detectorIntrusion=detectorIntrusion,
	detectorFires=detectorFires,
	detectorFlooding=detectorFlooding,
	elevator=elevator,
	jusGas=jusGas,
	naturalGas=naturalGas,
	canalizedGas=canalizedGas,
	thermalIsolation=thermalIsolation,
	acousticIsolation=acousticIsolation,
	armoredDoor=armoredDoor,
	highDoorSecurity=highDoorSecurity,
	garage=garage,
	annex=annex,
	preInstalationAirConditioned=preInstalationAirConditioned,
	preInstalationCentralAspiration=preInstalationCentralAspiration,
	preInstalationGas=preInstalationGas,	
	construtionYear=construtionYear,	
	state=state,	
	boiler=boiler
where property.id=id;




UPDATE building
	SET              
      apartmentNumber= apartmentNumber,
      commerce=commerce
	where building.id=id;
  COMMIT;	
end;
CREATE DEFINER = 'root'@'localhost' PROCEDURE `proc_actualizar_terreno`(IN id INTEGER(11), IN description VARCHAR(255), IN date INTEGER(11), IN totalArea FLOAT, IN transactionType INTEGER(11), IN price FLOAT, IN geenZones INTEGER(11), IN courtTenis INTEGER(11), IN golf INTEGER(11), IN firemen INTEGER(11), IN library INTEGER(11), IN autoRoad INTEGER(11), IN cityCenter INTEGER(11), IN commercialZone INTEGER(11), IN sightRiver INTEGER(11), IN sightField INTEGER(11), IN sightBeach INTEGER(11), IN sightLak INTEGER(11), IN riverPort INTEGER(11), IN seaPort INTEGER(11), IN areaInfantileLeisure INTEGER(11), IN beach INTEGER(11), IN publicTransports INTEGER(11), IN police INTEGER(11), IN hospital INTEGER(11), IN hypermarket INTEGER(11), IN airport INTEGER(11), IN pharmacy INTEGER(11), IN gymnasium INTEGER(11), IN school INTEGER(11), IN CompanyId INTEGER(11), IN typeProperty INTEGER(11), IN council INTEGER(11), IN freguesia INTEGER(11), IN zip INTEGER(11), IN orderBy INTEGER(11), IN parking INTEGER(11), IN contactId INTEGER(11), IN reference VARCHAR(255), IN userId INTEGER(11), IN accessDeficient INTEGER(11), IN centralAspiration INTEGER(11), IN airConditioned INTEGER(11), IN internetLinking INTEGER(11), IN alarm INTEGER(11), IN phone INTEGER(11), IN detectorIntrusion INTEGER(11), IN detectorFires INTEGER(11), IN detectorFlooding INTEGER(11), IN elevator INTEGER(11), IN jusGas INTEGER(11), IN naturalGas INTEGER(11), IN canalizedGas INTEGER(11), IN thermalIsolation INTEGER(11), IN acousticIsolation INTEGER(11), IN armoredDoor INTEGER(11), IN highDoorSecurity INTEGER(11), IN garage INTEGER(11), IN annex INTEGER(11), IN preInstalationAirConditioned INTEGER(11), IN preInstalationCentralAspiration INTEGER(11), IN preInstalationGas INTEGER(11), IN construtionYear INTEGER(11), IN state INTEGER(11), IN boiler INTEGER(11), IN constructionArea INTEGER(11), IN publicPark INTEGER(11), IN wall INTEGER(11), IN Vedacao INTEGER(11), IN warehouse INTEGER(11), IN typeLand INTEGER(11), IN idnovo INTEGER(11))
    NOT DETERMINISTIC
    CONTAINS SQL
    SQL SECURITY DEFINER
    COMMENT ''
begin
   
   start TRANSACTION;

UPDATE property
	SET 
	description = description,
	totalArea = totalArea,
	transactionType= transactionType,
	price=price ,
	geenZones=geenZones ,
	courtTenis=courtTenis ,
	golf=golf ,
	firemen=firemen,
	library=library ,
	autoRoad=autoRoad,
	cityCenter=cityCenter ,
	commercialZone=commercialZone ,
	sightRiver=sightRiver ,
	sightField=sightField ,
	sightBeach=sightBeach ,
	sightLak=sightLak ,
	riverPort=riverPort ,
	seaPort=seaPort ,
	areaInfantileLeisure=areaInfantileLeisure ,
	beach =beach,
	publicTransports =publicTransports,
	police=police ,
	hospital=hospital ,
	hypermarket = hypermarket,
	airport =airport,
	pharmacy=pharmacy ,
	gymnasium=gymnasium ,
	school = school,
	CompanyId =CompanyId,
	typeProperty = typeProperty,
	council = council,
	freguesia = freguesia,
	zip = zip,
	orderBy = orderBy,
	parking = parking,
	contactId =contactId,
	reference =reference,
	userId =userId,
	accessDeficient=accessDeficient,
	centralAspiration=centralAspiration,
	airConditioned=airConditioned,
	internetLinking=internetLinking,
	alarm=alarm,
	phone=phone,
	detectorIntrusion=detectorIntrusion,
	detectorFires=detectorFires,
	detectorFlooding=detectorFlooding,
	elevator=elevator,
	jusGas=jusGas,
	naturalGas=naturalGas,
	canalizedGas=canalizedGas,
	thermalIsolation=thermalIsolation,
	acousticIsolation=acousticIsolation,
	armoredDoor=armoredDoor,
	highDoorSecurity=highDoorSecurity,
	garage=garage,
	annex=annex,
	preInstalationAirConditioned=preInstalationAirConditioned,
	preInstalationCentralAspiration=preInstalationCentralAspiration,
	preInstalationGas=preInstalationGas,	
	construtionYear=construtionYear,	
	state=state,	
	boiler=boiler
where property.id=id;



UPDATE land
	SET              
    constructionArea=constructionArea,
    publicPark=publicPark,
    wall=wall,
    Vedacao=Vedacao,
    warehouse=warehouse,
    typeLand=typeLand
	where land.id=id;
  COMMIT;
end;

#Procedure apagar
CREATE DEFINER = 'root'@'localhost' PROCEDURE `proc_apagar`(IN id INTEGER(11))
    NOT DETERMINISTIC
    CONTAINS SQL
    SQL SECURITY DEFINER
    COMMENT ''
begin
   declare apart INT;
   declare warehouse INT;
   declare build INT;
   declare lan INT;
   start TRANSACTION;
   delete from property where property.id=id;
   
   select count(*) into apart from apartmentHousingFarm where apartmentHousingFarm.id=id; 
   select count(*) into warehouse from warehouseStoreOffice where warehouseStoreOffice.id=id; 
   select count(*) into build from building where building.id=id; 
   select count(*) into lan from land where land.id=id; 
   
   if(apart <> 0 ) then
       delete from apartmentHousingFarm where apartmentHousingFarm.id=id;
   ELSEIF (warehouse <> 0) then
   		delete from warehouseStoreOffice where warehouseStoreOffice.id=id;
   ELSEIF (build <> 0 ) then 
   		delete from building where building.id=id;
   ELSEIF (lan <> 0 ) then 
   		delete from land where land.id=id;
   end IF;
   
  COMMIT;

#procedure inserir


CREATE DEFINER = 'root'@'localhost' PROCEDURE `proc_inserir_apartamento`(IN id INTEGER(11), IN description VARCHAR(255), IN date INTEGER(11), IN totalArea FLOAT, IN transactionType INTEGER(11), IN price FLOAT, IN geenZones INTEGER(11), IN courtTenis INTEGER(11), IN golf INTEGER(11), IN firemen INTEGER(11), IN library INTEGER(11), IN autoRoad INTEGER(11), IN cityCenter INTEGER(11), IN commercialZone INTEGER(11), IN sightRiver INTEGER(11), IN sightField INTEGER(11), IN sightBeach INTEGER(11), IN sightLak INTEGER(11), IN riverPort INTEGER(11), IN seaPort INTEGER(11), IN areaInfantileLeisure INTEGER(11), IN beach INTEGER(11), IN publicTransports INTEGER(11), IN police INTEGER(11), IN hospital INTEGER(11), IN hypermarket INTEGER(11), IN airport INTEGER(11), IN pharmacy INTEGER(11), IN gymnasium INTEGER(11), IN school INTEGER(11), IN CompanyId INTEGER(11), IN typeProperty INTEGER(11), IN council INTEGER(11), IN freguesia INTEGER(11), IN zip INTEGER(11), IN orderBy INTEGER(11), IN parking INTEGER(11), IN contactId INTEGER(11), IN reference VARCHAR(255), IN userId INTEGER(11), IN accessDeficient INTEGER(11), IN centralAspiration INTEGER(11), IN airConditioned INTEGER(11), IN internetLinking INTEGER(11), IN alarm INTEGER(11), IN phone INTEGER(11), IN detectorIntrusion INTEGER(11), IN detectorFires INTEGER(11), IN detectorFlooding INTEGER(11), IN elevator INTEGER(11), IN jusGas INTEGER(11), IN naturalGas INTEGER(11), IN canalizedGas INTEGER(11), IN thermalIsolation INTEGER(11), IN acousticIsolation INTEGER(11), IN armoredDoor INTEGER(11), IN highDoorSecurity INTEGER(11), IN garage INTEGER(11), IN annex INTEGER(11), IN preInstalationAirConditioned INTEGER(11), IN preInstalationCentralAspiration INTEGER(11), IN preInstalationGas INTEGER(11), IN construtionYear INTEGER(11), IN state INTEGER(11), IN boiler INTEGER(11), IN typology VARCHAR(255), IN hall INTEGER(11), IN bedRoom INTEGER(11), IN laundryRoom INTEGER(11), IN marquee INTEGER(11), IN suite INTEGER(11), IN livingRoom INTEGER(11), IN verandah INTEGER(11), IN pantry INTEGER(11), IN kitchenet INTEGER(11), IN dinnerRoom INTEGER(11), IN kitchen INTEGER(11), IN barbecue INTEGER(11), IN hidromassagemBathtub INTEGER(11), IN mirroredGlass INTEGER(11), IN doubleGlasses INTEGER(11), IN videoDoorman INTEGER(11), IN heatedTowelRacks INTEGER(11), IN securityService INTEGER(11), IN poliban INTEGER(11), IN closet INTEGER(11), IN dishWasher INTEGER(11), IN dryer INTEGER(11), IN jacuzzi INTEGER(11), IN microWaves INTEGER(11), IN exhaustFan INTEGER(11), IN fireplace INTEGER(11), IN waterHeater INTEGER(11), IN electricBlinds INTEGER(11), IN stove INTEGER(11), IN oven INTEGER(11), IN refrigerator INTEGER(11), IN terrace INTEGER(11), IN pool INTEGER(11), IN coveredTerrace INTEGER(11), IN land FLOAT, IN clothesWather INTEGER(11), IN typeHousing INTEGER(11), IN idnovo INTEGER(11))
    NOT DETERMINISTIC
    CONTAINS SQL
    SQL SECURITY DEFINER
    COMMENT ''
begin
    declare _id INT;
   start TRANSACTION;

INSERT INTO property(
id ,
description ,
date ,
totalArea ,
transactionType ,
price ,
geenZones ,
courtTenis ,
golf ,
firemen ,
library ,
autoRoad ,
cityCenter ,
commercialZone ,
sightRiver ,
sightField ,
sightBeach ,
sightLak ,
riverPort ,
seaPort ,
areaInfantileLeisure ,
beach ,
publicTransports ,
police ,
hospital ,
hypermarket ,
airport ,
pharmacy ,
gymnasium ,
school ,
CompanyId ,
typeProperty ,
council ,
freguesia ,
zip ,
orderBy ,
parking ,
contactId ,
reference ,
userId ,
accessDeficient,
centralAspiration,
airConditioned,
internetLinking,
alarm,
phone,
detectorIntrusion,
detectorFires,
detectorFlooding,
elevator,
jusGas,
naturalGas,
canalizedGas,
thermalIsolation,
acousticIsolation,
armoredDoor,
highDoorSecurity,
garage,
annex,
preInstalationAirConditioned,
preInstalationCentralAspiration,
preInstalationGas,	
construtionYear,	
state,	
boiler)
	VALUES ('' ,
description ,
NULL ,
totalArea ,
transactionType ,
price ,
geenZones ,
courtTenis ,
golf ,
firemen ,
library ,
autoRoad ,
cityCenter ,
commercialZone ,
sightRiver ,
sightField ,
sightBeach ,
sightLak ,
riverPort ,
seaPort ,
areaInfantileLeisure ,
beach ,
publicTransports ,
police ,
hospital ,
hypermarket ,
airport ,
pharmacy ,
gymnasium ,
school ,
CompanyId ,
typeProperty ,
council ,
freguesia ,
zip ,
orderBy ,
parking ,
contactId ,
reference ,
userId ,
accessDeficient,
centralAspiration,
airConditioned,
internetLinking,
alarm,
phone,
detectorIntrusion,
detectorFires,
detectorFlooding,
elevator,
jusGas,
naturalGas,
canalizedGas,
thermalIsolation,
acousticIsolation,
armoredDoor,
highDoorSecurity,
garage,
annex,
preInstalationAirConditioned,
preInstalationCentralAspiration,
preInstalationGas,	
construtionYear,	
state,	
boiler);




UPDATE apartmentHousingFarm
	SET 
		typology=typology,
		hall=hall,
		bedRoom=bedRoom,
		laundryRoom=laundryRoom,
		marquee=marquee,
		suite=suite,
		livingRoom=livingRoom,
		verandah=verandah,
		pantry=pantry,
		kitchenet=kitchenet,
		dinnerRoom=dinnerRoom,
		kitchen=kitchen,
		barbecue=barbecue,
		hidromassagemBathtub=hidromassagemBathtub,
		mirroredGlass=mirroredGlass,
		doubleGlasses=doubleGlasses,
		videoDoorman=videoDoorman,
		heatedTowelRacks=heatedTowelRacks,
		securityService=securityService,
		poliban=poliban,
		closet=closet,
		dishWasher=dishWasher,
		dryer=dryer,    
         jacuzzi= jacuzzi,
  microWaves= microWaves,
  exhaustFan= exhaustFan,
  fireplace= fireplace,
  waterHeater= waterHeater,
  electricBlinds= electricBlinds,
  stove= stove,
  oven= oven,
  refrigerator= refrigerator,
 terrace= terrace,
  pool= pool,
 coveredTerrace= coveredTerrace,
  land= land,
  clothesWather= clothesWather,
  typeHousing= typeHousing    
	where apartmentHousingFarm.id=LAST_INSERT_ID();
  COMMIT;
 
     
	
	
		
  
end;


CREATE DEFINER = 'root'@'localhost' PROCEDURE `proc_inserir_armazem`(IN id INTEGER(11), IN description VARCHAR(255), IN date INTEGER(11), IN totalArea FLOAT, IN transactionType INTEGER(11), IN price FLOAT, IN geenZones INTEGER(11), IN courtTenis INTEGER(11), IN golf INTEGER(11), IN firemen INTEGER(11), IN library INTEGER(11), IN autoRoad INTEGER(11), IN cityCenter INTEGER(11), IN commercialZone INTEGER(11), IN sightRiver INTEGER(11), IN sightField INTEGER(11), IN sightBeach INTEGER(11), IN sightLak INTEGER(11), IN riverPort INTEGER(11), IN seaPort INTEGER(11), IN areaInfantileLeisure INTEGER(11), IN beach INTEGER(11), IN publicTransports INTEGER(11), IN police INTEGER(11), IN hospital INTEGER(11), IN hypermarket INTEGER(11), IN airport INTEGER(11), IN pharmacy INTEGER(11), IN gymnasium INTEGER(11), IN school INTEGER(11), IN CompanyId INTEGER(11), IN typeProperty INTEGER(11), IN council INTEGER(11), IN freguesia INTEGER(11), IN zip INTEGER(11), IN orderBy INTEGER(11), IN parking INTEGER(11), IN contactId INTEGER(11), IN reference INTEGER(11), IN userId INTEGER(11), IN accessDeficient INTEGER(11), IN centralAspiration INTEGER(11), IN airConditioned INTEGER(11), IN internetLinking INTEGER(11), IN alarm INTEGER(11), IN phone INTEGER(11), IN detectorIntrusion INTEGER(11), IN detectorFires INTEGER(11), IN detectorFlooding INTEGER(11), IN elevator INTEGER(11), IN jusGas INTEGER(11), IN naturalGas INTEGER(11), IN canalizedGas INTEGER(11), IN thermalIsolation INTEGER(11), IN acousticIsolation INTEGER(11), IN armoredDoor INTEGER(11), IN highDoorSecurity INTEGER(11), IN garage INTEGER(11), IN annex INTEGER(11), IN preInstalationAirConditioned INTEGER(11), IN preInstalationCentralAspiration INTEGER(11), IN preInstalationGas INTEGER(11), IN construtionYear INTEGER(11), IN state INTEGER(11), IN boiler INTEGER(11), IN bathHouse INTEGER(11), IN numberDivisions INTEGER(11), IN idnovo INTEGER(11), IN removableWalls INTEGER(11), IN storeWindow INTEGER(11))
    NOT DETERMINISTIC
    CONTAINS SQL
    SQL SECURITY DEFINER
    COMMENT ''
begin
   
   start TRANSACTION;

INSERT INTO property(
id ,
description ,
date ,
totalArea ,
transactionType ,
price ,
geenZones ,
courtTenis ,
golf ,
firemen ,
library ,
autoRoad ,
cityCenter ,
commercialZone ,
sightRiver ,
sightField ,
sightBeach ,
sightLak ,
riverPort ,
seaPort ,
areaInfantileLeisure ,
beach ,
publicTransports ,
police ,
hospital ,
hypermarket ,
airport ,
pharmacy ,
gymnasium ,
school ,
CompanyId ,
typeProperty ,
council ,
freguesia ,
zip ,
orderBy,
parking ,
contactId ,
reference ,
userId ,
accessDeficient,
centralAspiration,
airConditioned,
internetLinking,
alarm,
phone,
detectorIntrusion,
detectorFires,
detectorFlooding,
elevator,
jusGas,
naturalGas,
canalizedGas,
thermalIsolation,
acousticIsolation,
armoredDoor,
highDoorSecurity,
garage,
annex,
preInstalationAirConditioned,
preInstalationCentralAspiration,
preInstalationGas,	
construtionYear,	
state,	
boiler)
	VALUES ('' ,
description ,
NULL ,
totalArea ,
transactionType ,
price ,
geenZones ,
courtTenis ,
golf ,
firemen ,
library ,
autoRoad ,
cityCenter ,
commercialZone ,
sightRiver ,
sightField ,
sightBeach ,
sightLak ,
riverPort ,
seaPort ,
areaInfantileLeisure ,
beach ,
publicTransports ,
police ,
hospital ,
hypermarket ,
airport ,
pharmacy ,
gymnasium ,
school ,
CompanyId ,
typeProperty ,
council ,
freguesia ,
zip ,
orderBy,
parking ,
contactId ,
reference ,
userId ,
accessDeficient,
centralAspiration,
airConditioned,
internetLinking,
alarm,
phone,
detectorIntrusion,
detectorFires,
detectorFlooding,
elevator,
jusGas,
naturalGas,
canalizedGas,
thermalIsolation,
acousticIsolation,
armoredDoor,
highDoorSecurity,
garage,
annex,
preInstalationAirConditioned,
preInstalationCentralAspiration,
preInstalationGas,	
construtionYear,	
state,	
boiler);




UPDATE warehouseStoreOffice
	SET              
       bathHouse=bathHouse,
       numberDivisions=numberDivisions,
       removableWalls=removableWalls,
       storeWindow=storeWindow
	where warehouseStoreOffice.id=LAST_INSERT_ID();
  COMMIT;
 
     
	
	
		
  
end;

CREATE DEFINER = 'root'@'localhost' PROCEDURE `proc_inserir_predio`(IN id INTEGER(11), IN description VARCHAR(255), IN date INTEGER(11), IN totalArea FLOAT, IN transactionType INTEGER(11), IN price FLOAT, IN geenZones INTEGER(11), IN courtTenis INTEGER(11), IN golf INTEGER(11), IN firemen INTEGER(11), IN library INTEGER(11), IN autoRoad INTEGER(11), IN cityCenter INTEGER(11), IN commercialZone INTEGER(11), IN sightRiver INTEGER(11), IN sightField INTEGER(11), IN sightBeach INTEGER(11), IN sightLak INTEGER(11), IN riverPort INTEGER(11), IN seaPort INTEGER(11), IN areaInfantileLeisure INTEGER(11), IN beach INTEGER(11), IN publicTransports INTEGER(11), IN police INTEGER(11), IN hospital INTEGER(11), IN hypermarket INTEGER(11), IN airport INTEGER(11), IN pharmacy INTEGER(11), IN gymnasium INTEGER(11), IN school INTEGER(11), IN CompanyId INTEGER(11), IN typeProperty INTEGER(11), IN council INTEGER(11), IN freguesia INTEGER(11), IN zip INTEGER(11), IN orderBy INTEGER(11), IN parking INTEGER(11), IN contactId INTEGER(11), IN reference INTEGER(11), IN userId INTEGER(11), IN accessDeficient INTEGER(11), IN centralAspiration INTEGER(11), IN airConditioned INTEGER(11), IN internetLinking INTEGER(11), IN alarm INTEGER(11), IN phone INTEGER(11), IN detectorIntrusion INTEGER(11), IN detectorFires INTEGER(11), IN detectorFlooding INTEGER(11), IN elevator INTEGER(11), IN jusGas INTEGER(11), IN naturalGas INTEGER(11), IN canalizedGas INTEGER(11), IN thermalIsolation INTEGER(11), IN acousticIsolation INTEGER(11), IN armoredDoor INTEGER(11), IN highDoorSecurity INTEGER(11), IN garage INTEGER(11), IN annex INTEGER(11), IN preInstalationAirConditioned INTEGER(11), IN preInstalationCentralAspiration INTEGER(11), IN preInstalationGas INTEGER(11), IN construtionYear INTEGER(11), IN state INTEGER(11), IN boiler INTEGER(11), IN apartmentNumber INTEGER(11), IN commerce INTEGER(11), IN idnovo INTEGER(11))
    NOT DETERMINISTIC
    CONTAINS SQL
    SQL SECURITY DEFINER
    COMMENT ''
begin
   
   start TRANSACTION;

INSERT INTO property(
id ,
description ,
date ,
totalArea ,
transactionType ,
price ,
geenZones ,
courtTenis ,
golf ,
firemen ,
library ,
autoRoad ,
cityCenter ,
commercialZone ,
sightRiver ,
sightField ,
sightBeach ,
sightLak ,
riverPort ,
seaPort ,
areaInfantileLeisure ,
beach ,
publicTransports ,
police ,
hospital ,
hypermarket ,
airport ,
pharmacy ,
gymnasium ,
school ,
CompanyId ,
typeProperty ,
council ,
freguesia ,
zip ,
orderBy,
parking ,
contactId ,
reference ,
userId ,
accessDeficient,
centralAspiration,
airConditioned,
internetLinking,
alarm,
phone,
detectorIntrusion,
detectorFires,
detectorFlooding,
elevator,
jusGas,
naturalGas,
canalizedGas,
thermalIsolation,
acousticIsolation,
armoredDoor,
highDoorSecurity,
garage,
annex,
preInstalationAirConditioned,
preInstalationCentralAspiration,
preInstalationGas,	
construtionYear,	
state,	
boiler)
	VALUES ('' ,
description ,
NULL ,
totalArea ,
transactionType ,
price ,
geenZones ,
courtTenis ,
golf ,
firemen ,
library ,
autoRoad ,
cityCenter ,
commercialZone ,
sightRiver ,
sightField ,
sightBeach ,
sightLak ,
riverPort ,
seaPort ,
areaInfantileLeisure ,
beach ,
publicTransports ,
police ,
hospital ,
hypermarket ,
airport ,
pharmacy ,
gymnasium ,
school ,
CompanyId ,
typeProperty ,
council ,
freguesia ,
zip ,
orderBy,
parking ,
contactId ,
reference ,
userId ,
accessDeficient,
centralAspiration,
airConditioned,
internetLinking,
alarm,
phone,
detectorIntrusion,
detectorFires,
detectorFlooding,
elevator,
jusGas,
naturalGas,
canalizedGas,
thermalIsolation,
acousticIsolation,
armoredDoor,
highDoorSecurity,
garage,
annex,
preInstalationAirConditioned,
preInstalationCentralAspiration,
preInstalationGas,	
construtionYear,	
state,	
boiler);




UPDATE building
	SET              
      apartmentNumber= apartmentNumber,
      commerce=commerce

	where building.id=LAST_INSERT_ID();
  COMMIT;
 
     
	
	
		
  
end;

CREATE DEFINER = 'root'@'localhost' PROCEDURE `proc_inserir_terreno`(IN id INTEGER(11), IN description VARCHAR(255), IN date INTEGER(11), IN totalArea FLOAT, IN transactionType INTEGER(11), IN price FLOAT, IN geenZones INTEGER(11), IN courtTenis INTEGER(11), IN golf INTEGER(11), IN firemen INTEGER(11), IN library INTEGER(11), IN autoRoad INTEGER(11), IN cityCenter INTEGER(11), IN commercialZone INTEGER(11), IN sightRiver INTEGER(11), IN sightField INTEGER(11), IN sightBeach INTEGER(11), IN sightLak INTEGER(11), IN riverPort INTEGER(11), IN seaPort INTEGER(11), IN areaInfantileLeisure INTEGER(11), IN beach INTEGER(11), IN publicTransports INTEGER(11), IN police INTEGER(11), IN hospital INTEGER(11), IN hypermarket INTEGER(11), IN airport INTEGER(11), IN pharmacy INTEGER(11), IN gymnasium INTEGER(11), IN school INTEGER(11), IN CompanyId INTEGER(11), IN typeProperty INTEGER(11), IN council INTEGER(11), IN freguesia INTEGER(11), IN zip INTEGER(11), IN orderBy INTEGER(11), IN parking INTEGER(11), IN contactId INTEGER(11), IN reference INTEGER(11), IN userId INTEGER(11), IN accessDeficient INTEGER(11), IN centralAspiration INTEGER(11), IN airConditioned INTEGER(11), IN internetLinking INTEGER(11), IN alarm INTEGER(11), IN phone INTEGER(11), IN detectorIntrusion INTEGER(11), IN detectorFires INTEGER(11), IN detectorFlooding INTEGER(11), IN elevator INTEGER(11), IN jusGas INTEGER(11), IN naturalGas INTEGER(11), IN canalizedGas INTEGER(11), IN thermalIsolation INTEGER(11), IN acousticIsolation INTEGER(11), IN armoredDoor INTEGER(11), IN highDoorSecurity INTEGER(11), IN garage INTEGER(11), IN annex INTEGER(11), IN preInstalationAirConditioned INTEGER(11), IN preInstalationCentralAspiration INTEGER(11), IN preInstalationGas INTEGER(11), IN construtionYear INTEGER(11), IN state INTEGER(11), IN boiler INTEGER(11), IN construtionArea INTEGER(11), IN publicPark INTEGER(11), IN wall INTEGER(11), IN Vedacao INTEGER(11), IN warehouse INTEGER(11), IN typeLand INTEGER(11), IN idnovo INTEGER(11))
    NOT DETERMINISTIC
    CONTAINS SQL
    SQL SECURITY DEFINER
    COMMENT ''
begin
   
   start TRANSACTION;

INSERT INTO property(
id ,
description ,
date ,
totalArea ,
transactionType ,
price ,
geenZones ,
courtTenis ,
golf ,
firemen ,
library ,
autoRoad ,
cityCenter ,
commercialZone ,
sightRiver ,
sightField ,
sightBeach ,
sightLak ,
riverPort ,
seaPort ,
areaInfantileLeisure ,
beach ,
publicTransports ,
police ,
hospital ,
hypermarket ,
airport ,
pharmacy ,
gymnasium ,
school ,
CompanyId ,
typeProperty ,
council ,
freguesia ,
zip ,
orderBy,
parking ,
contactId ,
reference ,
userId ,
accessDeficient,
centralAspiration,
airConditioned,
internetLinking,
alarm,
phone,
detectorIntrusion,
detectorFires,
detectorFlooding,
elevator,
jusGas,
naturalGas,
canalizedGas,
thermalIsolation,
acousticIsolation,
armoredDoor,
highDoorSecurity,
garage,
annex,
preInstalationAirConditioned,
preInstalationCentralAspiration,
preInstalationGas,	
construtionYear,	
state,	
boiler)
	VALUES ('' ,
description ,
NULL ,
totalArea ,
transactionType ,
price ,
geenZones ,
courtTenis ,
golf ,
firemen ,
library ,
autoRoad ,
cityCenter ,
commercialZone ,
sightRiver ,
sightField ,
sightBeach ,
sightLak ,
riverPort ,
seaPort ,
areaInfantileLeisure ,
beach ,
publicTransports ,
police ,
hospital ,
hypermarket ,
airport ,
pharmacy ,
gymnasium ,
school ,
CompanyId ,
typeProperty ,
council ,
freguesia ,
zip ,
orderBy,
parking ,
contactId ,
reference ,
userId ,
accessDeficient,
centralAspiration,
airConditioned,
internetLinking,
alarm,
phone,
detectorIntrusion,
detectorFires,
detectorFlooding,
elevator,
jusGas,
naturalGas,
canalizedGas,
thermalIsolation,
acousticIsolation,
armoredDoor,
highDoorSecurity,
garage,
annex,
preInstalationAirConditioned,
preInstalationCentralAspiration,
preInstalationGas,	
construtionYear,	
state,	
boiler);




UPDATE land
	SET              
    construtionArea=construtionArea,
    publicPark=publicPark,
    wall=wall,
    Vedacao=Vedacao,
    warehouse=warehouse,
    typeLand=typeLand
	where land.id=LAST_INSERT_ID();
  COMMIT;
 
     
	
	
		
  
end;