26 lines
531 B
SQL
26 lines
531 B
SQL
DELIMITER $$
|
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `hedera`.`image_ref`(
|
|
vCollection VARCHAR(255),
|
|
vName VARCHAR(255)
|
|
)
|
|
proc: BEGIN
|
|
/**
|
|
* Increases the reference count of an image.
|
|
*
|
|
* @param vCollection The collection name
|
|
* @param vName The image name
|
|
*/
|
|
IF vName IS NULL THEN
|
|
LEAVE proc;
|
|
END IF;
|
|
|
|
INSERT INTO `image`
|
|
SET `collectionFk` = vCollection,
|
|
`name` = vName,
|
|
`updated` = util.VN_UNIX_TIMESTAMP(),
|
|
`nRefs` = 1
|
|
ON DUPLICATE KEY UPDATE
|
|
`nRefs` = nRefs + 1;
|
|
END$$
|
|
DELIMITER ;
|