<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../style.css">
<title>
Gambas Documentation - transaction
</title>
</head>
<table class="none" width="100%" cellpadding="0" cellspacing="0" border="0">
<tr><td align="left">
<font size="-1">
<a href="../../help+en"><img class="flag" alt="Home" border="0" src="../../img/lang/en.png" align="center"></a>&nbsp;
<a href="../def+en">Up</a>&nbsp;
<a href="stream+en">Previous</a>&nbsp;
<a href="translate+en">Next</a>&nbsp;
</td></tr></table>
<div class="notab">
<h1>
transaction
</h1>
A transaction is a series of changes to a database which either all must succeed or all must fail, for example, when transferring money from a checking account to a savings account, either the money can first be added to the savings account, then subtracted from the checking account, or first subtracted from the checking account, then added to the savings account.  If for some reason one of these fails, the other must not be completed.
<p>
A transaction is started with the <a href="../comp/gb.db/db+en">DB</a>.<a href="../comp/gb.db/db/begin+en">Begin</a> method, is done when either it is completed by use of the <a href="../comp/gb.db/db+en">DB</a>.<a href="../comp/gb.db/db/commit+en">Commit</a> method, or fails by use of the <a href="../comp/gb.db/db+en">DB</a>.<a href="../comp/gb.db/db/rollback+en">Rollback</a> method.
<p>
<div class="warning"><table class="none" border="0"><tr><td width="40" valign="top"><img border="0" src="../../img/info.png" align="center"></td><td valign="top">
Within <b>MySQL</b>, transactions can only be executed with transaction safe tables: <tt>BDB</tt> and <tt>InnoDB</tt>. The other MySQL table types (<tt>ISAM</tt>, <tt>MyISAM</tt> and <tt>HEAP</tt>) commit immediately.
</td></tr></table></div>

</div>
</body>
</html>

