summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--system/database/DB_driver.php9
-rw-r--r--system/database/DB_export.php132
-rw-r--r--system/database/DB_utility.php121
-rw-r--r--system/database/drivers/mysql/mysql_utility.php48
-rw-r--r--system/libraries/Controller.php12
-rw-r--r--system/libraries/Encrypt.php35
-rw-r--r--system/libraries/Loader.php14
-rw-r--r--user_guide/database/export.html158
-rw-r--r--user_guide/database/index.html1
-rw-r--r--user_guide/database/utilities.html57
10 files changed, 229 insertions, 358 deletions
diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php
index 94db84bbf..275d51c53 100644
--- a/system/database/DB_driver.php
+++ b/system/database/DB_driver.php
@@ -45,6 +45,7 @@ class CI_DB_driver {
var $query_count = 0;
var $bind_marker = '?';
var $queries = array();
+ var $cache = array();
var $trans_enabled = TRUE;
var $_trans_depth = 0;
var $_trans_failure = FALSE; // Used with transactions to determine if a rollback should occur
@@ -563,6 +564,12 @@ class CI_DB_driver {
*/
function field_names($table = '')
{
+ // Is there a cached result?
+ if (isset($this->cache['field_names'][$table]))
+ {
+ return $this->cache['field_names'][$table];
+ }
+
if ($table == '')
{
if ($this->db_debug)
@@ -596,7 +603,7 @@ class CI_DB_driver {
}
}
- return $retval;
+ return $this->cache['field_names'][$table] =& $retval;
}
// --------------------------------------------------------------------
diff --git a/system/database/DB_export.php b/system/database/DB_export.php
deleted file mode 100644
index 1704f0dfd..000000000
--- a/system/database/DB_export.php
+++ /dev/null
@@ -1,132 +0,0 @@
-<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
-/**
- * Code Igniter
- *
- * An open source application development framework for PHP 4.3.2 or newer
- *
- * @package CodeIgniter
- * @author Rick Ellis
- * @copyright Copyright (c) 2006, pMachine, Inc.
- * @license http://www.codeignitor.com/user_guide/license.html
- * @link http://www.codeigniter.com
- * @since Version 1.0
- * @filesource
- */
-
-// ------------------------------------------------------------------------
-
-/**
- * DB Exporting Class
- *
- * @category Database
- * @author Rick Ellis
- * @link http://www.codeigniter.com/user_guide/database/
- */
-class CI_DB_export {
-
-
- /**
- * Constructor. Simply calls the log function
- */
- function CI_DB_export()
- {
- log_message('debug', "Database Export Class Initialized");
- }
-
- // --------------------------------------------------------------------
-
- /**
- * Generate CVS from a query result object
- *
- * @access public
- * @param object The query result object
- * @param string The delimiter - tab by default
- * @param string The newline character - \n by default
- * @return string
- */
- function cvs_from_result($query, $delim = "\t", $newline = "\n")
- {
- if ( ! is_object($query) OR ! method_exists($query, 'field_names'))
- {
- show_error('You must submit a valid result object');
- }
-
- $out = '';
-
- // First generate the headings from the table column names
- foreach ($query->field_names() as $name)
- {
- $out .= $name.$delim;
- }
-
- $out = rtrim($out);
- $out .= $newline;
-
- // Next blast through the result array and build out the rows
- foreach ($query->result_array() as $row)
- {
- foreach ($row as $item)
- {
- $out .= $item.$delim;
- }
- $out = rtrim($out);
- $out .= $newline;
- }
-
- return $out;
- }
-
- // --------------------------------------------------------------------
-
-
- /**
- * Generate XML data from a query result object
- *
- * @access public
- * @param object The query result object
- * @param array Any preferences
- * @return string
- */
- function xml_from_result($query, $params = array())
- {
- if ( ! is_object($query) OR ! method_exists($query, 'field_names'))
- {
- show_error('You must submit a valid result object');
- }
-
- // Set our default values
- foreach (array('root' => 'root', 'element' => 'element', 'newline' => "\n", 'tab' => "\t") as $key => $val)
- {
- if ( ! isset($params[$key]))
- {
- $params[$key] = $val;
- }
- }
-
- // Create variables for convenience
- extract($params);
-
- // Load the xml helper
- $obj =& get_instance();
- $obj->load->helper('xml');
-
- // Generate the result
- $xml = "<{$root}/>".$newline;
- foreach ($query->result_array() as $row)
- {
- $xml .= $tab."<{$element}/>".$newline;
-
- foreach ($row as $key => $val)
- {
- $xml .= $tab.$tab."<{$key}>".xml_convert($val)."</{$key}>".$newline;
- }
- $xml .= $tab."</{$element}>".$newline;
- }
- $xml .= "</$root>".$newline;
-
- return $xml;
- }
-
-}
-
-?> \ No newline at end of file
diff --git a/system/database/DB_utility.php b/system/database/DB_utility.php
index 764f10cb7..ff9407ebd 100644
--- a/system/database/DB_utility.php
+++ b/system/database/DB_utility.php
@@ -25,6 +25,7 @@
class CI_DB_utility {
var $db;
+ var $cache = array();
/**
* Constructor
@@ -93,6 +94,12 @@ class CI_DB_utility {
*/
function list_databases()
{
+ // Is there a cached result?
+ if (isset($this->cache['db_names']))
+ {
+ return $this->cache['db_names'];
+ }
+
$query = $this->db->query($this->_list_database());
$dbs = array();
if ($query->num_rows() > 0)
@@ -103,7 +110,7 @@ class CI_DB_utility {
}
}
- return $dbs;
+ return $this->cache['db_names'] =& $dbs;
}
// --------------------------------------------------------------------
@@ -116,6 +123,12 @@ class CI_DB_utility {
*/
function list_tables()
{
+ // Is there a cached result?
+ if (isset($this->cache['table_names']))
+ {
+ return $this->cache['table_names'];
+ }
+
if (FALSE === ($sql = $this->_list_tables()))
{
if ($this->db->db_debug)
@@ -143,7 +156,7 @@ class CI_DB_utility {
}
}
- return $retval;
+ return $this->cache['table_names'] =& $retval;
}
// --------------------------------------------------------------------
@@ -258,7 +271,111 @@ class CI_DB_utility {
return $this->db->query($sql);
}
+ // --------------------------------------------------------------------
+
+ /**
+ * Generate CVS from a query result object
+ *
+ * @access public
+ * @param object The query result object
+ * @param string The delimiter - tab by default
+ * @param string The newline character - \n by default
+ * @return string
+ */
+ function cvs_from_result($query, $delim = "\t", $newline = "\n")
+ {
+ if ( ! is_object($query) OR ! method_exists($query, 'field_names'))
+ {
+ show_error('You must submit a valid result object');
+ }
+
+ $out = '';
+
+ // First generate the headings from the table column names
+ foreach ($query->field_names() as $name)
+ {
+ $out .= $name.$delim;
+ }
+
+ $out = rtrim($out);
+ $out .= $newline;
+
+ // Next blast through the result array and build out the rows
+ foreach ($query->result_array() as $row)
+ {
+ foreach ($row as $item)
+ {
+ $out .= $item.$delim;
+ }
+ $out = rtrim($out);
+ $out .= $newline;
+ }
+
+ return $out;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Generate XML data from a query result object
+ *
+ * @access public
+ * @param object The query result object
+ * @param array Any preferences
+ * @return string
+ */
+ function xml_from_result($query, $params = array())
+ {
+ if ( ! is_object($query) OR ! method_exists($query, 'field_names'))
+ {
+ show_error('You must submit a valid result object');
+ }
+
+ // Set our default values
+ foreach (array('root' => 'root', 'element' => 'element', 'newline' => "\n", 'tab' => "\t") as $key => $val)
+ {
+ if ( ! isset($params[$key]))
+ {
+ $params[$key] = $val;
+ }
+ }
+
+ // Create variables for convenience
+ extract($params);
+
+ // Load the xml helper
+ $obj =& get_instance();
+ $obj->load->helper('xml');
+
+ // Generate the result
+ $xml = "<{$root}/>".$newline;
+ foreach ($query->result_array() as $row)
+ {
+ $xml .= $tab."<{$element}/>".$newline;
+
+ foreach ($row as $key => $val)
+ {
+ $xml .= $tab.$tab."<{$key}>".xml_convert($val)."</{$key}>".$newline;
+ }
+ $xml .= $tab."</{$element}>".$newline;
+ }
+ $xml .= "</$root>".$newline;
+
+ return $xml;
+ }
+
+ // --------------------------------------------------------------------
+ /**
+ * Database Backup
+ *
+ * @access public
+ * @return void
+ */
+ function export()
+ {
+ // The individual driver overloads this method
+ }
}
diff --git a/system/database/drivers/mysql/mysql_utility.php b/system/database/drivers/mysql/mysql_utility.php
index 65fb87f92..f43299382 100644
--- a/system/database/drivers/mysql/mysql_utility.php
+++ b/system/database/drivers/mysql/mysql_utility.php
@@ -128,19 +128,18 @@ class CI_DB_mysql_utility extends CI_DB_utility {
/**
* MySQL Export
*
- * @access public
- * @param object The query result object
+ * @access private
* @param array Any preferences
- * @return string
+ * @return mixed
*/
- function export($params = array())
+ function _export($params = array())
{
// Set up our default preferences
$prefs = array(
'tables' => array(),
'ignore' => array(),
'format' => 'gzip',
- 'download' => TRUE,
+ 'action' => 'download', // download, archive, echo, return
'filename' => date('Y-m-d-H:i', time()),
'filepath' => '',
'add_drop' => TRUE,
@@ -169,8 +168,6 @@ class CI_DB_mysql_utility extends CI_DB_utility {
$tables = $this->list_tables();
}
-
-
// Start buffering the output
ob_start();
@@ -193,7 +190,6 @@ class CI_DB_mysql_utility extends CI_DB_utility {
}
// Write out the table schema
-
echo $newline.$newline.'#'.$newline.'# TABLE STRUCTURE FOR: '.$table.$newline.'#'.$newline.$newline;
if ($add_drop == TRUE)
@@ -211,13 +207,13 @@ class CI_DB_mysql_utility extends CI_DB_utility {
}
}
- // Build the insert statements
-
+ // If inserts are not needed we're done...
if ($add_insert == FALSE)
{
continue;
}
-
+
+ // Grab all the data from the current table
$query = $this->db->query("SELECT * FROM $table");
if ($query->num_rows() == 0)
@@ -225,37 +221,39 @@ class CI_DB_mysql_utility extends CI_DB_utility {
continue;
}
- // Grab the field names and determine if the field is an
+ // Fetch the field names and determine if the field is an
// integer type. We use this info to decide whether to
// surround the data with quotes or not
$i = 0;
- $fields = '';
+ $field_str = '';
$is_int = array();
while ($field = mysql_fetch_field($query->result_id))
{
$is_int[$i] = (in_array(
- mysql_field_type($query->result_id, $i),
+ strtolower(mysql_field_type($query->result_id, $i)),
array('tinyint', 'smallint', 'mediumint', 'int', 'bigint', 'timestamp'),
TRUE)
) ? TRUE : FALSE;
// Create a string of field names
- $fields .= $field->name.', ';
+ $field_str .= $field->name.', ';
$i++;
}
-
- $fields = preg_replace( "/, $/" , "" , $fields);
+
+ // Trim off the end comma
+ $field_str = preg_replace( "/, $/" , "" , $field_str);
- // Build the inserts
+ // Build the insert string
foreach ($query->result_array() as $row)
{
- $values = '';
+ $val_str = '';
$i = 0;
foreach ($row as $v)
{
+ // Do a little formatting...
$v = str_replace(array("\x00", "\x0a", "\x0d", "\x1a"), array('\0', '\n', '\r', '\Z'), $v);
$v = str_replace(array("\n", "\r", "\t"), array('\n', '\r', '\t'), $v);
$v = str_replace('\\', '\\\\', $v);
@@ -265,21 +263,21 @@ class CI_DB_mysql_utility extends CI_DB_utility {
$v = str_replace('\\\t', '\t', $v);
// Escape the data if it's not an integer type
- $values .= ($is_int[$i] == FALSE) ? $this->db->escape($v) : $v;
- $values .= ', ';
+ $val_str .= ($is_int[$i] == FALSE) ? $this->db->escape($v) : $v;
+ $val_str .= ', ';
$i++;
}
- $values = preg_replace( "/, $/" , "" , $values);
+ $val_str = preg_replace( "/, $/" , "" , $val_str);
- if ($download == FALSE)
+ if ($action == 'echo')
{
- $values = htmlspecialchars($values);
+ $val_str = htmlspecialchars($val_str);
}
// Build the INSERT string
- echo 'INSERT INTO '.$table.' ('.$fields.') VALUES ('.$values.');'.$newline;
+ echo 'INSERT INTO '.$table.' ('.$field_str.') VALUES ('.$val_str.');'.$newline;
}
diff --git a/system/libraries/Controller.php b/system/libraries/Controller.php
index be66b19b7..51f455023 100644
--- a/system/libraries/Controller.php
+++ b/system/libraries/Controller.php
@@ -189,8 +189,6 @@ class Controller extends CI_Base {
}
$remap = array(
- 'DB_export' => 'dbexport',
- 'DB_utility' => 'dbutility',
'Unit_test' => 'unit'
);
@@ -516,19 +514,15 @@ class Controller extends CI_Base {
{
if ( ! $this->_ci_is_loaded('db'))
{
- $this->_init_database();
+ $this->_ci_init_database();
}
if ($class == 'dbutil')
{
require_once(BASEPATH.'database/DB_utility'.EXT);
require_once(BASEPATH.'database/drivers/'.$this->db->dbdriver.'/'.$this->db->dbdriver.'_utility'.EXT);
- $this->init_class('CI_DB_'.$this->db->dbdriver.'_utility', 'dbutil');
- }
- elseif ($class == 'dbexport')
- {
- require_once(BASEPATH.'database/DB_export'.EXT);
- $this->init_class('CI_DB_export', 'dbexport');
+ $class = 'CI_DB_'.$this->db->dbdriver.'_utility';
+ $this->dbutil = new $class();
}
}
diff --git a/system/libraries/Encrypt.php b/system/libraries/Encrypt.php
index abc769460..537b1ab20 100644
--- a/system/libraries/Encrypt.php
+++ b/system/libraries/Encrypt.php
@@ -27,6 +27,7 @@
* @link http://www.codeigniter.com/user_guide/libraries/encryption.html
*/
class CI_Encrypt {
+ var $encryption_key = '';
var $_hash_type = 'sha1';
var $_mcrypt_exists = FALSE;
var $_mcrypt_cipher;
@@ -43,7 +44,6 @@ class CI_Encrypt {
$this->_mcrypt_exists = ( ! function_exists('mcrypt_encrypt')) ? FALSE : TRUE;
log_message('debug', "Encrypt Class Initialized");
}
- // END CI_Encrypt()
// --------------------------------------------------------------------
@@ -61,6 +61,11 @@ class CI_Encrypt {
{
if ($key == '')
{
+ if ($this->encryption_key != '')
+ {
+ return $this->encryption_key;
+ }
+
$obj =& get_instance();
$key = $obj->config->item('encryption_key');
@@ -72,7 +77,20 @@ class CI_Encrypt {
return md5($key);
}
- // END get_key()
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Set the encryption key
+ *
+ * @access public
+ * @param string
+ * @return void
+ */
+ function set_key($key = '')
+ {
+ $this->encryption_key = $key;
+ }
// --------------------------------------------------------------------
@@ -103,7 +121,6 @@ class CI_Encrypt {
}
return base64_encode($enc);
}
- // END encode()
// --------------------------------------------------------------------
@@ -134,7 +151,6 @@ class CI_Encrypt {
return $this->_xor_decode($dec, $key);
}
- // END decode()
// --------------------------------------------------------------------
@@ -167,7 +183,6 @@ class CI_Encrypt {
return $this->_xor_merge($enc, $key);
}
- // END _xor_encode()
// --------------------------------------------------------------------
@@ -194,7 +209,6 @@ class CI_Encrypt {
return $dec;
}
- // END _xor_decode()
// --------------------------------------------------------------------
@@ -219,7 +233,6 @@ class CI_Encrypt {
return $str;
}
- // END _xor_merge()
// --------------------------------------------------------------------
@@ -238,7 +251,6 @@ class CI_Encrypt {
$init_vect = mcrypt_create_iv($init_size, MCRYPT_RAND);
return mcrypt_encrypt($this->_mcrypt_cipher, $key, $data, $this->_mcrypt_mode, $init_vect);
}
- // END mcrypt_encode()
// --------------------------------------------------------------------
@@ -257,7 +269,6 @@ class CI_Encrypt {
$init_vect = mcrypt_create_iv($init_size, MCRYPT_RAND);
return rtrim(mcrypt_decrypt($this->_mcrypt_cipher, $key, $data, $this->_mcrypt_mode, $init_vect), "\0");
}
- // END mcrypt_decode()
// --------------------------------------------------------------------
@@ -272,7 +283,6 @@ class CI_Encrypt {
{
$this->_mcrypt_cipher = $cypher;
}
- // END set_cypher()
// --------------------------------------------------------------------
@@ -287,7 +297,6 @@ class CI_Encrypt {
{
$this->_mcrypt_mode = $mode;
}
- // END set_mode()
// --------------------------------------------------------------------
@@ -309,7 +318,6 @@ class CI_Encrypt {
$this->_mcrypt_mode = MCRYPT_MODE_ECB;
}
}
- // END _get_mcrypt()
// --------------------------------------------------------------------
@@ -324,7 +332,6 @@ class CI_Encrypt {
{
$this->_hash_type = ($type != 'sha1' AND $type != 'md5') ? 'sha1' : $type;
}
- // END set_hash()
// --------------------------------------------------------------------
@@ -339,7 +346,6 @@ class CI_Encrypt {
{
return ($this->_hash_type == 'sha1') ? $this->sha1($str) : md5($str);
}
- // END hash()
// --------------------------------------------------------------------
@@ -370,7 +376,6 @@ class CI_Encrypt {
return sha1($str);
}
}
- // END sha1()
}
diff --git a/system/libraries/Loader.php b/system/libraries/Loader.php
index fff9e78d3..2534e6965 100644
--- a/system/libraries/Loader.php
+++ b/system/libraries/Loader.php
@@ -135,20 +135,6 @@ class CI_Loader {
$obj =& get_instance();
$obj->_ci_init_dbextra('dbutil');
}
-
- // --------------------------------------------------------------------
-
- /**
- * Database Export Loader
- *
- * @access public
- * @return object
- */
- function dbexport()
- {
- $obj =& get_instance();
- $obj->_ci_init_dbextra('dbexport');
- }
// --------------------------------------------------------------------
diff --git a/user_guide/database/export.html b/user_guide/database/export.html
deleted file mode 100644
index 6932fbcb8..000000000
--- a/user_guide/database/export.html
+++ /dev/null
@@ -1,158 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html>
-<head>
-
-<title>Code Igniter User Guide</title>
-
-<style type='text/css' media='all'>@import url('../userguide.css');</style>
-<link rel='stylesheet' type='text/css' media='all' href='../userguide.css' />
-
-<script type="text/javascript" src="../nav/nav.js"></script>
-<script type="text/javascript" src="../nav/prototype.lite.js"></script>
-<script type="text/javascript" src="../nav/moo.fx.js"></script>
-<script type="text/javascript">
-window.onload = function() {
- myHeight = new fx.Height('nav', {duration: 400});
- myHeight.hide();
-}
-</script>
-
-<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-<meta http-equiv='expires' content='-1' />
-<meta http-equiv= 'pragma' content='no-cache' />
-<meta name='robots' content='all' />
-<meta name='author' content='Rick Ellis' />
-<meta name='description' content='Code Igniter User Guide' />
-
-</head>
-<body>
-
-<!-- START NAVIGATION -->
-<div id="nav"><div id="nav_inner"><script type="text/javascript">create_menu('../');</script></div></div>
-<div id="nav2"><a name="top"></a><a href="javascript:void(0);" onclick="myHeight.toggle();"><img src="../images/nav_toggle.jpg" width="153" height="44" border="0" title="Toggle Table of Contents" alt="Toggle Table of Contents" /></a></div>
-<div id="masthead">
-<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
-<tr>
-<td><h1>Code Igniter User Guide Version 1.5.0</h1></td>
-<td id="breadcrumb_right"><a href="../toc.html">Full Table of Contents</a></td>
-</tr>
-</table>
-</div>
-<!-- END NAVIGATION -->
-
-
-<!-- START BREADCRUMB -->
-<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
-<tr>
-<td id="breadcrumb">
-<a href="http://www.codeigniter.com/">Code Igniter Home</a> &nbsp;&#8250;&nbsp;
-<a href="../index.html">User Guide Home</a> &nbsp;&#8250;&nbsp;
-<a href="index.html">Database Library</a> &nbsp;&#8250;&nbsp;
-Database Export Class
-</td>
-<td id="searchbox"><form method="get" action="http://www.google.com/search"><input type="hidden" name="as_sitesearch" id="as_sitesearch" value="www.codeigniter.com/user_guide/" />Search User Guide&nbsp; <input type="text" class="input" style="width:200px;" name="q" id="q" size="31" maxlength="255" value="" />&nbsp;<input type="submit" class="submit" name="sa" value="Go" /></form></td>
-</tr>
-</table>
-<!-- END BREADCRUMB -->
-
-
-<br clear="all" />
-
-
-<!-- START CONTENT -->
-<div id="content">
-
-<h1>Database Export Class</h1>
-
-<p>The Database Utilities Class contains functions that help you export your data.</p>
-
-<p class="important"><strong>Important:</strong>&nbsp; This class must be initialized independently since it is a separate class from the main Database class.
-More info below...</p>
-
-
-<h2>Initializing the Export Class</h2>
-
-<p>To initialize this class please use the following code:</p>
-
-<code>$this->load->dbexport()</code>
-
-<p>You can also autoload this class from within your <dfn>config/autoload.php</dfn> file by specifying <kbd>dbexport</kbd> in the <samp>$autoload['libraries']</samp> array.</p>
-
-<p>Once initialized you will access the functions using the <dfn>$this->dbexport</dfn> object:</p>
-
-<code>$this->dbexport->some_function()</code>
-
-
-
-<h2>$this->dbexport->cvs_from_result($db_result)</h2>
-
-<p>Permits you to generate a CVS file from a query result. The first parameter of the function must contain the result object from your query.
-Example:</p>
-
-<code>
-$this->load->dbexport();<br />
-<br />
-$query = $this->db->query("SELECT * FROM mytable");<br />
-<br />
-echo $this->dbexport->cvs_from_result($query);
-</code>
-
-<p>The second and third parameters allows you to
-set the delimiter and newline character. By default tabs are used as the delimiter and "\n" is used as a new line. Example:
-
-<code>
-$delimiter = ",";<br />
-$newline = "\r\n";<br />
-<br />
-echo $this->dbexport->cvs_from_result($query, $delimiter, $newline);
-</code>
-
-<p class="important"><strong>Important:</strong>&nbsp; This function will NOT write the CVS file for you. It simply creates the CVS layout.
-If you need to write the file use the <a href="../helpers/file_helper.html">File Helper</a>.</p>
-
-
-
-<h2>$this->dbexport->xml_from_result($db_result)</h2>
-
-<p>Permits you to generate an XML file from a query result. The first parameter expects a query result object, the second
-may contain an optional array of config parameters. Example:</p>
-
-<code>
-$this->load->dbexport();<br />
-<br />
-$query = $this->db->query("SELECT * FROM mytable");<br />
-<br />
-$config = array (<br />
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'root'&nbsp;&nbsp;&nbsp; => 'root',<br />
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'element' => 'element', <br />
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'newline' => "\n", <br />
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';tab'&nbsp;&nbsp;&nbsp;&nbsp;=> "\t"<br />
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;);<br />
-<br />
-echo $this->dbexport->cvs_from_result($query, $config);
-</code>
-
-<p class="important"><strong>Important:</strong>&nbsp; This function will NOT write the CVS file for you. It simply creates the CVS layout.
-If you need to write the file use the <a href="../helpers/file_helper.html">File Helper</a>.</p>
-
-
-
-
-
-</div>
-<!-- END CONTENT -->
-
-
-<div id="footer">
-<p>
-Previous Topic:&nbsp;&nbsp;<a href="utilities.html">Database Utility Class</a>
-&nbsp;&nbsp;&nbsp;&middot;&nbsp;&nbsp;
-<a href="#top">Top of Page</a>&nbsp;&nbsp;&nbsp;&middot;&nbsp;&nbsp;
-<a href="../index.html">User Guide Home</a>&nbsp;&nbsp;&nbsp;&middot;&nbsp;&nbsp;
-Next Topic:&nbsp;&nbsp;<a href="../libraries/email.html">Email Class</a>
-<p>
-<p><a href="http://www.codeigniter.com">Code Igniter</a> &nbsp;&middot;&nbsp; Copyright &#169; 2006 &nbsp;&middot;&nbsp; <a href="http://www.pmachine.com">pMachine, Inc.</a></p>
-</div>
-
-</body>
-</html> \ No newline at end of file
diff --git a/user_guide/database/index.html b/user_guide/database/index.html
index 61864221e..78f90478f 100644
--- a/user_guide/database/index.html
+++ b/user_guide/database/index.html
@@ -79,7 +79,6 @@ structures and Active Record patterns. The database functions offer clear, simpl
<li><a href="fields.html">Field MetaData</a></li>
<li><a href="call_function.html">Custom Function Calls</a></li>
<li><a href="utilities.html">Database Utilities Class</a></li>
- <li><a href="export.html">Database Export Class</a></li>
<li><a href="caching.html">Database Caching Class</a></li>
</ul>
diff --git a/user_guide/database/utilities.html b/user_guide/database/utilities.html
index e23f1f575..b064c7983 100644
--- a/user_guide/database/utilities.html
+++ b/user_guide/database/utilities.html
@@ -193,6 +193,61 @@ if ($result !== FALSE)<br />
+<h2>$this->dbutil->cvs_from_result($db_result)</h2>
+
+<p>Permits you to generate a CVS file from a query result. The first parameter of the function must contain the result object from your query.
+Example:</p>
+
+<code>
+$this->load->dbutil();<br />
+<br />
+$query = $this->db->query("SELECT * FROM mytable");<br />
+<br />
+echo $this->dbutil->cvs_from_result($query);
+</code>
+
+<p>The second and third parameters allows you to
+set the delimiter and newline character. By default tabs are used as the delimiter and "\n" is used as a new line. Example:
+
+<code>
+$delimiter = ",";<br />
+$newline = "\r\n";<br />
+<br />
+echo $this->dbutil->cvs_from_result($query, $delimiter, $newline);
+</code>
+
+<p class="important"><strong>Important:</strong>&nbsp; This function will NOT write the CVS file for you. It simply creates the CVS layout.
+If you need to write the file use the <a href="../helpers/file_helper.html">File Helper</a>.</p>
+
+
+
+<h2>$this->dbutil->xml_from_result($db_result)</h2>
+
+<p>Permits you to generate an XML file from a query result. The first parameter expects a query result object, the second
+may contain an optional array of config parameters. Example:</p>
+
+<code>
+$this->load->dbutil();<br />
+<br />
+$query = $this->db->query("SELECT * FROM mytable");<br />
+<br />
+$config = array (<br />
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'root'&nbsp;&nbsp;&nbsp; => 'root',<br />
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'element' => 'element', <br />
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'newline' => "\n", <br />
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';tab'&nbsp;&nbsp;&nbsp;&nbsp;=> "\t"<br />
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;);<br />
+<br />
+echo $this->dbutil->cvs_from_result($query, $config);
+</code>
+
+<p class="important"><strong>Important:</strong>&nbsp; This function will NOT write the CVS file for you. It simply creates the CVS layout.
+If you need to write the file use the <a href="../helpers/file_helper.html">File Helper</a>.</p>
+
+
+
+
+
</div>
<!-- END CONTENT -->
@@ -204,7 +259,7 @@ Previous Topic:&nbsp;&nbsp;<a href="call_function.html">Custom Function Calls</a
&nbsp;&nbsp;&nbsp;&middot;&nbsp;&nbsp;
<a href="#top">Top of Page</a>&nbsp;&nbsp;&nbsp;&middot;&nbsp;&nbsp;
<a href="../index.html">User Guide Home</a>&nbsp;&nbsp;&nbsp;&middot;&nbsp;&nbsp;
-Next Topic:&nbsp;&nbsp;<a href="export.html">Database Export Class</a>
+Next Topic:&nbsp;&nbsp;<a href="caching.html">Database Caching Class</a>
<p>
<p><a href="http://www.codeigniter.com">Code Igniter</a> &nbsp;&middot;&nbsp; Copyright &#169; 2006 &nbsp;&middot;&nbsp; <a href="http://www.pmachine.com">pMachine, Inc.</a></p>
</div>