@@ -30,6 +30,73 @@ parameter.
3030Using the Database Utilities
3131****************************
3232
33+ Retrieve List of Database Names
34+ ================================
35+
36+ Returns an array of database names:
37+
38+ .. literalinclude :: utilities/004.php
39+ :lines: 2-
40+
41+ Determine If a Database Exists
42+ ==============================
43+
44+ Sometimes it's helpful to know whether a particular database exists.
45+ Returns a boolean ``true ``/``false ``. Usage example:
46+
47+ .. literalinclude :: utilities/005.php
48+ :lines: 2-
49+
50+ .. note :: Replace ``database_name`` with the name of the database you are
51+ looking for. This method is case sensitive.
52+
53+ Optimize a Table
54+ ================
55+
56+ Permits you to optimize a table using the table name specified in the
57+ first parameter. Returns ``true ``/``false `` based on success or failure:
58+
59+ .. literalinclude :: utilities/006.php
60+ :lines: 2-
61+
62+ .. note :: Not all database platforms support table optimization. It is
63+ mostly for use with MySQL.
64+
65+ Optimize a Database
66+ ===================
67+
68+ Permits you to optimize the database your DB class is currently
69+ connected to. Returns an array containing the DB status messages or
70+ ``false `` on failure:
71+
72+ .. literalinclude :: utilities/008.php
73+ :lines: 2-
74+
75+ .. note :: Not all database platforms support database optimization. It
76+ it is mostly for use with MySQL.
77+
78+ Export a Query Result as a CSV File
79+ ===================================
80+
81+ Permits you to generate a CSV file from a query result. The first
82+ parameter of the method must contain the result object from your
83+ query. Example:
84+
85+ .. literalinclude :: utilities/009.php
86+ :lines: 2-
87+
88+ The second, third, and fourth parameters allow you to set the delimiter
89+ newline, and enclosure characters respectively. By default commas are
90+ used as the delimiter, ``"\n" `` is used as a new line, and a double-quote
91+ is used as the enclosure. Example:
92+
93+ .. literalinclude :: utilities/010.php
94+ :lines: 2-
95+
96+ .. important :: This method will NOT write the CSV file for you. It
97+ simply creates the CSV layout. If you need to write the file
98+ use the :php:func: `write_file() ` helper.
99+
33100Export a Query Result as an XML Document
34101========================================
35102
0 commit comments