narfbg suggested fixes
diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php
index b829bbe..7c73fc2 100644
--- a/system/database/DB_driver.php
+++ b/system/database/DB_driver.php
@@ -256,7 +256,7 @@
 
 		// Some DBs have functions that return the version, and don't run special
 		// SQL queries per se. In these instances, just return the result.
-		$driver_version_exceptions = array('oci8', 'sqlite', 'cubrid', 'pdo', 'mysqli');
+		$driver_version_exceptions = array('oci8', 'sqlite', 'cubrid', 'pdo', 'mysqli', 'interbase');
 
 		if (in_array($this->dbdriver, $driver_version_exceptions))
 		{
diff --git a/system/database/drivers/interbase/interbase_driver.php b/system/database/drivers/interbase/interbase_driver.php
index 97bf722..a6f192a 100644
--- a/system/database/drivers/interbase/interbase_driver.php
+++ b/system/database/drivers/interbase/interbase_driver.php
@@ -1,13 +1,13 @@
-<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
 /**
  * CodeIgniter
  *
  * An open source application development framework for PHP 5.1.6 or newer
  *
  * NOTICE OF LICENSE
- * 
+ *
  * Licensed under the Open Software License version 3.0
- * 
+ *
  * This source file is subject to the Open Software License (OSL 3.0) that is
  * bundled with this package in the files license.txt / license.rst.  It is
  * also available through the world wide web at this URL:
@@ -61,28 +61,26 @@
 	
 	// Keeps track of the resource for the current transaction
 	protected $trans;
+	
+	/**
+	 * Constructor for some overall setup
+	 */
+	public function __construct()
+	{
+		if( ! empty($this->hostname) && $this->hostname !== "localhost")
+		{
+			$this->database = $this->hostname.':'.$this->database;
+		}
+	}
 
 	/**
 	 * Non-persistent database connection
 	 *
-	 * @access	private called by the base class
 	 * @return	resource
 	 */
 	public function db_connect()
 	{
-		if ( ! $conn_id = @ibase_connect($this->database, $this->username, $this->password, $this->char_set))
-		{
-			log_message('error', $this->_error_message());
-
-			if ($this->db_debug)
-			{
-				$this->display_error($this->_error_message(), '', TRUE);
-			}
-
-			return FALSE;
-		}
-
-		return $conn_id;
+		return @ibase_connect($this->database, $this->username, $this->password, $this->char_set);
 	}
 
 	// --------------------------------------------------------------------
@@ -90,24 +88,11 @@
 	/**
 	 * Persistent database connection
 	 *
-	 * @access	private called by the base class
 	 * @return	resource
 	 */
 	public function db_pconnect()
 	{
-		if ( ! $conn_id = @ibase_pconnect($this->database, $this->username, $this->password, $this->char_set))
-		{
-			log_message('error', $this->_error_message());
-
-			if ($this->db_debug)
-			{
-				$this->display_error($this->_error_message(), '', TRUE);
-			}
-
-			return FALSE;
-		}
-
-		return $conn_id;
+		return @ibase_pconnect($this->database, $this->username, $this->password, $this->char_set);
 	}
 
 	// --------------------------------------------------------------------
@@ -118,7 +103,6 @@
 	 * Keep / reestablish the db connection if no queries have been
 	 * sent for a length of time exceeding the server's idle timeout
 	 *
-	 * @access	public
 	 * @return	void
 	 */
 	public function reconnect()
@@ -131,7 +115,6 @@
 	/**
 	 * Select the database
 	 *
-	 * @access	private called by the base class
 	 * @return	resource
 	 */
 	public function db_select()
@@ -145,7 +128,6 @@
 	/**
 	 * Set client character set
 	 *
-	 * @access	public
 	 * @param	string
 	 * @param	string
 	 * @return	resource
@@ -161,7 +143,6 @@
 	/**
 	 * Version number query string
 	 *
-	 * @access	public
 	 * @return	string
 	 */
 	public function _version()
@@ -180,7 +161,6 @@
 	/**
 	 * Execute the query
 	 *
-	 * @access	private called by the base class
 	 * @param	string	an SQL query
 	 * @return	resource
 	 */
@@ -197,7 +177,6 @@
 	 *
 	 * If needed, each database adapter can prep the query string
 	 *
-	 * @access	private called by execute()
 	 * @param	string	an SQL query
 	 * @return	string
 	 */
@@ -211,7 +190,6 @@
 	/**
 	 * Begin Transaction
 	 *
-	 * @access	public
 	 * @return	bool
 	 */
 	public function trans_begin($test_mode = FALSE)
@@ -242,7 +220,6 @@
 	/**
 	 * Commit Transaction
 	 *
-	 * @access	public
 	 * @return	bool
 	 */
 	public function trans_commit()
@@ -268,7 +245,6 @@
 	/**
 	 * Rollback Transaction
 	 *
-	 * @access	public
 	 * @return	bool
 	 */
 	public function trans_rollback()
@@ -294,7 +270,6 @@
 	/**
 	 * Escape String
 	 *
-	 * @access	public
 	 * @param	string
 	 * @param	bool	whether or not the string will be used in a LIKE condition
 	 * @return	string
@@ -327,7 +302,6 @@
 	/**
 	 * Affected Rows
 	 *
-	 * @access	public
 	 * @return	integer
 	 */
 	public function affected_rows()
@@ -340,12 +314,11 @@
 	/**
 	 * Insert ID
 	 *
-	 * @access	public
 	 * @param  	string $generator_name
 	 * @param   integer $inc_by
 	 * @return	integer
 	 */
-	public function insert_id($generator_name, $inc_by=1)
+	public function insert_id($generator_name, $inc_by=0)
 	{
 		return ibase_gen_id($generator_name, $inc_by);
 	}
@@ -358,7 +331,6 @@
 	 * Generates a platform-specific query string that counts all records in
 	 * the specified database
 	 *
-	 * @access	public
 	 * @param	string
 	 * @return	string
 	 */
@@ -369,7 +341,7 @@
 			return 0;
 		}
 
-		$query = $this->query($this->_count_string . $this->_protect_identifiers('numrows') . " FROM " . $this->_protect_identifiers($table, TRUE, NULL, FALSE));
+		$query = $this->query($this->_count_string . $this->_protect_identifiers('numrows') . ' FROM ' . $this->_protect_identifiers($table, TRUE, NULL, FALSE));
 
 		if ($query->num_rows() == 0)
 		{
@@ -388,7 +360,6 @@
 	 *
 	 * Generates a platform-specific query string so that the table names can be fetched
 	 *
-	 * @access	private
 	 * @param	boolean
 	 * @return	string
 	 */
@@ -414,7 +385,6 @@
 	 *
 	 * Generates a platform-specific query string so that the column names can be fetched
 	 *
-	 * @access	public
 	 * @param	string	the table name
 	 * @return	string
 	 */
@@ -440,7 +410,6 @@
 	 *
 	 * Generates a platform-specific query so that the column data can be retrieved
 	 *
-	 * @access	public
 	 * @param	string	the table name
 	 * @return	object
 	 */
@@ -457,7 +426,6 @@
 	/**
 	 * The error message string
 	 *
-	 * @access	private
 	 * @return	string
 	 */
 	public function _error_message()
@@ -470,7 +438,6 @@
 	/**
 	 * The error message number
 	 *
-	 * @access	private
 	 * @return	integer
 	 */
 	public function _error_number()
@@ -485,7 +452,6 @@
 	 *
 	 * This public function escapes column and table names
 	 *
-	 * @access	private
 	 * @param	string
 	 * @return	string
 	 */
@@ -523,7 +489,6 @@
 	 * This public function implicitly groups FROM tables so there is no confusion
 	 * about operator precedence in harmony with SQL standards
 	 *
-	 * @access	public
 	 * @param	type
 	 * @return	type
 	 */
@@ -534,6 +499,7 @@
 			$tables = array($tables);
 		}
 
+		//Interbase/Firebird doesn't like grouped tables
 		return implode(', ', $tables);
 	}
 
@@ -544,7 +510,6 @@
 	 *
 	 * Generates a platform-specific insert string from the supplied data
 	 *
-	 * @access	public
 	 * @param	string	the table name
 	 * @param	array	the insert keys
 	 * @param	array	the insert values
@@ -552,7 +517,7 @@
 	 */
 	public function _insert($table, $keys, $values)
 	{
-		return "INSERT INTO {$table} (".implode(', ', $keys).") VALUES (".implode(', ', $values).")";
+		return "INSERT INTO {$table} (".implode(', ', $keys).') VALUES ('.implode(', ', $values).')';
 	}
 
 	// --------------------------------------------------------------------
@@ -562,7 +527,6 @@
 	 *
 	 * Generates a platform-specific update string from the supplied data
 	 *
-	 * @access	public
 	 * @param	string	the table name
 	 * @param	array	the update data
 	 * @param	array	the where clause
@@ -581,9 +545,9 @@
 
 		$orderby = (count($orderby) >= 1)?' ORDER BY '.implode(", ", $orderby):'';
 
-		$sql = "UPDATE ".$table." SET ".implode(', ', $valstr);
+		$sql = "UPDATE {$table} SET ".implode(', ', $valstr);
 
-		$sql .= ($where != '' AND count($where) >=1) ? " WHERE ".implode(" ", $where) : '';
+		$sql .= ($where != '' AND count($where) >=1) ? ' WHERE '.implode(' ', $where) : '';
 
 		$sql .= $orderby;
 
@@ -600,7 +564,6 @@
 	 * If the database does not support the truncate() command
 	 * This public function maps to "DELETE FROM table"
 	 *
-	 * @access	public
 	 * @param	string	the table name
 	 * @return	string
 	 */
@@ -616,7 +579,6 @@
 	 *
 	 * Generates a platform-specific delete string from the supplied data
 	 *
-	 * @access	public
 	 * @param	string	the table name
 	 * @param	array	the where clause
 	 * @param	string	the limit clause
@@ -633,7 +595,7 @@
 
 			if (count($where) > 0 && count($like) > 0)
 			{
-				$conditions .= " AND ";
+				$conditions .= ' AND ';
 			}
 			$conditions .= implode("\n", $like);
 		}
@@ -650,7 +612,6 @@
 	 *
 	 * Generates a platform-specific LIMIT clause
 	 *
-	 * @access	public
 	 * @param	string	the sql query string
 	 * @param	integer	the number of rows to limit the query to
 	 * @param	integer	the offset value
@@ -667,7 +628,6 @@
 	/**
 	 * Close DB Connection
 	 *
-	 * @access	public
 	 * @param	resource
 	 * @return	void
 	 */
diff --git a/system/database/drivers/interbase/interbase_forge.php b/system/database/drivers/interbase/interbase_forge.php
index 177433f..6301481 100644
--- a/system/database/drivers/interbase/interbase_forge.php
+++ b/system/database/drivers/interbase/interbase_forge.php
@@ -1,13 +1,13 @@
-<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
 /**
  * CodeIgniter
  *
  * An open source application development framework for PHP 5.1.6 or newer
  *
  * NOTICE OF LICENSE
- * 
+ *
  * Licensed under the Open Software License version 3.0
- * 
+ *
  * This source file is subject to the Open Software License (OSL 3.0) that is
  * bundled with this package in the files license.txt / license.rst.  It is
  * also available through the world wide web at this URL:
@@ -39,7 +39,6 @@
 	/**
 	 * Create database
 	 *
-	 * @access	public
 	 * @param	string	the database name
 	 * @return	bool
 	 */
@@ -55,7 +54,6 @@
 	/**
 	 * Drop database
 	 *
-	 * @access	private
 	 * @param	string	the database name - not used in this driver 
 	 *	- the current db is dropped
 	 * @return	bool
@@ -69,7 +67,6 @@
 	/**
 	 * Create Table
 	 *
-	 * @access	private
 	 * @param	string	the table name
 	 * @param	array	the fields
 	 * @param	mixed	primary key(s)
@@ -171,16 +168,11 @@
 	/**
 	 * Drop Table
 	 *
-	 * @access	private
 	 * @return	bool
 	 */
 	public function _drop_table($table)
 	{
-		if ($this->db->db_debug)
-		{
-			return $this->db->display_error('db_unsuported_feature');
-		}
-		return array();
+		return 'DROP TABLE '.$name;
 	}
 
 	// --------------------------------------------------------------------
@@ -191,7 +183,6 @@
 	 * Generates a platform-specific query so that a table can be altered
 	 * Called by add_column(), drop_column(), and column_alter(),
 	 *
-	 * @access	private
 	 * @param	string	the ALTER type (ADD, DROP, CHANGE)
 	 * @param	string	the column name
 	 * @param	string	the table name
@@ -237,14 +228,13 @@
 	 *
 	 * Generates a platform-specific query so that a table can be renamed
 	 *
-	 * @access	private
 	 * @param	string	the old table name
 	 * @param	string	the new table name
 	 * @return	string
 	 */
 	public function _rename_table($table_name, $new_table_name)
 	{
-		$sql = 'ALTER TABLE '.$this->db->_protect_identifiers($table_name)." RENAME TO ".$this->db->_protect_identifiers($new_table_name);
+		$sql = 'ALTER TABLE '.$this->db->_protect_identifiers($table_name).' RENAME TO '.$this->db->_protect_identifiers($new_table_name);
 		return $sql;
 	}
 }
diff --git a/system/database/drivers/interbase/interbase_result.php b/system/database/drivers/interbase/interbase_result.php
index f2465ab..7d56c56 100644
--- a/system/database/drivers/interbase/interbase_result.php
+++ b/system/database/drivers/interbase/interbase_result.php
@@ -1,13 +1,13 @@
-<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
 /**
  * CodeIgniter
  *
  * An open source application development framework for PHP 5.1.6 or newer
  *
  * NOTICE OF LICENSE
- * 
+ *
  * Licensed under the Open Software License version 3.0
- * 
+ *
  * This source file is subject to the Open Software License (OSL 3.0) that is
  * bundled with this package in the files license.txt / license.rst.  It is
  * also available through the world wide web at this URL:
@@ -38,23 +38,21 @@
  */
 class CI_DB_interbase_result extends CI_DB_result {
 
+	public $num_rows;
+
 	/**
 	 * Number of rows in the result set
 	 *
-	 * @access	public
 	 * @return	integer
 	 */
 	public function num_rows()
 	{
-		//Will have to manually calculate :(
-		$count = 0;
-		
-		while($r = @ibase_fetch_row($this->result_id))
+		if( ! is_null($this->num_rows))
 		{
-			$count++;
+			return $this->num_rows;
 		}
 		
-		return $count;
+		return $this->num_rows = (isset($this->result_array()) ? count($this->result_array()) : 0;
 	}
 
 	// --------------------------------------------------------------------
@@ -62,7 +60,6 @@
 	/**
 	 * Number of fields in the result set
 	 *
-	 * @access	public
 	 * @return	integer
 	 */
 	public function num_fields()
@@ -77,13 +74,12 @@
 	 *
 	 * Generates an array of column names
 	 *
-	 * @access	public
 	 * @return	array
 	 */
 	public function list_fields()
 	{
 		$field_names = array();
-		for ($i = 0; $i < $this->num_fields(); $i++)
+		for ($i = 0, $num_fields=$this->num_fields(); $i < $num_fields; $i++)
 		{
 			$info = ibase_field_info($this->result_id, $i);
 			$field_names[] = $info['name'];
@@ -99,14 +95,13 @@
 	 *
 	 * Generates an array of objects containing field meta-data
 	 *
-	 * @access	public
 	 * @return	array
 	 */
 	public function field_data()
 	{
 		
 		$retval = array();
-		for ($i = 0; $i < $this->num_fields(); $i++)
+		for ($i = 0, $num_fields=$this->num_fields(); $i < $num_fields; $i++)
 		{
 			$info = ibase_field_info($this->result_id, $i);
 		
@@ -144,13 +139,12 @@
 	 * this internally before fetching results to make sure the
 	 * result set starts at zero
 	 *
-	 * @access	private
 	 * @return	array
 	 */
 	public function _data_seek($n = 0)
 	{
 		//Interbase driver doesn't implement a suitable function
-		return array();	
+		return FALSE;	
 	}
 
 	// --------------------------------------------------------------------
@@ -160,7 +154,6 @@
 	 *
 	 * Returns the result set as an array
 	 *
-	 * @access	private
 	 * @return	array
 	 */
 	public function _fetch_assoc()
@@ -175,7 +168,6 @@
 	 *
 	 * Returns the result set as an object
 	 *
-	 * @access	private
 	 * @return	object
 	 */
 	public function _fetch_object()
diff --git a/system/database/drivers/interbase/interbase_utility.php b/system/database/drivers/interbase/interbase_utility.php
index 7642755..e31021a 100644
--- a/system/database/drivers/interbase/interbase_utility.php
+++ b/system/database/drivers/interbase/interbase_utility.php
@@ -1,13 +1,13 @@
-<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
 /**
  * CodeIgniter
  *
  * An open source application development framework for PHP 5.1.6 or newer
  *
  * NOTICE OF LICENSE
- * 
+ *
  * Licensed under the Open Software License version 3.0
- * 
+ *
  * This source file is subject to the Open Software License (OSL 3.0) that is
  * bundled with this package in the files license.txt / license.rst.  It is
  * also available through the world wide web at this URL:
@@ -44,7 +44,6 @@
 	 * try reading a directory looking for Firebird files, but
 	 * that doesn't seem like a terribly good idea
 	 *
-	 * @access	private
 	 * @return	bool
 	 */
 	public function _list_databases()
@@ -53,7 +52,7 @@
 		{
 			return $this->db->display_error('db_unsuported_feature');
 		}
-		return array();
+		return FALSE;
 	}
 
 	// --------------------------------------------------------------------
@@ -63,7 +62,6 @@
 	 *
 	 * Is optimization even supported in Interbase/Firebird?
 	 *
-	 * @access	private
 	 * @param	string	the table name
 	 * @return	object
 	 */
@@ -79,7 +77,6 @@
 	 *
 	 * Table repairs are not supported in Interbase/Firebird
 	 *
-	 * @access	private
 	 * @param	string	the table name
 	 * @return	object
 	 */
@@ -93,7 +90,6 @@
 	/**
 	 * Interbase/Firebird Export
 	 *
-	 * @access	private
 	 * @param	array	Preferences
 	 * @return	mixed
 	 */