summaryrefslogtreecommitdiffstats
path: root/user_guide_src/source/database/utilities.rst
diff options
context:
space:
mode:
authorAndrew Podner <a.podner@me.com>2012-12-19 20:15:41 +0100
committerAndrew Podner <a.podner@me.com>2012-12-19 20:15:41 +0100
commit79494dde1c53b671f279e5c5fab2ae03a9ff0353 (patch)
treee38cac2f093958b2e75cbda38429ca34bc2a38e5 /user_guide_src/source/database/utilities.rst
parenta9162502512e5eca4fa257689e7a250be900968f (diff)
Resolves issue #2081 : provides an option to include statements to disable and re-enable foreign key checks in a MySQL database backup output statement.
Diffstat (limited to 'user_guide_src/source/database/utilities.rst')
-rw-r--r--user_guide_src/source/database/utilities.rst27
1 files changed, 14 insertions, 13 deletions
diff --git a/user_guide_src/source/database/utilities.rst b/user_guide_src/source/database/utilities.rst
index 06ecb2da1..1631066fe 100644
--- a/user_guide_src/source/database/utilities.rst
+++ b/user_guide_src/source/database/utilities.rst
@@ -45,7 +45,7 @@ $this->dbutil->list_databases();
Returns an array of database names::
$dbs = $this->dbutil->list_databases();
-
+
foreach ($dbs as $db)
{
echo $db;
@@ -102,7 +102,7 @@ FALSE on failure.
::
$result = $this->dbutil->optimize_database();
-
+
if ($result !== FALSE)
{
print_r($result);
@@ -119,9 +119,9 @@ parameter of the method must contain the result object from your
query. Example::
$this->load->dbutil();
-
+
$query = $this->db->query("SELECT * FROM mytable");
-
+
echo $this->dbutil->csv_from_result($query);
The second, third, and fourth parameters allow you to set the delimiter
@@ -147,16 +147,16 @@ parameter expects a query result object, the second may contain an
optional array of config parameters. Example::
$this->load->dbutil();
-
+
$query = $this->db->query("SELECT * FROM mytable");
-
+
$config = array (
'root' => 'root',
'element' => 'element',
'newline' => "\n",
- 'tab' => "\t"
+ 'tab' => "\t"
);
-
+
echo $this->dbutil->xml_from_result($query, $config);
.. important:: This method will NOT write the XML file for you. It
@@ -172,7 +172,7 @@ backup data can be compressed in either Zip or Gzip format.
.. note:: This feature is only available for MySQL and Interbase/Firebird databases.
.. note:: For Interbase/Firebird databases, the backup file name is the only parameter.
-
+
Eg. $this->dbutil->backup('db_backup_filename');
.. note:: Due to the limited execution time and memory available to PHP,
@@ -188,14 +188,14 @@ Usage Example
// Load the DB utility class
$this->load->dbutil();
-
+
// Backup your entire database and assign it to a variable
$backup =& $this->dbutil->backup();
-
+
// Load the file helper and write the file to your server
$this->load->helper('file');
write_file('/path/to/mybackup.gz', $backup);
-
+
// Load the download helper and send the file to your desktop
$this->load->helper('download');
force_download('mybackup.gz', $backup);
@@ -215,7 +215,7 @@ parameter of the ``backup()`` method. Example::
'add_insert' => TRUE, // Whether to add INSERT data to backup file
'newline' => "\n" // Newline character used in backup file
);
-
+
$this->dbutil->backup($prefs);
Description of Backup Preferences
@@ -233,4 +233,5 @@ Preference Default Value Options Description
**add_drop** TRUE TRUE/FALSE Whether to include DROP TABLE statements in your SQL export file.
**add_insert** TRUE TRUE/FALSE Whether to include INSERT statements in your SQL export file.
**newline** "\\n" "\\n", "\\r", "\\r\\n" Type of newline to use in your SQL export file.
+**fk_checks** TRUE TRUE/FALSE Whether output should keep foreign key checks enabled.
=============== ======================= ======================= ======================================================================== \ No newline at end of file