title: creating very large mysql INSERT query efficiently with C API
body: <p>I got data in files, which I need to write into a database. I have tried a NoSQL solution, which results in extremely high memory usage. Now I'm trying to get the same thing to work in MySQL using the C API.</p>
  
  <p>The data that needs to be written to the MySQL database is 120+million records. I got it all working basically, but I think the way I create the SQL statements is somewhat slow.</p>
  
  <p>Here is the code that I use:</p>
  
  <pre><code>sprintf(queryData, "INSERT INTO table(column1, column2, column3) VALUE");
  for (i = 0; i &lt; records; i++){
      sprintf(queryTemp, "(%s,%f,%f)", stringValue, floatValue1, floatValue2);
      strcat(queryData, queryTemp);
  }
  </code></pre>
  
  <p>there is some more code in there that adds the "," between the different records.</p>
  
  <p>is there a faster way of creating MySQL queries, than using string manipulation?</p>
  
  <p>Any help is appreciated.</p>