Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

PhoneyDeveloper

macrumors 68040
Sep 2, 2008
3,114
93
It depends on the data. In essence you have to build an array that represents the data in the database even though the array won't be full. However, you don't have to load all the data into memory. If you have a small number of rows, say less than 1000, then I'd probably just load it into an array. If you have a large number of rows then you want to pre-sort it in some way.

My array is an array of dictionaries where each dictionary holds an array that represents the actual rows of the table. Each dictionary represents a section of the table.

I have a tableview that lists people 'Lastname, firstname' where the records are stored in a db. I pre-sort the rows and store counts for the number of records that have a last name that starts with each letter of the alphabet. So I have 26 records each with a count for a letter. So I know how many rows in the table. When the user types the first letter into the search box I retrieve all of the records where the first letter of the last name matches that letter. So I'm only retrieving a fraction of the records, but that's what will be visible to the user.
 

mekopolis

macrumors regular
Original poster
Feb 10, 2008
152
0
thanks for your responses

def. interesting ways to approach it

i have about 500 entries into a sqlite3 database

for sorting, i was considering having a sort by name, state, etc, and each button would execute a ORDER BY command that would sort the entries

but with so many entries, a real time table search would be more practical

so if i was to load the table, lets say the name into an NSArray, i would have to load all 500+ just to be able to have the user do a real time table search for a name?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.