title: Delphi SQLite Cached Updates and Auto-Incremental Fields
body: <p>I am using Cached updates in order to increase speed for my SQLites INSERT queries. The problem I am facing, is that inside the loop where I have my INSERT, I am using an auto-incemental value. </p>
  
  <p>I am using TFDConnection and TFDQuery to implement my database writing part.</p>
  
  <p>Before moving on the next Post()  I need the value of the previous auto-incemental value. The problem is that auto-incremental value is not generated unless in call TFDquery.ApplyUpdates().</p>
  
  <p>SO, is there a way that I can use CachedUpdates but also keep Auto-Incremental values that will be generated after calling TFDquery.ApplyUpdates()?</p>
  
  <p>One idea that came up on my mind, is getting the last generated value with TFDConnection.GetLastAutoGenValue() and calculate how many row I will need. For example if I know that I will insert 5 rows and the last auto-generated value was 300, I know that my next values will be 301,302,303,304,305. The whole problem with this, is that I dont have control on which values correlate with the next Post().</p>