diff options
author | Ahmad Anbar <aanbar@gmail.com> | 2015-10-10 21:51:54 +0200 |
---|---|---|
committer | Andrey Andreev <narf@devilix.net> | 2015-10-12 15:48:58 +0200 |
commit | 6d6b3b2f89d517b4589cb52965f34b115036584a (patch) | |
tree | 507c43279bac890cca15fa24c9140539af7ff8b5 /system/database | |
parent | 4bb2b95a1b1f580427680c3bef71888e98c25523 (diff) |
Optimize csv_from_result speed.
Diffstat (limited to 'system/database')
-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; |