summaryrefslogtreecommitdiffstats
path: root/system/database/DB_export.php
diff options
context:
space:
mode:
authoradmin <devnull@localhost>2006-09-26 04:09:05 +0200
committeradmin <devnull@localhost>2006-09-26 04:09:05 +0200
commit910d8620519d777ab45bdad5fb6dc9f05c6b2869 (patch)
treeedb4af16a4062cbf034fcd9dba9aad4a34abfacf /system/database/DB_export.php
parent9cd4e8e639a1a09fd6ca426f1af94586f30d4a80 (diff)
Diffstat (limited to 'system/database/DB_export.php')
-rw-r--r--system/database/DB_export.php38
1 files changed, 35 insertions, 3 deletions
diff --git a/system/database/DB_export.php b/system/database/DB_export.php
index 195510d9d..1e94c6c97 100644
--- a/system/database/DB_export.php
+++ b/system/database/DB_export.php
@@ -23,19 +23,51 @@
* @link http://www.codeigniter.com/user_guide/database/
*/
class CI_DB_export {
-
+
+
+ function CI_DB_export()
+ {
+ log_message('debug', "Database Export Class Initialized");
+ }
+
/**
- * Some function
+ * Generate CVS
*
* @access public
* @return integer
*/
- function something()
+ function generate_cvs($query, $delim = "\t", $newline = "\n")
{
+ if ( ! is_object($query) OR ! method_exists($query, 'field_names'))
+ {
+ show_error('You must submit a valid result object');
+ }
+
+ $out = '';
+ foreach ($query->field_names() as $name)
+ {
+ $out .= $name.$delim;
+ }
+
+ $out .= $newline;
+
+ foreach ($query->result_array() as $row)
+ {
+ foreach ($row as $item)
+ {
+ $out .= $item.$delim;
+ }
+
+ $out .= $newline;
+ }
+
+
+ return $out;
}
// --------------------------------------------------------------------
+
}
?> \ No newline at end of file