On Mar 13, 2008, at 2:11 PM, Karan Lyons wrote:

        What's the best way to lookup something from a huge table?
I'm trying to write a piece of code that checks weather data given a zipcode. But I first need to change that zipcode into another format in order for it to work with the online service I'm querying. For example:

        1) User inputs zipcode 02139.
2) Application looks up zipcode in table and finds that 02139 is USMA0007
        3) Application uses code USMA0007 to query the online service.

One other thing you could do is use Core Data with a SQLite persistent store that you generate during development, and embed as a resource within your application and add read-only to a coordinator.

Under Leopard you can specify that the code attribute of your zip code entity is indexed for faster retrieval. Core Data will also do the work of ensuring you don't pull in the whole (1MB or whatever) database just for a couple searches.

You could also use SQLite directly, but it'd be so easy to use Core Data for this that it's probably the first thing I'd try. I'd probably do so by creating a separate tool to generate the persistent store from a downloaded XML file (or whatever it is that you get the data from initially), and calling that tool from my build process via a build rule in my app target.

  -- Chris

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to