Last active
August 29, 2015 14:27
-
-
Save PareshRadadiya/360f5601381ec214f395 to your computer and use it in GitHub Desktop.
Dummy view generator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE DEFINER=`root`@`localhost` PROCEDURE `dummy_data`(IN `start_date` DATETIME) | |
NO SQL | |
BEGIN | |
DECLARE x INT; | |
DECLARE y INT DEFAULT 1; | |
DECLARE rand_no INT; | |
DECLARE view_date DATETIME; | |
SET x = 1; | |
SET view_date = start_date; | |
REPEAT | |
SET rand_no = FLOOR(1 + (RAND() * 10)); | |
SET y = 1; | |
SET view_date = DATE_ADD( view_date, INTERVAL 1 DAY); | |
REPEAT | |
INSERT INTO `testing_com`.`wp_rt_buddy_views_log` (`id`, `member_id`, `viewer_id`, `last_view`, `viewer_ip`) VALUES (NULL, '1',y, view_date , '127.0.0.1'); | |
SET y = y + 1; | |
UNTIL y > rand_no | |
END REPEAT; | |
SET x = x + 1; | |
UNTIL x > 90 | |
END REPEAT; | |
END |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment