I want to execute the following SQL code using a QT application (entered from line edit).
DROP PROCEDURE IF EXISTS mprocedure;
DELIMITER $$
CREATE PROCEDURE mprocedure ()
BEGIN
DECLARE EXIT HANDLER FOR SQLEXCEPTION
BEGIN
ROLLBACK;
SELECT 'An exception occurred';
END;
START TRANSACTION;
INSERT INTO `mschema`.`table1`
(`maxbudget`, `blocked`, `d_percentage`, `max discount`)
VALUES ('2250', '0', '.9', '.99');
INSERT INTO `mschema`.`table2`
(`name`,`image`,`date`,`fKey_id`)
VALUES ('jhon','jfdd', '2018-01-01 00:00:00', LAST_INSERT_ID());
COMMIT;
END;
$$
DELIMITER ;

When i try to execute it, the exec() function does not return error but the database is not affected. When i copy this query and past in MySQL workbench, it is executed successfully. When i try to execute call mprocedure(); from qt application, it is executed successfully and made the required effect on my database