diff options
author | Andrey Andreev <narf@devilix.net> | 2015-10-12 15:47:45 +0200 |
---|---|---|
committer | Andrey Andreev <narf@devilix.net> | 2015-10-12 15:47:45 +0200 |
commit | 30f593bbb3408d0c076f2453818c68a7c5c59248 (patch) | |
tree | eb012b696c5f290997ebf8b607eccf56fa7c2907 /system | |
parent | d4357dcc8ef213874d263dd9c55d39446bed2163 (diff) | |
parent | d8687a59572f1f1b6d855588577363f6e628242e (diff) |
Merge pull request #4166 from aanbar/optimize-csv-export
Optimize DB_utility csv_from_result() for speed
Diffstat (limited to 'system')
-rw-r--r-- | system/database/DB_utility.php | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/system/database/DB_utility.php b/system/database/DB_utility.php index 78398ea83..b51893e18 100644 --- a/system/database/DB_utility.php +++ b/system/database/DB_utility.php @@ -254,11 +254,12 @@ abstract class CI_DB_utility { // 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; |