title: MySQL LOAD DATA INFILE store line number
body: <p>I'm using MySQL LOAD DATA INFILE to move CSV file data into a database table. I'm looking for a way to reference the original file line number (row) in the imported record.</p>
  <p>So that a table like this:</p>
  <pre><code>CREATE TABLE tableName (
    uniqueId INT UNSIGNED NOT NULL PRIMARY_KEY,
    import_file VARCHAR(100),
    import_line INT,
    import_date = DATETIME,
    fieldA VARCHAR(100),
    fieldB VARCHAR(100),
    fieldC VARCHAR(100)
  );
  </code></pre>
  <p>Where import_file, import_line and import_date are meta data relevant to the specific file import. fieldA, fieldB and fieldC represent the actual data in the file.</p>
  <p>Would be updated by a query like this:</p>
  <pre><code>LOAD DATA INFILE '$file' 
  REPLACE
  INTO TABLE '$tableName' 
  FIELDS TERMINATED BY ',' ENCLOSED BY '\&quot;'
  LINES TERMINATES BY '\n'
  IGNORE 1 LINES # first row is column headers
  (fieldA,fieldB,fieldC)
  SET import_date = now(), 
  import_file = '&quot; . addslashes($file) . &quot;', 
  import_line = '???';
  </code></pre>
  <p><strong>Is there a variable I can set 'import_line' to?</strong></p>
  <p>Thanks,</p>
  <p>-M</p>