Skip to content

Commit

Permalink
docs: add "Initializing the Utility Class"
Browse files Browse the repository at this point in the history
  • Loading branch information
kenjis committed Nov 30, 2023
1 parent 31388c8 commit 3e076d3
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 4 deletions.
28 changes: 24 additions & 4 deletions user_guide_src/source/database/utilities.rst
Original file line number Diff line number Diff line change
@@ -1,13 +1,34 @@
#########
Utilities
#########
######################
Database Utility Class
######################

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

.. contents::
:local:
:depth: 2

******************************
Initializing the Utility Class
******************************

Load the Utility Class as follows:

.. literalinclude:: utilities/002.php
:lines: 2-

You can also pass another database group to the DB Utility loader, in case
the database you want to manage isn't the default one:

.. literalinclude:: utilities/003.php
:lines: 2-

In the above example, we're passing a database group name as the first
parameter.

****************************
Using the Database Utilities
****************************

Export a Query Result as an XML Document
========================================
Expand All @@ -30,4 +51,3 @@ and it will get the following xml result when the ``mytable`` has columns ``id``
.. important:: This method will NOT write the XML file for you. It
simply creates the XML layout. If you need to write the file
use the :php:func:`write_file()` helper.

3 changes: 3 additions & 0 deletions user_guide_src/source/database/utilities/002.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?php

$dbutil = \CodeIgniter\Database\Config::utils();
3 changes: 3 additions & 0 deletions user_guide_src/source/database/utilities/003.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?php

$dbutil = \CodeIgniter\Database\Config::utils('group_name');

0 comments on commit 3e076d3

Please sign in to comment.