This commit is contained in:
parent
85a8009034
commit
b3a98226c0
|
@ -1,5 +1,5 @@
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`address_updateCorordinates`(
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`address_updateCoordinates`(
|
||||||
vTicketFk INT,
|
vTicketFk INT,
|
||||||
vLongitude INT,
|
vLongitude INT,
|
||||||
vLatitude INT)
|
vLatitude INT)
|
||||||
|
@ -13,18 +13,14 @@ BEGIN
|
||||||
*/
|
*/
|
||||||
DECLARE vAddressFK INT;
|
DECLARE vAddressFK INT;
|
||||||
|
|
||||||
START TRANSACTION;
|
|
||||||
|
|
||||||
SELECT addressFK INTO vAddressFK
|
SELECT addressFK INTO vAddressFK
|
||||||
FROM ticket
|
FROM ticket
|
||||||
WHERE id = vTicketFk
|
WHERE id = vTicketFk;
|
||||||
FOR UPDATE;
|
|
||||||
|
|
||||||
UPDATE address
|
UPDATE address
|
||||||
SET longitude = vLongitude,
|
SET longitude = vLongitude,
|
||||||
latitude = vLatitude
|
latitude = vLatitude
|
||||||
WHERE id = vAddressFK;
|
WHERE id = vAddressFK;
|
||||||
|
|
||||||
COMMIT;
|
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
|
@ -5,7 +5,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`delivery_beforeInsert
|
||||||
BEGIN
|
BEGIN
|
||||||
|
|
||||||
IF (NEW.longitude IS NOT NULL AND NEW.latitude IS NOT NULL AND NEW.ticketFK IS NOT NULL) THEN
|
IF (NEW.longitude IS NOT NULL AND NEW.latitude IS NOT NULL AND NEW.ticketFK IS NOT NULL) THEN
|
||||||
CALL address_updateCorordinates(NEW.ticketFk,NEW.longitude,NEW.latitude);
|
CALL address_updateCoordinates(NEW.ticketFk,NEW.longitude,NEW.latitude);
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
END$$
|
END$$
|
||||||
|
|
|
@ -5,7 +5,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`delivery_beforeUpdate
|
||||||
BEGIN
|
BEGIN
|
||||||
|
|
||||||
IF (NEW.longitude IS NOT NULL AND NEW.latitude IS NOT NULL AND NEW.ticketFK IS NOT NULL) THEN
|
IF (NEW.longitude IS NOT NULL AND NEW.latitude IS NOT NULL AND NEW.ticketFK IS NOT NULL) THEN
|
||||||
CALL address_updateCorordinates(NEW.ticketFk,NEW.longitude,NEW.latitude);
|
CALL address_updateCoordinates(NEW.ticketFk,NEW.longitude,NEW.latitude);
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
END$$
|
END$$
|
||||||
|
|
Loading…
Reference in New Issue