/*written by Michael Matschiner, 08/05/2009*/ /*send feedback to michael.matschiner-at-unibas.ch*/ /*This code is intended for import of data into the 'primer' table of the MySQL database 'gene_sample' running on evo-lutra.zoo.unibas.ch. Data is imported from the file addToPrimer.csv, which needs to be correctly formatted for successful import. A template Excel file with individual sheets for every database table can be found at www.evolution.unibas.ch/salzburger/protocols.htm. You'll need to save the respective sheet in csv format and change the filename specified below accordingly.*/ LOAD DATA LOCAL INFILE "/Users/michaelmatschiner/Documents/addToPrimer.csv" INTO TABLE primer FIELDS TERMINATED BY "," ENCLOSED BY "\"" LINES TERMINATED BY "\r" IGNORE 5 LINES (name, direction, sequence, ordered_by, @date_ordered, company, fluorescent_label, melting_point, box_name, row, col, @reference.name) SET reference_id = (SELECT id FROM reference WHERE name = @reference.name), date_ordered = str_to_date(@date_ordered,'%Y-%m-%d')