AWS SimpleDB のデフォルトの結果制限は 100 で、データベースから最後の 20 レコードを取得しようとしています。彼らのオンライン ヘルプには次のように記載されています。 )、10,000 の limit 句でカウントを実行し、次のトークンを使用して select で次の 200 項目を返すことができます。」
だから私はこれら2つの操作を実行する方法を考え出そうとしています. まず、レコード数 (私の例では約 160) を取得し、そこから 20 を引いてオフセットを作成します。しかし、AWS はまだ最初の 100 レコードを返しています。オフセットを作成する際に「//++」の間のコードが正しくないと思います。
//++ AWS has display limit of 100 so create offset by starting from count - 20
NSString *sdbAppOffset = [NSString stringWithFormat:@"select count(*) from %@ limit %i",sdbAppUse,iDbaseRecordCountOffset];
SimpleDBSelectRequest *selectOffsetRequest = [[SimpleDBSelectRequest alloc] initWithSelectExpression:sdbAppOffset];
selectOffsetRequest.consistentRead = YES;
SimpleDBSelectResponse *selectOffSetResponse = [sdbClient select:selectOffsetRequest];
//NSLog(@"sdbAppUse count %i",[selectOffSetResponse.items count]);
//++
NSString *sdbAppUseString = [NSString stringWithFormat:@"select * from %@",sdbAppUse];
SimpleDBSelectRequest *selectRequest = [[SimpleDBSelectRequest alloc] initWithSelectExpression:sdbAppUseString];
selectRequest.consistentRead = YES;
SimpleDBSelectResponse *selectResponse = [sdbClient select:selectRequest];
NSLog(@"sdbAppUse count %i",[selectResponse.items count]);
for (int x = 0; x < [selectResponse.items count]; x++) {
SimpleDBItem *registerUser = [selectResponse.items objectAtIndex:x];
for (SimpleDBAttribute *attribute in registerUser.attributes) {
NSLog(@"trackUsage registerUser |%@|, name |%@|, value |%@|",registerUser.name, attribute.name, attribute.value);
}
}