summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoradmin <devnull@localhost>2006-09-26 20:14:43 +0200
committeradmin <devnull@localhost>2006-09-26 20:14:43 +0200
commitb63ac845de0c7c57c7db755de9af36ce34b67426 (patch)
treeb852d227ad6bda19d1c5bf3166a3638a895eb8d7
parent6e00bab0ecfbbdd35d135a297d54a4989a44e500 (diff)
-rw-r--r--system/database/DB_export.php13
1 files changed, 8 insertions, 5 deletions
diff --git a/system/database/DB_export.php b/system/database/DB_export.php
index 14e7af68b..02b4b42ad 100644
--- a/system/database/DB_export.php
+++ b/system/database/DB_export.php
@@ -12,7 +12,6 @@
* @since Version 1.0
* @filesource
*/
-
// INITIALIZE THE CLASS ---------------------------------------------------
@@ -38,10 +37,13 @@ class CI_DB_export {
}
/**
- * Generate CVS
+ * Generate CVS from a query result object
*
* @access public
- * @return integer
+ * @param object The query result object
+ * @param string The delimiter - tab by default
+ * @param string The newline character - \n by default
+ * @return string
*/
function generate_cvs($query, $delim = "\t", $newline = "\n")
{
@@ -51,13 +53,15 @@ class CI_DB_export {
}
$out = '';
+
+ // First generate the headings from the table column names
foreach ($query->field_names() as $name)
{
$out .= $name.$delim;
}
-
$out .= $newline;
+ // Next blast through the result array and build out the rows
foreach ($query->result_array() as $row)
{
foreach ($row as $item)
@@ -67,7 +71,6 @@ class CI_DB_export {
$out .= $newline;
}
-
return $out;
}