@@ -36,21 +36,21 @@ Running Transactions
36
36
====================
37
37
38
38
To run your queries using transactions you will use the
39
- ``$this->db->transStart() `` and ``$this->db->transComplete() `` functions as
39
+ ``$this->db->transStart() `` and ``$this->db->transComplete() `` methods as
40
40
follows:
41
41
42
42
.. literalinclude :: transactions/001.php
43
43
44
- You can run as many queries as you want between the start/complete
45
- functions and they will all be committed or rolled back based on the success
44
+ You can run as many queries as you want between the `` transStart() ``/`` transComplete() ``
45
+ methods and they will all be committed or rolled back based on the success
46
46
or failure of any given query.
47
47
48
48
Strict Mode
49
49
===========
50
50
51
51
By default, CodeIgniter runs all transactions in Strict Mode. When strict
52
52
mode is enabled, if you are running multiple groups of transactions, if
53
- one group fails all groups will be rolled back. If strict mode is
53
+ one group fails all subsequent groups will be rolled back. If strict mode is
54
54
disabled, each group is treated independently, meaning a failure of one
55
55
group will not affect any others.
56
56
@@ -61,9 +61,11 @@ Strict Mode can be disabled as follows:
61
61
Managing Errors
62
62
===============
63
63
64
- If you have error reporting enabled in your Config/Database.php file
65
- you'll see a standard error message if the commit was unsuccessful. If
66
- debugging is turned off, you can manage your own errors like this:
64
+ When you have ``DBDebug `` true in your **app/Config/Database.php ** file,
65
+ if a query error occurs, all the queries will be rolled backed, and an exception
66
+ will be thrown. So you'll see a standard error page.
67
+
68
+ If the ``DBDebug `` is false, you can manage your own errors like this:
67
69
68
70
.. literalinclude :: transactions/003.php
69
71
@@ -84,14 +86,15 @@ Test Mode
84
86
You can optionally put the transaction system into "test mode", which
85
87
will cause your queries to be rolled back -- even if the queries produce
86
88
a valid result. To use test mode simply set the first parameter in the
87
- ``$this->db->transStart() `` function to true:
89
+ ``$this->db->transStart() `` method to true:
88
90
89
91
.. literalinclude :: transactions/005.php
90
92
91
93
Running Transactions Manually
92
94
=============================
93
95
94
- If you would like to run transactions manually you can do so as follows:
96
+ When you have ``DBDebug `` false in your **app/Config/Database.php ** file, and
97
+ if you would like to run transactions manually you can do so as follows:
95
98
96
99
.. literalinclude :: transactions/006.php
97
100
0 commit comments