When you extend SQLiteOpenHelper, override this method:

                public void onUpgrade(final SQLiteDatabase db, final int 
oldVersion,
final int newVersion)

It will be called when your application is being updated with a newer
version.


On Jan 5, 8:52 am, "Dan Dumont" <ddum...@gmail.com> wrote:
> There is a method that will get called when the version number you supply to
> the create db command exceeds the listed version that the user has ( you've
> upgraded your design )
>
> You then put code in that handler to handle the database schema updates.
> Sorry I can't be more specific...  my code is at home.
>
> On Mon, Jan 5, 2009 at 3:34 AM, Jean-Baptiste Queru <j...@google.com> wrote:
>
> > You might find SQLiteOpenHelper useful to manage the various scenarios.
>
> > JBQ
>
> > On 1/5/09, Jay-andro <jayan...@gmail.com> wrote:
>
> > > I have an app that creates an sqllite database on first-use, if one
> > > doesn't already exist. Recently I released a new version of the app,
> > > and all of a sudden several users are complaining of erros that I
> > > didnt encounter in my testing. In my development I always installed
> > > using adb over usb, which in turn requires uninstall the older version
> > > first. So the database was always created anew on first-use of the new
> > > version. But I suspect my existing users are doing an in-place install
> > > on top of their old version, in which case the old db is incompatible
> > > with the new one.
>
> > > So my questions are:
> > > - Does the Market app allow you to install a new version "on top of"
> > > an old one, without requiring an uninstall first (unlike adb)?
> > > - If an in-place upgrade is supported but the database is not dropped,
> > > the question arises what else is not deleted? Resources, preferences,
> > > manifest? I suspect there would be major havoc if these things werent
> > > completely removed & replaced by the new version.
>
> > > I am now contemplating adding a preference which will indicate to the
> > > app what version of my db it needs and use this on first-use to
> > > determine if I need to drop and recreate the database or just use the
> > > old db.
>
> > > Any thoughts?
>
> > --
> > Jean-Baptiste M. "JBQ" Queru
> > Android Engineer, Google.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to