当前位置: 首页>>代码示例>>PHP>>正文


PHP StatementBuilder::Select方法代码示例

本文整理汇总了PHP中StatementBuilder::Select方法的典型用法代码示例。如果您正苦于以下问题:PHP StatementBuilder::Select方法的具体用法?PHP StatementBuilder::Select怎么用?PHP StatementBuilder::Select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在StatementBuilder的用法示例。


在下文中一共展示了StatementBuilder::Select方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testToStatementForPqlTableWithKeywords

 /**
  * @covers StatementBuilder::ToStatement
  */
 public function testToStatementForPqlTableWithKeywords()
 {
     $expectedQuery = 'SELECT Id FROM table WHERE a = b AND b = c ORDER BY a ' . 'ASC, b DESC LIMIT 200 OFFSET 0';
     $statementBuilder = new StatementBuilder();
     $query = $statementBuilder->Select('Id')->From('FrOM table')->Where('WHERE a = b AND b = c')->OrderBy('order BY a ASC, b DESC')->Limit(200)->Offset(0)->ToStatement()->query;
     $this->assertEquals($expectedQuery, $query);
 }
开发者ID:googleads,项目名称:googleads-php-lib,代码行数:10,代码来源:StatementBuilderTest.php

示例2: dirname

set_include_path(get_include_path() . PATH_SEPARATOR . $path);
require_once 'Google/Api/Ads/Dfp/Lib/DfpUser.php';
require_once 'Google/Api/Ads/Dfp/Util/v201508/Pql.php';
require_once 'Google/Api/Ads/Dfp/Util/v201508/StatementBuilder.php';
require_once dirname(__FILE__) . '/../../../Common/ExampleUtils.php';
try {
    // Get DfpUser from credentials in "../auth.ini"
    // relative to the DfpUser.php file's directory.
    $user = new DfpUser();
    // Log SOAP XML request and response.
    $user->LogDefaults();
    // Get the PublisherQueryLanguageService.
    $pqlService = $user->GetService('PublisherQueryLanguageService', 'v201508');
    // Create statement to select all line items.
    $statementBuilder = new StatementBuilder();
    $statementBuilder->Select('Id, BrowserName, MajorVersion, MinorVersion')->From('Browser')->OrderBy('BrowserName ASC')->Limit(StatementBuilder::SUGGESTED_PAGE_LIMIT);
    // Default for result sets.
    $resultSet = null;
    $combinedResultSet = null;
    $i = 0;
    do {
        // Get all browsers.
        $resultSet = $pqlService->select($statementBuilder->ToStatement());
        // Combine result sets with previous ones.
        $combinedResultSet = !isset($combinedResultSet) ? $resultSet : Pql::CombineResultSets($combinedResultSet, $resultSet);
        printf("%d) %d browsers beginning at offset %d were found.\n", $i++, isset($resultSet->rows) ? count($resultSet->rows) : 0, $statementBuilder->GetOffset());
        $statementBuilder->IncreaseOffsetBy(StatementBuilder::SUGGESTED_PAGE_LIMIT);
    } while (isset($resultSet->rows) && count($resultSet->rows) > 0);
    // Change to your file location.
    $filePath = sprintf("%s/Browsers-%s.csv", sys_get_temp_dir(), uniqid());
    $fp = fopen($filePath, 'w');
开发者ID:stevenmaguire,项目名称:googleads-php-lib,代码行数:31,代码来源:GetAllBrowsers.php

示例3: dirname

require_once 'Google/Api/Ads/Dfp/Util/v201508/Pql.php';
require_once 'Google/Api/Ads/Dfp/Util/v201508/StatementBuilder.php';
require_once dirname(__FILE__) . '/../../../Common/ExampleUtils.php';
try {
    // Get DfpUser from credentials in "../auth.ini"
    // relative to the DfpUser.php file's directory.
    $user = new DfpUser();
    // Log SOAP XML request and response.
    $user->LogDefaults();
    // Get the PublisherQueryLanguageService.
    $pqlService = $user->GetService('PublisherQueryLanguageService', 'v201508');
    // Set the type of geo target.
    $geoTargetType = 'City';
    // Create statement to select all line items.
    $statementBuilder = new StatementBuilder();
    $statementBuilder->Select('Id, Name, CanonicalParentId, ParentIds, CountryCode, Type, Targetable')->From('Geo_Target')->Where('Type = :Type AND Targetable = true')->OrderBy('CountryCode ASC, Name ASC')->Limit(StatementBuilder::SUGGESTED_PAGE_LIMIT)->WithBindVariableValue('Type', $geoTargetType);
    // Default for result sets.
    $resultSet = null;
    $combinedResultSet = null;
    $i = 0;
    do {
        // Get all cities.
        $resultSet = $pqlService->select($statementBuilder->ToStatement());
        // Combine result sets with previous ones.
        $combinedResultSet = !isset($combinedResultSet) ? $resultSet : Pql::CombineResultSets($combinedResultSet, $resultSet);
        printf("%d) %d geo targets beginning at offset %d were found.\n", $i++, isset($resultSet->rows) ? count($resultSet->rows) : 0, $statementBuilder->GetOffset());
        $statementBuilder->IncreaseOffsetBy(StatementBuilder::SUGGESTED_PAGE_LIMIT);
    } while (isset($resultSet->rows) && count($resultSet->rows) > 0);
    // Change to your file location.
    $filePath = sprintf("%s/%s-%s.csv", sys_get_temp_dir(), $geoTargetType, uniqid());
    $fp = fopen($filePath, 'w');
开发者ID:stevenmaguire,项目名称:googleads-php-lib,代码行数:31,代码来源:GetGeoTargets.php

示例4: dirname

$path = dirname(__FILE__) . '/../../../../src';
set_include_path(get_include_path() . PATH_SEPARATOR . $path);
require_once 'Google/Api/Ads/Dfp/Lib/DfpUser.php';
require_once 'Google/Api/Ads/Dfp/Util/v201608/Pql.php';
require_once 'Google/Api/Ads/Dfp/Util/v201608/StatementBuilder.php';
require_once dirname(__FILE__) . '/../../../Common/ExampleUtils.php';
try {
    // Get DfpUser from credentials in "../auth.ini"
    // relative to the DfpUser.php file's directory.
    $user = new DfpUser();
    // Log SOAP XML request and response.
    $user->LogDefaults();
    $pqlService = $user->GetService('PublisherQueryLanguageService', 'v201608');
    // Create statement to select all programmatic buyers.
    $statementBuilder = new StatementBuilder();
    $statementBuilder->Select('BuyerAccountId, Name')->From('Programmatic_Buyer')->OrderBy('BuyerAccountId ASC')->Limit(StatementBuilder::SUGGESTED_PAGE_LIMIT);
    // Retrieve a small amount of rows at a time, paging through until all rows
    // have been retrieved.
    $resultSet = null;
    $combinedResultSet = null;
    $i = 0;
    do {
        $resultSet = $pqlService->select($statementBuilder->ToStatement());
        // Combine result sets with previous ones.
        $combinedResultSet = $combinedResultSet !== null ? $resultSet : Pql::CombineResultSets($combinedResultSet, $resultSet);
        printf("%d) %d programmatic buyers beginning at offset %d were found.\n", $i++, $resultSet->rows !== null ? count($resultSet->rows) : 0, $statementBuilder->GetOffset());
        $statementBuilder->IncreaseOffsetBy(StatementBuilder::SUGGESTED_PAGE_LIMIT);
    } while ($resultSet->rows !== null && count($resultSet->rows) > 0);
    // Change to another file location if desired.
    $filePath = sprintf("%s/programmatic-buyers-%s.csv", sys_get_temp_dir(), uniqid());
    $fp = fopen($filePath, 'w');
开发者ID:googleads,项目名称:googleads-php-lib,代码行数:31,代码来源:GetAllProgrammaticBuyers.php

示例5: dirname

set_include_path(get_include_path() . PATH_SEPARATOR . $path);
require_once 'Google/Api/Ads/Dfp/Lib/DfpUser.php';
require_once 'Google/Api/Ads/Dfp/Util/v201602/Pql.php';
require_once 'Google/Api/Ads/Dfp/Util/v201602/StatementBuilder.php';
require_once dirname(__FILE__) . '/../../../Common/ExampleUtils.php';
try {
    // Get DfpUser from credentials in "../auth.ini"
    // relative to the DfpUser.php file's directory.
    $user = new DfpUser();
    // Log SOAP XML request and response.
    $user->LogDefaults();
    // Get the PublisherQueryLanguageService.
    $pqlService = $user->GetService('PublisherQueryLanguageService', 'v201602');
    // Create statement to select line items whose names begin with "line item".
    $statementBuilder = new StatementBuilder();
    $statementBuilder->Select('Id, Name, Status')->From('Line_Item')->Where('Name LIKE \'line item%\'')->OrderBy('Id ASC')->Limit(StatementBuilder::SUGGESTED_PAGE_LIMIT);
    // Default for result sets.
    $combinedResultSet = null;
    $resultSet = null;
    $i = 0;
    do {
        // Get line items like 'line item%'.
        $resultSet = $pqlService->select($statementBuilder->ToStatement());
        // Combine result sets with previous ones.
        $combinedResultSet = !isset($combinedResultSet) ? $resultSet : Pql::CombineResultSets($combinedResultSet, $resultSet);
        printf("%d) %d line items beginning at offset %d were found.\n", $i++, isset($resultSet->rows) ? count($resultSet->rows) : 0, $statementBuilder->GetOffset());
        $statementBuilder->IncreaseOffsetBy(StatementBuilder::SUGGESTED_PAGE_LIMIT);
    } while (isset($resultSet->rows) && count($resultSet->rows) > 0);
    // Change to your file location.
    $filePath = sprintf("%s/Line-Items-Named-Like-%s.csv", sys_get_temp_dir(), uniqid());
    ob_start();
开发者ID:googleads,项目名称:googleads-php-lib,代码行数:31,代码来源:GetLineItemsNamedLike.php

示例6: fetchMatchTable

require_once 'Google/Api/Ads/Dfp/Util/v201411/StatementBuilder.php';
require_once dirname(__FILE__) . '/../../../Common/ExampleUtils.php';
try {
    // Get DfpUser from credentials in "../auth.ini"
    // relative to the DfpUser.php file's directory.
    $user = new DfpUser();
    // Log SOAP XML request and response.
    $user->LogDefaults();
    // Get the PublisherQueryLanguageService.
    $pqlService = $user->GetService('PublisherQueryLanguageService', 'v201411');
    // Create statement to select all line items.
    $lineItemStatementBuilder = new StatementBuilder();
    $lineItemStatementBuilder->Select('Id, Name, Status')->From('Line_Item')->OrderBy('Id ASC')->Limit(StatementBuilder::SUGGESTED_PAGE_LIMIT);
    // Create statement to select all ad units.
    $adUnitStatementBuilder = new StatementBuilder();
    $adUnitStatementBuilder->Select('Id, Name')->From('Ad_Unit')->OrderBy('Id ASC')->Limit(StatementBuilder::SUGGESTED_PAGE_LIMIT);
    $lineItemFilePath = fetchMatchTable($lineItemStatementBuilder, $pqlService, "Line-Item-Matchtable");
    $adUnitFilePath = fetchMatchTable($adUnitStatementBuilder, $pqlService, "Ad-Unit-Matchtable");
    printf("Line items saved to %s\n", $lineItemFilePath);
    printf("Ad units saved to %s\n", $adUnitFilePath);
} catch (OAuth2Exception $e) {
    ExampleUtils::CheckForOAuth2Errors($e);
} catch (ValidationException $e) {
    ExampleUtils::CheckForOAuth2Errors($e);
} catch (Exception $e) {
    printf("%s\n", $e->getMessage());
}
/**
 * Fetches a match table from a PQL statement and writes it to a file.
 */
function fetchMatchTable($statementBuilder, $pqlService, $fileName)
开发者ID:sjakil,项目名称:api-hub,代码行数:31,代码来源:FetchMatchTables.php


注:本文中的StatementBuilder::Select方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。