Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 01-03-2012, 02:39 PM   #1 (permalink)
Registered Member
 
Join Date: Jan 2012
Posts: 1
BigZee is on a distinguished road
Default Updating SQLite database with MySQL database based on version

This is my first post here so I’m going to do my best to ask my question in the best possible way. I wouldn’t be here asking if I had other options.

First off I am basically new to iPhone development. I am currently working on an app which has a great working version on the app store, but now it’s time for some updates. A basic description of the app is that it is an informational app. Users get it to find out information about certain things. The one that’s currently up is basically static. All the information is stored in a sqlite database and is pulled from this database for the users to view. It’s nothing special at all, just sitting in the apps resource folder which we all know is not editable.

The version that we need to update it with is completely dynamic. I built a webservice with a MySQL database with feeds for the information that gets updated. This all works great. When the app starts it deletes the existing database in the Documents directory and then recreates it based on the schema of the database in the Resources directory. I can perform an update on the web side and the app updates as it should, which was a task in itself…lol

Here is where my problem lies. I don’t want to go through this process every time because the information is a bit heavy and only going to be added to, but not frequently. So ideally I would like the database to be updated on the first run, but not again until the data has changed in the database, maybe weekly or so. I would like to accomplish this using a database version table, stored on my webservice side and the app side. I have the tables built to hold the versions but I can’t figure out how to compare the two. I.E. The MySQL database has a version of 1, so does the SQLite database, so nothing happens. Now the MySQL database has a version of 2 and the sqlite is still 1, so the sqlite database in the Documents directory gets deleted and the new one gets brought in, parsed and put in to the sqlite database in the Documents directory.

All the work as far as the parsing and inserting is being done in the AppDelegate. I’m not too sure how to accomplish what I am trying to do. I have done an ample amount of research on this and I do find things that say that this is one way to do it along with last modified date, but that is about it. I would really like to stick with the database version way as that is what I am currently setup for. If someone can point me in the right direction for this I would greatly appreciate it. If any more details are needed please ask…
BigZee is offline   Reply With Quote
Old 01-09-2012, 10:37 AM   #2 (permalink)
Registered Member
 
Join Date: Nov 2008
Posts: 15
lawicko is on a distinguished road
Default

Hi. As far as I can tell, the best way to go is to make your web service send the client just the delta. You said you want to use the database version information, but deleting the entire database whenever some records were added on the server side is not a good idea, in my humble opinion. You have the feeds already implemented, why not read them in the client and basically insert rows into existing table in the databas?
lawicko is offline   Reply With Quote
Reply

Bookmarks

Tags
database synchronization, iphone, mysql, sqlite

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 398
12 members and 386 guests
buggen, EvilElf, guusleijsten, j.b.rajesh@gmail.com, LunarMoon, morterbaher, QuantumDoja, sacha1996, Sami Gh, tim0504, VinceYuan
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,673
Threads: 94,122
Posts: 402,907
Top Poster: BrianSlick (7,990)
Welcome to our newest member, morterbaher
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 05:33 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0