When I CALL
this proc in MySQL, it just shows LOADING...
and even freezes my server:
delimiter $$
CREATE PROCEDURE MyProc(IN index1 INT, IN count1 INT, IN index2 INT, IN count2 INT)
BEGIN
SELECT id FROM view1 WHERE column1 IS NULL OR column1 = 1 ORDER BY dateColumn DESC LIMIT index1, count1;
SELECT id FROM view1 WHERE column2 = 0 ORDER BY column3 DESC LIMIT index2, count2;
END$$
delimiter ;
If I only have one of either SELECT
s, it works.
Anyone have any idea what I'm missing/doing wrong?
Many thanks in advance!
Details
I'm creating a proc for PHP so that I don't have to make so many connections to the database. Each SELECT
needs to be its' own result set with column information for ease in PHP.
I need the slightly extra speed because my site is heavily dependent upon dynamic pagination.
What you are doing is quite sensible. This looks like a defect in phpmyadmin that may have been recently fixed, where stored procedures returning multiple result sets were not handled properly.
http://sourceforge.net/tracker/?func=detail&atid=377408&aid=3474853&group_id=23067