我PREPARE
在存储过程中使用语句,但在插入记录时需要很长时间。请建议我替换PREPARE
声明。
SET @COUNT = 0;
SET @countQuery = CONCAT("select count(ufl.id) INTO @COUNT from user_friend_list as ufl where ufl.user_id = ",@USERREGID," AND ufl.friend_user_id = ",FID);
PREPARE STMTC FROM @countQuery;
EXECUTE STMTC;
IF @COUNT = 0 THEN
INSERT INTO user_friend_list(user_id, friend_user_id) VALUES(@USERREGID,FID),(FID,@USERREGID);
END IF;
DEALLOCATE PREPARE STMTC;