Database Reference
In-Depth Information
26
Managing Transaction
Processing
In this chapter you learn what transactions are and how to use COMMIT and
ROLLBACK statements to manage transaction processing.
Understanding Transaction Processing
Note
Not All Engines Support Transactions As explained in Chapter 21, “Creating and
Manipulating Tables,” MariaDB supports the use of several underlying database
engines. Not all engines support explicit management of transaction processing, as
explained in this chapter. One of the most commonly used engines is MyISAM, which
does not support explicit transaction management, while InnoDB and ARIA do. This is
why the sample tables used in this topic were created to use ARIA. If you need transac-
tion processing functionality in your applications, be sure to use the correct engine type.
Transaction processing is used to maintain database integrity by ensuring that
batches of MariaDB SQL operations execute completely or not at all.
As explained back in Chapter 15, “Joining Tables,” relational databases are
designed so data is stored in multiple tables to facilitate easier data manipula-
tion, management, and reuse. Without going into the hows and whys of rela-
tional database design, take it as a given that well-designed database schemas
are relational to some degree.
The orders tables you've been using in prior chapters are a good example
of this. Orders are stored in two tables: orders stores actual orders, and
orderitems stores the individual items ordered. These two tables are related
to each other using unique IDs called primary keys (as discussed in Chapter 1,
“Understanding SQL”). These tables, in turn, are related to other tables con-
taining customer and product information.
The process of adding an order to the system is as follows:
 
 
 
Search WWH ::




Custom Search