diff --git a/system/database/DB_utility.php b/system/database/DB_utility.php
index 36d74c5..950db7d 100644
--- a/system/database/DB_utility.php
+++ b/system/database/DB_utility.php
@@ -65,6 +65,30 @@
 	// --------------------------------------------------------------------
 
 	/**
+	 * Primary
+	 *
+	 * Retrieves the primary key.  It assumes that the row in the first
+	 * position is the primary key
+	 * 
+	 * @access	public
+	 * @param	string	the table name
+	 * @return	string		 
+	 */	
+	function primary($table = '')
+	{	
+		$fields = $this->field_names($table);
+		
+		if ( ! is_array($fields))
+		{
+			return FALSE;
+		}
+
+		return current($fields);
+	}
+
+	// --------------------------------------------------------------------
+
+	/**
 	 * Returns an array of table names
 	 * 
 	 * @access	public
@@ -188,39 +212,15 @@
 	// --------------------------------------------------------------------
 
 	/**
-	 * Primary
-	 *
-	 * Retrieves the primary key.  It assumes that the row in the first
-	 * position is the primary key
-	 * 
-	 * @access	public
-	 * @param	string	the table name
-	 * @return	string		 
-	 */	
-	function primary($table = '')
-	{	
-		$fields = $this->field_names($table);
-		
-		if ( ! is_array($fields))
-		{
-			return FALSE;
-		}
-
-		return current($fields);
-	}
-
-	// --------------------------------------------------------------------
-
-	/**
 	 * Create database
 	 *
 	 * @access	public
 	 * @param	string	the database name
 	 * @return	bool
 	 */
-	function create_database($name)
+	function create_database($db_name)
 	{
-		$sql = $this->_create_database($name);
+		$sql = $this->_create_database($db_name);
 		
 		if (is_bool($sql))
 		{
@@ -239,9 +239,9 @@
 	 * @param	string	the database name
 	 * @return	bool
 	 */
-	function drop_database($name)
+	function drop_database($db_name)
 	{
-		$sql = $this->_drop_database($name);
+		$sql = $this->_drop_database($db_name);
 		
 		if (is_bool($sql))
 		{
@@ -273,6 +273,51 @@
 			
 		return $dbs;
 	}
+	
+	// --------------------------------------------------------------------
+
+	/**
+	 * Optimize Table
+	 *
+	 * @access	public
+	 * @param	string	the table name
+	 * @return	bool
+	 */
+	function optimize_table($table_name)
+	{
+		$sql = $this->_optimize_table($table_name);
+		
+		if (is_bool($sql))
+		{
+			return $sql;
+		}
+	
+		$query = $this->db->query($sql);
+		return current($query->result_array());
+	}
+
+	// --------------------------------------------------------------------
+
+	/**
+	 * Optimize Table
+	 *
+	 * @access	public
+	 * @param	string	the table name
+	 * @return	bool
+	 */
+
+	function repair_table($table_name)
+	{
+		$sql = $this->_repair_table($table_name);
+		
+		if (is_bool($sql))
+		{
+			return $sql;
+		}
+	
+		$query = $this->db->query($sql);
+		return current($query->result_array());
+	}
 
 	// --------------------------------------------------------------------
 
@@ -283,9 +328,9 @@
 	 * @param	string	the table name
 	 * @return	bool
 	 */
-	function drop_table($name)
+	function drop_table($table_name)
 	{
-		$sql = $this->_drop_table($name);
+		$sql = $this->_drop_table($table_name);
 		
 		if (is_bool($sql))
 		{
@@ -296,23 +341,6 @@
 	}
 
 
-	
-	function alter_table()
-	{
-	}
-	
-	function create_index()
-	{
-	}
-	
-	function drop_index()
-	{
-	}
-	
-	function optimize()
-	{
-	}
-
 
 
 }
diff --git a/system/database/drivers/mssql/mssql_result.php b/system/database/drivers/mssql/mssql_result.php
index a8a8e20..53b7832 100644
--- a/system/database/drivers/mssql/mssql_result.php
+++ b/system/database/drivers/mssql/mssql_result.php
@@ -49,7 +49,28 @@
 	{
 		return @mssql_num_fields($this->result_id);
 	}
-	
+
+	// --------------------------------------------------------------------
+
+	/**
+	 * Fetch Field Names
+	 *
+	 * Generates an array of column names
+	 *
+	 * @access	public
+	 * @return	array
+	 */
+	function field_names()
+	{
+		$field_names = array();
+		while ($field = mssql_fetch_field($this->result_id))
+		{
+			$field_names[] = $field->name;       
+		}
+		
+		return $field_names;
+	}
+
 	// --------------------------------------------------------------------
 
 	/**
diff --git a/system/database/drivers/mssql/mssql_utility.php b/system/database/drivers/mssql/mssql_utility.php
index b85a420..cf15104 100644
--- a/system/database/drivers/mssql/mssql_utility.php
+++ b/system/database/drivers/mssql/mssql_utility.php
@@ -138,6 +138,37 @@
 	}
 	
 
+	// --------------------------------------------------------------------
+
+	/**
+	 * Optimize table query
+	 *
+	 * Generates a platform-specific query so that a table can be optimized
+	 *
+	 * @access	private
+	 * @param	string	the table name
+	 * @return	object
+	 */
+	function _optimize_table($table)
+	{
+		return FALSE; // Is this supported in MS SQL?
+	}
+
+	// --------------------------------------------------------------------
+
+	/**
+	 * Repair table query
+	 *
+	 * Generates a platform-specific query so that a table can be repaired
+	 *
+	 * @access	private
+	 * @param	string	the table name
+	 * @return	object
+	 */
+	function _repair_table($table)
+	{
+		return return FALSE; // Is this supported in MS SQL?
+	}
 
 }
 
diff --git a/system/database/drivers/mysql/mysql_result.php b/system/database/drivers/mysql/mysql_result.php
index e540489..91c4af1 100644
--- a/system/database/drivers/mysql/mysql_result.php
+++ b/system/database/drivers/mysql/mysql_result.php
@@ -53,6 +53,27 @@
 	// --------------------------------------------------------------------
 
 	/**
+	 * Fetch Field Names
+	 *
+	 * Generates an array of column names
+	 *
+	 * @access	public
+	 * @return	array
+	 */
+	function field_names()
+	{
+		$field_names = array();
+		while ($field = mysql_fetch_field($this->result_id))
+		{
+			$field_names[] = $field->name;       
+		}
+		
+		return $field_names;
+	}
+
+	// --------------------------------------------------------------------
+
+	/**
 	 * Field data
 	 *
 	 * Generates an array of objects containing field meta-data
diff --git a/system/database/drivers/mysql/mysql_utility.php b/system/database/drivers/mysql/mysql_utility.php
index a0c7462..800a90c 100644
--- a/system/database/drivers/mysql/mysql_utility.php
+++ b/system/database/drivers/mysql/mysql_utility.php
@@ -136,6 +136,39 @@
 		return "SELECT * FROM ".$this->db->_escape_table($table)." LIMIT 1";
 	}
 
+	// --------------------------------------------------------------------
+
+	/**
+	 * Optimize table query
+	 *
+	 * Generates a platform-specific query so that a table can be optimized
+	 *
+	 * @access	private
+	 * @param	string	the table name
+	 * @return	object
+	 */
+	function _optimize_table($table)
+	{
+		return "OPTIMIZE TABLE ".$this->db->_escape_table($table);
+	}
+
+	// --------------------------------------------------------------------
+
+	/**
+	 * Repair table query
+	 *
+	 * Generates a platform-specific query so that a table can be repaired
+	 *
+	 * @access	private
+	 * @param	string	the table name
+	 * @return	object
+	 */
+	function _repair_table($table)
+	{
+		return "REPAIR TABLE ".$this->db->_escape_table($table);
+	}
+
+
 
 
 }
diff --git a/system/database/drivers/mysqli/mysqli_result.php b/system/database/drivers/mysqli/mysqli_result.php
index b0db6c1..2eca68f 100644
--- a/system/database/drivers/mysqli/mysqli_result.php
+++ b/system/database/drivers/mysqli/mysqli_result.php
@@ -49,7 +49,28 @@
 	{
 		return @mysqli_num_fields($this->result_id);
 	}
-	
+
+	// --------------------------------------------------------------------
+
+	/**
+	 * Fetch Field Names
+	 *
+	 * Generates an array of column names
+	 *
+	 * @access	public
+	 * @return	array
+	 */
+	function field_names()
+	{
+		$field_names = array();
+		while ($field = mysql_fetch_field($this->result_id))
+		{
+			$field_names[] = $field->name;       
+		}
+		
+		return $field_names;
+	}
+
 	// --------------------------------------------------------------------
 
 	/**
diff --git a/system/database/drivers/mysqli/mysqli_utility.php b/system/database/drivers/mysqli/mysqli_utility.php
index 3286618..8c9e1e9 100644
--- a/system/database/drivers/mysqli/mysqli_utility.php
+++ b/system/database/drivers/mysqli/mysqli_utility.php
@@ -136,6 +136,37 @@
 		return "SELECT * FROM ".$this->db->_escape_table($table)." LIMIT 1";
 	}
 	
+	// --------------------------------------------------------------------
+
+	/**
+	 * Optimize table query
+	 *
+	 * Generates a platform-specific query so that a table can be optimized
+	 *
+	 * @access	private
+	 * @param	string	the table name
+	 * @return	object
+	 */
+	function _optimize_table($table)
+	{
+		return "OPTIMIZE TABLE ".$this->db->_escape_table($table);
+	}
+
+	// --------------------------------------------------------------------
+
+	/**
+	 * Repair table query
+	 *
+	 * Generates a platform-specific query so that a table can be repaired
+	 *
+	 * @access	private
+	 * @param	string	the table name
+	 * @return	object
+	 */
+	function _repair_table($table)
+	{
+		return "REPAIR TABLE ".$this->db->_escape_table($table);
+	}
 
 
 }
diff --git a/system/database/drivers/oci8/oci8_result.php b/system/database/drivers/oci8/oci8_result.php
index d2354a1..59adda7 100644
--- a/system/database/drivers/oci8/oci8_result.php
+++ b/system/database/drivers/oci8/oci8_result.php
@@ -74,6 +74,27 @@
         return $count;
     }
 
+	// --------------------------------------------------------------------
+
+	/**
+	 * Fetch Field Names
+	 *
+	 * Generates an array of column names
+	 *
+	 * @access	public
+	 * @return	array
+	 */
+	function field_names()
+	{
+		$field_names = array();
+        $fieldCount = $this->num_fields();
+        for ($c = 1; $c <= $fieldCount; $c++)
+        {
+            $field_names[] = ocicolumnname($this->stmt_id, $c);
+        }
+		return $field_names;
+	}
+
     // --------------------------------------------------------------------
 
     /**
diff --git a/system/database/drivers/oci8/oci8_utility.php b/system/database/drivers/oci8/oci8_utility.php
index 9c3059f..011e971 100644
--- a/system/database/drivers/oci8/oci8_utility.php
+++ b/system/database/drivers/oci8/oci8_utility.php
@@ -138,6 +138,38 @@
     }
 
 
+	// --------------------------------------------------------------------
+
+	/**
+	 * Optimize table query
+	 *
+	 * Generates a platform-specific query so that a table can be optimized
+	 *
+	 * @access	private
+	 * @param	string	the table name
+	 * @return	object
+	 */
+	function _optimize_table($table)
+	{
+		return FALSE; // Is this supported in Oracle?
+	}
+
+	// --------------------------------------------------------------------
+
+	/**
+	 * Repair table query
+	 *
+	 * Generates a platform-specific query so that a table can be repaired
+	 *
+	 * @access	private
+	 * @param	string	the table name
+	 * @return	object
+	 */
+	function _repair_table($table)
+	{
+		return return FALSE; // Is this supported in Oracle?
+	}
+
 }
 
 ?>
\ No newline at end of file
diff --git a/system/database/drivers/odbc/odbc_result.php b/system/database/drivers/odbc/odbc_result.php
index 49e5e90..385209c 100644
--- a/system/database/drivers/odbc/odbc_result.php
+++ b/system/database/drivers/odbc/odbc_result.php
@@ -49,7 +49,28 @@
 	{
 		return @odbc_num_fields($this->result_id);
 	}
-	
+
+	// --------------------------------------------------------------------
+
+	/**
+	 * Fetch Field Names
+	 *
+	 * Generates an array of column names
+	 *
+	 * @access	public
+	 * @return	array
+	 */
+	function field_names()
+	{
+		$field_names = array();
+		for ($i = 0; $i < $this->num_fields(); $i++)
+		{
+			$field_names[] 	= odbc_field_name($this->result_id, $i);
+		}
+		
+		return $field_names;
+	}
+
 	// --------------------------------------------------------------------
 
 	/**
diff --git a/system/database/drivers/odbc/odbc_utility.php b/system/database/drivers/odbc/odbc_utility.php
index 5b4558f..2932da8 100644
--- a/system/database/drivers/odbc/odbc_utility.php
+++ b/system/database/drivers/odbc/odbc_utility.php
@@ -159,6 +159,47 @@
 		return "SELECT TOP 1 FROM ".$this->db->_escape_table($table);
 	}
 
+	// --------------------------------------------------------------------
+
+	/**
+	 * Optimize table query
+	 *
+	 * Generates a platform-specific query so that a table can be optimized
+	 *
+	 * @access	private
+	 * @param	string	the table name
+	 * @return	object
+	 */
+	function _optimize_table($table)
+	{
+		// Not a supported ODBC feature	
+		if ($this->db_debug)
+		{
+			return $this->display_error('db_unsuported_feature');
+		}
+		return FALSE;
+	}
+
+	// --------------------------------------------------------------------
+
+	/**
+	 * Repair table query
+	 *
+	 * Generates a platform-specific query so that a table can be repaired
+	 *
+	 * @access	private
+	 * @param	string	the table name
+	 * @return	object
+	 */
+	function _repair_table($table)
+	{
+		// Not a supported ODBC feature	
+		if ($this->db_debug)
+		{
+			return $this->display_error('db_unsuported_feature');
+		}
+		return FALSE;
+	}
 
 
 }
diff --git a/system/database/drivers/postgre/postgre_result.php b/system/database/drivers/postgre/postgre_result.php
index 6af7f94..ee838b4 100644
--- a/system/database/drivers/postgre/postgre_result.php
+++ b/system/database/drivers/postgre/postgre_result.php
@@ -49,7 +49,28 @@
 	{
 		return @pg_num_fields($this->result_id);
 	}
-	
+
+	// --------------------------------------------------------------------
+
+	/**
+	 * Fetch Field Names
+	 *
+	 * Generates an array of column names
+	 *
+	 * @access	public
+	 * @return	array
+	 */
+	function field_names()
+	{
+		$field_names = array();
+		for ($i = 0; $i < $this->num_fields(); $i++)
+		{
+			$Ffield_names[] = pg_field_name($this->result_id, $i);
+		}
+		
+		return $field_names;
+	}
+
 	// --------------------------------------------------------------------
 
 	/**
diff --git a/system/database/drivers/postgre/postgre_utility.php b/system/database/drivers/postgre/postgre_utility.php
index b31609a..b2fdd5f 100644
--- a/system/database/drivers/postgre/postgre_utility.php
+++ b/system/database/drivers/postgre/postgre_utility.php
@@ -137,6 +137,38 @@
 		return "SELECT * FROM ".$this->db->_escape_table($table)." LIMIT 1";
 	}
 
+	// --------------------------------------------------------------------
+
+	/**
+	 * Optimize table query
+	 *
+	 * Generates a platform-specific query so that a table can be optimized
+	 *
+	 * @access	private
+	 * @param	string	the table name
+	 * @return	object
+	 */
+	function _optimize_table($table)
+	{
+		return FALSE; // Is this supported in Postgre?
+	}
+
+	// --------------------------------------------------------------------
+
+	/**
+	 * Repair table query
+	 *
+	 * Generates a platform-specific query so that a table can be repaired
+	 *
+	 * @access	private
+	 * @param	string	the table name
+	 * @return	object
+	 */
+	function _repair_table($table)
+	{
+		return return FALSE; // Is this supported in Postgre?
+	}
+
 
 }
 
diff --git a/system/database/drivers/sqlite/sqlite_result.php b/system/database/drivers/sqlite/sqlite_result.php
index f30a8cf..7f48ce8 100644
--- a/system/database/drivers/sqlite/sqlite_result.php
+++ b/system/database/drivers/sqlite/sqlite_result.php
@@ -49,7 +49,28 @@
 	{
 		return @sqlite_num_fields($this->result_id);
 	}
-	
+
+	// --------------------------------------------------------------------
+
+	/**
+	 * Fetch Field Names
+	 *
+	 * Generates an array of column names
+	 *
+	 * @access	public
+	 * @return	array
+	 */
+	function field_names()
+	{
+		$field_names = array();
+		for ($i = 0; $i < $this->num_fields(); $i++)
+		{
+			$Ffield_names[] = sqlite_field_name($this->result_id, $i);
+		}
+		
+		return $field_names;
+	}
+
 	// --------------------------------------------------------------------
 
 	/**
diff --git a/system/database/drivers/sqlite/sqlite_utility.php b/system/database/drivers/sqlite/sqlite_utility.php
index 754a755..e9f4eb6 100644
--- a/system/database/drivers/sqlite/sqlite_utility.php
+++ b/system/database/drivers/sqlite/sqlite_utility.php
@@ -155,6 +155,37 @@
 		return "SELECT * FROM ".$this->db->_escape_table($table)." LIMIT 1";
 	}
 
+	// --------------------------------------------------------------------
+
+	/**
+	 * Optimize table query
+	 *
+	 * Generates a platform-specific query so that a table can be optimized
+	 *
+	 * @access	private
+	 * @param	string	the table name
+	 * @return	object
+	 */
+	function _optimize_table($table)
+	{
+		return FALSE; // Is this supported SQLite?
+	}
+
+	// --------------------------------------------------------------------
+
+	/**
+	 * Repair table query
+	 *
+	 * Generates a platform-specific query so that a table can be repaired
+	 *
+	 * @access	private
+	 * @param	string	the table name
+	 * @return	object
+	 */
+	function _repair_table($table)
+	{
+		return return FALSE; // Is this supported in SQLite?
+	}
 
 
 }
diff --git a/user_guide/database/fields.html b/user_guide/database/fields.html
index 7cf1f9c..ecb6fcb 100644
--- a/user_guide/database/fields.html
+++ b/user_guide/database/fields.html
@@ -66,10 +66,13 @@
 

 

 <h2>Retrieving Field Names</h2>

-<p>Sometimes it's helpful to gather the field names.</p>

+<p>Sometimes it's helpful to gather the field names for a particular table or with a paritcular query result.</p>

 

 <h2>$this->db->field_names();</h2>

-<p>Returns an array containing the field names.  You must supply the table name to the function:</p>

+<p>Returns an array containing the field names. This query can be called two ways:</p>

+

+

+<p>1. You can supply the table name and call it from the <dfn>$this->db-></dfn> object:</p>

 

 <code>

 $fields = $this->db->field_names('table_name');<br /><br />

@@ -80,6 +83,21 @@
 }

 </code>

 

+<p>2. You can gather the feild names associated with any query you run by calling the function 

+from your query result object:</p>

+

+<code>

+$query = $this->db->query('SELECT * FROM some_table');

+<br /><br />

+

+foreach ($query->field_names() as $field)<br />

+{<br />

+&nbsp;&nbsp;&nbsp;echo $field;<br />

+}

+</code>

+

+

+

 

 

 <h2>Retrieving Field MetaData</h2>