當前位置: 首頁>>代碼示例>>PHP>>正文


PHP StatementBuilder::IncreaseOffsetBy方法代碼示例

本文整理匯總了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());
}
開發者ID:rochmit10,項目名稱:googleads-php-lib,代碼行數:31,代碼來源:GetAllContent.php

示例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);
 }
開發者ID:googleads,項目名稱:googleads-php-lib,代碼行數:14,代碼來源:StatementBuilderTest.php


注:本文中的StatementBuilder::IncreaseOffsetBy方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。