dbutil->csv_from_result() produces only header record. |
When I tried to create a CSV file using dbutil->csv_from_result() CI3 gave me just a header record missing whole actual data rows.
I found something after I played around with system/database/DB_utility.php. The original code is (CI3.1.7 is the same) like this; PHP Code: // Next blast through the result array and build out the rows In my environment (CI3 and PostgreSQL 10), there was no unbuffered_row in the query object, so the try misses. I remember CI2's dbutil->csv_from_result() worked fine with PostgreSQL 9.2 and the code in the both programs look the same... Then I gave a modification to the original code as follows and it works fine for me. PHP Code: //while ($row = $query->unbuffered_row('array')) // Original : while iteration doesn't work with object I'm not exactly sure if it works for everyone, but I believe it will help someone who have the same issue as I had.
@yoshee,
If you feel that this is a real issue then I suggest that you put in a pull request so that others will not run into this issue https://github.com/bcit-ci/CodeIgniter |
Welcome Guest, Not a member yet? Register Sign In |