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.

- (nonnull instancetype)initWithTable:(nonnull 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.

- (nullable instancetype)initWithTable:(nullable MSTable *)table predicate:(nullable 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.

- (nullable instancetype)initWithSyncTable:(nullable 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.

- (nullable instancetype)initWithSyncTable:(nullable MSSyncTable *)table predicate:(nullable 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, nullable) 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, nullable) 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, nullable) 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, nullable) 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:(nonnull 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:(nonnull 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:(nullable 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.

- (nullable NSString *)queryStringOrError:(NSError *__nullable *__nullable)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, nullable) MSTable *table

Discussion

The table associated with this query.

Declared In

MSQuery.h

  syncTable

@property (nonatomic, strong, nullable) MSSyncTable *syncTable