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?