Transactions Not Working IN HediSQL but are working in PHPMYADMIN

jocose's profile image jocose posted 3 years ago in General Permalink

I have the following code:

`START TRANSACTION; UPDATE clients SET invoice_count = @ic := invoice_count + 1 WHERE clients.id = 7;

INSERT INTO invoices (client_invoice_count, grand_totalz) VALUES(( SELECT @ic) ,1208);

SELECT LAST_INSERT_ID(); COMMIT; `

I added a "z" to grand_total so that the second query fails. Since i'm using "START TRANSACTION" auto_commit should be 0 and the update before the insert should not commit to the database.

The problem is that it does commit every single time.

However if I run this exact same command in PHPMYADMIN it works as expected. The insert fails and the update isn't committed.

What is going on?

jocose's profile image jocose posted 3 years ago Permalink

NOTE: I am using MYSQL 5.7 and, yes, InnoDB is set for all the tables being used.

ansgar's profile image ansgar posted 3 years ago Permalink

Confirmed, on MariaDB 10.3 with Heidi 10.2.

Any clue what could cause that?

Please login to leave a reply, or register at first.