ChecksumParser: increment checksum_xref_id BEFORE use
The initial value of the variable $counter is set to the highest checksum_xref.checksum_xref_id found if the table in question is not empty, or 0 if it is. This causes problems if $counter is only incremented after each use in the input-file loop: - for a non-empty table the parser would attempt to re-use an existing value of checksum_xref_id for the first entry read from the input file. checksum_xref_id is the primary key of checksum_xref so its values have to be unique, therefore "LOAD DATA" silently discards the offending row; - for an empty table we lose one input row as well but it is the SECOND rather than the first one. Reason: 0 is not a valid value for auto_increment fields in MySQL, resulting in the first row being inserted with the first allowed ID value of 1 - which brings us back to the previous scenario when "LOAD DATA" attempts to insert the second row. Incrementing $counter before use ought to address both forms of the problem.
parent
d3f22cfa
No related branches found
No related tags found
Please register or sign in to comment