title: Using sqlite3_bind_XXX inside a loop
body: <p>I want to do multiple parameterized inserts with SQLite in my code. For this :</p>
  <p>I have a single prepare statement outside of my loop as :</p>
  <pre><code>error = sqlite3_prepare(connection, insert_sql, strlen(insert_sql), &amp;stmt, NULL);
  </code></pre>
  <p>I want inserts within a loop as:</p>
  <pre><code>while ( not reached end of datafile ) {
      
      // Insert into server table
      sqlite3_bind_int(stmt,    1, id1);
      sqlite3_bind_double(stmt, 2, latitude);
      sqlite3_bind_double(stmt, 3, longitude);
      
      sqlite3_step(stmt);
  
  }
  </code></pre>
  <p>The API docs for the function : <a href="https://www.sqlite.org/c3ref/bind_blob.html" rel="nofollow noreferrer">https://www.sqlite.org/c3ref/bind_blob.html</a>
  mention that :</p>
  <blockquote>
  <p>sqlite3_step() has been called more recently than sqlite3_reset(), then the call will return SQLITE_MISUSE</p>
  <p>Bindings are not cleared by the sqlite3_reset() routine</p>
  <p>If any sqlite3_bind_() routine is passed a prepared statement that has
  been finalized, the result is undefined and probably harmful.</p>
  </blockquote>
  <p>I am really confused as to how do I do repeated inserts with parameterized query in SQLite?</p>