本文整理匯總了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);
}