我想从 laravel 中的存储过程中获取多个结果集。有没有办法我可以做到这一点?目前,我可以使用以下代码获取单行数据:
$result = DB::statement('CALL user_login(' . $userId . ',"'
. $password . '",'
. '@success'.','
. '@first_Name'
);
$res = DB::select('select @success AS success, @first_Name AS firstName);
Here is my stored procedure:
DELIMITER //
DROP PROCEDURE IF EXISTS user_login//
create procedure user_login (IN userid VARCHAR(50),
IN password VARCHAR(50),
out success int,
OUT first_Name VARCHAR(255),
)
begin
declare count int(1);
set count =0;
select firstName, count(*)
into first_Name, count
from `tmc`.user where user_id = userid and pwd=password;
if count >0 then
set success =0;
else
set success=1;
end if;
end//