BmobQuery Class Reference

Inherits from NSObject
Declared in BmobQuery.h

Overview

Bmob后台查询类

  limit

限制得到多少个结果
@property (nonatomic) NSInteger limit

Declared In

BmobQuery.h

  skip

查询结果跳到第几个
@property (nonatomic) NSInteger skip

Declared In

BmobQuery.h

  cachePolicy

缓存策略
@property (assign) BmobCachePolicy cachePolicy

Declared In

BmobQuery.h

  maxCacheAge

缓存有效时间
@property (readwrite, assign) NSTimeInterval maxCacheAge

Declared In

BmobQuery.h

  isGroupcount

统计时是否返回记录数

@property BOOL isGroupcount

Declared In

BmobQuery.h

+ queryWithClassName:

查询对象
+ (BmobQuery *)queryWithClassName:(NSString *)className

Parameters

className

对象名称(数据库表名)

Return Value

BmobQuery查询对象

Declared In

BmobQuery.h

+ queryForUser

查询用户表

+ (BmobQuery *)queryForUser

Return Value

BmobQuery查询对象

Declared In

BmobQuery.h

– initWithClassName:

通过className初始化BmobQuery对象
- (id)initWithClassName:(NSString *)className

Parameters

className

对象名称(数据库表名)

Return Value

BmobQuery查询对象

Declared In

BmobQuery.h

– orderByAscending:

按key进行升序排序
- (void)orderByAscending:(NSString *)key

Parameters

key

列名

Declared In

BmobQuery.h

– orderByDescending:

按key进行降序排序
- (void)orderByDescending:(NSString *)key

Parameters

key

列名

Declared In

BmobQuery.h

– includeKey:

添加需要返回类型的列名

- (void)includeKey:(NSString *)key

Parameters

key

列名

Declared In

BmobQuery.h

– selectKeys:

设置查询后要返回的key

- (void)selectKeys:(NSArray *)keys

Parameters

keys

key数组

Declared In

BmobQuery.h

– whereKey:equalTo:

添加key的值等于object的约束条件
- (void)whereKey:(NSString *)key equalTo:(id)object

Parameters

key

object

提供的值

Declared In

BmobQuery.h

– whereKey:containsAll:

添加查询列类型为数组的约束条件,只有数组当中包含array的所有元素才匹配

- (void)whereKey:(NSString *)key containsAll:(NSArray *)array

Parameters

key

类型为数组的列名

array

需要匹配的元素数组

Declared In

BmobQuery.h

– whereKey:notEqualTo:

添加key的值不为object的约束条件
- (void)whereKey:(NSString *)key notEqualTo:(id)object

Parameters

key

object

提供的值

Declared In

BmobQuery.h

– whereKey:greaterThan:

添加key的值大于object的约束条件
- (void)whereKey:(NSString *)key greaterThan:(id)object

Parameters

key

object

提供的值

Declared In

BmobQuery.h

– whereKey:greaterThanOrEqualTo:

添加key的值大于或等于提供的object的约束条件
- (void)whereKey:(NSString *)key greaterThanOrEqualTo:(id)object

Parameters

key

object

提供的值

Declared In

BmobQuery.h

– whereKey:lessThan:

添加key的值小于提供的object的约束条件
- (void)whereKey:(NSString *)key lessThan:(id)object

Parameters

key

object

提供的值

Declared In

BmobQuery.h

– whereKey:lessThanOrEqualTo:

添加key的值小于或等于提供的object的约束条件
- (void)whereKey:(NSString *)key lessThanOrEqualTo:(id)object

Parameters

key

object

提供的值

Declared In

BmobQuery.h

– whereKey:containedIn:

添加key的值包含array的约束条件
- (void)whereKey:(NSString *)key containedIn:(NSArray *)array

Parameters

key

array

提供的数组

Declared In

BmobQuery.h

– whereKey:notContainedIn:

添加key的值不包含array的约束条件
- (void)whereKey:(NSString *)key notContainedIn:(NSArray *)array

Parameters

key

array

提供的数组

Declared In

BmobQuery.h

– whereKeyExists:

指定的key是存在的

- (void)whereKeyExists:(NSString *)key

Parameters

key

Declared In

BmobQuery.h

– whereKeySExists:

keys数组内的各列的值是存在的

- (void)whereKeySExists:(NSArray *)keys

Parameters

keys

多个列组成的数组

Declared In

BmobQuery.h

– whereKeyDoesNotExist:

指定的key是不存在的

- (void)whereKeyDoesNotExist:(NSString *)key

Parameters

key

Declared In

BmobQuery.h

– whereKeysDoesNotExist:

keys数组中的各列的值是不存在的

- (void)whereKeysDoesNotExist:(NSArray *)keys

Parameters

keys

多个列组成的数组

Declared In

BmobQuery.h

– whereKey:matchesQuery:

查询的对象某个列符合另一个查询

- (void)whereKey:(NSString *)key matchesQuery:(BmobQuery *)query

Parameters

key

列名

query

另一个查询

Declared In

BmobQuery.h

– whereKey:doesNotMatchQuery:

查询的对象某个列不符合另一个查询

- (void)whereKey:(NSString *)key doesNotMatchQuery:(BmobQuery *)query

Parameters

key

列名

query

另一个查询

Declared In

BmobQuery.h

– whereObjectKey:relatedTo:

获取object的关系成员的对象

- (void)whereObjectKey:(NSString *)key relatedTo:(BmobObject *)object

Parameters

key

object所在表的列名,为Relation类型

object

Bmobject对象

Declared In

BmobQuery.h

– sumKeys:

设置需要计算总和的列名数组

- (void)sumKeys:(NSArray *)keys

Parameters

keys

需要计算总和的列名称数组

Declared In

BmobQuery.h

– averageKeys:

设置需要计算平均值的列名数组

- (void)averageKeys:(NSArray *)keys

Parameters

keys

需要计算平均值的列名称数组

Declared In

BmobQuery.h

– maxKeys:

设置需要计算最大值的列名数组

- (void)maxKeys:(NSArray *)keys

Parameters

keys

需要计算最大值的列名称数组

Declared In

BmobQuery.h

– minKeys:

设置需要计算最小值的列名数组

- (void)minKeys:(NSArray *)keys

Parameters

keys

需要计算最小值的列名称数组

Declared In

BmobQuery.h

– groupbyKeys:

设置需要分组的列名数组

- (void)groupbyKeys:(NSArray *)keys

Parameters

key

需要计算进行分组的列名称数组

Declared In

BmobQuery.h

– constructHavingDic:

设置having条件字典

- (void)constructHavingDic:(NSDictionary *)havingDic

Parameters

havingDic

having条件字典

Declared In

BmobQuery.h

– whereKey:nearGeoPoint:

- (void)whereKey:(NSString *)key nearGeoPoint:(BmobGeoPoint *)geopoint

Parameters

key

geopoint

位置信息

Declared In

BmobQuery.h

– whereKey:nearGeoPoint:withinMiles:

- (void)whereKey:(NSString *)key nearGeoPoint:(BmobGeoPoint *)geopoint withinMiles:(double)maxDistance

Parameters

key

geopoint

位置信息

maxDistance

最大长度(单位:英里)

Declared In

BmobQuery.h

– whereKey:nearGeoPoint:withinKilometers:

- (void)whereKey:(NSString *)key nearGeoPoint:(BmobGeoPoint *)geopoint withinKilometers:(double)maxDistance

Parameters

key

geopoint

位置信息

maxDistance

最大长度(单位:公里)

Declared In

BmobQuery.h

– whereKey:nearGeoPoint:withinRadians:

- (void)whereKey:(NSString *)key nearGeoPoint:(BmobGeoPoint *)geopoint withinRadians:(double)maxDistance

Parameters

key

geopoint

位置信息

maxDistance

最大半径

Declared In

BmobQuery.h

– whereKey:withinGeoBoxFromSouthwest:toNortheast:

- (void)whereKey:(NSString *)key withinGeoBoxFromSouthwest:(BmobGeoPoint *)southwest toNortheast:(BmobGeoPoint *)northeast

Parameters

key

southwest

西南方向位置

northeast

东北方向位置

Declared In

BmobQuery.h

– addTheConstraintByAndOperationWithArray:

组合并查询

- (void)addTheConstraintByAndOperationWithArray:(NSArray *)array

Parameters

array

约束条件数组

Declared In

BmobQuery.h

– addTheConstraintByOrOperationWithArray:

组合或查询

- (void)addTheConstraintByOrOperationWithArray:(NSArray *)array

Parameters

array

约束条件数组

Declared In

BmobQuery.h

– queryWithAllConstraint:

构造查询条件,一旦设置,查询的条件即为conDictionary

- (void)queryWithAllConstraint:(NSDictionary *)conDictionary

Parameters

conDictionary

构造查询条件

Declared In

BmobQuery.h

– queryWithConstraint:

构造查询条件,可以与其他方法同时存在

- (void)queryWithConstraint:(NSDictionary *)dictionary

Parameters

dictionary

查询条件

Declared In

BmobQuery.h

– hasCachedResult

查看是否有查询的缓存
- (BOOL)hasCachedResult

Return Value

查询结果 有为YES 没有为NO

Declared In

BmobQuery.h

– clearCachedResult

清理查询的缓存
- (void)clearCachedResult

Declared In

BmobQuery.h

+ clearAllCachedResults

清理所有查询的缓存
+ (void)clearAllCachedResults

Declared In

BmobQuery.h

– getObjectInBackgroundWithId:block:

通过id查找BmobObject对象
- (void)getObjectInBackgroundWithId:(NSString *)objectId block:(BmobObjectResultBlock)block

Parameters

objectId

BmobObject对象的id

block

得到的BmobObject对象

Declared In

BmobQuery.h

– findObjectsInBackgroundWithBlock:

查找BmobObject对象数组,该方法可查询多条数据
- (void)findObjectsInBackgroundWithBlock:(BmobObjectArrayResultBlock)block

Parameters

block

得到BmobObject对象数组

Declared In

BmobQuery.h

– calcInBackgroundWithBlock:

统计表数据
- (void)calcInBackgroundWithBlock:(BmobObjectArrayResultBlock)block

Parameters

block

得到字典数组

Declared In

BmobQuery.h

– countObjectsInBackgroundWithBlock:

查找表中符合条件的个数
- (void)countObjectsInBackgroundWithBlock:(BmobIntegerResultBlock)block

Parameters

block

得到个数

Declared In

BmobQuery.h

– setBQL:

设置bql语句

- (void)setBQL:(NSString *)bql

Parameters

bql

bql语句

Declared In

BmobQuery.h

– setPlaceholder:

设置占位符

- (void)setPlaceholder:(NSArray *)ary

Parameters

ary

占位符数据

Declared In

BmobQuery.h

– queryInBackgroundWithBQL:block:

使用 BQL 异步查询

- (void)queryInBackgroundWithBQL:(NSString *)bql block:(BmobBQLObjectResultBlock)block

Parameters

bql

BQL 字符串

block

查询结果回调

Declared In

BmobQuery.h

– queryInBackgroundWithBQL:pvalues:block:

使用BQL异步查询,该方法是使用占位符时的调用方法

- (void)queryInBackgroundWithBQL:(NSString *)bql pvalues:(NSArray *)pvalues block:(BmobBQLObjectResultBlock)block

Parameters

bql

BQL字符串

pvalues

占位符的值

block

查询结果回调

Declared In

BmobQuery.h

– queryBQLCanCacheInBackgroundWithblock:

使用BQL异步查询,只有该方法支持异步查询

- (void)queryBQLCanCacheInBackgroundWithblock:(BmobBQLObjectResultBlock)block

Parameters

block

查询结果回调

Declared In

BmobQuery.h

– statisticsInBackgroundWithBQL:block:

使用 BQL 异步统计查询

- (void)statisticsInBackgroundWithBQL:(NSString *)bql block:(BmobBQLArrayResultBlock)block

Parameters

bql

BQL 统计查询字符串

block

查询结果回调

Declared In

BmobQuery.h

– statisticsInBackgroundWithBQL:pvalues:block:

使用BQL异步统计查询,该方法是使用占位符时的调用方法

- (void)statisticsInBackgroundWithBQL:(NSString *)bql pvalues:(NSArray *)pvalues block:(BmobBQLArrayResultBlock)block

Parameters

bql

BQL字符串

pvalues

占位符的值

block

查询结果回调

Declared In

BmobQuery.h

– cancle

取消查询

- (void)cancle

Declared In

BmobQuery.h

– whereKey:matchesWithRegex:

正则表达式查询

- (void)whereKey:(NSString *)key matchesWithRegex:(NSString *)regex

Parameters

key

字段名

regex

正则表达式

Declared In

BmobQuery.h

– whereKey:startWithString:

查询以特定字符串开头的数据

- (void)whereKey:(NSString *)key startWithString:(NSString *)start

Parameters

key

字段名

start

想要查询的开头的字符串

Declared In

BmobQuery.h

– whereKey:endWithString:

查询以特定字符串结尾的数据

- (void)whereKey:(NSString *)key endWithString:(NSString *)end

Parameters

key

字段名

end

想要查询的结尾的字符串

Declared In

BmobQuery.h