'Field names in first row' in CSV import drops every 5000 row
Issue #246
resolved
Originally reported on Google Code with ID 246
What steps will reproduce the problem?
1. craft big CSV file containing 5000+ rows
2. try importing it
What is the expected output? What do you see instead?
One row per 5000 lines from input file is missing in SQL with successfull SQL import
status.
This happens because $ields_in_first_row flag is not being cleared after first row
is skipped.
Simple fix:
if($csv_data[0] != NULL || count($csv_data)>1)
{
$csv_number_of_rows++;
- if($fields_in_first_row && $csv_number_of_rows==1)
continue;
+ if($fields_in_first_row && $csv_number_of_rows==1){
+ $fields_in_first_row = FALSE;
+ continue;
+ }
$csv_col_number = count($csv_data);
Reported by lytboris
on 2014-02-08 11:42:55
Comments (2)
-
-
Thanks for reporting this issue. Just to explain why this happens: Of course it's no integer overflow (php automatically casts to float if ints get too big and 5000 is a lot smaller than 2147483647). The problem is cause because we start a new transaction every 5000 rows and when we do this, we set $csv_number_of_rows=0. I just fixed this in svn the same way as you proposed. Thanks.
Reported by
crazy4chrissi
on 2014-02-09 21:29:43 - Labels added: Target-1.9.6 - Log in to comment
Reported by
crazy4chrissi
on 2014-02-09 21:25:39 - Status changed:Fixed