Transactions

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
eazyGen
Forum Commoner
Posts: 46
Joined: Mon Aug 29, 2011 4:32 am
Location: Central London

Transactions

Post by eazyGen »

Hi Guys,

I am building an app that I know will be deployed on a LAMP server but where I am not in control of the MySQL database engine. It could be InnoDB or it could be MyISAM. Or it could be something else for that matter.

My app has some pretty complicated updates that are tightly related and represent what folk call a “transaction”. In other words, and in an ideal world, all my updates should succeed or none should. The classic example is the bank transfer:

UPDATE account1 SET balance=balance-500;
UPDATE account2 SET balance=balance+500;

Both or none please.

I have been reading up on MySQL transactions, commit and rollback etc; and I am seeing what I would more or less expect (my background is with IBM's DB2).

However, I have been searching around, and, from what I have read thus far, it seems that MyISAM does not support row level locking - only table locks (which is madness in my book).

So I thought I would ask here how folk achieve guaranteed transaction integrity if they are forced (by the host for example) to use MyISAM.

Or do you just put up with this db engine limitation?

Many thanks in advance.

S
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Re: Transactions

Post by Weirdan »

Pretty simple - MyISAM = no transactions.
User avatar
eazyGen
Forum Commoner
Posts: 46
Joined: Mon Aug 29, 2011 4:32 am
Location: Central London

Re: Transactions

Post by eazyGen »

Weirdan wrote:Pretty simple - MyISAM = no transactions.
Fair enough - at least it is clear !!!!

Thanks for the pointer.

S
Post Reply