Optimize changes from PR #2290
diff --git a/system/database/DB_utility.php b/system/database/DB_utility.php
index b270cdd..9f953d4 100644
--- a/system/database/DB_utility.php
+++ b/system/database/DB_utility.php
@@ -238,8 +238,7 @@
 			$out .= $enclosure.str_replace($enclosure, $enclosure.$enclosure, $name).$enclosure.$delim;
 		}
 
-		$out = substr(rtrim($out), 0, -strlen($delim)); // Remove the trailing delimiter character(s) at the end of the column names
-		$out = $out.$newline;
+		$out = substr(rtrim($out), 0, -strlen($delim)).$newline;
 
 		// Next blast through the result array and build out the rows
 		while ($row = $query->unbuffered_row('array'))
@@ -248,8 +247,7 @@
 			{
 				$out .= $enclosure.str_replace($enclosure, $enclosure.$enclosure, $item).$enclosure.$delim;
 			}
-			$out = substr(rtrim($out), 0, -strlen($delim)); // Remove the trailing delimiter character(s) at the end of the row lines
-			$out = rtrim($out).$newline;
+			$out = substr(rtrim($out), 0, -strlen($delim)).$newline;
 		}
 
 		return $out;