Optimize csv_from_result speed.
diff --git a/system/database/DB_utility.php b/system/database/DB_utility.php
index 78398ea..b51893e 100644
--- a/system/database/DB_utility.php
+++ b/system/database/DB_utility.php
@@ -254,11 +254,12 @@
 		// Next blast through the result array and build out the rows
 		while ($row = $query->unbuffered_row('array'))
 		{
+			$line = array();
 			foreach ($row as $item)
 			{
-				$out .= $enclosure.str_replace($enclosure, $enclosure.$enclosure, $item).$enclosure.$delim;
+				$line[] = $enclosure.str_replace($enclosure, $enclosure.$enclosure, $item).$enclosure;
 			}
-			$out = substr($out, 0, -strlen($delim)).$newline;
+			$out .= implode($delim, $line).$newline;
 		}
 
 		return $out;