summaryrefslogtreecommitdiffstats
path: root/user_guide/libraries/database
diff options
context:
space:
mode:
Diffstat (limited to 'user_guide/libraries/database')
-rw-r--r--user_guide/libraries/database/transactions.html25
1 files changed, 13 insertions, 12 deletions
diff --git a/user_guide/libraries/database/transactions.html b/user_guide/libraries/database/transactions.html
index 41f27fc76..35e494282 100644
--- a/user_guide/libraries/database/transactions.html
+++ b/user_guide/libraries/database/transactions.html
@@ -66,18 +66,18 @@ Transactions
<h1>Transactions</h1>
-<p>Code Igniter's database abstraction allows you to use <dfn>transactions</dfn> will databases that support transaction-safe table types. In MySQL, you'll need
+<p>Code Igniter's database abstraction allows you to use <dfn>transactions</dfn> with databases that support transaction-safe table types. In MySQL, you'll need
to be running InnoDB or BDB table types rather then the more common MyISAM. Most other databases support transactions natively.</p>
<p>If you are not familiar with
-transactions we recommend you spend some time learning about them for your particular database. The information below assumes you
-have a basic understanding of transactions.
+transactions we recommend you find a good online resource to learn about them for your particular database. The information below assumes you
+have a basic understanding of transactions. For most sites, however, transactions won't be necessary.
</p>
<h2>Code Igniter's Approach to Transactions</h2>
-<p>Code Igniter utilizes an approach to transactions that is very similar to the popular database class ADODB. We've chosen that approach
-becuase it greatly simplifies the process of running transactions. In most cases all that is required are two lines of code.</p>
+<p>Code Igniter utilizes an approach to transactions that is very similar to the process used by the popular database class ADODB. We've chosen that approach
+because it greatly simplifies the process of running transactions. In most cases all that is required are two lines of code.</p>
<p>Traditionally transactions have required a fair amount of work to implement since they demand that you to keep track of your queries
and determine whether to <dfn>commit</dfn> or <dfn>rollback</dfn> based on the success or failure of your queries. In contrast,
@@ -85,7 +85,7 @@ we've implemented a smart transaction system that does all this for you automati
<h2>Running Transactions</h2>
-<p>To run your queries using transactions you will use the <kbd>$this->db->trans_start()</kbd> and <kbd>$this->db->trans_complete()</kbd> functions as follows:</p>
+<p>To run your queries using transactions you will use the <dfn>$this->db->trans_start()</dfn> and <dfn>$this->db->trans_complete()</dfn> functions as follows:</p>
<code>
<kbd>$this->db->trans_start();</kbd><br />
@@ -106,6 +106,7 @@ manage your own errors like this:</p>
<code>
$this->db->trans_start();<br />
$this->db->query('AN SQL QUERY...');<br />
+$this->db->query('ANOTHER QUERY...');<br />
$this->db->trans_complete();<br />
<br />
if (<kbd>$this->db->trans_status()</kbd> === FALSE)<br />
@@ -117,8 +118,8 @@ if (<kbd>$this->db->trans_status()</kbd> === FALSE)<br />
<h2>Enabling Transactions</h2>
-<p>Transactions are enabled automatically the moment you use <kbd>$this->db->trans_start()</kbd>. If you would like to disable transactions you
-can do so using <kbd>$this->db->trans_off()</kbd>:
+<p>Transactions are enabled automatically the moment you use <dfn>$this->db->trans_start()</dfn>. If you would like to disable transactions you
+can do so using <dfn>$this->db->trans_off()</dfn>:
<code>
<kbd>$this->db->trans_off()</kbd><br /><br />
@@ -128,16 +129,16 @@ $this->db->query('AN SQL QUERY...');<br />
$this->db->trans_complete();
</code>
-<p>When transactions are disabled, any queries will be auto-commited, just as they are when running queries normally.</p>
+<p class="important">When transactions are disabled, your queries will be auto-commited, just as they are when running queries without transactions.</p>
<h2>Test Mode</h2>
<p>You can optionally put the transaction system into "test mode", which will cause your queries to be rolled back -- even if the queries produce a valid result.
-To use test mode simply set the first parameter in the <kbd>$this->db->trans_start()</kbd> function to <samp>TRUE</samp>:
+To use test mode simply set the first parameter in the <dfn>$this->db->trans_start()</dfn> function to <samp>TRUE</samp>:
<code>
-$this->db->trans_start(</kbd><samp>TRUE</samp><kbd>);<br />
+$this->db->trans_start(<samp>TRUE</samp>); // Query will be rolled back<br />
$this->db->query('AN SQL QUERY...');<br />
$this->db->trans_complete();
</code>
@@ -166,7 +167,7 @@ else<br />
}<br />
</code>
-<p class="important"><strong>Note:</strong> Make sure to use <kbd>$this->db->trans_begin()</kbd> when running manual trasactions, <strong>NOT</strong>
+<p class="important"><strong>Note:</strong> Make sure to use <kbd>$this->db->trans_begin()</kbd> when running manual transactions, <strong>NOT</strong>
<dfn>$this->db->trans_start()</dfn>.</p>