Re: ANN: CDBStore, a lightweight persistent dictionary
Re: ANN: CDBStore, a lightweight persistent dictionary
- Subject: Re: ANN: CDBStore, a lightweight persistent dictionary
- From: Jeff LaMarche <email@hidden>
- Date: Fri, 02 May 2008 21:38:19 -0400
On May 2, 2008, at 9:07 PM, Jens Alfke wrote:
CDBStore is a kind of middle ground between simple property-lists or
archived objects, and CoreData. There's a very large empty space
there, and I kept getting annoyed by having to cobble together yet
another bit of code to read and write a dictionary from a file. And
I'm not the only one, as evidenced by this message:
This is very cool, Jens. I'm looking forward to trying this out.
I actually started working on a little different approach to that
"middle ground" you talk about yesterday. What I've done, although
it's not production ready yet, is to use some of Objective-C's runtime
functions to create a class that if you subclass it, all the
properties you declare are automatically saved to a SQLite database.
It's implemented as just a single class and a single-method protocol
that your application delegate needs to conform to (a method that
opens and returns the database). It dynamically generates the SQL to
create, delete, insert, and update the database based on the declared
properties, so you don't have to write any code and don't have to
create a mapping file, or do anything else. It even handles foreign
key associations for instance variables that are also subclasses of
this class, and uses cross reference tables to store arrays and
dictionaries that contain objects that are subclasses.
It's similar to the Ruby ActiveRecord implementation, except for being
object-driven rather than table driven. I think the concept has a lot
of potential, but I've got quite a bit of work to do before I'm
comfortable publishing it for others to see. Your solution might work
for me, though, and save me some work. :)
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden