diff options
author | Andrey Andreev <narf@devilix.net> | 2015-12-08 12:10:41 +0100 |
---|---|---|
committer | Andrey Andreev <narf@devilix.net> | 2015-12-08 12:10:41 +0100 |
commit | b1cde1fdd77aec1278dd2b4d6ae071e814a58c2a (patch) | |
tree | 5a5395d03e89c490771ffc53b31b56bf023ebcfa /system | |
parent | c83cfe8f9bdaf8fc7d9af2a392c7514ba612fec9 (diff) |
Type-hint csv_from_result(), xml_from_result() DB utilities
Close #4299
Diffstat (limited to 'system')
-rw-r--r-- | system/database/DB_utility.php | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/system/database/DB_utility.php b/system/database/DB_utility.php index b51893e18..fcc56f24e 100644 --- a/system/database/DB_utility.php +++ b/system/database/DB_utility.php @@ -235,13 +235,8 @@ abstract class CI_DB_utility { * @param string $enclosure Enclosure (default: ") * @return string */ - public function csv_from_result($query, $delim = ',', $newline = "\n", $enclosure = '"') + public function csv_from_result(CI_DB_result $query, $delim = ',', $newline = "\n", $enclosure = '"') { - if ( ! is_object($query) OR ! method_exists($query, 'list_fields')) - { - show_error('You must submit a valid result object'); - } - $out = ''; // First generate the headings from the table column names foreach ($query->list_fields() as $name) @@ -274,13 +269,8 @@ abstract class CI_DB_utility { * @param array $params Any preferences * @return string */ - public function xml_from_result($query, $params = array()) + public function xml_from_result(CI_DB_result $query, $params = array()) { - if ( ! is_object($query) OR ! method_exists($query, 'list_fields')) - { - 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) { |