views:

35

answers:

0

Hi,

I'm trying to do a simple transaction in MySQL

 delimiter go

  start transaction;
    BEGIN
      DECLARE EXIT HANDLER FOR SQLEXCEPTION, SQLWARNING, NOT FOUND ROLLBACK;
      INSERT INTO jext_categories (Name) VALUES ('asdfas');
      INSERT INTO jext_categories (Name) VALUES ('asdfas2');
    END;
  commit;

  SELECT * FROM jext_categories;

 go
 delimiter ;

but I keep getting an error saying query was empty. Could someone please tell me what I am doing wrong, and also, what is the proper format for doing a transaction in MySQL?

Thanks!