title: MySQL LOAD DATA INFILE: works, but unpredictable line terminator
body: <p>MySQL has a nice CSV import function <code>LOAD DATA INFILE</code>.</p>
  
  <p>I have a large dataset that needs to be imported from CSV on a regular basis, so this feature is exactly what I need. I've got a working script that imports my data perfectly.</p>
  
  <p>.....except.... I don't know in advance what the end-of-line terminator will be.</p>
  
  <p>My SQL code currently looks something like this:</p>
  
  <pre><code>LOAD DATA INFILE '{fileName}'
   INTO TABLE {importTable}
   FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
   LINES TERMINATED BY '\n'
   IGNORE 1 LINES
  ( {fieldList} );
  </code></pre>
  
  <p>This works great for some import files.</p>
  
  <p>However, the import data is coming from multiple sources. Some of them have the <code>\n</code> terminator; others have <code>\r\n</code>. I can't predict which one I'll have.</p>
  
  <p>Is there a way using <code>LOAD DATA INFILE</code> to specify that my lines may be terminated with either <code>\n</code> or <code>\r\n</code>? How do I deal with this?</p>