MSQuery Class Reference

Inherits from NSObject
Conforms to NSCopying
Declared in MSQuery.h

Overview

The MSQuery class represents a query that can be configured and then executed against a table of a Microsoft Azure Mobile Service. The query is serialized as a query string in the URL of the request. A query can be configured and then sent to the Microsoft Azure Mobile Service using the readOnSuccess:onError: method. MSQuery instances can be modfied and reused, but are not threadsafe.

Initializing the MSQuery object

– initWithTable:

Initializes a MSQuery instance with the given table.

- (id)initWithTable:(MSTable *)table

Discussion

Initializes a MSQuery instance with the given table.

Declared In

MSQuery.h

– initWithTable:predicate:

Returns a new MSQuery instance with the given table and the given predicate is used as the filter clause of the query.

- (id)initWithTable:(MSTable *)table predicate:(NSPredicate *)predicate

Discussion

Returns a new MSQuery instance with the given table and the given predicate is used as the filter clause of the query.

Declared In

MSQuery.h

– initWithSyncTable:

Initializes a MSQuery instance with the given table.

- (id)initWithSyncTable:(MSSyncTable *)table

Discussion

Initializes a MSQuery instance with the given table.

Declared In

MSQuery.h

– initWithSyncTable:predicate:

Returns a new MSQuery instance with the given table and the given predicate is used as the filter clause of the query.

- (id)initWithSyncTable:(MSSyncTable *)table predicate:(NSPredicate *)predicate

Discussion

Returns a new MSQuery instance with the given table and the given predicate is used as the filter clause of the query.

Declared In

MSQuery.h

  predicate

The predicate used as the filter clause of the query.

@property (nonatomic) NSPredicate *predicate

Discussion

The predicate used as the filter clause of the query.

Declared In

MSQuery.h

  fetchLimit

The maximum number of items to return from the query.

@property (nonatomic) NSInteger fetchLimit

Discussion

The maximum number of items to return from the query.

Declared In

MSQuery.h

  fetchOffset

The offset from the initial item to use when returning items from a query. Can be used with fetchLimit to implement paging.

@property (nonatomic) NSInteger fetchOffset

Discussion

The offset from the initial item to use when returning items from a query. Can be used with fetchLimit to implement paging.

Declared In

MSQuery.h

  orderBy

The array of NSSortDescriptors used to order the query results

@property (nonatomic, copy) NSArray *orderBy

Discussion

The array of NSSortDescriptors used to order the query results

Declared In

MSQuery.h

  includeTotalCount

Indicates if the Microsoft Azure Mobile Service should also include the total count of items on the server (not just the count of items returned) with the query results.

@property (nonatomic) BOOL includeTotalCount

Discussion

Indicates if the Microsoft Azure Mobile Service should also include the total count of items on the server (not just the count of items returned) with the query results.

Declared In

MSQuery.h

  parameters

A dictionary of string key-value pairs that can include user-defined parameters to use with the query.

@property (nonatomic, retain) NSDictionary *parameters

Discussion

A dictionary of string key-value pairs that can include user-defined parameters to use with the query.

Declared In

MSQuery.h

  selectFields

The fields or keys of an item that should be included in the results. A value of “” means all fields should be included. “” is the default value if no select keys are specified.

@property (nonatomic, retain) NSArray *selectFields

Discussion

The fields or keys of an item that should be included in the results. A value of “” means all fields should be included. “” is the default value if no select keys are specified.

Declared In

MSQuery.h

– orderByAscending:

Indicates that the query results should be returned in ascending order based on the given field. orderByAscending: and orderByDescending: can each be called multiple times to further specify how the query results should be ordered.

- (void)orderByAscending:(NSString *)field

Discussion

Indicates that the query results should be returned in ascending order based on the given field. orderByAscending: and orderByDescending: can each be called multiple times to further specify how the query results should be ordered.

Declared In

MSQuery.h

– orderByDescending:

Indicates that the query results should be returned in descending order based on the given field. orderByAscending: and orderByDescending: can each be called multiple times to further specify how the query results should be ordered.

- (void)orderByDescending:(NSString *)field

Discussion

Indicates that the query results should be returned in descending order based on the given field. orderByAscending: and orderByDescending: can each be called multiple times to further specify how the query results should be ordered.

Declared In

MSQuery.h

Executing the query

– readWithCompletion:

Executes the query by sending a request to the Microsoft Azure Mobile Service.

- (void)readWithCompletion:(MSReadQueryBlock)completion

Discussion

Executes the query by sending a request to the Microsoft Azure Mobile Service.

Declared In

MSQuery.h

– queryStringOrError:

Generates a query string for current state of the MSQuery instance or an error if the query string could not be generated.

- (NSString *)queryStringOrError:(NSError **)error

Discussion

Generates a query string for current state of the MSQuery instance or an error if the query string could not be generated.

Declared In

MSQuery.h

  table

The table associated with this query.

@property (nonatomic, strong) MSTable *table

Discussion

The table associated with this query.

Declared In

MSQuery.h

  syncTable

@property (nonatomic, strong) MSSyncTable *syncTable