Skip to content

Commit ff2d8b7

Browse files
committed
docs: update docs
1 parent 8efd2c7 commit ff2d8b7

6 files changed

Lines changed: 10 additions & 32 deletions

File tree

user_guide_src/source/changelogs/v4.3.0.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ Exceptions when Database Errors Occur
2727

2828
- The exceptions thrown by the database connection classes have been changed to ``CodeIgniter\Database\Exceptions\DatabaseException``. Previously, different database drivers threw different exception classes, but these have been unified into ``DatabaseException``.
2929
- The exceptions thrown by the ``execute()`` method of Prepared Queries have been changed to ``DatabaseException``. Previously, different database drivers might throw different exception classes or did not throw exceptions, but these have been unified into ``DatabaseException``.
30+
- During transactions, exceptions are not thrown by default even if ``DBDebug`` is true.
3031
- ``DBDebug`` and ``CI_DEBUG`` Changes
3132

3233
- To be consistent in behavior regardless of environments, ``Config\Database::$default['DBDebug']``
@@ -38,11 +39,10 @@ Exceptions when Database Errors Occur
3839
- The default value of ``BaseConnection::$DBDebug`` has been changed to ``true``.
3940
- With these changes, ``DBDebug`` **now means whether or not to throw an exception when an error occurs**.
4041
Although unrelated to debugging, the name has not been changed.
41-
- When running transactions with ``DBDebug`` is ``true``, if a query error occurs, all the queries
42-
will be rolled backed, and an exception will be thrown. :ref:`transactions-managing-errors` or
43-
:ref:`transactions-manual-transactions` won't work. This is no different from previous versions,
44-
but changing the ``DBDebug`` setting from the previous default value to ``true`` will change the
45-
behavior in the production environment.
42+
- When running transactions with ``DBDebug`` is ``true``, even if a query error occurs, exceptions
43+
are not thrown by default. Previously, if a query error occurs, all the queries
44+
will be rolled backed, and an exception will be thrown, so :ref:`transactions-managing-errors` or
45+
:ref:`transactions-manual-transactions` won't work.
4646
- Now when you delete without WHERE clause in ``Model``, ``DatabaseException`` is thrown even if
4747
``CI_DEBUG`` is false. Previously, it is thrown if ``CI_DEBUG`` is true.
4848

user_guide_src/source/database/transactions.rst

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,9 @@ contrast, we've implemented a smart transaction system that does all
3232
this for you automatically (you can also manage your transactions
3333
manually if you choose to, but there's really no benefit).
3434

35-
.. note:: Since v4.3.0, ``DBDebug`` is true by default in all environments.
36-
When ``DBDebug`` is true, if a query error occurs, all the queries
37-
will be rolled backed, and a ``DatabaseException`` will be thrown.
38-
In previous versions, ``DBDebug`` was false only in production environment,
39-
and different database drivers might throw different exception classes.
35+
.. note::
36+
Since v4.3.0, during transactions, exceptions are not thrown by default
37+
even if ``DBDebug`` is true.
4038

4139
Running Transactions
4240
====================
@@ -45,8 +43,6 @@ To run your queries using transactions you will use the
4543
``$this->db->transStart()`` and ``$this->db->transComplete()`` methods as
4644
follows:
4745

48-
.. literalinclude:: transactions/008.php
49-
5046
.. literalinclude:: transactions/001.php
5147

5248
You can run as many queries as you want between the ``transStart()``/``transComplete()``
@@ -66,12 +62,6 @@ Strict Mode can be disabled as follows:
6662

6763
.. literalinclude:: transactions/002.php
6864

69-
.. note:: Since v4.3.0, ``DBDebug`` is true by default in all environments.
70-
When ``DBDebug`` is true, if a query error occurs, all the queries
71-
will be rolled backed, and a ``DatabaseException`` will be thrown.
72-
In previous versions, ``DBDebug`` was false only in production environment,
73-
and different database drivers might throw different exception classes.
74-
7565
.. _transactions-managing-errors:
7666

7767
Managing Errors
@@ -85,12 +75,6 @@ If the ``DBDebug`` is false, you can manage your own errors like this:
8575

8676
.. literalinclude:: transactions/003.php
8777

88-
.. note:: Since v4.3.0, ``DBDebug`` is true by default in all environments.
89-
When ``DBDebug`` is true, if a query error occurs, all the queries
90-
will be rolled backed, and a ``DatabaseException`` will be thrown.
91-
In previous versions, ``DBDebug`` was false only in production environment,
92-
and different database drivers might throw different exception classes.
93-
9478
Disabling Transactions
9579
======================
9680

user_guide_src/source/database/transactions/001.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
<?php
22

3-
// When DBDebug in the Database Config is false.
4-
53
$this->db->transStart();
64
$this->db->query('AN SQL QUERY...');
75
$this->db->query('ANOTHER QUERY...');

user_guide_src/source/database/transactions/003.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
<?php
22

3-
// DBDebug in the Database Config must be false.
4-
53
$this->db->transStart();
64
$this->db->query('AN SQL QUERY...');
75
$this->db->query('ANOTHER QUERY...');

user_guide_src/source/database/transactions/006.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
<?php
22

3-
// DBDebug in the Database Config must be false.
4-
53
$this->db->transBegin();
64

75
$this->db->query('AN SQL QUERY...');

user_guide_src/source/database/transactions/008.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<?php
22

3-
// When DBDebug in the Database Config is true.
3+
// When DBDebug in the Database Config must be true.
44

55
use CodeIgniter\Database\Exceptions\DatabaseException;
66

77
try {
8-
$this->db->transStart();
8+
$this->db->transException(true)->transStart();
99
$this->db->query('AN SQL QUERY...');
1010
$this->db->query('ANOTHER QUERY...');
1111
$this->db->query('AND YET ANOTHER QUERY...');

0 commit comments

Comments
 (0)