cache db record fully instead of caching separate column values
Reported by yas375 | January 31st, 2012 @ 11:51 AM
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?
No comments found
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.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
ActiveRecord is an insanely easy to use database framework written in objective-c It's obviously "inspired" by (copying) the infamous ActiveRecord that comes with Rails(http://rubyonrails.org) But it tries to be more versatile when it comes to working with multiple connections.