0

I have a simple stored procedure:

PROCEDURE `status_recalculate`(IN aid INT)
BEGIN
DECLARE actions INT DEFAULT 0;
DECLARE rid INT DEFAULT 0;
DECLARE actions_done INT DEFAULT 0;
DECLARE status_done INT DEFAULT 0;

SELECT request_id INTO rid FROM mtset_dev.actions a WHERE a.id=aid;
SELECT count(*) INTO actions FROM mtset_dev.actions a WHERE a.request_id=rid;

SELECT count(*) INTO actions_done FROM mtset_dev.actions a WHERE a.request_id=rid AND a.action_status=1;
SELECT CEIL(actions_done/actions*100) INTO status_done;

#UPDATE requests SET `status` = status_done WHERE id=rid;

SELECT rid, status_done;
END

And I want to call it from Kohana 3.2 via AJAX. In model there are code:

$query = "call status_recalculate($aid);";
DB::query(Database::SELECT, $query)->execute();

And there is no successful AJAX response. What am I doing wrong? How can I get result (or, perhaps, error)? Reading this answer didn't help.

Thanks.

Community
  • 1
  • 1
Pavel Evsegneev
  • 105
  • 1
  • 5

1 Answers1

0

I have solved it. All simple: mysql privilege to execute.

Pavel Evsegneev
  • 105
  • 1
  • 5