Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iPhone SQLite DB and Web-based DB synchronization and interaction recommendations

I'm in the process of developing my second iPhone application, and am looking for architectural recommendations on DB handling.

The idea is: 1. A database of information is stored on a server (LAMP stack), and information is delivered to the device via JSON. This part has been implemented.

  1. The user is able to "favorite" an item in the database, which stores it in SQLite on their local device.

  2. The user can also submit new items to the remote server that don't already exist, making them available for other users to favorite.

  3. The user can search both databases, via a single search interface to find items.

I'm trying to decide the data structure for this, and how to deal with the resulting objects from the database. I think I have two options for the objects:

  1. The remote DB and the local DB have the same object type, and the local DB stores the id of the remote item to link the two

  2. Separate objects for the remote item and the local item

Any ideas, thoughts, etc are greatly appreciated!

like image 527
pixel Avatar asked Jan 16 '09 18:01

pixel


2 Answers

You'll need to write your own synchronization engine. I posted a lengthy set of notes on a record-level, history-driven synchronization engine I wrote from a wine journal application, which you can find here…

http://blog.deeje.tv/musings/2009/06/notes-on-writing-a-history-driven-client-server-synchronization-engine.html

like image 185
deeje cooley Avatar answered Nov 11 '22 23:11

deeje cooley


If you want to have synchronized objects in the databases, you could use a combination of a modification timestamps comparison and a hash column to determine which records are stale and need to be updated.

like image 33
Billy Gray Avatar answered Nov 11 '22 23:11

Billy Gray