Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

when i use redis_command_v2 in cursor, the data count is wrong #13

Open
hezhiqiang opened this issue Dec 26, 2019 · 0 comments
Open

when i use redis_command_v2 in cursor, the data count is wrong #13

hezhiqiang opened this issue Dec 26, 2019 · 0 comments

Comments

@hezhiqiang
Copy link

BEGIN
DECLARE done INT DEFAULT FALSE;
DECLARE v_id INT;
DECLARE v_ret INT;
DECLARE cur CURSOR FOR SELECT u.user_id FROM kid_users u WHERE u.latest_login_time>=DATE(DATE_ADD(NOW(),INTERVAL -1 DAY)) AND EXISTS(SELECT * FROM kid_child_info WHERE user_id=u.user_id AND gender IN(0,1)) ORDER BY u.latest_login_time DESC;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;

OPEN cur;
read_loop: LOOP
	FETCH cur INTO v_id;
	IF done THEN
		LEAVE read_loop;
	END IF;

	SET v_ret=redis_command_v2('LPUSH', 'calcReadingRecommendForYou', CONCAT(v_id));
END LOOP;
CLOSE cur;

END

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant