salix/db/routines/vn/functions/zoneGeo_new.sql

30 lines
689 B
MySQL
Raw Normal View History

DELIMITER $$
CREATE OR REPLACE DEFINER=`vn-admin`@`localhost` FUNCTION `vn`.`zoneGeo_new`(vType VARCHAR(255), vName VARCHAR(255), vParentFk INT)
RETURNS int(11)
NOT DETERMINISTIC
NO SQL
BEGIN
/**
* Creates a new node a node from the #zoneGeo table.
* Also sets a mark to force the tree recalculation.
*
* @param vType The node type
* @param vName The node name
* @param vParentFk The parent node identifier
* @return The new node identifier
*/
DECLARE vSelf INT;
INSERT INTO zoneGeo
SET `type` = vType,
`name` = vName,
parentFk = vParentFk;
SET vSelf = LAST_INSERT_ID();
UPDATE zoneGeoRecalc SET isChanged = TRUE;
RETURN vSelf;
END$$
DELIMITER ;