DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`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 ;
