Skip to content

Commit 3e076d3

Browse files
committed
docs: add "Initializing the Utility Class"
1 parent 31388c8 commit 3e076d3

File tree

3 files changed

+30
-4
lines changed

3 files changed

+30
-4
lines changed

user_guide_src/source/database/utilities.rst

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,34 @@
1-
#########
2-
Utilities
3-
#########
1+
######################
2+
Database Utility Class
3+
######################
44

55
The Database Utility Class contains methods that help you manage your database.
66

77
.. contents::
88
:local:
99
:depth: 2
1010

11+
******************************
12+
Initializing the Utility Class
13+
******************************
14+
15+
Load the Utility Class as follows:
16+
17+
.. literalinclude:: utilities/002.php
18+
:lines: 2-
19+
20+
You can also pass another database group to the DB Utility loader, in case
21+
the database you want to manage isn't the default one:
22+
23+
.. literalinclude:: utilities/003.php
24+
:lines: 2-
25+
26+
In the above example, we're passing a database group name as the first
27+
parameter.
28+
29+
****************************
30+
Using the Database Utilities
31+
****************************
1132

1233
Export a Query Result as an XML Document
1334
========================================
@@ -30,4 +51,3 @@ and it will get the following xml result when the ``mytable`` has columns ``id``
3051
.. important:: This method will NOT write the XML file for you. It
3152
simply creates the XML layout. If you need to write the file
3253
use the :php:func:`write_file()` helper.
33-
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<?php
2+
3+
$dbutil = \CodeIgniter\Database\Config::utils();
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<?php
2+
3+
$dbutil = \CodeIgniter\Database\Config::utils('group_name');

0 commit comments

Comments
 (0)