/** * Send a request to retrieve the next page of results. * * @return void */ protected function sendRequest() { // Issue a select command $command = new Select(); $command->setSelectExpression($this->data['select_expression'])->setNextToken($this->nextToken)->setConsistentRead($this->data['consistent_read'])->setXmlResponseOnly(true)->setClient($this->client)->execute(); $result = self::processSelectResult($command->getResult()); $this->resourceList = $result['resources']; $this->nextToken = $result['next_token']; $this->retrievedCount += count($this->resourceList); $this->currentIndex = 0; }
/** * @covers Guzzle\Service\ResourceIterator * @covers Guzzle\Service\ResourceIterator::current * @covers Guzzle\Service\ResourceIterator::key * @covers Guzzle\Service\ResourceIterator::calculatePageSize * @covers Guzzle\Aws\SimpleDb\Model\SelectIterator * @covers Guzzle\Aws\SimpleDb\Command\Select */ public function testSelectIteratorWithLimit() { $client = $this->getServiceBuilder()->get('test.simple_db'); $command = new Select(); $command->setSelectExpression('select * from mydomain where Title = \'The Right Stuff\''); $command->setLimit(2); $this->setMockResponse($client, array('SelectResponseWithNextToken', 'SelectResponse')); $client->execute($command); $this->assertInstanceOf('Guzzle\\Aws\\SimpleDb\\Model\\SelectIterator', $command->getResult()); $this->assertEquals(2, count($command->getResult())); $all = array(); foreach ($command->getResult() as $key => $value) { $all[$key] = $value; if ($command->getResult()->getPosition() == 0) { $this->assertEquals('item_name1', $command->getResult()->key()); $this->assertEquals(array('attr_1' => array('value_1', 'value_2', 'value_3'), 'attr_2' => 'value_4'), $command->getResult()->current()); } else { $this->assertEquals('item_name2', $command->getResult()->key()); $this->assertEquals(array('animal' => 'elephant'), $command->getResult()->current()); } } $this->assertEquals(array('item_name1' => array('attr_1' => array('value_1', 'value_2', 'value_3'), 'attr_2' => 'value_4'), 'item_name2' => array('animal' => 'elephant')), $all); }