43 lines
782 B
MySQL
43 lines
782 B
MySQL
|
CREATE SCHEMA IF NOT EXISTS `util`;
|
||
|
USE `util`;
|
||
|
|
||
|
DELIMITER ;;
|
||
|
DROP FUNCTION IF EXISTS `util`.`mockedDate`;
|
||
|
CREATE FUNCTION `util`.`mockedDate`()
|
||
|
RETURNS DATETIME
|
||
|
DETERMINISTIC
|
||
|
BEGIN
|
||
|
RETURN NOW();
|
||
|
-- '2022-01-19 08:00:00'
|
||
|
END ;;
|
||
|
DELIMITER ;
|
||
|
|
||
|
DELIMITER ;;
|
||
|
DROP FUNCTION IF EXISTS `util`.`VN_CURDATE`;
|
||
|
CREATE FUNCTION `util`.`VN_CURDATE`()
|
||
|
RETURNS DATE
|
||
|
DETERMINISTIC
|
||
|
BEGIN
|
||
|
RETURN DATE(mockedDate());
|
||
|
END ;;
|
||
|
DELIMITER ;
|
||
|
|
||
|
DELIMITER ;;
|
||
|
DROP FUNCTION IF EXISTS `util`.`VN_CURTIME`;
|
||
|
CREATE FUNCTION `util`.`VN_CURTIME`()
|
||
|
RETURNS TIME
|
||
|
DETERMINISTIC
|
||
|
BEGIN
|
||
|
RETURN TIME(mockedDate());
|
||
|
END ;;
|
||
|
DELIMITER ;
|
||
|
|
||
|
DELIMITER ;;
|
||
|
DROP FUNCTION IF EXISTS `util`.`VN_NOW`;
|
||
|
CREATE FUNCTION `util`.`VN_NOW`()
|
||
|
RETURNS DATETIME
|
||
|
DETERMINISTIC
|
||
|
BEGIN
|
||
|
RETURN mockedDate();
|
||
|
END ;;
|
||
|
DELIMITER ;
|