-
Notifications
You must be signed in to change notification settings - Fork 12
/
devLog.sql
61 lines (50 loc) · 1.34 KB
/
devLog.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
DELIMITER $$
DROP PROCEDURE IF EXISTS `devLog`$$
CREATE
PROCEDURE `devLog`(concat_data TEXT)
BEGIN
CREATE TEMPORARY TABLE IF NOT EXISTS `devLog` (
`id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`concat_data` TEXT,
`date` DATETIME,
PRIMARY KEY (`id`)
) ENGINE=INNODB DEFAULT CHARSET=utf8;
INSERT INTO devLog (`concat_data`,`date`) VALUES (concat_data,NOW());
END$$
DELIMITER ;
DELIMITER $$
DROP FUNCTION IF EXISTS `devLog`$$
CREATE
FUNCTION `devLog`(concat_data TEXT)
RETURNS TEXT DETERMINISTIC
COMMENT 'Function is only adapter for procedure so it can be used in sql query'
BEGIN
CALL devLog(concat_data);
RETURN concat_data;
END$$
DELIMITER ;
DELIMITER $$
DROP PROCEDURE IF EXISTS `devReset`$$
CREATE
PROCEDURE `devReset`()
BEGIN
DROP TEMPORARY TABLE IF EXISTS `devLog`;
CREATE TEMPORARY TABLE IF NOT EXISTS `devLog` (
`id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`concat_data` TEXT,
`date` DATETIME,
PRIMARY KEY (`id`)
) ENGINE=INNODB DEFAULT CHARSET=utf8;
END$$
DELIMITER ;
DELIMITER $$
DROP FUNCTION IF EXISTS `devReset`$$
CREATE
FUNCTION `devReset`()
RETURNS TEXT DETERMINISTIC
COMMENT 'Function is only adapter for procedure so it can be used in sql query'
BEGIN
CALL devReset();
RETURN '';
END$$
DELIMITER ;