In some books and online I see these method calls being made after a
database is created:
db.setLocale(Locale.getDefault());
db.setLockingEnabled(true);
db.setVersion(DB_VERSION);
Why is this done? As far as I can tell, after creating a new database,
the system adds a table named android_metadata with one field named
locale and that table has one row with the locale field set to
"en_US". Now I assume the column has that value because I am using a
U.S. phone, and if I were using a phone from a different region then
the locale field would be set appropriately. Can anyone confirm this?
I'm guessing that the setLocale method would only be useful in the
case that you install a pre-built database onto a phone and then want
to change the locale to match the phone's locale. Sound right?
The documentation for setLockingEnabled says it defaults to true so
there's no need to make that call, right?
Lastly, what's with the call to setVersion? I can't find a table that
contains this information so I've been assuming that the database file
itself stores the version number somewhere. So when I create a
database, which requires you to have already specified the version
number in the call to the SQLiteOpenHelper constructor, there's no
point in calling setVersion. Again, perhaps this method exists for the
case of installing a pre-built database to a device and you then wish
to change the database's version (though I can't think of when doing
this would make sense).
Thanks for any insight!