Implement getTableData command.
Reviewed By: lblasa Differential Revision: D48267029 fbshipit-source-id: a2ee02d3d0c465c83acd99fd7093e0abb5c7c2de
This commit is contained in:
committed by
Facebook GitHub Bot
parent
a0510ad1bf
commit
42fb6f09f7
@@ -6,6 +6,7 @@
|
||||
*/
|
||||
|
||||
#import "MockDatabaseDriver.h"
|
||||
#import "DatabaseGetTableData.h"
|
||||
#import "DatabaseGetTableInfo.h"
|
||||
#import "DatabaseGetTableStructure.h"
|
||||
#import "MockDatabaseDescriptor.h"
|
||||
@@ -55,4 +56,28 @@
|
||||
initWithDefinition:@"This is mocked table definition"];
|
||||
}
|
||||
|
||||
- (DatabaseGetTableDataResponse*)
|
||||
getTableDataWithDatabaseDescriptor:
|
||||
(id<DatabaseDescriptor>)databaseDescriptor
|
||||
forTable:(NSString*)tableName
|
||||
order:(NSString*)order
|
||||
reverse:(BOOL)reverse
|
||||
start:(NSInteger)start
|
||||
count:(NSInteger)count {
|
||||
NSMutableArray* columns = [NSMutableArray array];
|
||||
NSMutableArray* values = [NSMutableArray array];
|
||||
for (int i = 0; i < 100; i++) {
|
||||
NSString* columnName = [NSString stringWithFormat:@"column%d", i + 1];
|
||||
[columns addObject:columnName];
|
||||
NSArray* valueRow = @[ @"value1", @"value2", @"value3" ];
|
||||
[values addObject:valueRow];
|
||||
}
|
||||
|
||||
return [[DatabaseGetTableDataResponse alloc] initWithColumns:[columns copy]
|
||||
values:[values copy]
|
||||
start:0
|
||||
count:100
|
||||
total:100];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user