summaryrefslogtreecommitdiffstats
path: root/system/database/DB_driver.php
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2015-01-05 15:56:41 +0100
committerAndrey Andreev <narf@devilix.net>2015-01-05 15:56:41 +0100
commit0d3fde261bd538dd5f9468a407db74a066bc11a4 (patch)
tree475fba3ba826c549e17e9bb7334944946868980d /system/database/DB_driver.php
parent2020409b1083c14eeef83f6a226b26ef43b79682 (diff)
Polish changes following PR #3416
Diffstat (limited to 'system/database/DB_driver.php')
-rw-r--r--system/database/DB_driver.php48
1 files changed, 26 insertions, 22 deletions
diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php
index fdd99167f..9ef197cd1 100644
--- a/system/database/DB_driver.php
+++ b/system/database/DB_driver.php
@@ -456,9 +456,23 @@ abstract class CI_DB_driver {
// --------------------------------------------------------------------
/**
+ * DB connect
+ *
+ * This is just a dummy method that all drivers will override.
+ *
+ * @return mixed
+ */
+ public function db_connect()
+ {
+ return TRUE;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
* Persistent database connection
*
- * @return resource
+ * @return mixed
*/
public function db_pconnect()
{
@@ -1034,7 +1048,7 @@ abstract class CI_DB_driver {
/**
* Escape String
*
- * @param string|string[] $str
+ * @param string|string[] $str Input string
* @param bool $like Whether or not the string will be used in a LIKE condition
* @return string
*/
@@ -1102,10 +1116,10 @@ abstract class CI_DB_driver {
* Retrieves the primary key. It assumes that the row in the first
* position is the primary key
*
- * @param string the table name
- * @return mixed
+ * @param string $table Table name
+ * @return string
*/
- public function primary($table = '')
+ public function primary($table)
{
$fields = $this->list_fields($table);
return is_array($fields) ? current($fields) : FALSE;
@@ -1146,7 +1160,7 @@ abstract class CI_DB_driver {
* Returns an array of table names
*
* @param string $constrain_by_prefix = FALSE
- * @return mixed
+ * @return array
*/
public function list_tables($constrain_by_prefix = FALSE)
{
@@ -1214,9 +1228,9 @@ abstract class CI_DB_driver {
* Fetch Field Names
*
* @param string the table name
- * @return mixed
+ * @return array
*/
- public function list_fields($table = '')
+ public function list_fields()
{
// Is there a cached result?
if (isset($this->data_cache['field_names'][$table]))
@@ -1224,11 +1238,6 @@ abstract class CI_DB_driver {
return $this->data_cache['field_names'][$table];
}
- if ($table === '')
- {
- return ($this->db_debug) ? $this->display_error('db_field_param_missing') : FALSE;
- }
-
if (FALSE === ($sql = $this->_list_columns($table)))
{
return ($this->db_debug) ? $this->display_error('db_unsupported_function') : FALSE;
@@ -1282,18 +1291,13 @@ abstract class CI_DB_driver {
/**
* Returns an object with field data
*
- * @param string the table name
- * @return object
+ * @param string $table the table name
+ * @return array
*/
- public function field_data($table = '')
+ public function field_data($table)
{
- if ($table === '')
- {
- return ($this->db_debug) ? $this->display_error('db_field_param_missing') : FALSE;
- }
-
$query = $this->query($this->_field_data($this->protect_identifiers($table, TRUE, NULL, FALSE)));
- return $query->field_data();
+ return ($query) ? $query->field_data() : FALSE;
}
// --------------------------------------------------------------------