I would like to create an interface for manipulating accounts in a transactional way.
The database consists of an invoice table that contains billing information and an invoice_lines table that contains items for invoices. A website is a set of scripts that allow you to add, modify and delete invoices and their corresponding lines.
The problem is that I would like the ACID properties of the database to be reflected in the web application.
- Atomic When the user clicks "Save", either the entire invoice changes or the entire invoice does not change at all.
- Agreed . Application code already ensures consistency; lines cannot be added to non-existent accounts. Account IDs cannot be duplicated.
- Isolated . If the user is in the middle of the change set for the invoice, I would like to hide these changes from other users until the user types save.
- Durable . If the website dies, the data should be safe. This is already working.
If I were writing a desktop application, it would always maintain a connection to the MySQL database, allowing me to simply use BEGIN TRANSACTION and COMMIT at the beginning and end of editing.
From what I understand, you cannot START TRANSFER on one page of PHP and COMMIT on another page, because the connection is closed between the pages.
Is there a way to make this possible without extensions? From what I found, only SQL Relay does this (but it is an extension).
php mysql transactions
Martin
source share