Changeset 210
- Timestamp:
- 01/24/07 13:49:34 (2 years ago)
- Files:
-
- trunk/cocoa/mogenerator/machine.m.motemplate (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/cocoa/mogenerator/machine.m.motemplate
r209 r210 14 14 <$if Attribute.name == position_$> 15 15 // position_ is a calculated value: @max(position_)+1. Calculate it the first time it's used. 16 static BOOL fetching = NO; 16 17 if (!result || [result longLongValue] == -1) { 18 fetching = YES; 17 19 NSFetchRequest *fetchObjectWithMaximumPosition = [[[NSFetchRequest alloc] init] autorelease]; 18 20 [fetchObjectWithMaximumPosition setEntity:[self entity]]; … … 23 25 result = [NSNumber numberWithLongLong:[objectWithMaximumPosition count] ? [[[objectWithMaximumPosition lastObject] valueForKey:@"position_"] longLongValue]+1 : 0]; 24 26 [self setPosition_:result]; 27 fetching = NO; 25 28 } 26 29 <$endif$>
