Right. We also implemented some basic database migration /
initialization support, but haven't finalized the API or decided quite
where to put it yet.
It handles schema versioning automatically -- you just implement a
migration delegate and return the new version.
Code is attached, usage would be:
YourDatabaseMigration *migration = [[[YourDatabaseMigration alloc]
init] autorelease];
PLAppDBManager *manager = [[PLAppDBManager alloc] initWithPath: path
delegate: migration];
// At this point, the database is fully initialized and all
migrations run. Open a connection:
NSObject<PLDatabase> *db = [manager openConnection];
The migration runs inside of a transaction, so any failure results in
a full rollback. We should probably at least post this on the web
site, if not merge it into the main tree.
-landonf
>
> Excellent. Will give it a try. Thanks.
>
> BTW, do you have any "samples" besides the 5-6 lines in the docs?
Other than the docs, we haven't written any official sample code. It
may be worth looking at the unit tests -- they are comprehensive and
should demonstrate how to use all parts of the system.
-landonf
> It compiles and links fine with the iPhone SDK. We anded up not using
> it and opting to use FMDB, as the footprint is quite different.
Resource footprint?
-landonf
For the record, this was referring to binary size. Unlinked,
PLDatabase 1.1 object files weigh in at 128K, and FMDB at 96K. This is
primarily due to fixed per-object file overhead. Linked into a
resulting executable, they're smaller.
We don't consider <128K in either direction to be particularly
concerning on the iPhone. I was primarily concerned this was a memory/
cpu resource consumption issue, which is something we're attentive to
and very interested in hearing about should you run into issues.
-landonf