Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added a fetchTotal property to SKFetchRequest, courtesy @cbguder

  • Loading branch information...
commit f0c92b9909f9fd1ae5162d9f85dc738e246f153d 1 parent bb0d847
@davedelong authored
Showing with 8 additions and 0 deletions.
  1. +2 −0  Classes/SKFetchRequest.h
  2. +6 −0 Classes/SKFetchRequest.m
View
2  Classes/SKFetchRequest.h
@@ -34,6 +34,7 @@
NSSortDescriptor * sortDescriptor;
NSUInteger fetchLimit;
NSUInteger fetchOffset;
+ NSNumber * fetchTotal;
NSPredicate * predicate;
NSError * error;
@@ -47,6 +48,7 @@
@property (retain) NSSortDescriptor * sortDescriptor;
@property NSUInteger fetchLimit;
@property NSUInteger fetchOffset;
+@property (readonly) NSNumber * fetchTotal;
@property (retain) NSPredicate * predicate;
@property (readonly, retain) NSError * error;
@property (assign) id<SKFetchRequestDelegate> delegate;
View
6 Classes/SKFetchRequest.m
@@ -31,6 +31,7 @@ @implementation SKFetchRequest
@synthesize sortDescriptor;
@synthesize fetchLimit;
@synthesize fetchOffset;
+@synthesize fetchTotal;
@synthesize predicate;
@synthesize error;
@synthesize delegate;
@@ -41,6 +42,8 @@ @implementation SKFetchRequest
NSString * SKErrorCodeKey = @"code";
NSString * SKErrorMessageKey = @"message";
+NSString * SKFetchTotalKey = @"total";
+
- (id) initWithSite:(SKSite *)aSite {
if (self = [super initWithSite:aSite]) {
fetchLimit = SKPageSizeLimitMax;
@@ -54,6 +57,7 @@ - (id) init {
}
- (void) dealloc {
+ [fetchTotal release];
[sortDescriptor release];
[predicate release];
[error release];
@@ -179,6 +183,8 @@ - (NSArray *) executeFetchRequest {
return nil;
}
+ fetchTotal = [[responseObjects objectForKey:SKFetchTotalKey] retain];
+
//check for an error in the response
NSDictionary * errorDictionary = [responseObjects objectForKey:SKErrorResponseKey];
if (errorDictionary != nil) {
Please sign in to comment.
Something went wrong with that request. Please try again.