       SET message_text = @msg;
   END IF;
 
-  DECLARE EXIT HANDLER FOR SQLEXCEPTION, SQLWARNING ROLLBACK;
   START TRANSACTION;
 
   -- add the user


  -- Prepare a handler in case there is a SQLException, 
  -- we want to roll back.
  DECLARE EXIT HANDLER FOR SQLEXCEPTION, SQLWARNING ROLLBACK;
  START TRANSACTION;

  -- A) The main part - add the request to that table.

  OUT new_request_id INT UNSIGNED
) 
BEGIN 
  DECLARE EXIT HANDLER FOR SQLEXCEPTION, SQLWARNING ROLLBACK;
  -- Check that the user has the points.
  SET @user_points_sql = "
      SELECT points INTO @user_points
