title: RSQLite Warning: "Too many SQL variables"
body: <p>I was having an issue getting the following error with RSQLite and was having trouble diagnosing the problem:</p>
  
  <p><code>Error in result_create(conn@ptr, statement) : too many SQL variables</code></p>
  
  <p>The database showed the correct, fixed number (24) of columns and should have had ~190 rows. Because the many rows at once won't fit in RAM, each entry (row) is iteratively appended.</p>
  
  <p>Unfortunately it kept failing on entry 99. However, when I tried to only enter rows 95 to 105 into a database, it works.</p>
  
  <pre><code>    # Doesn't work
  
      samplesToAdd &lt;- samplesToAdd[1:100, ]
  
      newDatabase2 &lt;- DBI::dbConnect(RSQLite::SQLite(),
                             "C:/Users/chase/Documents/GitHub/IDBac_App/inst/app/SpectraLibrary/z1.sqlite")
      IDBacApp::addNewLibrary(samplesToAdd = samplesToAdd,
                      newDatabase = newDatabase2,
                      selectedIDBacDataFolder = selectedIDBacDataFolder)
  
  
      Warning: Error in result_create: too many SQL variables
  
      # Works  
  
      samplesToAdd &lt;- samplesToAdd[95:105, ]
  
      newDatabase2 &lt;- DBI::dbConnect(RSQLite::SQLite(),
                             "C:/Users/chase/Documents/GitHub/IDBac_App/inst/app/SpectraLibrary/z1.sqlite")
      IDBacApp::addNewLibrary(samplesToAdd = samplesToAdd,
                      newDatabase = newDatabase2,
                      selectedIDBacDataFolder = selectedIDBacDataFolder)
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/ZdpxE.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZdpxE.png" alt="SQLiteDB"></a></p>
  
  <p>So, why was this failing for "too many variables" when there were only 24?</p>