title: Insert bulk of records into MySQL with stored procedure
body: <p>I have some millions records and I want to insert them as some batches to increase the speed.</p>
  
  <p>I have a table as follows:</p>
  
  <pre><code>CREATE TABLE `source_names` (
    `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
    `source_name` varchar(255) DEFAULT NULL,
    PRIMARY KEY (`id`),
    UNIQUE KEY `source_name_UNIQUE` (`source_name`)
  ) ENGINE=InnoDB AUTO_INCREMENT=39 DEFAULT CHARSET=latin1;
  </code></pre>
  
  <p>and in one step I want to add 500 <code>source_name</code> in <code>source_names</code> like this:</p>
  
  <pre><code>insert ignore into source_names (source_name) 
  values ('a01'),('a02'),...,('a500')
  </code></pre>
  
  <p>up to here there is no problem. </p>
  
  <p>In <code>Qt</code> I have a <code>QString</code> which is like this (of course the IDE is not important in this question):</p>
  
  <pre><code>QString totalSourceNames="('a01'),('a02'),...,('a500')";
  </code></pre>
  
  <p>I want to insert this QString into <code>source_names</code> table by <code>insertPro</code> stored procedure and these commands:</p>
  
  <pre><code>query.prepare("CALL insertPro(:source_names)");
  query.bindValue(":source_names",totalSourceNames);
  query.exec()
  </code></pre>
  
  <p>and my stored procedure is:</p>
  
  <pre><code>CREATE DEFINER=`root`@`localhost` PROCEDURE `insertPro`(
  IN source_names text
  )
  BEGIN
      insert ignore into source_names(source_name) values (source_names);
  END
  </code></pre>
  
  <p>By <code>MySQL</code> inserts just one row and concatenates all 500 values in one value. I know this is because of parenthesis in front of <code>values (...)</code> in above code but removing parenthesis makes an error in MySQL. </p>
  
  <p>How can I insert 500 records with stored procedure?</p>