summaryrefslogtreecommitdiffstats
path: root/system/database/drivers
diff options
context:
space:
mode:
authorTimothy Warren <tim@timshomepage.net>2012-02-17 19:59:44 +0100
committerTimothy Warren <tim@timshomepage.net>2012-02-17 19:59:44 +0100
commit3a4cdc62042c56da9527e6d1d4c1ab5417839e1c (patch)
treee9d4bb7d1eae968a84d0d027a579597d45c6e6e9 /system/database/drivers
parent9fad90f60dc9613527f1a1215d89a41a45878f5c (diff)
Workaround to fix method
Diffstat (limited to 'system/database/drivers')
-rw-r--r--system/database/drivers/interbase/interbase_driver.php53
-rw-r--r--system/database/drivers/interbase/interbase_result.php62
2 files changed, 115 insertions, 0 deletions
diff --git a/system/database/drivers/interbase/interbase_driver.php b/system/database/drivers/interbase/interbase_driver.php
index 20663d8bb..7bd4f6f4b 100644
--- a/system/database/drivers/interbase/interbase_driver.php
+++ b/system/database/drivers/interbase/interbase_driver.php
@@ -624,6 +624,59 @@ SQL;
{
@ibase_close($conn_id);
}
+
+ // --------------------------------------------------------------------------
+
+ /**
+ * Returns an array of table names
+ *
+ * @access public
+ * @return array
+ */
+ function list_tables($constrain_by_prefix = FALSE)
+ {
+ // Is there a cached result?
+ if (isset($this->data_cache['table_names']))
+ {
+ return $this->data_cache['table_names'];
+ }
+
+ if (FALSE === ($sql = $this->_list_tables($constrain_by_prefix)))
+ {
+ if ($this->db_debug)
+ {
+ return $this->display_error('db_unsupported_function');
+ }
+ return FALSE;
+ }
+
+ $retval = array();
+ $query = $this->query($sql);
+
+ $table = FALSE;
+ $rows = $query->result_array();
+
+ // This has to be called after getting the result due to the
+ // limitations of the database driver
+ if ($query->num_rows() > 0)
+ {
+ $key = (($row = current($rows)) && in_array('table_name', array_map('strtolower', array_keys($row))));
+
+ if ($key)
+ {
+ $table = array_key_exists('TABLE_NAME', $row) ? 'TABLE_NAME' : 'table_name';
+ }
+
+ foreach ($rows as $row)
+ {
+ $retval[] = ( ! $table) ? current($row) : $row[$table];
+ }
+ }
+
+ $this->data_cache['table_names'] = $retval;
+
+ return $this->data_cache['table_names'];
+ }
}
/* End of file interbase_driver.php */
diff --git a/system/database/drivers/interbase/interbase_result.php b/system/database/drivers/interbase/interbase_result.php
index 3d5721138..37f0a108c 100644
--- a/system/database/drivers/interbase/interbase_result.php
+++ b/system/database/drivers/interbase/interbase_result.php
@@ -183,6 +183,68 @@ class CI_DB_interbase_result extends CI_DB_result {
return @ibase_fetch_object($this->result_id);
}
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Query result. "object" version.
+ *
+ * @return object
+ */
+ public function result_object()
+ {
+ if (count($this->result_object) > 0)
+ {
+ return $this->result_object;
+ }
+
+ // In the event that query caching is on the result_id variable
+ // will return FALSE since there isn't a valid SQL resource so
+ // we'll simply return an empty array.
+ if ($this->result_id === FALSE)
+ {
+ return array();
+ }
+
+ $this->num_rows = 0;
+ while ($row = $this->_fetch_object())
+ {
+ $this->result_object[] = $row;
+ }
+
+ return $this->result_object;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Query result. "array" version.
+ *
+ * @return array
+ */
+ public function result_array()
+ {
+ if (count($this->result_array) > 0)
+ {
+ return $this->result_array;
+ }
+
+ // In the event that query caching is on the result_id variable
+ // will return FALSE since there isn't a valid SQL resource so
+ // we'll simply return an empty array.
+ if ($this->result_id === FALSE)
+ {
+ return array();
+ }
+
+ $this->num_rows = 0;
+ while ($row = $this->_fetch_assoc())
+ {
+ $this->result_array[] = $row;
+ }
+
+ return $this->result_array;
+ }
}