title: Data sync between database and google calendar
body: <p>I would like to sync my db (tasks on my db, that have a decription, a date, a start time and an end time, and a user) with Google calendar.</p>
  
  <p>For sync with google i plan to use <a href="http://www.sync-components.com/" rel="nofollow noreferrer">these components</a> (of course I could somehow write the whole stuff on my own but this is something I can plan for the future now I am short of time, or in alternative can you suggest some working code that connects to google calendar to send/recieve data?).</p>
  
  <p>Now my main problem is not really linked to Delphi programming anyway I must ask a Delphi related questions because other questions get unviewd (like <a href="https://stackoverflow.com/questions/7888812/suggestions-for-calendar-sync-algorithm">this one</a> i asked).</p>
  
  <p>So I wonder how to do the sync. Note: I do one way sync and the generated calendar will be a read only calendar.</p>
  
  <p>I can set a max number in the past and future to be synced (like 10 days in past and 100 in the future for example). Then the idea I  have is this:
  as I start the sync app I comletely read the google calendar itmes in the range, I compare one by one with what I have in db and then I "merge" changes. Then on timer I check for differences in my db and i upload changes.</p>
  
  <p>But I am not sure that these is the best solution.</p>
  
  <p>A simplification of the real case is this: imagine it is a CRM with some task assigend to every user. Since beyond every task there is a logic i want to managea that logic only in my application, but the idea of pulishing the calendar to google is that it is then easily available from any mobile device. This is way there is a one way sync. Ic ould also let the calendar not be readonly anyway at every sync I wil "download" the newly inserted tasks but I will ignore the deleted ones and the edited ones. In this second case it is not enough to track changes in db, but I shuold also track changes on google, at least to "intercept" the newly added tasks.</p>
  
  <p>I am aware this is gerneic question but I would like to trigger an answer that can be useful, etiher redirecting me to a sync algorithm or to Delphi sample code or anything that can help me progress on this issue. Thanks.</p>