in reply to Inserting Apostrophes into SQL
There is another, I think very compelling, reason to use placeholders: it enables you to prepare your query only once, and then re-use it (as you say...) “several hundred thousand times.” The difference in efficiency can be quite compelling.
You are executing one query, and the query does not change. Only the exact values being inserted each time. Therefore, the database engine only needs to parse the SQL once, build one execution-plan, and then just keep re-using it over and over. The data that corresponds to the various placeholders is never considered to be “part of the SQL string,” because of course (when you do it this way...) it isn’t.
You should also read-up on transactions. You probably want to wrap this insertion-loop into a transaction, and COMMIT that transaction (and start a new one) every few thousand records or so (and at the end).
Before you go too much farther, Google® this: bulk data inserts.