java - synchronizing current database entries with new data to insert -


I have to synchronize the data in my database table with the new data from the SQL query, where I will have to delete the current entries Not in new data and insert new entries that are not in current data. I was able to do this in Java using this pseudo code:

  // 1) Get all the data in the database and enter it in the list (currentList) // 2) SQL Synchronize both lists for the finalList.add (entry)} (if.FinalList) (list: currentList) {if (newList.contains (entry)) for the new data received through the entry (entry: newList) Entry (Entry)} / 4) Delete all data from DB / 5) Last Insert Enter a list for DB   

This works fine, although I think it will be a matter of performance when working with a large set of data because I can add new entries and new data Instead of removing the missing entries, I am restoring the entire list and adding the full list again.

Do you suggest a better way of doing this? Is it possible to create a SQL query that can take care of the synchronization of data?

Take a look.

Construction will allow you to specify the conditions under which to update existing records, or to add new ones.

This looks basically like this:

 Use the  table, use on source_table (some condition) when matched (update some_data_testment) when any match (INSERT some_insert_statement)    

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -