本文整理汇总了PHP中StatementBuilder::IncreaseOffsetBy方法的典型用法代码示例。如果您正苦于以下问题:PHP StatementBuilder::IncreaseOffsetBy方法的具体用法?PHP StatementBuilder::IncreaseOffsetBy怎么用?PHP StatementBuilder::IncreaseOffsetBy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StatementBuilder
的用法示例。
在下文中一共展示了StatementBuilder::IncreaseOffsetBy方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPredefinedCustomTargetingKeyIds
/**
* Gets predefined custom targeting key IDs.
*/
function getPredefinedCustomTargetingKeyIds($user)
{
$customTargetingKeyIds = array();
// Get the CustomTargetingService.
$customTargetingService = $user->GetService('CustomTargetingService', 'v201508');
// Create a statement to get predefined custom targeting keys.
$statementBuilder = new StatementBuilder();
$statementBuilder->Where('type = :type')->OrderBy('id ASC')->Limit(StatementBuilder::SUGGESTED_PAGE_LIMIT)->WithBindVariableValue('type', 'PREDEFINED');
// Default for total result set size.
$totalResultSetSize = 0;
do {
// Get custom targeting keys by statement.
$page = $customTargetingService->getCustomTargetingKeysByStatement($statementBuilder->ToStatement());
// Display results.
if (isset($page->results)) {
$totalResultSetSize = $page->totalResultSetSize;
$i = $page->startIndex;
foreach ($page->results as $customTargetingKey) {
printf("%d) Custom targeting key with ID %d, name '%s', and display " . "name '%s' was found.\n", $i++, $customTargetingKey->id, $customTargetingKey->name, $customTargetingKey->displayName);
$customTargetingKeyIds[] = $customTargetingKey->id;
}
}
$statementBuilder->IncreaseOffsetBy(StatementBuilder::SUGGESTED_PAGE_LIMIT);
} while ($statementBuilder->GetOffset() < $totalResultSetSize);
return $customTargetingKeyIds;
}
开发者ID:stevenmaguire,项目名称:googleads-php-lib,代码行数:29,代码来源:GetPredefinedCustomTargetingKeysAndValues.php
示例2: DfpUser
$user = new DfpUser();
// Log SOAP XML request and response.
$user->LogDefaults();
// Get the ContentService.
$contentService = $user->GetService('ContentService', 'v201408');
// Create a statement to select all content.
$statementBuilder = new StatementBuilder();
$statementBuilder->OrderBy('id ASC')->Limit(StatementBuilder::SUGGESTED_PAGE_LIMIT);
// Default for total result set size.
$totalResultSetSize = 0;
do {
// Get content by statement.
$page = $contentService->getContentByStatement($statementBuilder->ToStatement());
// Display results.
if (isset($page->results)) {
$totalResultSetSize = $page->totalResultSetSize;
$i = $page->startIndex;
foreach ($page->results as $content) {
printf("%d) Content with ID %d, name '%s', and status %s was found.\n", $i++, $content->id, $content->name, $content->status);
}
}
$statementBuilder->IncreaseOffsetBy(StatementBuilder::SUGGESTED_PAGE_LIMIT);
} while ($statementBuilder->GetOffset() < $totalResultSetSize);
printf("Number of results found: %d\n", $totalResultSetSize);
} catch (OAuth2Exception $e) {
ExampleUtils::CheckForOAuth2Errors($e);
} catch (ValidationException $e) {
ExampleUtils::CheckForOAuth2Errors($e);
} catch (Exception $e) {
printf("%s\n", $e->getMessage());
}
示例3: testToStatementIncreaseOffsetWithInitialOffset
/**
* @covers StatementBuilder::ToStatement
* @covers StatementBuilder::IncreaseOffsetBy
*/
public function testToStatementIncreaseOffsetWithInitialOffset()
{
$expectedQueryBefore = 'WHERE a = b ORDER BY a LIMIT 500 OFFSET 10';
$expectedQueryAfter = 'WHERE a = b ORDER BY a LIMIT 500 OFFSET 40';
$statementBuilder = new StatementBuilder();
$statementBuilder->Limit(500)->Offset(10)->Where('a = b')->OrderBy('a');
$this->assertEquals($expectedQueryBefore, $statementBuilder->ToStatement()->query);
$statementBuilder->IncreaseOffsetBy(30);
$this->assertEquals($expectedQueryAfter, $statementBuilder->ToStatement()->query);
}