Please note, this blog entry is from a previous course. You might want to check out the current one.
Loading Flickr information into your database can be ridiculously inefficient if, for each photo you download, you query to see if it is already in the database, add it if it is not (and maybe update it if it is). Enhance your application to make this download much more efficient, preferably only doing two or three queries total in the database for each “batch” of Flickr photos you download (instead of hundreds, which is what Photomania does). The predicate operator IN might be of value here.
Let’s start by limiting the photo queries, but only if there any photos. If there are none, the request containing a predicate with an IN operator and nil will most likely crash … A mystical helper method (described a little bit later) generates an array of photo IDs used to query the database. If there are matches, create a new array of Flickr photo dictionaries containing only photos not yet in the database. Replace the current photos array buy the new – reduced – one:
Continue reading “cs193p – Assignment #6 Extra Task #2”