Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

cache db record fully instead of caching separate column values

#18

I uncomment logger line 'ARDebugLog("Executing SQL: % subs: %@", sql, substitutions);' in 'executeSQL: substitutions:' method in ARSQLiteConnection.m file.
And I saw that there are different requests for each column value. More detailed description below.

I have created model Person with firstName and lastName. After that I try to access each of this two properties (just put them in to log):

Person *person = [[Person find:ARFindFirst] objectAtIndex:0];
NSLog(@"firstName: %@", person.firstName);
NSLog(@"lastName: %@", person.lastName);

and I saw in console that there are separate requests for firstName and lastName:

ARSQLiteConnection.m:75: warning: Executing SQL: SELECT firstName FROM people WHERE id = :id subs: {
    id = 1;
}
ARSQLiteConnection.m:75: warning: Executing SQL: SELECT lastName FROM people WHERE id = :id subs: {
    id = 1;
}

I already enable cache for ARBase, but it will cache only property value. Means that when I access firstName seconf time, than there is no request needed. Ok, but I think that it will be better to cache all record from database. For example on my first call to person.firstName next SQL should be executed:

SELECT * FROM people WHERE id = 1;

The result should be cached (if cache is enabled) and firstName returned.

What do you think about this?

Reported by yas375 · January 31st, 2012 @ 11:51 AM

State: new
Milestone: none
Assigned to: nobody

Activity

No comments yet.

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.